0

i am working with adobe flash cs6 with as3. i have a XML file and i needed to add a node to it .when i tried its working fine.but when the instance is closed,i opened the XML file with notepad ,it doesn't actually saved to original file.my XML file is stored locally in the same folder of flash project. I need a solution without using other languages like PHP. please help

var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("family.xml")); myLoader.addEventListener(Event.COMPLETE,xmlDownloaded) function xmlDownloaded(event:Event):void {
    var xmlData:XML = new XML(event.target.data); var attention:XML
    var surname:String= xmlData.@surname;
    var location:String= xmlData.@location;

    //  get the first granddaughter's age of the first daughter
    var grandchild_age:Number= Number(xmlData.DAUGHTER.GRANDCHILD.@age);    //trace(xmlData.DAUGHTER);   xmlData.ATTENTION.@avalue="85";     xmlData.MEDITATION.@mvalue="85";       trace(xmlData.*); 
}
wizard
  • 13
  • 1
  • 6

1 Answers1

0

I guess you need to save that xml file after editing it. You should try doing something like this after you make all changes to your xml:

var file:FileReference = new FileReference;
file.save( xmlData , "family.xml" );

or like this:

FileReference().save(xmlData , "family.xml");
jfgi
  • 107
  • 1
  • 10
  • it doesn't Autosave the document – wizard Jul 03 '13 at 11:02
  • It shouldn't clear any data but I just remembered that it will show "Save as" dialog. If it is problem for you, you can look at answer here: http://stackoverflow.com/questions/16138905/autosaving-to-xml-using-filereference-save-without-having-a-save-as-dialog-come – jfgi Jul 03 '13 at 11:07