I am using Rjgtav's login system tutorial I have working the thing is I want to now instead of it tracing it logged me in successfully I want the system to pass the user on to the chat frame after checking their credentials can somebody help me with achieving this?
Connection frame code:
Code: Select all
import it.gotoandplay.smartfoxserver.*;
stop();
var ip:String = "71.207.15.119";
var port:Number = 9339;
var zone:String = "simpleChat";
var connected:Boolean = false;
userName._visible = false;
passWord._visible = false;
login_btn._visible = false;
var smartfox:SmartFoxClient = new SmartFoxClient();
smartfox.debug = true;
connect();
function connect() {
status.text = "Connecting";
smartfox.connect(ip,port);
}
smartfox.onConnection = function(success) {
if (success) {
status.text = "Successfully connected!";
connected = true;
userName._visible = true;
passWord._visible = true;
login_btn._visible = true;
login_btn.onRelease = sendLogin;
Selection.setFocus(userName);
} else {
status.text = "Can't connect!";
}
};
function sendLogin() {
if (connected) {
if (userName.text != "") {
error.text = "";
status.text = "Logging in...";
smartfox.login(zone,userName.text,passWord.password);
}
}else{
connect()
}
}
smartfox.onExtensionResponse = function(resObj:Object) {
if (resObj._cmd == "logOK") {
_global.myName = resObj.name;
smartfox.getRoomList();
} else if (resObj._cmd == "logKO") {
error.text = "Error at login: "+resObj.error;
status.text = "Connected";
}
};
smartfox.onRoomListUpdate = function(roomList:Object) {
gotoAndStop("chat");
display.text = "Logged in as "+_global.myName;
};
smartfox.onConnectionLost = function() {
gotoAndStop("connect");
status.text = "Disconnected";
connected = false;
userName._visible = false;
passWord._visible = false;
};
disabler._visible = false