about
history
syntax
visu
arcade
goodies
wrappers
efficiency
examples
experiments
tabageos
tutorials
actiontad logo white


Flash Shared Objects are files that get stored on the clients computer that are similar to cookies.
They are used to store information about input or choices made from a SWF application.

They are most typically used in video players to store things like volume selected and current video position,
and they are used in games to store game settings options or other game info.

In the "Survival Of The Triangle" game I use a Shared Object to store all the options found in settings,
and the current region of the game the player has reached.

When you come back to the arcade, if you have played SOTT before and already reached level 80,
the game will read from the Shared Object that is stored on your computer and will therefore bring you striaght back to level 80.

To help with quickly creating and managing Shared Objects I've made the SOManager class:
The SOManager Class

Using it is simple, to call upon or create a Shared Object you just do:
import com.actiontad.utils.SOManager;

SOManager.establishLocalSO("TheNameOfTheSharedObject", "/");

//The first parameter is the name of the shared object you are trying to establish
//if it does not already exist it is created.
//The function will return the SharedObject.
//You use the data property of the SharedObject to actually store any data.
//To do that you use setDataOnLocalSO. (see below)

//The second parameter is the local path for the shared object, which is normally just "/"
//A "/" signifies that the SharedObject local path is the same as the swf file.
//The local path is the full or partial path to the swf file that created the SharedObject.
//It detsignates where the SharedObject will be saved.


//After you have called this function you can reference the data property of the SharedObject
//that was established by calling:
var saveFileData:Object = SOManger.sharedObjectData;

To set data on a local SharedObject you use the setDataOnLocalSO method:
import com.actiontad.utils.SOManager;

var result:Boolean = 
SOManager.setDataOnLocalSO("nameOfPropertyToSet", valueToSet, "nameOfSharedObject", "/", false);

//For this method you pass the name of the property you want to set on the data object,
//the value you want it to be, which can be an Object,
//the name of the shared object, and it's local path.

//The last parameter provieds a way to have the SharedObject be flushed also after the propery is set.
//Pass true if you would like the SharedObject to be flushed after the property has been set.
//Flushing a local SharedObject immediatly writes it to a local file, in other words it gets saved.

//The default option is false,
//which means the SharedObject will be written to disk when the SharedObject session is over.
//Which normally happens when the SWF file is closed.

//If the data was set the method returns true, otherwise false.
//If you pass true for flushing, if there is an error during flushing the method returns false.











actiontad twitter.com/actiontad terms