dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: detecting when an exe is quit?

  1. #1
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227

    detecting when an exe is quit?

    Hey guys, I've 2 versions of my application, a swf/html and a exe.

    In the swf I've run some code when the browser is closed to quickly submit some data back to the website, works a treat.

    Now Can I do the same with an exe? I can make my own button sure but the app isn't full screen so you can see the "X" button.

    Is there anyway I can run code after the user clicks the "X" and before the swf shuts down?? I want to save a little shared object to the system
    Last edited by slinky2000; 04-17-2009 at 09:52 AM.

  2. #2
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The standalone Flash player doesn't give you any warning when the EXE is about to end or a way to intercept the shutdown call and do something else.

    If you grab a copy of http://www.northcode.com/misc/ncstart.zip you can use it to remove the title/border from your EXE so you can implement your own close button and do whatever you want before you call the quit fscommand.

    If you're doing this for a commercial project there are some third party tools that will let you intercept the EXE close event and insert your own code. In SWF Studio you can do it like this...

    Code:
    ssCore.App.setNotify({event:"onQuit"}, {callback:onQuit});
    
    function onQuit(ret_obj, cb_obj, err_obj)
    {
       if (ret_obj.success)
       {
          // save files here before quitting
          ssCore.App.forceQuit();
       }
    }
    So you tell SWF Studio that you want to be notified when the user tries to quit the application. SWF Studio generates an event (onQuit) that gets called when the user tries to quit and you can insert whatever code you like there. When you're done you just call ssCore.App.forceQuit to end the application.

    Here's a list of commercial tools you might want to look at. I'm not sure if all of them provide the same kind of onQuit functionality as SWF Studio but some of them do.

    SWF Studio http://www.northcode.com
    mProjector http://www.screentime.com
    SWFKit http://www.swfkit.com
    SWiSH Studio http://www.swishzone.com
    Jugglor http://www.jugglor.com
    Zinc http://www.multidmedia.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center