Referring to dynamically named movie clips in actionscript
Hi there
Basically, I'm really confused about the syntax for referring to a movie clip which you've created in a for loop, and named accordingly, like so:
for(i = 1; i < 8; i++){
j = "holder"+i;
createEmptyMovieClip(instanceName=j,i);
loadMovie(i+".png",j);
j._x = 30 + (i*80);
}
So, that all works fine, except for the last line :
j._x = 30 + (i*80);
Obviously I want to set each mc's x to a different position, but I guess I must just not be referring to it correctly? Which is weird, because the loadMovie(i... thing works fine. What I'm doing at the moment is setting it manually after the for loop but that's so dumb when I could cut down 14 lines of code to 2 lines (I'm doing both the x and y co-ords).
Any help appreciated!
|