IntroductionÂ
The SharedObject class functions like a browser cookie. You use the class to store data on the user’s local hard drive and call that data during the same session or in a later session. Below are the keys of using SharedObject:
- Applications can only access their own SharedObject data, and only if they are running on the same domain. The data is not sent to the server and is not accessible by other Flex applications running on other domains.
- When you create a SharedObject, Macromedia Flash Player creates a new directory for the application and domain, and creates an empty *.sol file that stores the SharedObject data. The default location of this file is in a subdirectory of the user’s home directory.
- By default, Flash can save locally persistent SharedObjects of up to 100K in size. When you try to save a larger set of data, Flash Player displays the Local Storage dialog box, which lets the user allow or deny local storage for the domain that is requesting access.
- Some important methods:
- clear()
- flush() - write to the file. If not, flex persists it when the application is closed. However, this does not provide the user with an opportunity to increase the available space
- getLocal(”name”)
- getSize()
- You can store simple data types in a SharedObject. These types are Number, String, Boolean, XML, Date, Array, and Object. After you assign values to the data property, you must instruct Flash Player to write those values to the SharedObject’s file. To force Flash Player to write the values to the SharedObject’s file, use the flush() method:
sharedObject_ID.data.variable = value; //store data
LSO vs Cookie
- LSOs are can store more data than cookies
- LSOs never expire
- LSOs arent transmitted between the client and the server
- LSOs can store native ActionScript datatypes.Â
Reference
http://www.adobe.com/support/documentation/en/flex/1/lsos/lsos5.html






































(4.75 out of 5)
No Comment Received
Sorry the comment area are closed for non registered users