Before closing the html tab: how to notify Flex app internally?

In Firefox (or IE or whatever), when a tab is closed, I remember that you can be notified of this, and I would like to notify the Flex application and tell it to close (when possible) all connections that are open.

Does anyone know how to do this?

+1


a source to share


2 answers


Typically, you have no control over when the tab is closed and when the flash / flex app is destroyed. Therefore, you should not try to take any action on such an event, as they can be easily unloaded and your deinitialization logic will be broken.

In your case (closing connections), you should notice that all connections are automatically closed when the Flash Player application is destroyed.




Edit: There is actually a way to unload the page unload event in some cases (see the other answer). But there is no guarantee that such methods will always work (i.e., they may not work in a browser application), so you shouldn't completely rely on them anyway.

0


a source


You have to listen to the onbeforeunload event from the browser.



See more here http://seanmonahan.org/2009/03/19/preventing-users-from-accidently-navigating-away-from-your-flex-app/

+2


a source







All Articles