Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] abstract movie clip name refs
From: AndyA
Date: Mon, 26 Mar 2001 14:13:31 -0000

Hi Marc,

ActionScript provides you with the array access operator too. It works in
pretty much the same way as in javascript. So if you want to access
myMovieClip1 and:

string = "MovieClip";
number = 1;

then

_root["my" + string + number]._x = 25;

would change the _x property of myMovieClip1 to 25

In Flash4 notation, you'd use eval() to evaluate a name

set Property (eval("me" add string add number),_x,25;

I think (F4 notation isn't my strong point).

You might also want to look at storing the object ref in a variable:

mc1 = _root["my" + string + number];
mc1._x = 25;
mc1._y = 50;
mc1._visible = true;

So you can use the variable name without the array access operator because
you set the variable to equal the object reference of the object.

Regards

Andy




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]