-
[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
-
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
-
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! :)
-
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
-
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
-
Oh, just checking out the link. That might work, thanks.
-
I just tried a quick example of it, you can test it here.
Go to a different site, or exit, it should work.
Cheers!