tags:

views:

131

answers:

3

Hi, can I use cookie information in flex? Suppose a user logs in first time in login form (designed in flex) and when he logs in again I need to show users name in dropdown from cookies, is it possible in flex? Is there any way I can do please suggest me Thanks in Advance.

A: 

You can create a SharedObject to store session data on a users computer.

var so:SharedObject = SharedObject.getLocal("savedData");

If a shared object by the name you specified doesn't exist, one will be created.

Check out the Live Docs for more info: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/SharedObject.html

jeremynealbrown
A: 

You should use cookies for uses identification on the server (a session id) just like you would with any other web app. Then have a service on your back-end like getUserInfo() that returns the information for the currently logged in user. Call that method from Flex (via HTTPService, WebService, RemoteObject, etc) and then you will have the user information on the client.

James Ward
A: 

See a number of SO threads on this issue:

http://stackoverflow.com/questions/523633/accessing-browser-cookies-from-flex http://stackoverflow.com/questions/1879240/how-do-i-store-cookies-in-flex

Briefly, two options that don't involve going back to the server:

  • Use Javascript integration to access cookie data, as in this library.

  • Use SharedObjects ("Flash cookies") to persist local data.

Michael Brewer-Davis
Hi Michael, Thanks for your response. I don’t want to use shared objects (as per my requirement) I need to use cookie data, if user deletes cookie information from browser data should be deleting. I am planning to use JavaScript integration to access cookie data in that this library is not opening for me it is blocked(in my organization). Can you give me the code? And how can I retrieve cookies in java script? It would be helpful if you provide. Thanks in advance.
praveen
Perhaps try this link to download the `Actionscript Cookie Util` library referenced above: http://depositfiles.com/files/ry60vxfh8
Michael Brewer-Davis
Thanks it is downloading
praveen