5 Replies Latest reply on Jun 10, 2006 4:24 PM by Wolf_van_Ween

    _root.onQuit Event?

      Is there and event that occurs when the user presses the page refresh and the current swf stops playing.
        • 1. Re: _root.onQuit Event?
          Wolf_van_Ween Level 1
          Interesting question. I don't know to be honest, but I don't think that the flash object finds out when it's unloaded.
          There is however a window.onbeforeunload event in the browser, so you can catch that with javascript and tell Flash what to do.
          • 2. Re: _root.onQuit Event?
            Jim_Esteban Level 1
            I'll give that a try. I need to learn more about communicating between flash and javascript anyway. Thanks.
            • 3. Re: _root.onQuit Event?
              2m Level 2
              Internaly there has to be something like that, because localShared objects are automaticaly flushed at that moment (it's said not to rely on that but I can't remember a case when it wouldn't work as advertised)

              As the swf is gone anyway, the usefullness would be limeded to storing info (I'm probably missing something though) and perhaps the functinality of the LSO is something that can help you?
              • 4. Re: _root.onQuit Event?
                Jim_Esteban Level 1
                I have tried to use _root.onUnload and that didn't seem to do it. I was reading the help this morning and this is what is said about the MovieClip.onUnload "Event handler; invoked in the first frame after the movie clip is removed from the Timeline". If it's invoked the first frame after the movie clip is removed then this event must only be for MovieClips that are added to the main timeline, because if the _root is removed then there will be no next frame...Right?
                • 5. Re: _root.onQuit Event?
                  Wolf_van_Ween Level 1
                  Yes, of course. The unload event inside Flash doesn't do the trick.
                  I've played around a bit, too. Here's an excerpt from my test.
                  It works by catching the unload event in javaScript, informing the Flash (by setting a variable) and then waiting at the html level (by displaying an alert dialog box in javascript).
                  Your Flash movie then has some time to do whatever it needs to do to say goodbye...
                  Good luck