i have a question. If i have my flash application on a website, is it possible to run a function right before the person closes the website window? Some help would be useful :) thanks in advance.
Asked
Active
Viewed 100 times
1
-
1I know in AIR you can (there is an event that is fired when the application is closing - `Event.CLOSING` on the `stage.nativeWindow` object (which is only available in air), not sure there is an equivalent in FlashPlayer for the web. You could possibly use `ExternalInterface` with the javascript `window.onbeforeunload` function to make it work if there isn't a built in event in FlashPlayer – BadFeelingAboutThis Feb 08 '17 at 20:52
1 Answers
0
You can use javascript to catch event when window is closing and invoke a function in actionscript through ExternalInterface.
Check this answer to see how to catch event :
How to capture the browser window close event?
Check this to see how to invoke function in AS3 from JS :