+ -
当前位置:首页 → 问答吧 → XML数据调用问题

XML数据调用问题

时间:2011-03-18

来源:互联网

有一个XML文件,格式如下:
<?xml version="1.0" encoding="UTF-8"?>
<config node="5">

       <newsq>template/n001/bg_news_d.png</newsq>
       <newsd>template/n001/bg_news_d.png</newsd>
</config>

我想调用 node的值做为全局变量使用,让他在函数外也可以正常使用,请问有什么方法吗?
//初始化部分

var configXML = new XML ();
var qArray:Array = new Array ();

configXML.ignoreWhite=true;//忽略空白
//初始化函数设置
configXML.onLoad = function (ok)
{
       if (ok){
                     _global.node = configXML.firstChild.attributes.node;
                     trace(node)
                     
              }
};

//函数设置
trace(_global.node) //我想让这里输出node值


configXML.load("config.xml");

作者: lcl0117   发布时间: 2011-03-18

理论普及:http://bbs.9ria.com/thread-48624-1-1.html

同类型参考:

http://flash.9ria.com/archiver/tid-41093.html
http://space.flash8.net/bbs/thread-393354-1-1.html
http://space.flash8.net/BBS/redi ... 68&goto=newpost
http://flash.9ria.com/viewthread ... mp;page=1#pid174071
http://bbs.blueidea.com/thread-2992127-1-1.html

作者: flash023   发布时间: 2011-03-18