Changing the content of a xml from as3 and saving it
Hi guys...
I have a simple question... I access a xml from my code and read a value... and I need to change it to another one, since I will access the xml from the other stage... can it be done?
I have used replace but when I check the original xml, the value remains the same:
var xmlldr:URLLoader = new URLLoader();
xmlldr.addEventListener(Event.COMPLETE, loadComplete);
xmlldr.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var xmlContent:XML;
var bT:int;
xmlldr.load(new URLRequest("c.xml"));
function loadComplete(e:Event):void {
xmlContent = new XML(xmlldr.data);
xmlldr.removeEventListener(Event.COMPLETE, loadComplete);
xmlldr.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
trace(xmlContent.gCg.fBT);
ChangeBT();
}
function loadError(e:IOErrorEvent):void {
}
function ChangeBT():void {
bT = 2000;
xmlContent.gCg.fBT.replace("1000", bT);
trace(xmlContent.gCg.fBT);
}
Can it be done? meaning? can I, by changing the value on the first stage, have the original xml file value changed as well?
Thanks!!!
