Hi Guys,
I am attempting to create a login screen which sends and loads the variables
using php, php will query the database and print out a variable which wil then
be loaded back into flsh and tell flash which frame to go to.
the little issue I'm having is, I did this two weeks ago and it all worked
great, now I would like to do it again but when the php file is unavailable the
statusmsg label box does not say Login Failed like it should.
What am I doing wrong and is it trying to reconnect like it should if the
variables were not loaded.
//Define a new Variable called (submitlistener)
var submitListener:Object = new Object();
//Listen for the Button Click
submitListener.click = function(evt:Object) {
//Set a message in the Label object called statusmsg for tracking
statusmsg.text = "Connecting to Server";
//Define a new LoadVars Object for storing the recieved Variables in
var result_lv:LoadVars = new LoadVars();
//Listen for the Variables to be loaded
result_lv.onLoad = function(success:Boolean) {
//If the Variables were loaded, check to see if they were undefined or empty
if (success) {
framejump = result_lv.template;
if (framejump == undefined) {
//Set a message in the Label object called statusmsg for tracking
statusmsg.text = "Login Failed - Retrying...";
//resend the Variables (userinput, passinput) and Load the Result Variables
from the PHP file in to result_lv
send_lv.sendAndLoad("login.php", result_lv, "POST");
} else {
//Go to Frame Label (loggedin) = Frame 2 if all Variables were set and did not
= undefined
gotoAndPlay(LoggedIn);
}
} else {
//Set a message in the Label object called statusmsg for tracking
statusmsg.text = "Connecting to Secondary Server";
//resend the Variables (userinput, passinput) and Load the Result Variables
from the PHP file in to result_lv
send_lv.name = userinput.text;
send_lv.name = passinput.text;
send_lv.sendAndLoad("login.php", result_lv, "POST");
}
}
};
//Define a new Load Vars Object which will post all the variables using prefix
(send_lv.name)
var send_lv:LoadVars = new LoadVars();
//Send the Variables (userinput, passinput) and Load the Result Variables from
the PHP file in to result_lv
send_lv.name = this.userinput.text;
send_lv.name = this.passinput.text;
send_lv.sendAndLoad("login.php", result_lv, "POST");
//Define an Event Listenter for the Connect Button Being Pressed
connect_button.addEventListener("click", submitListener);
//Prevent from going to the next Frame
stop();
Any suggestions on code improvement will be greatly appreciated.