1 Reply Latest reply on Mar 9, 2010 4:52 AM by Ned Murphy

    Play/stop buton change into one button.

    imadnan

      I have two buttons for paly and stop movie.

       

      It is possible to only use ONE button ...

       

      EXample

      When click PLAY , stop btn is on

      When click Stop, Play btn is on.

       

      My file:

      http://www.4shared.com/file/237493999/92c00610/ps_online.html

        • 1. Re: Play/stop buton change into one button.
          Ned Murphy Adobe Community Professional & MVP

          You just described using two buttons (one on or the other).  So I won't touch that aspect since your post indicates you want to use one button.  If you want the one button to have different appearances for the two uses, then you need to use a movieclip for the button so that you can control which frame it is on or what inside it is displaying.

           

          You need code to take the place of what separate buttons would give you without it.  You basically need to keep track of what mode you're in (playing or stopped) and use a conditional to decide whether to end up stopping or playing when you click the button.  So you could have a variable that you assign based on the mode, and use that to decide...

           

          // main timeline variable

          var playing:Boolean = true;

           

          // in your button function on the main timeline...

          function ...

               if(playing){

                    stop();

                    playing = false;

               } else {

                    play();

                    playing = true;

               }

          }