PDA

View Full Version : removing movieclips


hanchinliu
02-28-2001, 06:52 PM
Hi,
I made a game with a space ship moving to its mothership. Users have the option to show the trace of the movement. I use attachMovie to play the game (the space ship) and duplicateMovieClip to show the trace (the dots). How can I remove those duplicated dots when users click the button "reset"? Whenever I use a loop with removeMovieClip(_root["dot"+i], i); it takes like forever and a message ask me to stop the script because the script slows down the performance.
Any help will be appreciated.

Marx
03-02-2001, 05:47 PM
Hi...
The best thing I can do is first give you a script that duplicates my 'dot' MC, then I'll provide you with a reset button that removes all my duplicated MC's:

on (release) {
xpos = 20;
xspace = 50;
i = 1;
while (i<10) {
_root.dot.duplicateMovieClip("newDot"+i, i);
this["newDot"+i]._x = xpos;
xpos += xspace;
i++;
}
}

Reset button:

on (release) {
i = 1;
while (i<20) {
this["newDot"+i].removeMovieClip();
i++;
}
}

Hope this helps.