Any event for Flash ending?

I want to be able to inform an HTTPserver with a GET request when the user “gets out of Flash.” By that, I mean either (a) the user switches away from the web page that contains the embedded SWF, or (b) the user closes his Flash Player. In other words, I cannot expect the user to cleanly exit the Flash application.\r\rIs there a way to trap this event?\r\rThank you

How can you “close your flash player”?!\rwhy not just do something onUnload of the page containing the swf?\rWhat exactly is it you wanna do?

By “close the Flash player” I mean if I were to run the SWF directly, not from a web page, (e.g. download the SWF file and either double-click it or open it from Flash Player), and while the SWF is playing, I were to close its window.\r\rAs for a Flash SWF that’s embedded in a web page, while the Flash is playing is the browser, I switch to another web page, or close the browser window.\r\rIn the above two scenarios, I want to do something at the point in time just before the Flash animation ends.\r\rFor anyone familiar with windows programming, I am trying to simulate a WINDOW_DESTROY event.\r\rThe movieclip “unload” event it not triggered in the above cases. I would like to trap that event to, say, message a server that the user has “left” or discontinued watching the movie. In the case of online courses, this is a way (I thought) that I could, know when the student has “left” the course.\r\rThanks