Re: [問題] Flash接收PHP傳送的變數

看板Flash作者 (~終日昏昏睡夢間~)時間16年前 (2009/03/11 00:36), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/4 (看更多)
爬文看到這篇文章 但實際測試檔案好像還是無法在flash抓到php要傳的值 能否請懂得flash與php傳值的板友 幫我看一下是哪個地方寫錯了呢? 謝謝 以下附上連結及程式碼(大部分是複製zswolf/MrMarcus兩位大大的文章內容) (以flash 8製作) http://tfgcamille.myweb.hinet.net/temp/test.rar [php內容] <? $a="Hic"; $returnToFlash = "reply_txt=".$a; echo mb_convert_encoding($returnToFlash, "UTF-8", "BIG5"); ?> [flash AS內容] var myEntries = new LoadVars(); myEntries.load("http://localhost/test.php?="); myEntries.onData = function(success) { if (success) { trace(this.reply_txt); //有放一個變數名為 reply_txt 的動態文字區塊 for(i in this) trace(i + '=' + this[i]); } else { reply_txt.text = "not yet"; } }; [輸出結果] undefined onData=[type Function] ※ 引述《MrMarcus (請勿忘記密碼)》之銘言: : ※ 引述《zswolf (響徹雲霄的喇叭聲)》之銘言: : : 小弟最近想動手寫留言版 : [del] : : PHP的部分: : : <? : : $a="pio"; : : $returnToFlash = "reply_txt=".$a; : : echo $returnToFlash; : : ?> : : Flash的部分 : : var myEntries = new LoadVars(); : : myEntries.load("http://localhost/eztest/ez.php?="); : : myEntries.onLoad = function(success) { : : if (success) { : : trace(returnToFlash); : 上面這行改成 trace(this.reply_txt); 才對。 : 可以在這裡加上下面這行檢視接收到的資料: : for(i in this) trace(i + '=' + this[i]); : : //有放一個變數名為 reply_txt 的動態文字區塊 : : } else { : : reply_txt.text = "not yet"; : : } : : }; : [del] -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.166.75.62
文章代碼(AID): #19jfRx0Q (Flash)
文章代碼(AID): #19jfRx0Q (Flash)