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

Move text between Text Field with Flash ActionScript 3

Buttons and text Fields are the best friends of Flash Movies. You always see them in most Flash Movies. In this Flash ActionScript 3 tutorial series, we will work with Button and Text Fields.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Most Flash Movies use buttons to control objects on the stage. In this Flash tutorial, we learn how to write a simple function with ActionScript 3. And then we learn how to hook up a button with the function.

Input some texts in the above Flash Movie and click the Enter button to see how it works.

Flash ActionScript Codes:

// We need Keybpard control
import flash.events.KeyboardEvent;

// Allow Text Fields to input data
inputText1_txt.type = TextFieldType.INPUT;

// Set the mouse cursor to focus on the first field
inputText1_txt.stage.focus = inputText1_txt;

// write a function to display the text in the TextField
// to the Message Box
function readText(evt:Event):void {

// Check if data are entered in the text field
if (inputText1_txt.text == ""){
output_txt.text = "Field is Empty!";
} else {
output_txt.text = inputText1_txt.text;
}
}

// Hook up the button with the function readText
enter_btn.addEventListener(MouseEvent.CLICK, readText);

Download Flash Source File:

Flash Source File text-1.fla

Remarks:

Usually the Dynamic Text Field is used to handle string (text) in Flash Movies. In next tutorial, we will use Dynamic Text Fields to handle numbers so that so can do some arithmatic caculation.