- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
public class XMLParser extends Sprite
{
private var _xmlData:XML;
private var _xmlLoader:URLLoader;
public function XMLParser() {}
public function loadXML(url:String):void
{
_xmlLoader = new URLLoader();
_xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad);
_xmlLoader.load(new URLRequest(url));
}
private function onXMLLoad(e:Event):void
{
_xmlData = new XML(e.target.data);
parent.dispatchEvent(new Event("LOAD"));
}
public function parseXML():Array
{
var infoData:Array = new Array();
for(var i:int=0; i <= _xmlData.item.length()-1; i++)
infoData.push([ _xmlData.item.attribute("src")[i],
_xmlData.item[i].title,
_xmlData.item[i].image,
_xmlData.item[i].call,
_xmlData.item[i].description,
_xmlData.item[i].place,
_xmlData.item[i].file]);
return infoData;
}
}