The following example shows using
var myArray:Array = new Array("one", "two", "three");
for (var index in myArray)
trace("myArray["+index+"] = " + myArray[index]);
// output:
myArray[2] = three
myArray[1] = two
myArray[0] = one
The following example uses the
child:
for (var name in this) {
if (typeof (this[name]) == "movieclip") {
trace("I have a movie clip child named "+name);
}
}
Note: If you have several movie clips, the output consists of the instance names of those clips.
160
Chapter 5: ActionScript Core Language Elements
to iterate over the elements of an array:
for..in
operator with
typeof
to iterate over a particular type of
for..in
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?