Optimize a Runtime Shared Library
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
private var mySharedObject : SharedObject;
private function readSharedObject() : void
{
var sampleData1 : String = "data1";
mySharedObject = SharedObject.getLocal( "myData" );
if ( mySharedObject.data.someData1 == undefined ) {
mySharedObject.data.someData1 = sampleData1;
mySharedObject.flush();
status.text += "mySharedObject data after assignment: " + mySharedObject.data.someData1 + "\n\n";
} else {
status.text += "mySharedObject already written to: " + mySharedObject.data.someData1 + "\n";
}
}
</mx:Script>
<mx:VBox width="100%" height="100%">
<mx:Button label="read a shared object" click="{ readSharedObject() }" />
<mx:TextArea id="status" width="100%" height="100%" />
</mx:VBox>
</mx:Application>
Related examples in the same category