Auto-size TextField to Fit Text with Flash ActionScript 3
Flash Tutorial Content:
In previous flash tutorial, we noticed that it was very difficult to draw the size of Dynamic Text Field fit to the text "Hello World". Now we are going to use Flash ActionScript to resize the TextField to fit with the text automatically.
Flash ActionScript Codes:
// Add Content to Text Field
textField_txt.text = "Hello World";
// Autosize TextField with the text and align to CENTER.
textField_txt.autoSize = TextFieldAutoSize.CENTER;
Download Flash Source File:
Hm..... we also want to align the Text Field in the center of the stage. In the next Flash tutorial, we will use ActionScript to align the text Field.