Skip to content

Session Management in Flex – SharedObject

December 21, 2009

We’re trying to implement a simple Session Management for our end-users to be able to reload the page after signing in to stay signed in.

I did this by utilizing the SharedObject, which can store information on the users computer, regardless if they close the browser or went to a different site.
To create a SharedObject (cannot use the new keyword), and hence is instantiated like so:

private var _so:SharedObject = SharedObject.getLocal("member");  // member here is the name of the cookie stored on the clients computer

To add some parameters to the object stored, you simply:

_so.data.userFirstName 	= obj.response.firstName; // obj.response.firstname comes from the server after a user signed in

To read from the shared Object located on the users computer:

trace(_so.data.userFirstName) // as you can tell it’s the same way to read, as it is to write.



 
About these ads

From → AIR, Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: