Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : dynamic movie clip names


CR Chisholm
1/27/2005 10:15:11 PM
Ok, stupid question....

I have a movie clip instance named Master . I want to duplicate this clip
several times for menu buttons something like this....

for (i=0;i<ops.length;i++) {
Master.duplicateMovieClip("Btn"+i,this.getNextHighestDepth());
.
. yada yada yada
.
set("Btn"+i+"._x",(i*138)+69); //this just spaces the buttons
.
yada yada yada
}

My question is: since I don't know exactly how many of these duplicates I
will need to create, I would rather use an array or something like that so
that I could reference the new clips directly. The way I am doing it above
is kind of difficult to manipulate. I have not found a syntax that works
for making an array of movie clips.

Is there a better way to create these clips dynamically and be able to
reference them more directly than what I did above?

Charlie


Byron Canfield
1/30/2005 7:18:01 PM
[quoted text, click to view]

Create references to them -- saves wear and tear on the fingers:

for (i=0; i<ops.length; i++) {
rfcClip =
Master.duplicateMovieClip("Btn"+i,this.getNextHighestDepth());
rfcClip._x = i*138+69; .
}

AddThis Social Bookmark Button