3 Replies Latest reply: Apr 16, 2012 11:05 AM by Cuwen RSS

    AS2 code for movie clip array w/ loop

    Cuwen Community Member

      Hi everyone.  I'm working on this for my job, and I've hit a wall.  I want to have an array that loops my movie clips.  However, there also needs to be the ability for the loop to stop and play a specific movie clip when a specific thumbnail that corresponds to that clip is clicked on.  Then, when that movie is done playing, the array is accessed again and the array continues once again, also looping.  I don't even know if this is possible.

       

      I set up something that worked in Flash Catalyst, but the only problem is that FC doesn't have the ability to have a fullscreen button in it for the document.  I need to be able to have the entire document go fullscreen when a button is pressed.  If anyone knows of an easier way to do that, that would also be a good answer.  Code for above or an easier way to do all of this with a fullscreen button would be great and very much appreciated!   I do not have Flash Builder.

       

      Here is the code I'm using so far:

       

      var currentSwf:Number = 0;
      var swfs:Array = new Array("StandFiles/SmartStand.swf", "StandFiles/Intro.swf");

       

      var listener:Object = new Object();
      var mcl:MovieClipLoader = new MovieClipLoader();
      mcl.addListener(listener);

       

         // When the swf loads, set it up to constantly check its current frame
      // against the total frames, and if those match, the swf is done playing.
      // If that's the case, then load the next one.

       

      listener.onLoadInit = function(targ:MovieClip):Void {
         targ.onEnterFrame = function():Void {
            if (this._currentframe == this._totalframes) {
               loadNext();
               delete this.onEnterFrame;
            }
         }
      }

      var i = 1;

      while (i < 5){

      trace ("This code is repeated");

      i++;

      }

       

      //Previous and Next Swf Buttons

       

      function loadNext():Void {

       

      if (currentSwf <swfs.length-1){

        currentSwf++;

      loadSWF(currentSwf);

      }

      }

       

       

      function loadSWF(nextSWFToLoad){

         mcl.loadClip(swfs[nextSWFToLoad],theTargetClip_mc);

      }

       

       

      loadSWF(currentSwf);

       

       

      function loadPrevious():Void{

         currentSwf--;

         if(currentSwf==-1) currentSwf = swfs.length-1;

         loadSWF(currentSwf);

      }

       

       

      previous_btn.onRelease = loadPrevious;

      next_btn.onRelease = loadNext;

       

      //End Previous and Next Swf Buttons

       

       

      //Play Button

       

      play_btn.onRelease = function() {

      theTargetClip_mc.play();

      }

       

      //Pause Button

       

      pause_btn.onRelease = function() {

      theTargetClip_mc.stop();

      }

        • 1. Re: AS2 code for movie clip array w/ loop
          Cuwen Community Member

          Anybody?  Should I move this to the main forum in Flash?

          • 2. Re: AS2 code for movie clip array w/ loop
            kglad MVP

            you probably won't get any response there, either.

             

            i checked your message one or two days ago and passed on it because your code is so poorly formatted it is difficult to read.  i notice that there have been over 60 views of your message and noone else responded, either.  my guess is most of them felt like me about your code formatting.

             

            hopefully, your code is properly formatted in whatever app you use to code.  if so, you can then use control-c, control-v (pc) to copy and paste to this forum.  mac has similar shortcuts.  if your code looks that way in the app you're using, format your code.

             

            p.s.  your lack of formatting makes it look like there are unrelated bits of code in your message.  and, to be sure, some parts are unrelated to anything like:

             

            var i = 1;

            while (i < 5){

            trace ("This code is repeated");

            i++;

            }

            • 3. Re: AS2 code for movie clip array w/ loop
              Cuwen Community Member

              Thank you for your response.  I used to use AS quite a bit in the past (like 4 years ago), but it just doesn't click anymore.  So I'll probably just have to do something else.  Someone in a different forum pointed me in the direction of Adobe Encore and making a Blu Ray pop-up menu, which sounds similar to what I want.  Only problem is that Encore doesn't offer a free trial.