PROGRAMMING COURSES ADMIN VIDEO TUTORIALS COMMUNITY RESOURCES |
Looping in ActionScript 3.0 has many uses in
programming data flow and animations. For example, I have a Flash
ActionScript 3.0 tutorial here on how to create event listeners for many
buttons using a loop and a simple array. Looping is a great way for data
programmers to automate the data flow and streamline code.
for loop Using a for loop make code execute over and over as many times as needed. There are three expressions needed in the parenthesis. The first expression is the is the variable to be evaluated, the second expression in the operator evaluation, and the third expression increments or decrements the value. ![]() var i:uint;
1
2 3 4 for ( in ) loop for ( in ) loops make it possible to iterate through arrays of information or objects. ![]() var myArray:Array = ["France", "Great Britain", "Italy", "Germany"];
France
Great Britain Italy Germany for each ( in ) loop Using for each ( in ) to iterate over array objectsStart Copy+Paste for this box here on this line of text ![]() var myArray:Array = ["France", "Great Britain", "Italy", "Germany"];
France
Great Britain Italy Germany while loop A while loop is a loop that can execute code as long as the expression in parenthesis returns true. ![]() var myNum:uint = 0;
1
2 3 4 do while loop A do while loop is a while loop flipped upside down. It guarentees that the code block inside the loop will execute at least once due to the expression being on the bottom. Code runs from top to bottom. ![]() var myNum:uint = 1;
1 2 3 4 That concludes this section, to continue learning Actionscript 3.0 head back to the index
|
|||||||||||
|
|
DevelopPHP Requires Flash Player
___________________________________________
|
||||||||