calling external xml text

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("game_text.xml"));

myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void {
myXML = new XML(e.target.data);
//trace(myXML.level[1].item.@name[1]);
step1.text = myXML.level[0].@title;
//
text1.text = myXML.level[0].item.@name[0];
text2.text = myXML.level[0].item.@name[1];
text3.text = myXML.level[0].item.@name[2];
text4.text = myXML.level[0].item.@name[3];

}

-?xml version="1.0" encoding="utf-8"?!
-GALLERY!

-level title="Setep 1"!
-item name = "dog"!dog-/item!
-item name = "boy"!dog-/item!
-item name = "cat"!-/item!
-item name = "fish"!-/item!
-/level!
-/GALLERY!

0 comments:

Post a Comment