3 Replies Latest reply on Mar 23, 2011 1:27 PM by kglad

    Pause and Play Toggling Button

    VirtualCameron

      I have created a Pause and Play button that toggles between states.  It controls a Timeline with synced Sound.  When I use it the sound and animation go out of sync.  Can anyone help me with this or perhaps have better code I could swap out to make this work?

       

      Below is what I am currently using:

      On the first frame of an Action Script layer put this AS:

       

      playBtn.onRelease = function() {

      ns.pause(false);

      playBtn._visible = false;

      pauseBtn._visible = true;

      };

       

      pauseBtn.onRelease = function() {

      ns.pause(true);

      playBtn._visible = true;

      pauseBtn._visible = false;

      };

       

      _____________________________________

       

      Lable a Pause button Graphic "pauseBtn"

       

      put this AS on the button:

       

      on (release) {

                  gotoAndPlay(_currentframe+1);
      }

      _____________________________________

       

      Lable a Play button Graphic "playBtn"

      put this AS on the button:

       

      on (release) {

                  stop();

      }

       

      _____________________________________

       

      Put the Pause and Play buttons directly over each other on 2 layers for the duration of the timeline.

      Pause Button on top. (unless you have a STOP on the first line then maybe the Play button will start it (I didn't Try this)