actionscript does not see changes to the textbox
Here is the relevant AS3 code:
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;
}
and my php code:
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);
if ($login_counter > 0) {
while ($data = mysql_fetch_array($query)) {
$username = $data["username"];
print "systemResult=Welcome";
}
} else {
print "systemResult=The login details dont match our records.";
}
}
This is my mini project. My problem is if as3 finds a matching record in the MySQL database, my gotoscenetwo()
function starts to work. Thank you for help.
你的if需要在函数showResult中
链接地址: http://www.djcxy.com/p/69586.html上一篇: rows()期望参数1是资源
下一篇: 动作看不到对文本框的更改