AS3 Loops: Simple "for" loop

for (var i:Number=0; i < 5; i++) {
trace(i);
}

AS3 Loops: For Loop breakdown

for( init ; condition ; next ) {
method

}
//init counts how many times the loop is executed
//condition how far to count up too
//next is what we count by
//what you want to loop goes in here

Actionscript:

for (var i:Number=0; i < vExample; i++) {
tMessages.appendText([i]+" , " );
}

Loops: Create a "for loop" in AS3

Create a button movieclip on your stage.
Give it an instance name of bStart.

Create an input text box on your stage.
Give it an instance name of itSteps.

Create a dynamic text box on your stage.
Give it an instance name of tMessages.

Actionscript:

bStart.addEventListener(MouseEvent.CLICK, fLoop);

itSteps.restrict = "0-9";
itSteps.maxChars = 3;

function fLoop(event:MouseEvent):void {
tMessages.text="";
var vString:String = itSteps.text;
var vExample:Number = Number(vString);
for (var i:Number=0; i < vExample; i++) { tMessages.appendText([i]+", "); } }

Example:

Get Adobe Flash player