用URLLoader加載XML,,然后將data轉(zhuǎn)化為ByteArray
用byteArray.readMultiByte(bytes.length,"utf-8")
然后將轉(zhuǎn)化后的字符串再強(qiáng)制轉(zhuǎn)化為XML
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.Binary;
var urlRequest:URLRequest = new URLRequest(source);
loader.addEventListener("complete",completeHandler);
loader.load(urlRequest);
private var completeHandler(evt:Event):void
{
var bytes:ByteArray = ByteArray(evt.currentTarget.data);
var xmlStr:String = bytes.readMultiByte(bytes.length,"utf-8");
var xml:XML = XML(xmlStr);
trace(xml);
}