session in flex

Tuesday, May 17, 2011 Posted by Sanka Senevirathna
As you know there is not variables like session in flex.But i have created a class call session that can perform the task of session in our day to day programming life.Class have two basic methods setAttribute and getAttribute.we can keep any type value as key and value.
What is inside happening? I used singleton design pattern,generic and dictionary for the work.
You can Use the following class as a session in flex.

[Bindable]
private var session:Session = Session.getInstance();

How to insert data to session
session.setAttribute('username','sanka')

How to retrive data from session
var userName:String=session.getAttribute('username');

download the class from here.
http://dl.dropbox.com/u/7375335/Session.as

I have create a link in forum for questions
http://forums.adobe.com/thread/799057?tstart=0
Labels:

Post a Comment