Setting Styles on UITextField

You cannot use the setStyle() method on UITextField. To apply styles for example align text in a UITextField you use UITextFormat and setTextFormat.

1
2
3
4
5
6
7
var txt:UITextField = new UITextField();
txt.text = "My UITextField";
addChild( txt );

var tf:UITextFormat = new UITextFormat( this.systemManager );
tf.align = "center";
txt.setTextFormat( tf );

Comments