You need to keep the browser alive long enough for the request to be written to
the network. There's no hook available in the Player for running code on
shutdown/exit, which is good because if there was malicious swfs could prevent
a browser from closing.
I'd recommend catching the onunload event in Javascript, popping an alert (i.e.
Shutting down...), and then triggering your web service call in the Player
using ExternalInterface.
The Javascript alert improves your chances of the call making it onto the
network because the user has to manually click to close the alert box, and
users are generally slower than the machines they're using. The browser process
won't exit until the user has responded to the alert.
Seth
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jfournet
Sent: Wednesday, September 03, 2008 6:55 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Execute webservice on browser close
I am trying to execute a webservice using fds on browser close. It
seems like all of the flex as code gets executed, but flex fails to
send the xml to the server on which the webservice resides. I have
tries putting delays on the flex and javascript side, but the
webservice only executes intermittently.