[問題] Flex 擷取ASP.NET API的值

看板Flash作者 (am 4:07)時間16年前 (2009/10/13 18:17), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
我在這個版和網路上找到了很多資料,但是都僅有部分教學 現在有一個API,如下: http://www.annlar.com:102/APITest.aspx 其頁面會顯示的資料如下: Results=24.5,Advice=體重過重,T06URLtest=前往看更多建議,T06URLPoot=http://www.annlar.com,T01=沒有數據,T02=沒有數據 根據找來的資料我做出來的會連同html tag一起擷取到,所以我用了下面的蠢方式: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" layout="absolute"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import flash.net.navigateToURL; import flash.net.URLRequest; import flash.net.URLVariables; private var _url:String = "http://10.0.5.143/APITest.aspx"; private var request:URLRequest = new URLRequest(_url); private var loader:URLLoader = new URLLoader(request); private var variables:URLVariables = new URLVariables(); private var varsWord:String; private function init():void { loader.addEventListener(Event.COMPLETE, onComplete); } private function onComplete(event:Event):void { var qoo:String = String(loader.data).toString(); var txt:TextField = new TextField(); txt.text = qoo; varsWord = txt.getLineText(0); } private function clickHandler(event:MouseEvent):void { trace(varsWord); } ]]> </mx:Script> <mx:Button label="submit" click="clickHandler(event)"/> </mx:Application> 重點是,我覺得應該有更好的方式,但是我還是不清楚,有哪位大人可以指點小弟我? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.146.41.91

10/15 12:46, , 1F
用 ASP.net 的 WebService?
10/15 12:46, 1F

10/15 15:05, , 2F
如果在不更動.NET的程式之下,那要如何做呢?
10/15 15:05, 2F

10/15 15:05, , 3F
因為程式人員似乎不想改了!
10/15 15:05, 3F
文章代碼(AID): #1Ar5Eo8m (Flash)