Flash AS3 Helps: For Loop Statement in Flash AS3 ( ActionScript3)
I used the For loop statement all the time in ActionScript 2.0 for all sorts of things: traversing XML nodes, creation of arrays; assign values to symbol instances, etc. The For statement is very valuable in my opinion and should be in every ActionScripter’s toolbox.
In AS3, the For statement’s syntax is just a little different but still works the same. Here is a quick sample:
var myArray:Array = new Array();
for (var z:Number = 0; z < 11; z++) {
myArray[z] = (z + 1) * 2;
}
trace(myArray);
//this tracet: 2,4,6,8,10,12,14,16,18,20,22
Posted in: Flash Helps | Comments(3)
February 12th, 2008 at 10:59 am
[...] 3 ) example that combines a couple things that I’ve posted in the past, including the for loop and xml loading. So we use those methods in this FLV Video playlist sample. Since the xml file is [...]
February 18th, 2008 at 4:33 pm
[...] 3 Podcast player. This little sample uses similar Flash AS3 methods in past posts like the for loop, xml loading, and the Flash AS3 Video [...]
February 26th, 2008 at 12:49 pm
[...] lets build a functioning app using the Flash list component, arrays, for loop, and [...]