最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
as 3.0不分解析xml
时间:2022-07-02 17:00:06 编辑:袖梨 来源:一聚教程网
public class MoxieAS extends Sprite
{
public function MoxieAS ()
{
var stream:URLStream = new URLStream;
stream.addEventListener(Event.COMPLETE, complete);
stream.load(new URLRequest("ttt.xml")); //
}
private function complete (event:Event):void
{
var stream:URLStream = event.target as URLStream;
var xml:XML = XML(stream.readUTFBytes(stream.bytesAvailable));
trace(xml.*.length()); // output 3
}
}
方法二
public class MoxieAS extends Sprite
{
public function MoxieAS ()
{
var loader:URLLoader = new URLLoader(new URLRequest("ttt.xml")); //
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, complete);
}
private function complete (event:Event):void
{
var BA:ByteArray = new ByteArray;
BA.writeBytes((event.target as URLLoader).data);
BA.position = 0;
var xml:XML = XML(BA.readMultiByte(BA.length, "GBK"));
trace(xml.*); // output 测试
}
}
相关文章
- 重返未来1999趋光性研究夜幕之外怎么玩 12-27
- 桃源深处有人家养怡尘世装饰大赛怎么玩 12-27
- 第五人格贪吃蛇大作战联动时装怎么样 12-27
- 绝区零直到苍白荒秽之地怎么玩 12-27
- 第五人格贪吃蛇大作战联动时装怎么样 贪吃蛇联动独特时装介绍 12-27
- 以闪亮之名龙族幻想联动怎么玩 以闪亮之名龙族幻想联动介绍 12-27