how can i use cookies information in flex3
can I use cookie information in flex? Suppose a user logs in first time i开发者_运维技巧n 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.
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
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.
See a number of SO threads on this issue:
Accessing browser cookies from Flex 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.
精彩评论