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.*); 
}

1 Answer 1

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");
Sign up to request clarification or add additional context in comments.

2 Comments

it doesn't Autosave the document
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: stackoverflow.com/questions/16138905/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.