8 Replies Latest reply on Mar 30, 2011 2:45 AM by Kents79

    Pausing a movieclip

    Kents79

      Hi

       

      I tried to get this right but it just won't work for me. It's probably something very simple.

      I have a video in a movieclip on my timeline. On the first frame, I have the stop(); command. I want to be able to hit the SPACEBAR: which results in pausing the movieclip and jumping to frame 2 on the timeline.

       

      Can anybody help me with this please.


      Thanks

        • 1. Re: Pausing a movieclip
          Ned Murphy Adobe Community Professional & MVP

          Is the video spread along the timeline of the movieclip--if you put a stop() part way thru the movieclip's timeline does it stop?  Do you know how to code for keyboard interactions?

          • 2. Re: Pausing a movieclip
            Kents79 Level 1

            Hi Ned

             

            Thanks for your reply.

            Yes the video is spread along the timeline in the movieclip so if I place a stop command on the timeline......the video would stop.

             

            Is there a way to have a moiveclip on your time line. When it's playing, if you hit the Spacebar.......it pauses the movieclip......brings up a pause icon symbol.....then after 3 seconds jumps to another scene. Is this possible?

             

            E

            • 3. Re: Pausing a movieclip
              Ned Murphy Adobe Community Professional & MVP

              You should try inserting the stop  I suggested to see that it does indeed stop to your satisfaction (you might find otherwise).

               

              Yes, you can do what you want, but it will involve creating a pause icon that you display and using a time delay code to delay moving to another scene.

               

              The general approach to the code would be...

               

              pause_icon._visible = false;

               

              var keyListener:Object = new Object();
              Key.addListener(keyListener);

               

              keyListener.onKeyUp = function(){
                  if(Key.getCode() == 32){  // SPACE key

                        yourVideoMCName.stop();  // substitute your movieclip name

                        pause_icon._visible = true;

                        var sto = setTimeout(moveAlong, 3000);

                  }
              }

               

              function moveAlong(){

                   pause_icon._visible = false;

                   gotoAndStop(wherever);

              }

              • 4. Re: Pausing a movieclip
                Kents79 Level 1

                Hey Ned

                 

                That worked perfectly. Thank you very much for all of your help.

                 

                Emmet

                • 5. Re: Pausing a movieclip
                  Kents79 Level 1

                  Hi Ned

                   

                  Sorry to bother you again...............quick question for you.

                  I have a menu.exe file that I use to launch 3 separate .exe files (housed in a " Fscommand" folder)

                   

                  When I publish for Windows/Mac projector................the windows version works great.

                  But when I test it on the Mac......the call to action doesn't work.

                   

                  The following is what I have:

                   

                  on (keyPress "") {

                       fscommand("Exec", "screen_01.exe");

                  }

                   

                  Regards

                  Emmet

                  • 6. Re: Pausing a movieclip
                    Ned Murphy Adobe Community Professional & MVP

                    You are always better off starting new postings for new questions, especially if they have no relationship to your original question.

                     

                    I have no clue what might be failing with a Mac... not my cup of tea.

                    • 7. Re: Pausing a movieclip
                      Kents79 Level 1

                      Ok, cheers.

                      • 8. Re: Pausing a movieclip
                        Kents79 Level 1

                        Hi Ned

                         

                         

                         

                        Sorry to bother you again. I like to thank you for your help.

                         

                         

                         

                        I have a question in relation to your mail.

                         

                        I have my 'menu.swf' loading an external 'video.swf'.

                         

                         

                         

                        I have your script on the first frame of ‘video.swf’

                         

                         

                         

                        pause_icon._visible = false;

                         

                        var keyListener:Object = new Object();

                         

                        Key.addListener(keyListener);

                         

                        keyListener.onKeyUp = function(){

                         

                            if(Key.getCode() == 32){  // SPACE key

                         

                                  video_ad.stop();  // substitute your movieclip name

                         

                                  pause_icon._visible = true;

                         

                                  var sto = setTimeout(moveAlong, 3000);

                         

                                                          loadMovie("assets/pause.swf", 95);

                         

                         

                         

                            }

                         

                        }

                         

                        function moveAlong(){

                         

                             pause_icon._visible = false;

                         

                             gotoAndStop("home_promotions");

                         

                                        unloadMovie(90);

                         

                         

                         

                        }

                         

                         

                         

                        How do I get the playback head to jump to a certain framlabel on the 'menu.swf' when I press 'SPACEBAR' to run the above script on the ‘video.swf’

                         

                        Also, the pause icon appears straight away when the ‘video.swf’ starts?

                         

                         

                         

                        Regards

                         

                        Emmet