SWiSH Player Support
SWF5 or later - Supported Internally
Syntax
for(var in object){
statement(s);
}
Arguments
var: a variable assigned to represent each property of an object or array element.
object: The name of an object to be repeated.
statement(s): An instruction to be executed for each loop.
Returns
Nothing.
Description
Action; loops through individual properties of an object or array elements and initiates the statement(s) for each one.
Certain properties cannot be listed by the for or for...in actions. As an example, Sprite properties such as _x and _y are cannot be listed.
Sample
onFrame(1) {
n = 1;
products = new Array();
products[0] = "SWiSHstudio";
products[1] = "SWiSHsites";
products[2] = "SWiSHpix";
products[3] = "SWiSHmax";
products[4] = "SWiSH 2.0";
products[5] = "SWiSHlite";
for (var1 in products) {
trace ("Product" add n add " = " add products[var1]);
n += 1;
}
}
The above script displays the following in the debug window:
Product1 = SWiSHlite
Product2 = SWiSH 2.0
Product3 = SWiSHmax
Product4 = SWiSHpix
Product5 = SWiSHsites
Product6 = SWiSHstudio