In an effort to record "session time" that a user spends in my flex application I'm trying to capture the application closing event and log information before the user leaves.
Currently I can make a webservice call from a function called from the ExternalInterface if I return some text to show in the "Are you sure you want to navigate away from this page" dialog box that the browser displays. The real problem is, if I don't return any text, the browser calls before my webservice call is made, as if the browser will not allow any additional requests once the user has begun the page closing function. Details: I have a unload function in actionscript that I register with the External Interface call. It makes a webservice call first, and then returns a string with text or an empty string. In my index.template.html file, I set the window.onbeforeunload to a function that calls my actionscript function. If my actionscript function returns an a string everything works, the webservice call logs the user logged out and the browser displays the dialog. If my actionscript function returns an empty string then no webservice call is recorded, the browser closes and my server is oblivious to the fact that the user is gone.