1 Reply Latest reply on Jul 12, 2010 5:02 AM by Ned Murphy

    How to set criteria to Play/Pause buttons

    toastiesmonster

      How to set conditional criteria to Play/Pause buttons?

      i.e. to pause the animation only if the animation is playing; and to  play the animation again only if the animation is paused. thanks.

       

       

      on(release) {
      play();
      }

       

      on(release) {
      stop();
      }
        • 1. Re: How to set criteria to Play/Pause buttons
          Ned Murphy Adobe Community Professional & MVP

          Here's where that isStopped variable you had in your other posting could be handy if the intention is to have one button do both...

           

          var isStopped:Boolean  = false; // assuming it is playing at the start

           

          on(release){

               if(isStopped){

                    isStopped = false;

                    play();

               } else {

                    isStopped = true;

                    stop();

               }

          }

           

          But if you have separate buttons for Play and Pause, what you showed already would be sufficient when you match the two code bits to the correct buttons.