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

Flash ActionScript Variable Declaration and Data Type

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Variables are very useful in all computer programming languages. Variables allow to store data and use later any time. In order to use variables, you need to declare them. The following diagram shows a typical example of declaring a variable.

Variable and data type

Flash ActionScript Codes:

// Declare the variable
// Name of variable is tVariable
// Type of data is Number
// Data (Number) store to the variable is 25
var tVariable:Number = 25;


// Declare another variable
// Name of variable is tString
// Type of data is string
// Data (String) store to tString is "25"
var tString:String = String(tVariable);


// Use the variable (tString)
textField_txt.text = tString;

Download Flash Source File:

Flash Source File variable-declaration.fla

Data Type

The following are the most commonly used data type:

Number - Any number include decimals (e.g. 25.5, 25)

var tVariable: Number = 25;

String - Text or string of characters (e.g. "hello world", "abc123")

var tString:String = "hello world";

int - Integer (e.g. -4, -1, 6, 10, 15)

var tInteger:int = 8;

Note: var tInteger:int = 8.5; also return 8


There are many data types using in ActionScript 3. The above data types are most commonly used when begin learning ActionScript.