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 3 Step Up For Loop Statement(1)

In this Flash ActionScript tutorial, the value of the variable increase by one with each loop, i.e. n, n+1, n+2, n+3, etc... until the looping ends.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Step Up For Loop with increasement of 1 is most commonly used in a For Loop Statement in Flash ActionScript. This is also the most basic For Loop Statement. The value of the variable increase by one with each loop.

The complete Flash Movie is shown as above, you may try how it works before you start this Flash tutorial.

Flash ActionScript Codes:

//Set the multiline parameter of the Text Field to true
//The <br> tag creates a line break in the Text Field.
//Must set the text field to be a multiline Text Field to use this tag.
output_txt.multiline = true;


//Declare a string to the data
//Also assign an empty value to this string (myString)
var myString:String = "";


//Declare i as an integer
var i:int;


//Execute the For Loop Statement
//A For Loop requires three expressions:
//a variable i is set to an initial value - zero
//a conditional determines when the looping ends - when i < 5
//an expression changes the value of the variable with each loop - i++ (increase by one)
for (i = 0; i < 5; i++)

myString = myString + "The value of i is: " + i + "<BR>";



//Display the string to Text Field
output_txt.htmlText = myString;

Structure of a For Loop Statement

Still wonder how the For Loop works? Let's recall the structure of a For Loop statement as below:

Flash ActionScript For Loop Statement

Download Flash Source File:

Flash Source File for-loop-1.fla


Hm..... Actually the variable can be increased by any step (e.g. 2, 3, 4, etc..). The next Flash ActionScript tutorial will show how to do that.