Align Text with ActionScript 3 - Center AS3 Text
Imports needed to align your Flash text in AS3.
import flash.text.TextField;Alignments you can do with your text:
import flash.text.TextFieldAutoSize;
TextFieldAutoSize.LEFTSyntax needed to align your dynamic text in AS3.
TextFieldAutoSize.RIGHT
TextFieldAutoSize.CENTER
TextFieldAutoSize.NONE
_textField.autoSize = TextFieldAutoSize.LEFT;Make sure that you assign the autoSize before you set the text. If you set the text first the alignment will not work correclty.
_textField.text = "Hello World! This is my text.";




Comments