//Generating menu from XML
var linksXML:XML;
var linksLoader:URLLoader = new URLLoader();
var linksDB:Array = new Array();
linksLoader.load(new URLRequest("menu_links.xml"));
linksLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(evnt:Event):void {
linksXML = new XML(evnt.target.data);
for (var i:int = 0; i < linksXML.link.length(); i++){
var newLink:Array = [linksXML.link[i].@name, linksXML.link[i].@param, linksXML.link[i]];
linksDB[i] = new Array(newLink);
trace(linksDB);
}
}
trace(linksXML.*);
输出是
Second trace:
null
First trace:
<menu>
<link name="first" param="true">first.php</link>
<link name="second" param="true">second.php</link>
<link name="third" param="true">third.php</link>
</menu>
因此,在我看来,flash 在退出函数时会丢失变量。请帮忙!我不知道为什么会这样
提前致谢!