ActionScript 3 (Flash/AIR): テキストを画面に表示

TextField.as

var tfm:TextFormat = new TextFormat();
tfm.size = 40;
tfm.font = "Arial";
var tf:TextField = new TextField();
tf.defaultTextFormat = tfm;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.text = "hage";
addChild(tf);

var tfm2:TextFormat = new TextFormat();
tfm2.size = 40;
tfm2.font = "serif";
tfm2.color = 0xffffff;
var tf2:TextField = new TextField();
tf2.defaultTextFormat = tfm2;
tf2.autoSize = TextFieldAutoSize.RIGHT;
tf2.text = "hage";
tf2.background = true;
tf2.backgroundColor = 0xff0000;
tf2.y = 80;
tf2.x = stage.stageWidth - tf2.width;
addChild(tf2);