动作看不到对文本框的更改
这里是相关的AS3代码:
public function processLogin ():void {
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("php/controlpanel.php");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpVars.systemCall = "checkLogin";
phpVars.username = username.text;
phpVars.password = password.text;
phpLoader.load(phpFileRequest);
if(result_text.text == "Welcome")
{
gotoscenetwo();
}
else{
stop();
}
}
public function showResult (event:Event):void {
result_text.autoSize = TextFieldAutoSize.RIGHT;
result_text.text = "" + event.target.data.systemResult;
}
和我的PHP代码:
include_once“connect.php”;
$ username = $ _POST ['username']; $ password = $ _POST ['password'];
if($ _POST ['systemCall'] ==“checkLogin”){
$ sql =“SELECT * FROM users WHERE username ='$ username'AND password ='$ password'”;
$ query = mysql_query($ sql);
$ login_counter = mysql_num_rows($ query);
如果($ login_counter> 0){
while($ data = mysql_fetch_array($ query)){
$ username = $ data [“username”];
打印“systemResult =欢迎”;
}
} else {
打印“systemResult =登录详细信息不符合我们的记录。”;
}
}
这是我的小型项目。 我的问题是,如果as3在MySQL数据库中找到匹配的记录,我的gotoscenetwo()
函数开始工作。 谢谢你的帮助。
你的if需要在函数showResult中
链接地址: http://www.djcxy.com/p/69585.html