I am having trouble with the showing of result of the information from sql to flash cs6 textbox which is dynamic text.
I am using php to transfer the data to flash.
I will like to show me the information in order like
Name score
Tom 20
Jack 10
I already try reqVar.name + " " + reqVar.score and it does not work.
And there is also 6 data in the sql to be formated like the top.
function loginFunction(evt:MouseEvent):void
{
var variables:URLVariables;
var req:URLRequest;
var loader:URLLoader;
if (usertxt.text == "")
{
resTxt.text = "Please enter your username.";
return;
}
if (passtxt.text == "")
{
resTxt.text = "Please enter your password.";
return;
}
variables = new URLVariables();
variables.username = usertxt.text;
variables.password = MD5.hash(passtxt.text);
req = new URLRequest("http://localhost:8088/classP/checkLogin.php");
req.data = variables;
req.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE,handleRes);
loader.load(req);
}
function handleRes(evt:Event):void
{
var loader:URLLoader;
var reqVar:URLVariables;
loader = URLLoader(evt.target);
reqVar = new URLVariables(loader.data);
if (reqVar.result == "PASS")
{
gotoAndStop(10);
var req:URLRequest;
req = new URLRequest("http://localhost:8088/classP/getScores.php");
req.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE,handleRes3);
loader.load(req);
}
else
{resTxt.text = "Login Failed";}
}
function handleRes3(evt:Event):void //to show the output message when it is correct in user and pass
{
var loader:URLLoader;
var reqVar:URLVariables;
loader = URLLoader(evt.target);
reqVar = new URLVariables(loader.data);
displaytxt.text = reqVar.name + " " + reqVar.score;
}
}
}