当我按下按钮时它会显示文字,但我如何添加风格?如位置和颜色。
import flash.text.TextField;
var tf:TextField= new TextField();
convob.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
tf.text="hello world";
addChild(tf);
}
答案 0 :(得分:1)
这样的事情:
var format:TextFormat = new TextFormat();
format.color = 0x555555;
format.size = 18;
format.align = TextFormatAlign.CENTER;
format.bold = false;
tf.setTextFormat(format);
检查TextFormat的类引用:http://help.adobe.com/en_GB/FlashPlatform/reference/actionscript/3/flash/text/TextFormat.html