MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 159

Actionscript language reference
Table of Contents

Advertisement

for..in
Availability
Flash Player 5.
Usage
for(variableIterant in object){
statement(s);
}
Parameters
variableIterant
object or element in an array.
The name of an object to be iterated.
object
statement(s)
Returns
Nothing.
Description
Statement; iterates over the properties of an object or elements in an array and executes the
for each property or element. Methods of an object are not enumerated by the
statement
action.
for..in
Some properties cannot be enumerated by the
properties, such as
enumerable, unlike instance members.
The
statement iterates over properties of objects in the iterated object's prototype chain.
for..in
Properties of the object are enumerated first, then properties of its immediate prototype, then
properties of the prototype's prototype, and so on. The
the same property name twice. If the object
property
, the
prop
the one in
parent
The curly braces (
statement are not necessary if only one statement will execute.
Examples
The following example shows using
var myObject:Object = {name:"Tara", age:27, city:"San Francisco"};
for (var name in myObject) {
trace("myObject."+name+" = "+myObject[name]);
}
//output
myObject.name = Tara
myObject.age = 27
myObject.city = San Francisco
ActionScript Core Language Elements
The name of a variable to act as the iterant, referencing each property of an
An instruction to execute for each iteration.
and
, are not enumerated. In external class files, static members are not
_x
_y
statement called on
for..in
.
) used to enclose the block of statements to be executed by the
{}
for..in
action. For example, movie clip
for..in
statement does not enumerate
for..in
has prototype
child
parent
enumerates
child
to iterate over the properties of an object:
CHAPTER 5
and both contain the
from
but ignores
prop
child
for..in
for..in
159

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flex

Table of Contents