3 Replies Latest reply on Sep 11, 2006 10:58 AM by crazyjoemilan

    movement sequence

    microes
      i would like to animate an array of mcs, one after the other, use setinterval to control the speed of the animation sequence.
      what would be the best approach to this.
      does anyone have an example?

      thanks
        • 1. Re: movement sequence
          crazyjoemilan Level 2
          the speed of the spacing of the MCs? Or the speed of the actual MCs?

          Something like this would control the spacing.
          1) push all MC names into the array.
          2) set the Interval.
          3) run a for (i=0;i<=THEarray._length;i++) loop
          3.a- THEarray .gotoAndPlay(2);
          3.b- interval wastes some time, then kicks back to the original for loop.

          Like that?
          • 2. Re: movement sequence
            microes Level 1
            could you provide a working example?
            • 3. movement sequence
              crazyjoemilan Level 2
              Well, I don't have the time to upload a working example, but I can push the code a bit further. We'll assume you already have the array of mc names, in order of desired play. Also, we won't use a for loop because you don't need it, setInterval loops on its own.

              setInterval works like this:

              setInterval (function, time)
              "time" of course is a number where 1000 = 1 second" The function is self defined.

              so

              function PlayNext() {
              currentMC = THEarray[whichNumber];
              _root[currentMC].gotoAndPlay(2);
              whichNumber++
              if (whichNumber > _root.THEarray.length) {
              //here you can either reset the value (to start them all playing again, or turn off the setInterval function.
              }
              }
              setInterval( PlayNext, 1500);