RemoveMC question!

Oki guys, the thing is I’ve made an object that can be dragged around. When it is being dragged, it doesn’t duplicate a certain MC, which is what I want, and when it isn’t being dragged, it (of course) duplicates like hell…

THEN, I threw in a “controller” which keeps an eye on how many duplicates I actually HAVE. THEN that controller goes in and removes duplicates over 30 duplicates old (which means it makes sure there’s only 30 duplicates on the screen).

HOW CAN I, delete ALL duplicates made so far when I press my first object?

maybe this helps:


//my duplicateMC

i=i+1;
duplicateMovieClip(_root.follow, “follow” + i, i);


That’s the duplicator, pretty easy so far…


//my controller

if (i>30) {
removeMovieClip("_root.follow" + (i-30));
}


This works perfectly, but when the movie’s played, oh say, 20 seconds with an fps of 30, I end up with duplicates named: follow570 to follow600!!

Is there a way to delete those with an on(press) ?

And yeah I know I can just say


On(press){
RemoveMovieClip("_root.follow" + (i-1));
RemoveMovieClip("_root.follow" + (i-2));
RemoveMovieClip("_root.follow" + (i-3));***

   Aaaaand so on..... up to 30...

The problem is then, if i want to change the length of my trail (duplicates), I have to write on MORE of these…

Is there a faster method to this?

If anyone gets confused about my explanation, mention it, and I’ll post the fla.

Eilsoe (MAN, my longest post to date… =))

Can you post your fla? It’s easier to see what’s what’s going on.

Duplicate at already used depths. At level 0, 1…, 29, 30 and then 0, 1…

i++;
if (i>=30) i=0;
_root.follow.duplicateMovieClip("follow" + i, i);

// Or if you like the modulo operator :)
(++i)%30 instead of the first 2 lines

pom :asian:

Yeah i can also just re-use the depths, but the prob is I have 30 duplicates i want to remove all at once…

I’ll post the fla.

here: Physics-fla

And here’s the working swf: Working swf