看板 Flash 關於我們 聯絡資訊
※ 引述《winge (小春)》之銘言: 恕刪 : -------------------------------------------------------------- : 終於成功的透過flash CS3寫入資料庫了 : 現在的問題是 我想要寫另外一個flash檔 透過id去搜尋 score欄位 : 單純的asp網頁 我已經寫好了 也可以使用 : 但flash要怎麼得到score欄位的值呢?? : 上面的程式碼 該怎麼改呢?? 試試看吧 function getData(event:MouseEvent):void { var myRequest:URLRequest = new URLRequest("http://~.query.asp"); var myLoader:URLLoader = new URLLoader(); var myVariables:URLVariables = new URLVariables(); myVariables.id = "olala"; myRequest.method = URLRequestMethod.GET; myRequest.data = myVariables; myLoader.addEventListener(Event.COMPLETE, processData); try { myLoader.load(myRequest); } catch (error:Error) { trace(":("); } } function processData(event:Event):void { xml = new XML(); var loader:URLLoader = URLLoader(event.target); //loader.data就是頁面的output } 不過推薦用XML way,方便擴充和修改 xml = new XML(); var loader:URLLoader = URLLoader(event.target); xml = XML(loader.data); score = xml.data.@score; 如果用XML way,你要讓asp類似這樣output: <?xml version="1.0" encoding="UTF-8" ?> <output> <data score="33" /> </output> -- 東 湖 284 景 美 大有巴士284 尖峰12-15分一班 離峰或假日 15-20分一班 Donghu Jingmei 1985/7/1 延駛內湖 2003/5/20 延駛松山車站 東 湖 284 景 美 首都客運284 尖峰7-10分一班 離峰12-15分 假日15-20分 Donghu Jingmei 2007/5/31 由大有巴士移交路權 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.247.164
winge:非常感謝這位大大 11/08 00:26