var ldr:URLLoader = new URLLoader();
ldr.addEventListener(Event.COMPLETE, onLoaad);
ldr.load(new URLRequest("oman.xml"));//or any script that returns xml
function onLoaad(e:Event):void
{
var loadedText:String = URLLoader(e.target).data;
trace(loadedText);
//create xml from the received string
var xml:XML = new XML(loadedText);
trace(xml.toXMLString());
//modify it
var word2:XML = <word/>;
var name:XML = <name/>;
name.appendChild("the name");
word2.appendChild(name);
var title:String = "asdasd";
word2.appendChild("<title2>" + title + "</title2>");
xml.appendChild(word2);
trace(xml.toXMLString());
//save it
var ldr:URLLoader = new URLLoader();
ldr.addEventListener(Event.COMPLETE, onSave);
//listen for other events here.
var data:URLVariables = new URLVariables();
data.xml = xml.toXMLString();
var req:URLRequest = new URLRequest("oman.xml");
req.data = data;
ldr.load(req);
}
function onSave(e:Event):void
{
trace(e.target.data);
}
Здесь я написал код для структуры ml
<words>
<word>
<name>this</name>
<title>that</title>
</word>
</words>
Но здесь не происходит никаких обновлений ... есть ли альтернативные способы?