Reputation: 936
When i press a button it will display text, but how would i add style? such as position and color.
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);
}
Upvotes: 0
Views: 71
Reputation: 565
Something like this:
var format:TextFormat = new TextFormat();
format.color = 0x555555;
format.size = 18;
format.align = TextFormatAlign.CENTER;
format.bold = false;
tf.setTextFormat(format);
Check class reference for TextFormat: http://help.adobe.com/en_GB/FlashPlatform/reference/actionscript/3/flash/text/TextFormat.html
Upvotes: 1