【AS3代码】加载XML数据
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class Main extends Sprite
{
var jiazai:URLLoader = new URLLoader();
public function Main():void
{
//加载XML
jiazai.load(new URLRequest("abc.xml"));
//监听是否加载完成
jiazai.addEventListener(Event.COMPLETE,wancheng);
}
private function wancheng(evt:Event):void
{
//将加载的内容放入XML对象里
var a:XML = new XML(jiazai.data);
trace(a);
}
}
}
{
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class Main extends Sprite
{
var jiazai:URLLoader = new URLLoader();
public function Main():void
{
//加载XML
jiazai.load(new URLRequest("abc.xml"));
//监听是否加载完成
jiazai.addEventListener(Event.COMPLETE,wancheng);
}
private function wancheng(evt:Event):void
{
//将加载的内容放入XML对象里
var a:XML = new XML(jiazai.data);
trace(a);
}
}
}