5 Replies Latest reply on Nov 28, 2013 4:31 PM by kglad

    How to pause AS driven animation?

    alikim3

      I have a Flash file with lots of MovieClips enclosed in one another with different snippets of AS attached to them, including programmed delays and such.

       

      Is there a way to pause/play the whole thing?

       

      That would include pausing all timelines in all MovieClips and suspending AS execution.

       

      Thank you!

        • 1. Re: How to pause AS driven animation?
          kglad Adobe Community Professional & MVP

          you can pause and play all timelines using the following.

           

          to pause all:

          pauseAllF(_root,true);

           

          to play all:

          pauseAllF(_root.false);

           

          ///////////// do not alter below /////////////////////

          function pauseAllF(mc:MovieClip,bool:Boolean):Void{

          for(obj in mc){

          if(typeof(obj)=="movieclip"){

          if(bool){

          obj.stop();

          } else {

          obj.play();

          }

          pauseAllF(obj,bool);

          }

          }

          }

          1 person found this helpful
          • 2. Re: How to pause AS driven animation?
            alikim3 Level 1

            There are many snippets of code that goes like this (not the real code but you get the general idea):

             

            var tid = getTimer();

            this.onenterframe = function() {

            if(getTimer() - tid > 5000) {

            delete this.onenterframe;

            ....

            }

            }

             

            they are included in dozens of different frames on the timeline in dozens of enclosed moviecips.

            I need to pause/play all this kind code snippets. Also there are graphics that play inside and you can't access them as you do with movieclips.

             

            That's why I'm asking about pausing all timelines in all MovieClips and suspending AS execution for the whole thing.

             

            I can of course modify every snippet to include some kind of pause check but it's not practical, it'd be easier to remake the whole thing.

            • 3. Re: How to pause AS driven animation?
              kglad Adobe Community Professional & MVP

              there's no way to find and record all enterframe loops during runtime.  you can suspend all enterframe loops but you need to record them to restart them.

               

              you could find and record them using jsfl but that's probably more work than it's worth.

              1 person found this helpful
              • 4. Re: How to pause AS driven animation?
                alikim3 Level 1

                Ok, thank you.

                 

                Also, the problem with your code that starts / stops MovieClips is that I don't know which of them are playing atm and which are not, so I can't pause all of them and then play all of them, I'll end up with all of MovieClips that exist playing at the same time.

                • 5. Re: How to pause AS driven animation?
                  kglad Adobe Community Professional & MVP

                  you're welcome.