I created a circle movie clip (movie clip name: enemy, instance name: enemy_inst) and typed this in the first frame:
var i:Number;
for (i=1; i<=5; i++)
{
enemy_inst.duplicateMovieClip(enemy_inst, “enemy_inst”+i, i);
}
I’m trying to generate 5 duplicates of the same movie clip here. And in the action script box of the original instance, ie, ‘enemy_inst’, I typed:
onClipEvent(load)
{
this._x=500;
this._y= random(400);
this.z=random(10)+1;
}
onClipEvent(enterFrame)
{
this._x-=z;
}
So that I could see 6 different instances of the movie clip (including the original) move across the screen at varying speeds and at varying points on the y axis.
But no matter what I do, I only see 2 instances of the movie clip when I play the movie. They appear at different points on the y axis and move across the screen at different speeds like I wanted. I even tried changing the loop condition from i<=5 to i<=100. Still, I only see 2 instances of the movie clip. One of those instances is the original one, so that means the for loop in the first frame is running only once. Since I generate a new y value on load for each instance of the movie clip, that eliminates the possibility of overlapping. I can’t find anything wrong with the code either. Please help. (I’m new to flash, btw)