In the following example, the expression inside the brackets is evaluated, and the result is used as
the name of the variable to be retrieved from movie clip
name_mc["A" + i];
If you are familiar with the Flash 4 ActionScript slash syntax, you can use the
accomplish the same result:
eval("name_mc.A" & i);
You can use the following ActionScript to loop over all objects in the
for debugging:
for (i in _root) {
trace(i+": "+_root[i]);
}
You can also use the array access ([]) operator on the left side of an assignment statement to
dynamically set instance, variable, and object names:
employee_array[2] = "Sam";
See also
Array
class,
Object class
:
name_mc
eval()
scope, which is useful
_root
[] (array access)
function to
59
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?