Frame 1
System.exactSettings = false;
System.security.loadPolicyFile("http://www.lustynet.com/crossdomain.xml");
System.security.allowDomain("http://www.lustynet.com/");
new Main(this);
Symbol 79 MovieClip [__Packages.Main] Frame 0
class Main
{
var mcRef, oServerConnect, sState, sLogin, sPassword, sDisplayName, sEMail, sFAAccount, sFriends, sStats;
function Main (_mcRef) {
mcRef = _mcRef;
mcRef.onEnterFrame = library.Delegate.create(this, update);
oServerConnect = new library.ServerConnect(sGAMEID);
setState(sSTATE_LOGIN);
new library.MCButton(mcRef.mcPopupLogin.btnSend, library.Delegate.create(this, pressButton, sSTATE_LOGGING_IN));
new library.MCButton(mcRef.mcPopupLogin.btnCreateAccount, library.Delegate.create(this, pressButton, sSTATE_CREATE));
new library.MCButton(mcRef.mcPopupCreate.btnSend, library.Delegate.create(this, pressButton, sSTATE_CREATING));
new library.MCButton(mcRef.mcPopupManage.btnManage, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
new library.MCButton(mcRef.mcPopupManage.btnFriends, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
new library.MCButton(mcRef.mcPopupManage.btnStats, library.Delegate.create(this, pressButton, sSTATE_STATS));
}
function update() {
this["do" + sState]();
}
function setState(_sState) {
mcRef.mcPopupLogin._visible = false;
mcRef.mcPopupCreate._visible = false;
mcRef.mcPopupManage._visible = false;
mcRef.mcPopupProcessing._visible = false;
mcRef.mcPopupError._visible = false;
sState = _sState;
switch (sState) {
case sSTATE_LOGIN :
mcRef.mcPopupLogin._visible = true;
break;
case sSTATE_LOGGING_IN :
break;
case sSTATE_PROCESSING :
mcRef.mcPopupProcessing._visible = true;
break;
case sSTATE_CREATE :
mcRef.mcPopupCreate._visible = true;
mcRef.mcPopupError._visible = false;
break;
case sSTATE_MANAGE :
mcRef.mcPopupManage._visible = true;
mcRef.mcPopupManage.gotoAndStop(sSTATE_MANAGE);
new library.MCButton(mcRef.mcPopupManage.btnManage, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
new library.MCButton(mcRef.mcPopupManage.btnFriends, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
new library.MCButton(mcRef.mcPopupManage.btnStats, library.Delegate.create(this, pressButton, sSTATE_STATS));
new library.MCButton(mcRef.mcPopupManage.btnSend, library.Delegate.create(this, pressButton, sSTATE_MANAGE_SEND));
mcRef.mcPopupManage.txtLogin.text = sLogin;
mcRef.mcPopupManage.txtPassword.text = sPassword;
mcRef.mcPopupManage.txtDisplayName.text = sDisplayName;
mcRef.mcPopupManage.txtEMail.text = sEMail;
mcRef.mcPopupManage.txtFAAccount.text = sFAAccount;
break;
case sSTATE_FRIENDS :
mcRef.mcPopupManage._visible = true;
mcRef.mcPopupManage.gotoAndStop(sSTATE_FRIENDS);
new library.MCButton(mcRef.mcPopupManage.btnManage, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
new library.MCButton(mcRef.mcPopupManage.btnFriends, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
new library.MCButton(mcRef.mcPopupManage.btnStats, library.Delegate.create(this, pressButton, sSTATE_STATS));
new library.MCButton(mcRef.mcPopupManage.btnSend, library.Delegate.create(this, pressButton, sSTATE_FRIEND_SEND));
trace("sSTATE_FRIENDS sFriends: " + sFriends);
mcRef.mcPopupManage.txtFriends.text = sFriends;
break;
case sSTATE_STATS :
mcRef.mcPopupManage._visible = true;
mcRef.mcPopupManage.gotoAndStop(sSTATE_STATS);
new library.MCButton(mcRef.mcPopupManage.btnManage, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
new library.MCButton(mcRef.mcPopupManage.btnFriends, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
new library.MCButton(mcRef.mcPopupManage.btnStats, library.Delegate.create(this, pressButton, sSTATE_STATS));
mcRef.mcPopupManage.txtStats.text = sStats.split("**").join("\n\n");
break;
case sSTATE_ERR_LOGIN :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Login invalid";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_LOGIN));
break;
case sSTATE_ERR_CREATE :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Please use another login ";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_CREATE));
break;
case sSTATE_SUCCESS_MANAGE :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Profile successfully updated";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
break;
case sSTATE_ERR_MANAGE :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Profile update failed";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_MANAGE));
break;
case sSTATE_SUCCESS_FRIEND :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Watches successfully updated";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
break;
case sSTATE_ERR_FRIEND :
mcRef.mcPopupError._visible = true;
mcRef.mcPopupError.txtText.text = "Watches update failed";
new library.MCButton(mcRef.mcPopupError.btnSend, library.Delegate.create(this, pressButton, sSTATE_FRIENDS));
}
}
function doLoggingIn() {
var _local3 = oServerConnect.getMessageIncoming();
if (_local3 != "") {
switch (_local3.substr(0, 3)) {
case library.ServerConnect.sRESPONSE_LOGIN_SUCCESS :
var _local2 = _local3.substr(3).split("***");
sLogin = _local2[2];
sPassword = _local2[3];
sDisplayName = oServerConnect.getDisplayName();
sEMail = _local2[4];
sFAAccount = _local2[5];
sFriends = _local2[6];
sStats = _local2[7];
setState(sSTATE_MANAGE);
break;
case library.ServerConnect.sRESPONSE_LOGIN_FAIL :
setState(sSTATE_ERR_LOGIN);
}
}
}
function doManageSend() {
var _local2 = oServerConnect.getMessageIncoming();
trace("doManageSend: " + _local2);
if (_local2 != "") {
switch (_local2.substr(3)) {
case "success" :
setState(sSTATE_SUCCESS_MANAGE);
break;
case "error" :
setState(sSTATE_ERR_MANAGE);
}
}
}
function doFriendSend() {
var _local2 = oServerConnect.getMessageIncoming();
if (_local2 != "") {
switch (_local2.substr(3)) {
case "success" :
setState(sSTATE_SUCCESS_FRIEND);
break;
case "error" :
setState(sSTATE_ERR_MANAGE);
}
}
}
function doCreating() {
var _local2 = oServerConnect.getMessageIncoming();
if (_local2 != "") {
switch (_local2.substr(3)) {
case "error" :
setState(sSTATE_ERR_CREATE);
break;
default :
var _local3 = _local2.substr(3).split("**");
oServerConnect.setLogin(_local3[0], _local3[1]);
setState(sSTATE_MANAGE);
}
}
}
function tryCreate() {
}
function pressButton(_sButton) {
switch (_sButton) {
case sSTATE_LOGIN :
setState(sSTATE_LOGIN);
break;
case sSTATE_LOGGING_IN :
oServerConnect.login(mcRef.mcPopupLogin.txtLogin.text, mcRef.mcPopupLogin.txtPassword.text);
setState(sSTATE_PROCESSING);
sState = sSTATE_LOGGING_IN;
break;
case sSTATE_CREATE :
setState(sSTATE_CREATE);
break;
case sSTATE_CREATING :
sLogin = mcRef.mcPopupCreate.txtLogin.text;
sPassword = mcRef.mcPopupCreate.txtPassword.text;
sDisplayName = mcRef.mcPopupCreate.txtDisplayName.text;
sEMail = mcRef.mcPopupCreate.txtEMail.text;
sFAAccount = mcRef.mcPopupCreate.txtFAAccount.text;
sFriends = "";
sStats = "Go play some games!";
oServerConnect.addMessageOutgoing((((((((("createaccount***" + mcRef.mcPopupCreate.txtLogin.text) + "***") + mcRef.mcPopupCreate.txtPassword.text) + "***") + mcRef.mcPopupCreate.txtDisplayName.text) + "***") + mcRef.mcPopupCreate.txtEMail.text) + "***") + mcRef.mcPopupCreate.txtFAAccount.text);
oServerConnect.send_message(true);
setState(sSTATE_PROCESSING);
sState = sSTATE_CREATING;
break;
case sSTATE_MANAGE :
setState(sSTATE_MANAGE);
break;
case sSTATE_FRIENDS :
setState(sSTATE_FRIENDS);
break;
case sSTATE_STATS :
setState(sSTATE_STATS);
break;
case sSTATE_MANAGE_SEND :
sPassword = mcRef.mcPopupManage.txtPassword.text;
sDisplayName = mcRef.mcPopupManage.txtDisplayName.text;
sEMail = mcRef.mcPopupManage.txtEMail.text;
sFAAccount = mcRef.mcPopupManage.txtFAAccount.text;
oServerConnect.addMessageOutgoing((((((("updateprofile***" + sPassword) + "***") + sDisplayName) + "***") + sEMail) + "***") + sFAAccount);
oServerConnect.send_message(true);
setState(sSTATE_PROCESSING);
sState = sSTATE_MANAGE_SEND;
break;
case sSTATE_FRIEND_SEND :
sFriends = mcRef.mcPopupManage.txtFriends.text;
oServerConnect.addMessageOutgoing("updatefriend***" + sFriends.split("*").join("").split("'").join(""));
oServerConnect.send_message(true);
setState(sSTATE_PROCESSING);
sState = sSTATE_FRIEND_SEND;
}
}
static var sGAMEID = "accountmanage";
static var sSTATE_LOGIN = "login";
static var sSTATE_LOGGING_IN = "LoggingIn";
static var sSTATE_CREATE = "create";
static var sSTATE_CREATING = "Creating";
static var sSTATE_MANAGE = "manage";
static var sSTATE_MANAGE_SEND = "ManageSend";
static var sSTATE_FRIENDS = "friends";
static var sSTATE_FRIEND_SEND = "FriendSend";
static var sSTATE_STATS = "stats";
static var sSTATE_PROCESSING = "Processing";
static var sSTATE_ERR_LOGIN = "errlogin";
static var sSTATE_ERR_CREATE = "errcreate";
static var sSTATE_SUCCESS_MANAGE = "successManage";
static var sSTATE_ERR_MANAGE = "errManage";
static var sSTATE_SUCCESS_FRIEND = "successFriend";
static var sSTATE_ERR_FRIEND = "errFriend";
}
Symbol 80 MovieClip [__Packages.library.ServerConnect] Frame 0
class library.ServerConnect
{
var sPlayerId, sGameId, sDisplayName, sMessagesIncoming, sMessagesOutgoing, nLastTimer, oXML;
function ServerConnect (_sGameId) {
sPlayerId = "";
sGameId = _sGameId;
sDisplayName = "";
sMessagesIncoming = "";
sMessagesOutgoing = "";
nLastTimer = getTimer();
}
function login(_sLogin, _sPassword) {
_sPassword = encode(_sPassword, "lnfa" + sGameId);
oXML = new library.MainXML(library.Delegate.create(this, login_server));
oXML.loadXML((((((sLINK + "/login.php?login=") + _sLogin) + "&password=") + _sPassword) + "&gameid=") + sGameId);
trace((((((sLINK + "/login.php?login=") + _sLogin) + "&password=") + _sPassword) + "&gameid=") + sGameId);
}
function login_server() {
_root.txtTest.text = _root.txtTest.text + ("login_server : " + oXML.oXML.firstChild.nodeValue);
var _local3 = oXML.oXML.firstChild.nodeValue;
if (_local3 == "error") {
sMessagesIncoming = sRESPONSE_LOGIN_FAIL;
} else {
sMessagesIncoming = sRESPONSE_LOGIN_SUCCESS + _local3;
sPlayerId = _local3.split("***")[0];
sDisplayName = _local3.split("***")[1];
}
}
function send_message(_bForce) {
if ((getTimer() >= (nLastTimer + nUPDATE_TIMER)) || (_bForce)) {
oXML = new library.MainXML(library.Delegate.create(this, message_update));
trace((((((sLINK + "/update.php?connectid=") + sPlayerId) + "&gameid=") + sGameId) + "&msg=") + sMessagesOutgoing.substr(Math.min(sMessagesOutgoing.length, 3)));
oXML.loadXML((((((sLINK + "/update.php?connectid=") + sPlayerId) + "&gameid=") + sGameId) + "&msg=") + sMessagesOutgoing.substr(Math.min(sMessagesOutgoing.length, 3)));
sMessagesOutgoing = "";
nLastTimer = getTimer();
}
}
function message_update() {
sMessagesIncoming = sRESPONSE_UPDATE + oXML.oXML.firstChild.nodeValue;
}
function getMessageIncoming() {
var _local2 = sMessagesIncoming;
sMessagesIncoming = "";
return(_local2);
}
function getDisplayName() {
return(sDisplayName);
}
function addMessageOutgoing(_sMessagesOutgoing) {
sMessagesOutgoing = sMessagesOutgoing + ("***" + _sMessagesOutgoing);
}
function setLogin(_sPlayerId, _sDisplayName) {
sPlayerId = _sPlayerId;
sDisplayName = _sDisplayName;
}
static function encode(_text, _key) {
_text = _text + _key;
if ((_text == undefined) || (_key == undefined)) {
return("Invaild arguments");
}
var _local3 = "";
var _local4 = 0;
return(_text);
}
static var nUPDATE_TIMER = 4000;
static var sLINK = "http://www.lustynet.com";
static var sSEPARATOR = "**";
static var sCMD_LOGIN = "100";
static var sCMD_REGISTER = "101";
static var sCMD_UPDATE = "200";
static var sRESPONSE_LOGIN_SUCCESS = "400";
static var sRESPONSE_LOGIN_FAIL = "401";
static var sRESPONSE_REGISTER_SUCCESS = "402";
static var sRESPONSE_REGISTER_FAIL = "403";
static var sRESPONSE_UPDATE = "410";
}
Symbol 81 MovieClip [__Packages.library.MainXML] Frame 0
class library.MainXML
{
var bSuccess, fSuccess, oXML;
function MainXML (_fSuccess) {
bSuccess = false;
fSuccess = _fSuccess;
}
function loadXML(_sURL) {
oXML = new XML();
oXML.ignoreWhite = true;
oXML.load(_sURL);
oXML.onLoad = mx.utils.Delegate.create(this, onLoad);
}
function onLoad(_bSuccess) {
if (_bSuccess) {
if (fSuccess != undefined) {
fSuccess();
}
}
}
function test() {
return(oXML.firstChild.firstChild.nodeValue);
}
}
Symbol 82 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 83 MovieClip [__Packages.library.Delegate] Frame 0
class library.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
var _local4 = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(_local4.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 84 MovieClip [__Packages.library.State] Frame 0
class library.State
{
var mcRef, sState;
function State (_mcRef, _sState) {
mcRef = _mcRef;
setState(_sState);
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.gotoAndStop(_sState);
this["start" + _sState]();
}
}
function update() {
this["do" + sState]();
}
function get getState() {
return(sState);
}
function isStateComplete() {
return(mcRef.mcState._currentframe == mcRef.mcState._totalframes);
}
}
Symbol 85 MovieClip [__Packages.library.MCButton] Frame 0
class library.MCButton extends library.State
{
var mcRef, setState;
function MCButton (_mcRef, _fFunction) {
super(_mcRef);
mcRef.gotoAndStop("Idle");
mcRef.onRollOver = library.Delegate.create(this, setState, "Over");
mcRef.onRollOut = library.Delegate.create(this, setState, "Idle");
mcRef.onPress = library.Delegate.create(this, setState, "Down");
mcRef.onMouseUp = library.Delegate.create(this, setState, "Idle");
mcRef.onRelease = _fFunction;
}
}