【发布时间】:2014-05-15 13:51:43
【问题描述】:
更新:在下面回答!
我正在从为 Air 编码为 as3 的移动设备调用 php 脚本。 php 脚本运行良好,并将正确的 var 发送回 as3。我得到了正确的跟踪语句,但 if 语句不起作用。
这是 php 行:
echo "done=success";
这是as3代码
var variables:URLVariables = new URLVariables(event.target.data);
trace(variables.done); // WORKS echos out: success
// So I figured this line should work too, but it doesn't. Any ideas why?
if(variables.done=="success")
{
// Does not work
}
【问题讨论】:
-
不知道,但您可以尝试将值存储在临时变量中吗?就像
var done:String = variables.done一样,看看这是否也能找到“成功”。如果是这样,请尝试在您的 if 语句中使用它,看看是否可行。 -
我想过尝试一下。我还考虑了另外两个我也会尝试的选项。 1.也许“done”是flash中的一个var,已经被系统使用并且它不喜欢它或者2.也许我在if语句中需要空格。我将尝试所有 3 个选项,我会告诉你。谢谢
-
感谢 DidgerThud。我发现问题是最后有一个额外的空白。我用下面的代码提出了我的答案。
标签: php actionscript-3 if-statement