Thursday, May 7, 2009

Store content value in local

Some time we need to keep previous setting of application in our local system.
We can do this by SharedObject.

private var appHeight:Number=200; // Default height 200
private var appWidth:Number=200; // Default width 200
private var sharedObj:SharedObject; // SharedObject

Save Setting in SharedObject

sharedObj.data.setting = new Object();
sharedObj.data.setting.appHeight = appHeight;
sharedObj.data.setting.appWidth = appWidth;

Get Setting in SharedObject

sharedObj =SharedObject.getLocal("GeneralSetting");
appHeight = so.data.setting.appHeight;
appWidth = so.data.setting.appWidth;

No comments: