I am working on trying to get a shared object script to work, but can't seem to get it to save to my array. I am wondering if anyone can see what I am missing here.
Thanks, *********** main.mxml ************* <?xml version="1.0" encoding="iso-8859-1" ?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initApp();"> <mx:Script source="LSO_script.as"/> <mx:Panel width="100%" height="100%" backgroundColor="#666666"> <mx:Form width="100%" height="100%"> <mx:FormItem label="Date of event or close call:" required="true"> <mx:DateField id="txtEventDate" width="115" /> </mx:FormItem> <mx:FormItem label="Describe the actual event or close call:" required="true"> <mx:TextArea id="txtEventDescription" width="550" height="150" textAlign="left" focusIn="" text=""/> </mx:FormItem> </mx:Form> <mx:ControlBar> <mx:Button label="Set Value" click="setVal();" /> <mx:Button label="Get Value" click="getVal();" /> </mx:ControlBar> </mx:Panel> </mx:Application> ************ AS code ********* var myArray:Array; var _eventDate; var _desc; var mySharedObj:SharedObject; function initApp() { // Initialize Local Shared Object. mySharedObj = SharedObject.getLocal("safetyReport"); //This creates a safetyReport.sol file in the Flex application's directory. if (mySharedObj == null) { alert("Cannot create Local Shared Object","Error"); } function getVal() { // Get value from mySharedObj. myArray = mySharedObj.data.val; _eventDate = myArray [0]; _desc = myArray [1]; txtEventDate.text = _eventDate; txtEventDescription.text = _desc; } function setVal() { // Set value in mySharedObj. myArray [0] = txtEventDate.text; myArray [1] = txtEventDescription.text; mySharedObj.data.val = myArray; mySharedObj.flush(); mx.controls.Alert.show("Variable 1 = " + myArray [0] + " Variable 2 = " + myArray [1]); } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

