在我的Flash文件中,我有以下Actionscript代码:
gameEnd.submitBtn.removeEventListener(MouseEvent.MOUSE_DOWN, submitScore);
submitScore
功能如下:
public function submitScore(e:MouseEvent):void
{
this.addChild(scoreAdded);
scoreAdded.x = 165;
scoreAdded.y = 85;
var url:URLRequest = new URLRequest("./submitscore.php");
var thevariables:URLVariables = new URLVariables();
url.method = "GET";
thevariables.score = scoreText.text;
url.data = thevariables;
navigateToURL(url,"_self");
}
在我的submitscore.php
文件中,我有:
<?php
$scorefromflash = $_GET['score'];
echo ("Score: ".$scorefromflash);
?>
但这会导致错误Notice: Undefined index: score in submitscore.php
。任何人都知道为什么这不起作用?我以完全相同的方式完成了名称和得分,但使用不同的变量名称,得分永远不会有效。
我真的很感激任何帮助,因为我今天真的需要解决这个问题。
答案 0 :(得分:0)
您忘了将score
添加到thevariables
var thevariables:URLVariables = new URLVariables();
thevariables.score = submitScore;
然后将它们添加到请求中:
url.data = thevariables;