Jump to content

Flash Login question


Rifts

Recommended Posts

Hey guys,

 

so I have this

reg.onPress = function(){
       loadVariablesNum("users.php", 0, "POST");
}

 

on my register button which works fine (it enters the data into my database)

 

now i also have a login button

 

login.onPress = function(){
       loadVariablesNum("users.php", 0, "POST");
}

 

now with the login how to i "return" if the login was successful or not and if so stopandgoto a new frame?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/212131-flash-login-question/
Share on other sites

  • 2 weeks later...

i think all you need to do if check when the variables you called from php have arrived to flash and then you should check them and see what the variables contain. if they contain a success message, then login, else, logout.

use onEnterFrame and cehck the names of the variables that come in from php to see if they exist. when they exist, check their content.

LoadVars gives you a better control btw to do this.it contains a built in event handler that automatically check when the variables are  loaded, so you don't need to setup the onEnterFrame.

 

var myVars:LoadVars = new LoadVars();
myVars.onLoad = function(success:boolean) { //the event handler
  if(success) { //variables where loaded into flash successfully
    if(myVars.thePhpVarContainingTheResultOfASuccessfullLogin == "login successfull") {
      gotoAndStop("login");
    }else{
      gotoAndStop("logout");
    }
  }else{
    trace(the variables where unable to be loaded check the php path and code);
  }
}
myVars.load("file.php");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.