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.*);
}
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");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.