I'm trying to convert this to 3.0, anyone willing to help?
Code:
user1 = undefined;
pass1 = undefined;
Code:
function registerUser(user, pass) {
//Create new load variables
register = new LoadVars();
registered = new LoadVars();
//PHP user/pass = the user/pass passed to this function
register.user = user;
register.pass = pass;
//Update the registration text.
error2.text = "Registering Details..";
error2.visible = true;
error2.alpha = 0;
Tweener.addTween(error2, {alpha:1, time:1});
Tweener.addTween(error2, {alpha:0, time:1, delay:2});
registered.onLoad = function(success) {
if(success) { //if successful connection
//if the error/success message parsed from php reads..
if(registered.err == "Registration Successful.") {
//we dont get variables from PHP in this function
//we only send them because w're resgistering data
//varibles are only passed to flash when we're logging
//update register text with that of which PHP parsed
error2.text = registered.err;
} else {
//if the registration was not successful (user exists)
error2.text = "Registration Failed.";
error2.visible = true;
error2.alpha = 0;
Tweener.addTween(error2, {alpha:1, time:1});
Tweener.addTween(error2, {alpha:0, time:1, delay:2});
}
}
}
//using sendAndLoad to pass to the data to PHP
//Using Method 'GET' (Obviously change the URL to your own)
register.sendAndLoad("http://thegolfgame.uphero.com/golfgame/data/register.php", registered, "GET");
}
function clickHandler2(event:MouseEvent):void {
registerUser(_user1.text, _root,pass1.text);
}
Code:
function loginUser(user,pass) {
//Create new load variables
login = new LoadVars();
logged = new LoadVars();
//PHP user/pass = the user/pass passed to this function
login.user = user;
login.pass = pass;
//Update the login text.
_root.error1.text = "Submitting Details..";
error1.visible = true;
error1.alpha = 0;
Tweener.addTween(error1, {alpha:1, time:1});
Tweener.addTween(error1, {alpha:0, time:1, delay:2});
logged.onLoad = function(success) {
if(success) { //if successful connection
//if the error/success message parsed from php reads..
if(logged.err == "Login Successful.") {
//Update the flash user/pass to that of which PHP parsed
_root.user = logged.user;
_root.pass = logged.pass;
//update the login text with that of which PHP parsed
_root.error1.text = logged.err;
error1.visible = true;
error1.alpha = 0;
Tweener.addTween(error1, {alpha:1, time:1});
Tweener.addTween(error1, {alpha:0, time:1, delay:2});
//Go to frame 2, the 'logged in' frame
trace("Account was successfully made, you may login!");
} else {
//if the login was not successful (wrong user/pass)
_root.error1.text = "Login Failed.";
error1.visible = true;
error1.alpha = 0;
Tweener.addTween(error1, {alpha:1, time:1});
Tweener.addTween(error1, {alpha:0, time:1, delay:2});
}
}
}
login.sendAndLoad("http://thegolfgame.uphero.com/golfgame/data/login.php", logged, "GET");
}
//Function which passes user/pass variables to PHP for registration
function clickHandler(event:MouseEvent):void {
_root.loginUser(_root.user.text, _root.pass.text);
}