Ok, this example stores
the value of the textinput box in a sharedobject and gets it when the app first
starts:
<?xml version="1.0"
encoding="iso-8859-1" ?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initApp()"> <mx:Script> public var mySO:SharedObject; public var welcomeMessage:String; public function initApp() {
mySO = SharedObject.getLocal("mydata"); welcomeMessage = "Hello " + getName(); } private function
getName() {
return mySO.data.name; } private function
storeName() {
mySO.data.name = ti1.text; mySO.flush(); } </mx:Script> <mx:Label id="label1" text="{welcomeMessage}" /> <mx:Label id="label2" text="Enter Name:"
/> <mx:TextInput id="ti1"/> <mx:Button label="Store Name" click="storeName()" /> </mx:Application>
|
- RE: [flexcoders] Question about shared objects Matt Horn