Featured FLA
» Author: Nitin Tikhe
» Title: Cart
» Description: This Animation Tut is a fun and useful for kids below 15 years. Watch the Flag, Doors, Stick and Horse movements.
» More by Nitin Tikhe
Featured Site
» Posted in the Flash Kit Links section
» Title: Banana Swimwear
» Description: This is a banana swim wear interactive catalog we designed and animated in Flash
First, we have to create a local shared object within a Flash movie. To do so, just put this line of code in the first frame of your movie:
local_data = SharedObject.getLocal("user_data");
Now we have created an Object named "local_data" which is associated with a shared object on the local hard-drive named user_data. Note that in the feature, this data can be read from other movies from the same domain that created the Shared Object.
Writing data
Lets store something in our fresh created Shared Object. Lets say, we want to store the user's name and his age in it. To do so, use this:
Note that this code must be in the same level where you have created the Shared Object.
The flush () command is optional, it is used to write the information to disk immediately. If you don't use this command, Flash MX writes the shared object to a file when the SWF movie is closed or when the shared object is garbage-collected because it no longer has any references to it.