PDA

View Full Version : onBeforeUnload


hugobossv8
07-13-2004, 04:30 PM
From what I can tell, Flash has no methods for determining if the Flash Object has been unloaded when the browser window closes. First of all, is this correct?

Second, my problem is that I need to call a script inside flash that sends a remoting call to save state to a session. I've tried using a combination of TCallLabel and onBeforeUnload, but the browser has no way of being able to tell if Flash has completed the script, and the window unloads before the script completes.

Any ideas on what I can do to fix this? I've tried using setTimeout, but that doesn't appear to have any effect with onBeforeUnload.

Thanks.

janzaldo
07-13-2004, 04:56 PM
maybe you can use the unload method of html
that redirects to other page and then save the state of a session
or in the method unload of html call a javaScript function that comunicates to flash and save the state of the session

hugobossv8
07-13-2004, 05:15 PM
The data I need to send to session state is stored in an object and needs to be passed through a remoting call in Flash. So, I can't redirect the user to another page.

I haven't tried onUnload, but onUnload fires after onBeforeUnload, so I figured that onBeforeUnload made more sense since it gives a little extra time needed to run the script...but evidently still not enough time, because it still doesn't work.