Flash AS3 SharedObject

package
{
import flash.display.Sprite;
import flash.net.SharedObject;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

import flash.utils.*;

public class SharedObjectReader extends Sprite
{
//the only one shared object we will work with
private var _sharedObj:SharedObject;

public function SharedObjectReader ()
{

//open local shared object
try
{
_sharedObj = SharedObject.getLocal("myID");

}
catch (error:Error)
{
trace("SharedObject Error:"+error.toString());
return;
}

//read the values, if user had already been here, he has them already.
trace("my ID " + _sharedObj.data.myID)

//store the values
_sharedObj.data.myID = 60;

//saving the values
_sharedObj.flush();

//The call of close
_sharedObj.close();

}

}
}

source

Comments are closed.