Frage

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);

}
War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top