3 Replies Latest reply on Dec 8, 2006 1:25 PM by jabresner

    Looping MovieClips

    jabresner
      I have three movie clips in my library. Each has a unique identifier (mc_1, mc_2, mc_3).

      On my main timeline, I create an empty movie clip and want to attach the first MC from the library, have it play all the way through, the attach the second, have it play all the way through, etc...

      Any suggestions on how to do this with actionscript?

      Thanks
        • 1. Re: Looping MovieClips
          Level 7

          add a counter at the end of the timeline (lastframe)

          i++; or i=i+1;

          and on the first frame

          if (i==n) {
          do_whatever ();
          }

          T.

          > I have three movie clips in my library. Each has a unique identifier (mc_1,
          > mc_2, mc_3).
          >
          > On my main timeline, I create an empty movie clip and want to attach the first
          > MC from the library, have it play all the way through, the attach the second,
          > have it play all the way through, etc...
          >
          > Any suggestions on how to do this with actionscript?
          >
          > Thanks
          >
          • 2. Re: Looping MovieClips
            jabresner Level 1
            Well, here's the thing. I don't want to add any actionscript to the movie's in the library that are being dynamically loaded AND I am trying to keep all the actionscript on one frame. In fact, I only have one frame and one layer in my main timeline and that has all the actionscript.

            any other suggestions?
            • 3. Re: Looping MovieClips
              jabresner Level 1
              Nevermind. Figured it out....

              Make sure you have three movie clips in the library with linkage names of 'mc_1', 'mc_2', and mc_3'. Then add the actionscript below to frame 1 of the main timeline.


              var mcArray:Array = new Array( 'mc_1', 'mc_2', 'mc_3' );
              var nIndex:Number = 0;
              function ShowNextClip() {
              var mcClip:MovieClip = _root.attachMovie( mcArray[nIndex], 'showMe', 10 );

              mcClip.onEnterFrame = function() {
              if( mcClip._currentframe == mcClip._totalframes ) {
              _root.ShowNextClip();
              }

              }

              nIndex ++;
              if( nIndex > mcArray.length -1 ) {
              nIndex = 0;
              }
              }

              ShowNextClip();
              stop();