1 Reply Latest reply on Dec 1, 2006 1:54 AM by crazyjoemilan

    Script help

    jcifuent
      Hi,
      i have this .swf
      http://www.innovadesign.com.au/test/ballsinterval.swf

      its a loop

      for (k=0; k<150; k++) {
      duplicateMovieClip(this.orange, "orange"+k, k)
      }

      that duplicates a movie clip 150 times
      the movie clip has this code:

      onClipEvent (load) {
      movieWidth = 1024;
      movieHeight = 768;
      // when the clip loads, give it the folloing properties
      this._alpha = 50+Math.random()*100;
      this._xscale = this._yscale=Math.random()*10;
      speed = 20+Math.random()*2; // set desired speed
      angle = random(360); // set desired angle
      speedX = Math.cos(angle*Math.PI/180)*speed;
      speedY = Math.sin(angle*Math.PI/180)*speed;
      }

      onClipEvent (enterFrame) {
      this._x += speedX;
      this._y += speedY;
      this._width=this._height=this._width+1;
      if (this._y>=1034 || this._y<=0) {
      this._y = 366+Math.random()*10;
      this._x = 494+Math.random()*10;
      speed = 20+Math.random()*2; // set desired speed
      angle = random(360); // set desired angle
      speedX = Math.cos(angle*Math.PI/180)*speed;
      speedY = Math.sin(angle*Math.PI/180)*speed;
      this._xscale = this._yscale=Math.random()*20;
      }
      if ((this._x>=(movieWidth+10)) || (this._x<=-10)) {
      this._y = 366+Math.random()*10;
      this._x = 494+Math.random()*10;
      speed = 20+Math.random()*2; // set desired speed
      angle = random(360); // set desired angle
      speedX = Math.cos(angle*Math.PI/180)*speed;
      speedY = Math.sin(angle*Math.PI/180)*speed;
      this._xscale = this._yscale=Math.random()*20;
      }
      }


      if you see the animation, at the beginning it has a "circle" of balls that start at the middle. and then you see them getting randomly.
      How do i get rid of that first "circle" of balls? i want the animation to start after the "circle", with all the balls starting in the middle but randomly, not at the same time.

      thanks a lot LINK
        • 1. Re: Script help
          crazyjoemilan Level 2
          Well a cheater's way of doing this would be just to assign them all _alpha=0 until they've played once through.

          Another way of doing this would be to assign random timing to them all, so they don't initially start right away. I'd say do this one.