[AS3]as3.0读xml实例一看就会了(源代码)
读取外部XML,[AS3]as3.0读xml实例一看就会了(源代码)加载xml,as3加载xml
[AS3]as3.0读xml实例一看就会了(源代码)
- <LoadingData>
- <question>
- <text>CuPlayer.com</text>
- <answers>
- <answer type="correct">correct!!correct!!</answer>
- <answer type="wrong">wrong!!!!wrong!!!!</answer>
- </answers>
- </question>
- </LoadingData>
[AS3]as3.0读xml实例一看就会了(源代码)
- package
- {
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.net.URLLoader;
- import flash.net.URLRequest;
- public class Main extends Sprite
- {
- public function Main():void
- {
- init();
- }
- private function init():void
- {
- var xmlURL:URLRequest = new URLRequest("LoadingData.xml");
- var xmlLoader:URLLoader = new URLLoader(xmlURL);
- xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
- }
- public function xmlLoaded(e:Event):void
- {
- var dataXML = XML(e.target.data);
- trace(dataXML.question.text);
- trace(dataXML.question.answers.answer[0]);
- trace(dataXML.question.answers.answer[0].@type);
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...