1

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.

Cene Jenko
  • 23
  • 7
  • 1
    I 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 Answers1

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 :

Javascript call AS3 function

Community
  • 1
  • 1
n1kk
  • 742
  • 9
  • 9