A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [function] onClose?

  1. #1
    Impressive Click swcAndrew's Avatar
    Join Date
    Oct 2004
    Location
    USA
    Posts
    468

    [function] onClose?

    Is there any function in flash that can check when the program closes? Like for instance, when the program closes, send values to the database of a score/time? I don't believe there is any, and one of my clients has asked me to make a script that requires some function of that sort, but I just want to re-check with experts here at FK. I'd appreciate any help, thanks.

    -Andrew
    Andrew Webster
    Impressive Click

  2. #2
    I tried... dbarbarian's Avatar
    Join Date
    Aug 2003
    Location
    Berkeley, California, USA
    Posts
    678
    I don't know if there is either, but if there isn't maybe this will work:

    I don't know much about databeses and stuff, but you might be able to do something where it sends the values every frame/or every second to the database and itll replace the old values each time. This way, when the player closes the file, the last file written will be the last values so it is kind of like a onClose function.

    Just a thought

    DBarbarian

  3. #3
    Impressive Click swcAndrew's Avatar
    Join Date
    Oct 2004
    Location
    USA
    Posts
    468
    Thats, a great idea, I didn't think of that, thanks. I might use that idea, if there isn't any other ideas, because sending values every frame/second would cause a lot of lagging. Thanks for replying though!
    Andrew Webster
    Impressive Click

  4. #4
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,361
    I believe in javascript there is a command for executing something when the window is closed. I'm not sure what it is, but I'm pretty sure...

    Edit: Found a link to it, here it is... http://www.htmlgoodies.com/primers/j...le.php/3478221

  5. #5
    Impressive Click swcAndrew's Avatar
    Join Date
    Oct 2004
    Location
    USA
    Posts
    468
    Yeah I have heard of that command also and I can look it up, except its a function that checks to see when someone clicks outside of the window. Again, that would be a good idea, but I am not sure if you just click the exit button on the browser it would be the same as clicking off the screen. Also, it brings a problem if the game isn't browser based. But, I am going to keep that in mind, thanks.

    Andrew
    Andrew Webster
    Impressive Click

  6. #6
    Impressive Click swcAndrew's Avatar
    Join Date
    Oct 2004
    Location
    USA
    Posts
    468
    Oh, just checking out the link. That might work, thanks.
    Andrew Webster
    Impressive Click

  7. #7
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,361
    I just tried a quick example of it, you can test it here.

    Go to a different site, or exit, it should work.

    Cheers!

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