5 Replies Latest reply on Dec 27, 2008 9:26 AM by kglad

    How to stop this loop?

    NeronBurningRome
      Hi,

      I've got a proplem with stopping this loop:
      In the first frame I got this code:

      if(!initialized){
      i=0;
      initialized=true;
      }
      i++;
      duplicateMovieClip ("p", "p"+i, i);
      p = eval("p"+i);
      p._x = -70+random(10);
      p._y = 45+random(10);
      if (i==30){
      i=0;
      }

      ...and in the second frame I got:

      gotoAndPlay(_currentframe-1);

      The effect is that the clip duplicates over and over again. Now, I want to stop that loop, e.g. when "i" reaches 30. I've tried to do that by changing the last part of the code:

      if (i==30){
      stop();
      }

      ...but didn't work:) I wonder if anyone can help me on this. I'd appreciate.

      Actually I wanted the animation to stop, dissapear or was removed. I've tried this one for instance:

      if (i==30){
      removeMovieClip ("p");
      }

      but didn't work either.

      Thanks in advance for any help.