Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Auto-size TextField to Fit Text with Flash ActionScript 3

Please update flash player to view this Flash ActionScript tutorial!

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:

Flash Source File hello-world-2.fla


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.