Delete XML loader in AS3

165 Views Asked by At

I'm developing a tool for Adobe Animate and I ran into some issues with loaders.

I load a XML file in this tool and when I press a button, I want it to create a node in my XML file. But nothing happens...

I think it's caused by the XML being used with the loader and so I can't write in it.

I would like the XML file to be editable again after his loading, do you know a way to do this?

Thanks ! Here is the code :

var buttonListXML:XML = new XML();
var MenuXMLLoader:URLLoader = new URLLoader();

function loadXML(){
        MenuXMLLoader.load(new URLRequest(pathXML_RELATIVE));
        MenuXMLLoader.addEventListener(Event.COMPLETE, addNodeToXML);
}

function addNodeToXML(e:Event){
        buttonListXML = new XML(e.target.data);
        //for example, i modify this value
        buttonListXML.button[2].@number = 555;
        //here i try to delete the list
        MenuXMLLoader.removeEventListener(Event.COMPLETE, addNodeToXML);
        MenuXMLLoader = null;
        //everything is OK in the output
        trace(buttonListXML)
        //pathXML_ABSOLUTE cibling my XML file but nothing happens...
     MMExecute("FLfile.write("+pathXML_ABSOLUTE+","+buttonListXML+");");
}
0

There are 0 best solutions below