1 Reply Latest reply on Aug 5, 2006 7:02 AM by shikozel

    Going nuts

    indyjoe
      Hi I am new to Actionscript and am having trouble with multiple images, attachmovie and removemovieclip.

      I cannot seem to be able click on all the balls created only the last one. It is driving me nuts. Can anyone help?

      sum = 10;
      for (i = 0; i < 3; i++){
      mc = _root.attachMovie("ball", "ball_" + i, i+10);
      this["ball_"+i]._x = sum;
      this["ball_"+i]._y = 110;
      sum = sum + 50;
      trace ("sum is :" + sum);
      trace ("ball is :" + this["ball_"+i]._x);
      }
      mc.onRelease = function(){
      this.removeMovieClip();
      } // end onRelease
        • 1. Re: Going nuts
          shikozel Level 1
          because you on release function is outside of the for loop
          correction:

          sum = 10;
          for (i = 0; i < 3; i++){
          mc = _root.attachMovie("ball", "ball_" + i, i+10);
          this["ball_"+i]._x = sum;
          this["ball_"+i]._y = 110;
          sum = sum + 50;
          trace ("sum is :" + sum);
          trace ("ball is :" + this["ball_"+i]._x);
          mc.onRelease = function(){
          this.removeMovieClip();
          } // end onRelease
          }