I would like to use URLLoader
to save my user's state to the server when the SWF is shutting down. I have a function named saveUserState
which saves the user's state correctly when called at any point except shutting down.
Within my creationComplete function, how do I add an event listener to know when the main SWF is unloading?
I have tried:
addEventListener(Event.REMOVED_FROM_STAGE, saveUserState, true, 1000, true);
But my saveUserState
function is not being called when the SWF is closed. I've searched and found other answers on the Internet which require an external interface to JS which does the invocation on the browser's onbeforeunload, but I see issues with IE and I'd like to avoid requiring this JS. I also see this answer, but it's not marked as accepted and I found it not to work.
Is this possible?