12 Replies Latest reply on Mar 22, 2007 4:50 PM by kglad

    ActionScript Stop

    bcounts Level 1
      I need some code to put on a Frame inside of a MovieClip named "Hibernate" that will stop all of the ActionScript in the _root

      Please Help! Thanks In Advance!
        • 1. Re: ActionScript Stop
          kglad Adobe Community Professional & MVP
          use setTimeout() if you want to pause a timeline for some number of seconds. if you want your timeline to stop until some code executes instructing the timeline to play(), use stop().
          • 2. Re: ActionScript Stop
            bcounts Level 1
            This did not work when I tried before posting - is there a way to stop just a selection of code in the first frame of the root when the MovieClip gets to a certain Frame?
            • 3. Re: ActionScript Stop
              kglad Adobe Community Professional & MVP
              no. you must plan ahead and put code, whose execution you want to control, into a function. call that function using setTimeout().
              • 4. Re: ActionScript Stop
                sly one Level 1
                Not sure what you mean by "stop just a selection of code"...maybe if you post the code in question you'd get more specific help...
                • 5. ActionScript Stop
                  bcounts Level 1
                  Here is what I am trying to do with an example link included

                  Visit the link below and leave the cursor on the stage (do not move it); in about 10 seconds another screen will fade over - now move the cursor around and let it sit for another 10 seconds - the screen goes away / I need it to stay until the "wake up" button is clicked.

                  The problem is that the code in the root says to resart the timer each time the mouse moves but that does not go well with the "hibernate.gotoAndPlay("p1");" about 8 lines into the code.

                  The only way I could think to do this is stop this code in the main root.

                  Link : http://beta.apsiaustin.com/

                  Code ------------------------------------------------------------------------------

                  IdleTime = 10; //for 10 Seconds
                  Timer = 1
                  function checkIfIdle() {
                  trace("checkIfIdle() systemIdle "+ _root.systemIdle)
                  _root.systemIdle = true;
                  if(_root.systemIdle==true && IdleTime==Timer) {
                  //attach your movie
                  hibernate.gotoAndPlay("p1");
                  }
                  Timer++
                  }
                  timeInterval = setInterval(checkIfIdle,1000)

                  function resetTimer() {
                  _root.systemIdle = false;
                  Timer = 1;
                  }

                  //For mouse
                  var mouseListener:Object = new Object()
                  mouseListener.onMouseMove = function() {
                  // trace("moving Mouse")
                  resetTimer()
                  }

                  Mouse.addListener(mouseListener);

                  //For any key
                  var keyListener:Object = new Object()
                  keyListener.onKeyDown = function() {
                  resetTimer()
                  }
                  Key.addListener(keyListener)
                  • 6. Re: ActionScript Stop
                    kglad Adobe Community Professional & MVP
                    try:

                    • 7. ActionScript Stop
                      bcounts Level 1
                      I am not sure where to attach this to current code! or if this is a new code to try!

                      My MovieClips name is "hibernate" and I need it to go into the movieclip and play frame label "p1"

                      the wake up button is in the hibernate movie clip and called "wakeup" so I am assuming it would be hibernate.wakeup.onPress ect.

                      I need the movie clip to play after 10 seconds for now and I will change it to 30 minutes after I know it works fully!

                      Can you write a full proof code for me that will work - also taking into account the probleam I listed above one or two posts above!

                      Let me know!
                      • 8. Re: ActionScript Stop
                        kglad Adobe Community Professional & MVP
                        if hibernate has a stop() in its first frame, there's nothing on-stage in its first frame and the inactivity message is on frame p1 in hibernate, you can use the following code on the timeline that contains hibernate (and remove the rest of your code that you posted):

                        • 9. ActionScript Stop
                          bcounts Level 1
                          I am having the worst brain farts this week!

                          I have attached the hibernation movie and placed the codes all in a new fla file for you to look at - please tell me what I am doing wrong.

                          http://apsiaustin.com/hib.fla

                          Need it to appear after 10 seconds on inactivity on the site and only have the timer restart when the wake-up button is pressed when the movie is loaded or if the person moves the mouse before the movie is loaded!

                          Thanks So So Much!

                          You can email me the revised file or post on a websever for me to download!

                          bcounts@austin.rr.com - Bryan
                          • 10. Re: ActionScript Stop
                            kglad Adobe Community Professional & MVP
                            here's your corrected file. there were several problems:

                            http://www.gladstien.com/Files/hib.fla
                            • 11. Re: ActionScript Stop
                              bcounts Level 1
                              Thank you so so much for everything - it worked like a charm!

                              You are amazing!
                              • 12. Re: ActionScript Stop
                                kglad Adobe Community Professional & MVP
                                you're welcome.