header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
liquidvisual
Points:110
Posts:0
Answered

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!!



1
Flash_Guy
Points: 850
Posts:0
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.

2
liquidvisual
Points: 110
Posts:0
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?

3
bob_senior
Points: 1320
Posts:0
Accepted Answer
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.

4
liquidvisual
Points: 0
Posts:0
9/8/2010 4:55:50 AM



Thanks for that! Just what I was after - I'll look into this


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 4+6 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions