Ok what I am trying to do is have it so that when you press the first button it stores a string and saves it for the next time I run the application, this is something I have been able to do. What I have been unable to do is to have a second button store a different string and save it for the next time I run the application. When I run it the second shared object takes over for the first one so now I am confused about what to do. Can someone help?
 
 
 
 
 
 
<?xml version="1.0" encoding="iso-8859-1" ?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initAll()">
<mx:Script>
public var mySO:SharedObject;
public var mySO2:SharedObject;
public var welcomeMessage:String;
 public var welcomeMessage2:String;
public function initApp() {
 mySO = SharedObject.getLocal("mydata");
 
 welcomeMessage = "Hello " + getName();
}
 public function initApptwo() {
 mySO2 = SharedObject.getLocal("mydata");
 
 welcomeMessage = "Hello " + getNametwo();
}
public function initAll(){
initApp()
initApptwo()
}
private function getName() {
 return mySO.data.name;
}
 private function getNametwo() {
 return mySO2.data.name;
}
private function storeName() {
 mySO.data.name = ti1.text;
 mySO.flush();
}
private function storeNametwo() {
 mySO2.data.name = ti2.text;
 mySO2.flush();
}
 
</mx:Script>
<mx:Label id="label1" text="{welcomeMessage}" />
<mx:Label id="label2" text="{welcomeMessage}" />
<mx:Label id="label3" text="Enter Name:" />
<mx:TextInput id="ti1"/>
<mx:TextInput id="ti2"/>
<mx:Button label="Store Name" click="storeName()" />
<mx:Button label="Store second Name" click="storeNametwo()" />
</mx:Application>
 
 
 
 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to