9/7/2010 7:33:32 AM
Title:
Pass a Flash variable to the browser's Javascript
Okay this is a very specific issue I'm trying to tackle. Basically I've got a Flash login area where a member will enter, and an ASP script will trigger to record this user in the database, temporarily. This is to restrict users to a set number of logins on one account.
So that works well, what I need to do now is invoke an UNLOCK script that releases the user from the database after the browser is closed. I imagine some javascript would accomplish this, easy.
HOWEVER.. I need to pass a value via GET to the script. And this value is only accessible in Flash.
Question: Is it possible to pass this value from inside Flash to the javascript in the browser?
Thanks for any help!!
9/7/2010 8:52:12 AM
As soon as you press the close button of browser the page is destroyed and no JavaScript code can execute. Regarding the browser request , closing browser cancels any request made and hence is of no use.
You can only provide such functionality if you provide a logoff button in your page . Which logs off the user after sending request to database.
9/7/2010 4:11:45 PM
There is actually an unload listener in JS that triggers when the user exits the browser. Anyone know if Flash can share a variable with the browser?
9/7/2010 8:35:28 PM
yes there is a unload listener, but I don't think that gives enough time to make a url request. You can always pass data and communicate between flash and JavaScript using external interface class in flash.
9/8/2010 4:55:50 AM
Thanks for that! Just what I was after - I'll look into this