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

Set Properties to TextField with Flash ActionScript 3

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

This flash tutorial will set some properties (e.g. position, border, auto-size, etc...) to the Text Field that created by Flash ActionScript in previous tutorial.

Flash ActionScript Codes:

///////////////////////////////////////////
///// Create New TextField /////
//////////////////////////////////////////

// Create a textfield object with the name "textField_txt"
var textField_txt:TextField = new TextField();

 

// Add the new textfield_txt instance to the stage
addChild(textField_txt);

 

// Add Content to TextField
textField_txt.text = "Hello World";

 

////////////////////////////////////////////
///// Set BASIC Properties /////
///////////////////////////////////////////

// Set position of TextField (x = Left, y = Top)
textField_txt.x = 150;
textField_txt.y = 200;

 

// Set width of Text Field
textField_txt.width = 350;

 

//////////////////////////////////////////
///// Set Other Properties /////
/////////////////////////////////////////

// Text not selectable
textField_txt.selectable = false;

 

// Text border
textField_txt.border = false;

 

// Autosize with the text and align to the left.
textField_txt.autoSize = TextFieldAutoSize.LEFT;

Download Flash Source File:

Flash Source File hello-world-again-2.fla

Remarks:

In the next Flash ActionScript tutorial, we will set some Text Format (e.g. Text Size, Text Color, etc..) to the Text Field.