[quoted text, click to view] On Mar 8, 2:12 pm, "golem2" <webforumsu...@macromedia.com> wrote:
> HI,
> Is there a way to detect from within a flash movie, that the user has closed the browser?
> I want to send a variable to php page when a user is closing the browser.
>
> Thanks.
I don't believe you can get actual events when the browser is shutting
down, but you may be able to get events when the page is navigating
away. Since I know more about javascript and basically 0 about
actionscript, my answer will be more javascript based.
You can probably listen to the page "unload" event in javascript (both
mozilla and internet explorer should support this event, but I'm not
sure about the other browsers such as opera). Mozilla also has
another event called "pagehide". Anyways, once you get the unload
event, you can probably (i'm saying probably since I never tested this
out) call into flash through an ExternalInterface or do whatever is
necessary to extract info and shoot off the data to the server. One
thing that worries me about this is that the unload event is fired
when the page is unloading, so if you do fire off a php page request
to your server it may not go through since the page will navigate away
right way (unless you do something to block the navigation, but
blocking is an annoying user experience).
---Paul