• 用xml配置文件加载资源时(XML和XMLList的转换)


    <?xml version="1.0" encoding="UTF-8"?>
    <root path="resource/">
    
        <bg path="background.jpg" />
        <hammer uppath="hammer_up.png" downpath="hammer_down.png" />    
        <house buildpath="house_building.png" finalpath="house_final.png" buildtime="3000" />
        <stone buildpath="stonemine_building.png" finalpath="stonemine_final.png" buildtime="5000" />
            
    </root>
    urlLoader.removeEventListener(Event.COMPLETE,loadCOmhan);
                var rootXml:XML = new XML(urlLoader.data);
                urlLoader = null;
                var rootPath:String = rootXml.@path;
                
                var bgXMLlist:XMLList = XMLList(rootXml.bg);
                var hammerXmllist:XMLList = XMLList(rootXml.hammer);
                var houseXMlList:XMLList = XMLList(rootXml.house);
                var stoneXMllist:XMLList = XMLList(rootXml.stone);
                
                //背景
                var bgXML:XML = XML(bgXMLlist[0]);
                var bgpath:String = bgXML.@path;
                
                //hammer
                var hammerXML:XML = XML(hammerXmllist[0]);
                var hammerUPpath:String = rootPath + hammerXML.@uppath;
                var hammerDownpath:String = rootPath + hammerXML.@downpath;
                var hammerData:HammerVO = new HammerVO();
                hammerData.uppath = hammerUPpath;
                hammerData.downPath = hammerDownpath;
                AssetList.hammerData = hammerData
                
                //house
                var houseXML:XML = XML(houseXMlList[0]);
                var houseData:BuildingVO = new BuildingVO();
                houseData.buildTime = int(houseXML.@buildtime);
                houseData.finalPath = rootPath + String(houseXML.@finalpath);
                houseData.ingPath = rootPath + String(houseXML.@buildpath);
                AssetList.houseData = houseData;
                
                //stone
                var stoneXML:XML = XML(stoneXMllist[0]);
                var stoneData:BuildingVO = new BuildingVO();
                stoneData.buildTime = int(stoneXML.@buildtime);
                stoneData.finalPath = rootPath + String(stoneXML.@finalpath);
                stoneData.ingPath = rootPath + String(stoneXML.@buildpath);
                AssetList.stoneData = stoneData;
    urlLoader.removeEventListener(Event.COMPLETE,loadCOmhan);
                var rootXml:XML = new XML(urlLoader.data);
                urlLoader = null;
                var rootPath:String = rootXml.@path;
                
                var bgXMLlist:XMLList = XMLList(rootXml.bg);
                var hammerXmllist:XMLList = XMLList(rootXml.hammer);
                var houseXMlList:XMLList = XMLList(rootXml.house);
                var stoneXMllist:XMLList = XMLList(rootXml.stone);
                
                //背景
                var bgXML:XML = XML(bgXMLlist[0]);
                var bgpath:String = bgXML.@path;
                
                //hammer
                var hammerXML:XML = XML(hammerXmllist[0]);
                var hammerUPpath:String = rootPath + hammerXML.@uppath;
                var hammerDownpath:String = rootPath + hammerXML.@downpath;
                var hammerData:HammerVO = new HammerVO();
                hammerData.uppath = hammerUPpath;
                hammerData.downPath = hammerDownpath;
                AssetList.hammerData = hammerData
                
                //house
                var houseXML:XML = XML(houseXMlList[0]);
                var houseData:BuildingVO = new BuildingVO();
                houseData.buildTime = int(houseXML.@buildtime);
                houseData.finalPath = rootPath + String(houseXML.@finalpath);
                houseData.ingPath = rootPath + String(houseXML.@buildpath);
                AssetList.houseData = houseData;
                
                //stone
                var stoneXML:XML = XML(stoneXMllist[0]);
                var stoneData:BuildingVO = new BuildingVO();
                stoneData.buildTime = int(stoneXML.@buildtime);
                stoneData.finalPath = rootPath + String(stoneXML.@finalpath);
                stoneData.ingPath = rootPath + String(stoneXML.@buildpath);
                AssetList.stoneData = stoneDa
  • 相关阅读:
    获取Tekla属性方式
    基于C# 百度AI和科大汛飞语音合成SDK
    BIM工程信息管理系统-EF实体框架数据操作基类
    BIM工程信息管理新系统- 系统管理模块
    EChart绘制风速风向曲线分析图
    BIM工程信息管理系统-详细设计
    BIM工程信息管理系统搭建-系统功能需求
    基于C# 调用百度AI 人脸识别
    mago3DJS 应用
    Bitnami redmine windows环境下升级
  • 原文地址:https://www.cnblogs.com/kuailezoe/p/2832789.html
Copyright © 2020-2023  润新知