8 Replies Latest reply on Oct 28, 2009 11:12 PM by turnerator

    Single start/stop button for looping movie

    turnerator

      Dear Friends,

       

      I apologize if this has been addressed already in the forum, as I have had no luck searching here or the web in general for a solution.

       

      I currently have a 23-frame multilayered single-scene animation designed to loop continuously which I would like to add to my portfolio. As such, I am adding a Play button, which I would like to toggle to a Stop (or Pause) button. I currently have an instance of the Play button ("playButton") created.

       

      (You can find this at pineboxmovingco.com/gear_redux.swf)

       

      Besides imploring your assistance in providing the code, I must also ask if this requires (and best practice for) inserting an additional frame at the beginning for the ActionScript, as well as where/what layer to add an instance of the Stop button. I would like the movie to be stopped by default, presenting the Play button, toggling to the Stop button, and back to the Play button, each upon release.

       

      Thank you so much in advance!

       

      Michael T

      Phila, PA

        • 1. Re: Single start/stop button for looping movie
          kkaustubh

          refering to your question

           

          i think you should create a 'playBtn' movieClip

          and to this movie clip symbol add  2 frames labelled 'play' and 'pause'.....in this first frame should

          have 'play' graphic and the second should have 'stop' graphic

           

          now  assign the following A.s. to the playBtn movieClip

           

          on(release){

          if (this._currentframe==1){

          this.gotoAndStop("pause");

          _root.stop();

          }

           

          if(this._currentframe==2){

          this.gotoAndStop("play");

           

          _root.gotoAndPlay(''xxx");

          }

           

          you might do the required changes in above A.S.!!!!

          • 2. Re: Single start/stop button for looping movie
            turnerator Level 1

            Thank you so much for your reply - I'm sure in better hands that this would solve one's problem, but my attempt failed. Here's what I did:

             

            1) Created new top layer and inserted New Symbol>Movie Clip

            2) Dragged my button instance into the Movie Clip then created a second keyframe, changing the button on Frame 2 to a Stop button

            3) Dragged the MC to the stage (on top layer), selected it and applied the AS you provided:

             

            on(release){ if (this._currentframe==1){ this.gotoAndStop("pause"); _root.stop(); } if(this._currentframe==2){ this.gotoAndStop("play"); _root.gotoAndPlay("xxx"); }

            with XXX set to "1"

             

            Unfortunately, the clip now loops as usual with the Play/Stop buttons flashing throughout. Please note that the movie still begins at Frame 1 and is set to Loop. Did I implement your code incorrectly? If so, an elementary step-by-step may be required for this newbie!

             

            Thanks again,

            Michael

            • 3. Re: Single start/stop button for looping movie
              Ned Murphy Adobe Community Professional & MVP

              If you have an actions layer, in the first frame of that layer insert a stop(); command.  Similarly, for that play/stop button you created, add stop() commands at both keyframes.   This will keep things from running at the start.

              • 4. Re: Single start/stop button for looping movie
                turnerator Level 1

                So, Ned, insert the stop(); command - with no other code - on each keyframe of the MC like so:

                 

                stop.gif

                 

                Then, return to Scene 1 and select the MC, inserting the code:

                 

                action.gif

                 

                With an additional "stop" command in the first frame:

                 

                again.gif

                 

                I must be missing something as it is continues to loop. Any further assistance would be greatly appreciated...

                 

                Michael

                 

                (UPDATE: Replaced second image with AS reflecting replacement of XXX with "1".)

                 

                Message was edited by: turnerator

                • 5. Re: Single start/stop button for looping movie
                  turnerator Level 1

                  Thanks for all the great help with this; however, I have not yet successfully implement the solution, and I am guessing the reason boils down to a minor detail that is immediately apparent to those, unlike myself, who are familiar with actionscript basics.

                   

                  I have documented the desired action and my attempt to implement the recommended solution in great detail - please take a look and see what the missing puzzle piece is!

                   

                  Thanks again,

                  Michael

                   

                  ps Can I credit the two contributors, as well as whomever clears this up, without prematurely closing this post? This is my first time on the forum - I want each of you to know how much I appreciate your time.

                  • 6. Re: Single start/stop button for looping movie
                    kkaustubh Level 1

                    Hey

                    well first of all

                    thanks Ned i just forgot to add the 'stop' command in my reply

                     

                     

                    Now, here's a solution from me i created a start stop button

                    try watch every symbol and actionscript associated in the file

                    and make any changes you need

                    • 7. Re: Single start/stop button for looping movie
                      kkaustubh Level 1

                      i m having problem uploading the fla file

                       

                      so if give me ur email id i will mail it to u!

                      • 8. Re: Single start/stop button for looping movie
                        turnerator Level 1

                        leakproof at gmail dot com