作者hic (~终日昏昏睡梦间~)
看板Flash
标题Re: [问题] Flash接收PHP传送的变数
时间Wed Mar 11 00:36:10 2009
爬文看到这篇文章
但实际测试档案好像还是无法在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