Featured FLA
» Author: Sphere
» Title: Reacting Waves
» Description: Small red waves on a plane react when the mouse pointer nears them.
» More by Sphere
BBM.net is designed to save you time and deliver the highest quality royalty-free music for your multimedia projects. Features include: over 450 Music Loop Packages from some of the best composers in the business, our music search engine to speed your selection process, alternate music versions & bonus sounds to use for rollovers or transitions, free technical support and free consulting.
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.