Revision: 33931
Updated Code
at October 15, 2010 17:07 by ddtfish
Updated Code
//�root.xmlä¸Â读�status,a����������询xml public static function readStatus(a:String):ArrayCollection{ var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader(); var arr:ArrayCollection = new ArrayCollection(); xmlLoader.load(new URLRequest("pb/utils/root.xml")); xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); function xmlLoaded(event:Event):void { xml = XML(event.target.data); //��scope�� xmlList = xml..userStatus.(@scope==a); //trace(xmlList[0].@label); for(var i:int = 0; i < xmlList.length(); i++) { //�xmlList转�为object类� var o:Object = new Object(); o.label = xmlList[i].@label; o.data = xmlList[i].@data; arr.addItemAt(o,i); } } return arr; }
Revision: 33930
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 15, 2010 00:59 by ddtfish
Initial Code
//从root.xmlä¸è¯»å–status,a是å‚数,用æ¥é€‰æ‹©æ€§æŸ¥è¯¢xml public static function readStatus(a:String):ArrayCollection{ var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader(); var arr:ArrayCollection = new ArrayCollection(); xmlLoader.load(new URLRequest("pb/utils/root.xml")); xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); function xmlLoaded(event:Event):void { xml = XML(event.target.data); //选择scope属性 xmlList = xml..userStatus.(@scope==a); //trace(xmlList[0].@label); for(var i:int = 0; i < xmlList.length(); i++) { //把xmlList转化为object类型 var o:Object = new Object(); o.label = xmlList[i].@label; o.data = xmlList[i].@data; arr.addItemAt(o,i); } } return arr; }
Initial URL
Initial Description
As3 load from XML----------------------
Initial Title
As3 load from XML
Initial Tags
Initial Language
ActionScript 3