HI. I’m new here. I have a function on my script that attaches a movieclip on a specific position and then it duplicates it several times. This movieclip has a code in order to move across the stage randomly. When I try to use SetInterval to repeat this function two weird things happen: the movieclips don’t duplicate over that specific location (they appear on x=0,y=0) and if I set the location only one duplicates and the rest don’t. My question is: what can I do to repeat the function every 2 seconds exactly as it is the first time it runs, without the objects not duplicating or moving from the original location?
Here’s the code:
meteoros = function () {
this.attachMovie(“asteroid”,“asteroid_mc”,this.getNextHighestDepth());
asteroid_mc._x = 470;
asteroid_mc._y = 70;
//i++;
while (i<5) {
this.asteroid_mc.duplicateMovieClip(“asteroid_mc”+i,this.getNextHighestDepth());
i++;
}
};
setInterval(this,“meteoros”,2000);