两种好用的方式获取远程xml数据
<mx:Script><! private var list:ArrayCollection=new ArrayCollection(); private var list2:ArrayCollection=new ArrayCollection(); public var i:int = 0; private function xmlHandle(evt:ResultEvent):void { // good2.text = list.name+"@@@@@@"; //ok list=evt.result.files.file;//结果集存到list中,下面调用 }// function display(event:Event):void{ //good5.text= String(service.lastResult);}private function init():void{service.send();var url:URLRequest=new URLRequest("http://172.20.32.60:8080/new/tt"); var loader:URLLoader=new URLLoader(); loader.addEventListener(Event.COMPLETE, handleURLLoaderCompleted); loader.load(url); } private function handleURLLoaderCompleted(event:Event):void { var loader:URLLoader = event.target as URLLoader; var xml:XML = XML(loader.data); // good7.text=xml.file.name+"^^^^^^^^^^@@@"; //ok //xml中调用} private function readFiles(urlAdd:String):void{// //navigateToURL(new URLRequest("http://172.20.32.60:8080/new/download?url="+urlAdd), "_blank"); text1.text=file.toString()+"*******"; }private function downLoadZip():void{ downloadURL = new URLRequest("http://172.20.32.60:8080/new/download?url=zip"); file = new FileReference(); configureListeners(file); file.download(downloadURL,"log.zip"); } private function downLoadFiles(urlAdd:String):void{ downloadURL = new URLRequest("http://172.20.32.60:8080/new/download?url="+urlAdd); file = new FileReference(); configureListeners(file); file.download(downloadURL,urlAdd); } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); } private function completeHandler(event:Event):void { mx.controls.Alert.show("文件下载成功"); } ]]></mx:Script><mx:HTTPService id="service" url="http://172.20.32.60:8080/new/tt" result="xmlHandle(event)"/>
页:
[1]