• 【AS3代码】读取外部XML


    <LoadingData>
        <question>
            <text>XML!!</text>
            <answers>
                <answer type="correct">correct!!correct!!</answer>
                <answer type="wrong">wrong!!!!wrong!!!!</answer>
            </answers>
        </question>
    </LoadingData>
    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);
            }
        }

  • 相关阅读:
    node-log4js3.0.6配置
    MySQL命令学习
    64位 windows10,MYSQL8.0.13重置密码(忘记密码或者无法登录)
    64位 windows10,安装配置MYSQL8.0.13
    vscode切换界面布局
    一个网站同时监听两个端口
    javascript +new Date()
    es6 解构
    react列表数据显示
    访问禁止,检测到可疑访问,事件编号
  • 原文地址:https://www.cnblogs.com/kingfly/p/2575957.html
Copyright © 2020-2023  润新知