Frame 1
stop();
_quality = "BEST";
System.security.allowDomain(domainToAllow);
System.security.allowDomain("testing.arkadium.com");
System.security.allowDomain("v2.arkadium.com");
System.security.allowDomain("freeplay.arkadium.com");
Instance of Symbol 343 MovieClip in Frame 1
onClipEvent (enterFrame) {
numTotal = _parent.getBytesTotal();
numLoaded = _parent.getBytesLoaded();
numPercent = Math.floor((numLoaded * 100) / numTotal);
if (numPercent < 10) {
strL = "0" + numPercent;
} else {
strL = numPercent;
}
_parent.strLoaded = strL + "%";
if (numPercent >= 100) {
_parent.play();
}
}
Frame 7
function g_fInitUser() {
g_objUser.numUserId = 0;
g_objUser.strUserName = "";
g_objUser.blnActive = false;
g_objUser.numChairId = 0;
g_objUser.numAvatarId = 0;
g_objUser.blnTurn = false;
g_objUser.blnInititator = false;
g_objPlayer1.numUserId = 0;
g_objPlayer1.strUserName = "";
g_objPlayer1.numChairId = 0;
g_objPlayer1.numAvatarId = 0;
g_objPlayer1.blnTurn = false;
g_objPlayer2.numUserId = 0;
g_objPlayer2.strUserName = "";
g_objPlayer2.numChairId = 0;
g_objPlayer2.numAvatarId = 0;
g_objPlayer2.blnTurn = false;
}
function g_fGameInitialized() {
g_fSendToCSA(((((((("<gameinitialized width=\"" + g_numGameWidth) + "\" height=\"") + g_numGameHeight) + "\" backcolor=\"") + g_numBackColor) + "\" gamemode=\"") + g_fGetGameMode()) + "\"/>");
g_blnInitialized = true;
}
function g_fGetFlashVersion() {
var _local1 = getVersion().toUpperCase();
return(parseInt(_local1.substr(4, _local1.length)));
}
function g_fGetRandomValue(a_numMaxValue) {
g_numRandomSeed = (g_numRandomSeed * g_A) % 2147352576;
var _local1 = Math.floor((g_numRandomSeed * a_numMaxValue) / g_C) % a_numMaxValue;
return(_local1);
}
function g_fSetGameSize(a_numWidth, a_numHeight) {
g_numGameWidth = a_numWidth;
g_numGameHeight = a_numHeight;
}
function g_fSetGameBackgroundColor(a_strColor) {
var _local2 = a_strColor;
var _local1 = (_local2.substr(4, 2) + _local2.substr(2, 2)) + _local2.substr(0, 2);
g_numBackColor = parseInt(_local1, 16);
}
function g_fSetGameMode(a_strMode) {
var _local1 = a_strMode.toLowerCase();
if ((_local1 == "single") || (_local1 == "multi")) {
g_strGameMode = _local1;
}
}
function g_fGetGameMode() {
return(g_strGameMode);
}
function g_fSetDebug(a_flag) {
if (typeof(a_flag) == "boolean") {
g_blnDebug = a_flag;
}
if (g_blnDebug) {
_global.g_lcDebug = new LocalConnection();
g_lcDebug.fCheckLocalConnection = function () {
g_lcDebug.send("stend", "fCheckLocalConnection", g_numConnId);
};
g_lcDebug.fRecevePacketFromStend = function (a_strPacket, a_numId) {
strXMLReceive = a_strPacket;
};
g_lcDebug.fSetConnectionId = function (a_numId) {
if (g_numConnId == -1) {
g_numConnId = a_numId;
g_lcDebug.close();
var blnConnect = g_lcDebug.connect("game" + g_numConnId);
g_lvlScoreBoard.numConnId = g_numConnId;
}
};
var blnConnect = g_lcDebug.connect("game");
} else {
delete _global.g_lcDebug;
}
}
function g_fGetDebug() {
return(g_blnDebug);
}
function g_fCenter(a_clip) {
var _local1 = a_clip;
_local1.mcBack._xscale = (100 * g_numGameWidth) / 680;
_local1.mcBack._yscale = (100 * g_numGameHeight) / 430;
_local1._x = g_numGameWidth / 2;
_local1._y = g_numGameHeight / 2;
}
function g_fSearchInArray(a_array, a_element) {
var _local2 = a_array;
var _local3 = a_element;
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == _local3) {
return(_local1);
}
_local1++;
}
return(-1);
}
function g_fLoadScoreBoard() {
loadMovieNum ("scoreboard.swf", g_numScoreBoardLevel);
g_numLoadInterval = setInterval(g_fCheckScoreboardLoaded, 20);
}
function g_fCheckScoreboardLoaded() {
if (eval ("_level" + g_numScoreBoardLevel).blnLoaded) {
g_lvlScoreBoard = eval ("_level" + g_numScoreBoardLevel);
clearInterval(g_numLoadInterval);
g_fHideScoreBoard();
g_lvlScoreBoard._x = (g_numGameWidth - g_lvlScoreBoard.numWidth) / 2;
g_lvlScoreBoard._y = (g_numGameHeight - g_lvlScoreBoard.numHeight) / 2;
g_lvlScoreBoard.objUser = g_objUser;
if (g_blnDebug) {
g_lvlScoreBoard.numConnId = g_numConnId;
g_lvlScoreBoard.fSetDebug(g_blnDebug);
}
g_lvlScoreBoard.watch("strXMLToSend", g_fXMLFromScoreBoard);
g_fStartGameStepExecute();
}
}
function g_fXMLFromScoreBoard(prop, oldval, newval) {
var _local1 = newval;
if (_local1 != "") {
var _local2 = new XML();
_local2.parseXML(_local1);
if (_local2.status == 0) {
g_fSendToCSA(_local1);
}
}
return(_local1);
}
function g_fShowScoreBoard() {
if (mcScoreboardBack == undefined) {
attachMovie("mcScoreboardBack", "mcScoreboardBack", g_numMsgDepth + 100);
g_fCenter(mcScoreboardBack);
}
g_lvlScoreBoard._visible = true;
g_lvlScoreBoard.fSetGameType(g_strGameType);
g_lvlScoreBoard.fShow();
}
function g_fHideScoreBoard() {
if (mcScoreboardBack != undefined) {
mcScoreboardBack.removeMovieClip();
}
g_lvlScoreBoard._visible = false;
}
function g_fSendToCSA(a_strPacket) {
if (a_strPacket == undefined) {
} else {
var _local1 = ("<gameactions>" + a_strPacket) + "</gameactions>";
if (g_blnDebug) {
g_lcDebug.send("stend", "fReceivePacketFromFlash", _local1, g_numConnId);
} else {
fscommand ("SendCommand", _local1);
}
}
}
function g_fSendToServer(a_strPacket) {
if ((a_strPacket == undefined) || (g_blnPracticeGame)) {
} else {
var _local1 = ("<gamesend>" + a_strPacket) + "</gamesend>";
g_fSendToCSA(_local1);
}
}
function g_fSendStep(a_strPacket) {
if (a_strPacket == undefined) {
} else {
var _local3 = a_strPacket;
var _local2 = new XML(_local3);
var _local1 = 0;
while (_local1 < _local2.childNodes.length) {
_local2.childNodes[_local1].attributes.userid = String(g_objUser.numUserId);
_local1++;
}
_local3 = _local2.toString();
_local3 = ("<agmstep>" + _local3) + "</agmstep>";
g_fSendToServer(_local3);
}
}
function g_fReceiveFromCSA() {
if ((strXMLReceive == undefined) || (strXMLReceive == "")) {
return(undefined);
}
g_arrXMLReceived.push(strXMLReceive);
strXMLReceive = "";
g_fSendReadyToCSA();
}
function g_fSendReadyToCSA() {
clearInterval(readyForReceiveInt);
g_fSendToCSA("<readyforreceive/>");
readyForReceiveInt = setInterval(g_fSendReadyToCSA, 5000);
}
function g_fParseReceivedXML() {
if (g_arrXMLReceived.length == 0) {
return(undefined);
}
var xmlNextPacket = new XML(g_arrXMLReceived.shift());
if (xmlNextPacket.status != 0) {
return(undefined);
}
var i = 0;
while (i < xmlNextPacket.childNodes.length) {
if (xmlNextPacket.childNodes[i].nodeName.toLowerCase() == "gameactions") {
var j = 0;
while (j < xmlNextPacket.childNodes[i].childNodes.length) {
var xmlChild = xmlNextPacket.childNodes[i].childNodes[j];
var strPacketsName = xmlChild.nodeName.toLowerCase();
if (g_fSearchInArray(g_arrStdPacketsFromCSA, strPacketsName) >= 0) {
var theFunction = eval ("g_fXML" + strPacketsName);
var arrParams = new Array();
arrParams.push(xmlChild);
theFunction.apply(null, arrParams);
} else {
g_fUnknownXMLPacket(xmlChild);
}
j++;
}
} else {
g_fUnknownXMLPacket(xmlChild);
}
i++;
}
}
function g_fUnknownXMLPacket(a_xmlPacket) {
if (g_fGetDebug) {
if (mcUnknownPacket == undefined) {
attachMovie("mcUnknownPacket", "mcUnknownPacket", g_numMsgDepth + 1);
}
g_fCenter(mcUnknownPacket);
mcUnknownPacket.txtPacket.text = a_xmlPacket;
}
}
function g_fXMLAgmStartGame(a_xmlPacket) {
var _local2 = a_xmlPacket;
g_fStopGameStepExecute();
g_arrGameSteps.splice(0);
var _local1 = 0;
while (_local1 < _local2.childNodes.length) {
if (!(_local2.childNodes[_local1].nodeName.toLowerCase() === "startgamesituation")) {
} else if ((!g_blnRestoreGame) && (!g_blnAllReady)) {
g_fXMLStartGameSituation(_local2.childNodes[_local1]);
u_fInitGame();
gotoAndPlay ("syncronize");
}
_local1++;
}
}
function g_fXMLAgmRestoreGame(a_xmlPacket) {
g_blnRestoreGame = true;
var _local3 = 0;
while (_local3 < a_xmlPacket.childNodes.length) {
if (a_xmlPacket.childNodes[_local3].nodeName.toLowerCase() == "access") {
var _local2 = 0;
while (_local2 < a_xmlPacket.childNodes[_local3].childNodes.length) {
var _local1 = a_xmlPacket.childNodes[_local3].childNodes[_local2];
if (_local1.nodeName.toLowerCase() == "startgamesituation") {
g_fXMLStartGameSituation(_local1);
u_fInitGame();
} else {
g_arrGameSteps.push(_local1);
}
_local2++;
}
}
_local3++;
}
gotoAndPlay ("syncronize");
}
function g_fXMLGameInitialize(a_xmlPacket) {
var _local1 = a_xmlPacket;
if (g_blnInitialized) {
} else {
g_objUser.numUserId = Number(_local1.attributes.userid);
g_objUser.numChairId = Number(_local1.attributes.chairid);
g_objUser.numAvatarId = Number(_local1.attributes.avatarid);
g_objUser.strUserName = String(_local1.attributes.username);
gotoAndStop ("initialize");
}
}
function g_fXMLStandAlone(a_xmlPacket) {
g_blnPracticeGame = true;
g_objUser.blnActive = true;
if (mcAvatar != undefined) {
mcAvatar.setPlayerId(g_objUser.numUserId);
mcAvatar.setPlayerName(g_objUser.strUserName);
if ((g_objUser.numAvatarId > 0) && (g_fGetFlashVersion() > 5)) {
mcAvatar.loadAvatar(g_objUser.numAvatarId + ".jpg");
}
}
u_fInitPracticeGame();
if ((a_xmlPacket.attributes.practiceoptions == undefined) || (Number(a_xmlPacket.attributes.practiceoptions) == 0)) {
u_fInitGame();
gotoAndPlay ("syncronize");
} else {
var _local1 = g_objSAOptions.getOptions();
if (_local1.childNodes.length == 0) {
u_fInitGame();
gotoAndPlay ("syncronize");
} else {
g_fSendToCSA(_local1.toString());
}
}
}
function g_fXMLPracticeOptions(a_xmlPacket) {
var _local1 = 0;
while (_local1 < a_xmlPacket.childNodes.length) {
if (a_xmlPacket.childNodes[_local1].nodeName.toLowerCase() == "item") {
var _local2 = a_xmlPacket.childNodes[_local1];
var strName = _local2.attributes.name.toLowerCase();
var _local3 = _local2.attributes.value;
var strModifier = axmlItem.attributes.modifier;
switch (strName) {
case "time limit" :
g_numGameTime = Number(_local3) * 60;
mcTimer.setTimer(g_numGameTime);
break;
case "game number" :
if (strModifier == "normal") {
g_numRandomSeed = Number(_local3);
} else {
g_numRandomSeed = Math.floor(Math.random() * g_numMAXRandomSeed) + 1;
}
break;
default :
u_fXMLPracticeOptions(_local2);
}
}
_local1++;
}
u_fInitGame();
gotoAndPlay ("syncronize");
}
function g_fXMLGameResign(a_xmlPacket) {
if (a_xmlPacket.attributes.message != undefined) {
g_fShowMessage(a_xmlPacket.attributes.message);
}
if (g_objUser.blnActive == false) {
g_fGameFinished();
} else if ((g_lvlScoreBoard._visible == false) && (!g_blnGameOver)) {
g_fClickResign();
}
}
function g_fXMLGameStop(a_xmlPacket) {
g_fShowMessage(a_xmlPacket.attributes.message);
mcTimer.stopTimer();
g_blnPlayEnable = false;
}
function g_fXMLGameRestore(a_xmlPacket) {
g_fShowMessage(a_xmlPacket.attributes.message);
mcTimer.startTimer();
g_blnPlayEnable = true;
}
function g_fXMLGameFinished() {
mcTimer.stopTimer();
g_blnPlayEnable = false;
g_blnGameOver = true;
if (!g_lvlScoreBoard.blnAnswered) {
gamefinishInt = setInterval(g_fGameFinished, 10000);
} else {
g_fGameFinished();
}
}
function g_fXMLStartGameSituation(a_xmlPacket) {
var _local3 = a_xmlPacket;
g_strGameType = String(_local3.attributes.gametype);
var xmlGameInfo = new XML();
var _local2 = 0;
while (_local2 < _local3.childNodes.length) {
switch (_local3.childNodes[_local2].nodeName.toLowerCase()) {
case "gameinfo" :
xmlGameInfo = _local3.childNodes[_local2];
break;
case "gamers" :
var _local1 = 0;
for(;;){
if (_local1 >= _local3.childNodes[_local2].childNodes.length) {
break;
}
if (_local3.childNodes[_local2].childNodes[_local1].nodeName.toLowerCase() == "gamer") {
g_fXMLGamer(_local3.childNodes[_local2].childNodes[_local1], _local1 + 1);
}
_local1++;
};
}
_local2++;
}
u_fXMLGameInfo(xmlGameInfo);
}
function g_fXMLGamer(a_xmlPacket, a_numPlayer) {
var objPlayer = eval ("g_objPlayer" + String(a_numPlayer));
objPlayer.numUserId = Number(a_xmlPacket.attributes.userid);
if (objPlayer.numUserId == g_objUser.numUserId) {
g_objUser = eval ("g_objPlayer" + String(a_numPlayer));
g_objUser.blnActive = true;
}
objPlayer.strUserName = String(a_xmlPacket.attributes.username);
objPlayer.numAvatarId = Number(a_xmlPacket.attributes.avatarid);
objPlayer.numChairId = Number(a_xmlPacket.attributes.chairid);
var objAvatar = undefined;
if (g_fGetGameMode() == "multi") {
objAvatar = eval ("mcAvatar" + String(a_numPlayer));
} else if (objPlayer.numUserId == g_objUser.numUserId) {
objAvatar = mcAvatar;
}
if (objAvatar != undefined) {
objAvatar.setPlayerId(objPlayer.numUserId);
objAvatar.setPlayerName(objPlayer.strUserName);
if ((objPlayer.numAvatarId > 0) && (g_fGetFlashVersion() > 5)) {
objAvatar.loadAvatar(objPlayer.numAvatarId + ".jpg");
}
}
}
function g_fStartGameStepExecute() {
g_blnStepExecute = true;
}
function g_fStopGameStepExecute() {
g_blnStepExecute = false;
}
function g_fXMLAgmStep(a_xmlPacket) {
var _local2 = a_xmlPacket;
if (_local2.childNodes.length == 0) {
} else {
var _local1 = 0;
while (_local1 < _local2.childNodes.length) {
g_arrGameSteps.push(_local2.childNodes[_local1]);
_local1++;
}
}
}
function g_fXMLException(a_xmlPacket) {
g_blnPlayEnable = false;
g_fStopGameStepExecute();
mcTimer.stopTimer();
if (mcError == undefined) {
attachMovie("mcError", "mcError", g_numMsgDepth + 100);
}
g_fCenter(mcError);
g_fHideScoreBoard();
}
function g_fXMLAllAreReadyToGo(a_xmlPacket) {
if ((!g_blnRestoreGame) && (!g_blnAllReady)) {
g_blnAllReady = true;
gotoAndPlay ("startGame");
}
}
function g_fXMLGamerStatusNotify(a_xmlPacket) {
var _local2 = a_xmlPacket;
var _local1 = Number(_local2.attributes.userid);
var strNewStatus = String(_local2.attributes.gamerstatus).toLowerCase();
switch (strNewStatus) {
case "disconnect" :
if (_local1 != g_objUser.numUserId) {
g_numDisconnectStartAt = Math.floor(getTimer() / 1000);
g_numDisconnectTimer = Number(_local2.attributes.timeout) * 60;
g_lvlScoreBoard.numDisconnectStart = 0;
g_lvlScoreBoard.numDisconnectTimer = g_numDisconnectTimer;
if (g_fGetGameMode() == "multi") {
mcTimer.stopTimer();
g_blnPlayEnable = false;
if (!g_lvlScoreBoard._visible) {
if (g_objPlayer1.numUserId == _local1) {
var _local3 = new XML(((((("<gamerstate userid=\"" + g_objPlayer1.numUserId) + "\" username=\"") + g_objPlayer1.strUserName) + "\" avatarid=\"") + g_objPlayer1.numAvatarId) + "\" score=\"\" state=\"disconnect\" answer=\"\"/>");
g_lvlScoreBoard.fChangePlayerState(_local3.firstChild);
_local3 = new XML(((((("<gamerstate userid=\"" + g_objPlayer2.numUserId) + "\" username=\"") + g_objPlayer2.strUserName) + "\" avatarid=\"") + g_objPlayer2.numAvatarId) + "\" score=\"\" state=\"stillplaying\" answer=\"\"/>");
g_lvlScoreBoard.fChangePlayerState(_local3.firstChild);
} else if (g_objPlayer2.numUserId == _local1) {
var _local3 = new XML(((((("<gamerstate userid=\"" + g_objPlayer1.numUserId) + "\" username=\"") + g_objPlayer1.strUserName) + "\" avatarid=\"") + g_objPlayer1.numAvatarId) + "\" score=\"\" state=\"stillplaying\" answer=\"\"/>");
g_lvlScoreBoard.fChangePlayerState(_local3.firstChild);
_local3 = new XML(((((("<gamerstate userid=\"" + g_objPlayer2.numUserId) + "\" username=\"") + g_objPlayer2.strUserName) + "\" avatarid=\"") + g_objPlayer2.numAvatarId) + "\" score=\"\" state=\"disconnect\" answer=\"\"/>");
g_lvlScoreBoard.fChangePlayerState(_local3.firstChild);
}
g_fShowScoreBoard();
}
}
g_lvlScoreBoard.strXMLReceive = _local2.toString();
}
return;
case "stillplaying" :
g_lvlScoreBoard.strXMLReceive = _local2.toString();
if (_local1 != g_objUser.numUserId) {
g_numDisconnectStartAt = 0;
g_numDisconnectTimer = 0;
} else if (g_fGetGameMode() == "multi") {
if (((g_lvlScoreBoard.mcPlayerL.userID != _local1) && (g_lvlScoreBoard.mcPlayerL.state == "disconnect")) || ((g_lvlScoreBoard.mcPlayerR.userID != _local1) && (g_lvlScoreBoard.mcPlayerR.state == "disconnect"))) {
} else {
g_fHideScoreBoard();
if (!g_blnRestoreGame) {
mcTimer.startTimer();
g_blnPlayEnable = g_objUser.blnActive;
}
}
}
return;
default :
g_numDisconnectStartAt = 0;
g_numDisconnectTimer = 0;
g_lvlScoreBoard.strXMLReceive = _local2.toString();
}
}
function g_fXMLChairTimerReminder(a_xmlPacket) {
return(undefined);
}
function g_fXMLScoreBoard(a_xmlPacket) {
mcTimer.stopTimer();
g_blnPlayEnable = false;
var _local1 = Number(g_strGameType.substr(1, 1));
if (((_local1 == 0) || (_local1 == 1)) || (_local1 == 4)) {
g_lvlScoreBoard.numDisconnectStartAt = Math.floor(getTimer() / 1000) - g_numDisconnectStartAt;
g_lvlScoreBoard.numDisconnectTimer = ((g_numDisconnectTimer > 0) ? (g_numDisconnectTimer) : 600);
g_lvlScoreBoard.strXMLReceive = a_xmlPacket.toString();
g_fShowScoreBoard();
} else {
g_fShowGameOverMessage();
}
}
function g_fXMLTimerState(a_xmlPacket) {
if ((g_blnRestoreGame || (g_blnDebug)) && (Number(a_xmlPacket.attributes.userid) == g_objUser.numUserId)) {
mcTimer.setTimer(Number(a_xmlPacket.attributes.timer));
}
}
function g_fExecuteGameStep() {
if (g_arrGameSteps.length == 0) {
return(undefined);
}
var xmlNextStep = g_arrGameSteps.shift();
var strPacketsName = xmlNextStep.nodeName.toLowerCase();
var strFuncPrefix = "g_";
if (g_fSearchInArray(g_arrStdStepPackets, strPacketsName) == -1) {
strFuncPrefix = "u_";
}
var theFunction = eval ((strFuncPrefix + "fXML") + strPacketsName);
var arrParams = new Array();
arrParams.push(xmlNextStep);
theFunction.apply(null, arrParams);
}
function g_fGameOver(a_winnerid, a_reason) {
var _local3 = this;
if (g_blnGameOver) {
} else {
u_fGameOver(a_winnerid, a_reason);
mcTimer.stopTimer();
g_blnPlayEnable = false;
g_blnGameOver = true;
_root.xmlGameEnd = new XML();
if (g_blnStandAloneGame) {
if (freeplayid != undefined) {
var numScore = mcAvatar.getScore();
numScore = ((numScore == undefined) ? 0 : (numScore));
_root.xmlGameEnd.onLoad = function (success) {
var _local3 = this;
if (success) {
var _local1 = 0;
while (_local1 < _local3.childNodes.length) {
if (_local3.childNodes[_local1].nodeName.toLowerCase() == "gameend") {
var _local2 = 0;
while (_local2 < _local3.childNodes[_local1].childNodes.length) {
if (_local3.childNodes[_local1].childNodes[_local2].nodeName.toLowerCase() == "game") {
_root.endURL = _local3.childNodes[_local1].childNodes[_local2].attributes.url;
_root.affiliateId = _local3.childNodes[_local1].childNodes[_local2].attributes.affiliate;
_local1 = _local3.childNodes.length;
_local2 = _local3.childNodes[_local1].childNodes.length;
}
_local2++;
}
}
_local1++;
}
_root.g_fLoadGameEnd();
delete _local3.onLoad;
}
};
_root.xmlGameEnd.load((("http://freeplay.gamedek.com/gameend.aspx?freePlayID=" + freeplayid) + "&score=") + numScore);
} else {
trace("g_fLoadGameEnd");
g_fLoadGameEnd();
}
} else if (g_blnPracticeGame) {
g_fShowGameOverMessage();
} else {
g_fSendPlayerScore();
if ((a_reason != undefined) && (a_reason != "")) {
g_fSendStep(("<gameovermsg reason=\"" + a_reason) + "\"/>");
}
var strGameOver = "<gameover";
if ((a_winnerid != undefined) && (a_winnerid != 0)) {
strGameOver = strGameOver + ((" winnerid=\"" + a_winnerid) + "\"");
}
strGameOver = strGameOver + "/>";
g_fSendStep(strGameOver);
}
}
}
function g_fSendPlayerScore() {
var _local1 = 0;
if (g_fGetGameMode() == "multi") {
_local1 = ((g_objUser.numUserId == g_objPlayer1.numUserId) ? (mcAvatar1.getScore()) : (mcAvatar2.getScore()));
} else {
_local1 = mcAvatar.getScore();
}
g_fSendStep(("<playerscore score=\"" + _local1) + "\"/>");
}
function g_fShowGameOverMessage() {
if (mcGameOver == undefined) {
attachMovie("mcGameOver", "mcGameOver", g_numMsgDepth);
g_fCenter(mcGameOver);
}
mcGameOver.grGameOver._visible = true;
mcGameOver.txtMessage._visible = false;
}
function g_fSendTimerState() {
if (g_blnPlayEnable && (!g_blnGameOver)) {
g_fSendStep(("<timerstate timer=\"" + mcTimer.getTimer()) + "\"/>");
}
}
function g_fClickResign() {
if ((g_blnGameOver || (!g_blnGameStarted)) || (g_lvlScoreBoard._visible)) {
return(undefined);
}
sndClick.start();
if (mcResign == undefined) {
attachMovie("mcResign", "mcResign", g_numMsgDepth);
g_fCenter(mcResign);
}
if (g_objUser.blnActive) {
mcResign.gotoAndStop("resign");
} else {
mcResign.gotoAndStop("stopWatching");
}
}
function g_fClickResignYes() {
sndClick.start();
mcTimer.stopTimer();
if (g_blnStandAloneGame) {
g_fGameOver(g_objUser.numUserId, "resign");
} else if (g_blnPracticeGame) {
g_blnPracticeGame = false;
g_fGameFinished();
} else {
var _local1 = 0;
if (g_fGetGameMode() == "multi") {
_local1 = ((g_objUser.numUserId == g_objPlayer1.numUserId) ? (g_objPlayer2.numUserId) : (g_objPlayer1.numUserId));
}
g_fGameOver(_local1, "resign");
}
}
function g_fClickResignNo() {
}
function g_fClickStopWatchingYes() {
sndClick.start();
g_blnPlayEnable = false;
g_blnGameOver = true;
g_fGameFinished();
}
function g_fClickStopWatchingNo() {
}
function g_fSetSoundOn() {
g_sndGlobalSound.setVolume(100);
sndClick.start();
}
function g_fSetSoundOff() {
sndClick.start();
g_sndGlobalSound.setVolume(0);
}
function g_fXMLGameOver(a_xmlPacket) {
if (g_fGetGameMode() != "multi") {
return(undefined);
}
mcTimer.stopTimer();
g_blnPlayEnable = false;
g_blnGameOver = true;
var numWinnerId = Number(a_xmlPacket.attributes.winnerid);
}
function g_fXMLGameOverMsg(a_xmlPacket) {
var _local2 = Number(a_xmlPacket.attributes.userid);
if ((g_fGetGameMode() == "single") && (_local2 != g_objUser.numUserId)) {
} else {
mcTimer.stopTimer();
g_blnPlayEnable = false;
g_blnGameOver = true;
var _local1 = String(a_xmlPacket.attributes.reason);
if ((g_lvlScoreBoard._visible == false) && (g_blnRestoreGame == false)) {
g_fStopGameStepExecute();
if (mcGameOver == undefined) {
attachMovie("mcGameOver", "mcGameOver", g_numMsgDepth);
g_fCenter(mcGameOver);
}
if (_local1.toLowerCase() == "resign") {
if ((_local2 != g_objUser.numUserId) && (g_objUser.blnActive)) {
mcGameOver.grGameOver._visible = false;
mcGameOver.txtMessage.text = "YOUR OPPONENT HAS RESIGNED";
mcGameOver.txtMessage._y = (-mcGameOver.txtMessage.textHeight) / 2;
} else {
mcGameOver.grGameOver._visible = true;
mcGameOver.txtMessage._visible = false;
}
} else if (_local1 != "") {
mcGameOver.grGameOver._visible = false;
mcGameOver.txtMessage.text = _local1;
mcGameOver.txtMessage._y = (-mcGameOver.txtMessage.textHeight) / 2;
} else {
mcGameOver.grGameOver._visible = true;
mcGameOver.txtMessage._visible = false;
}
}
}
}
function g_fClickOptionsBtn() {
sndClick.start();
if (mcOptions == undefined) {
attachMovie("mcOptions", "mcOptions", g_numMsgDepth);
g_fCenter(mcOptions);
}
}
function g_fStr2Bln(a_str) {
var _local1 = a_str.toLowerCase();
if (((_local1 == "true") || (_local1 == "t")) || (_local1 == "1")) {
return(true);
}
return(false);
}
function g_fGameFinished() {
clearInterval(readyForReceiveInt);
clearInterval(gamefinishInt);
g_fSendToCSA(g_arrStdAnswersToCSA.gamefinished);
}
function g_fLoadGameEnd() {
mcResign.removeMovieClip();
mcGameOver.removeMovieClip();
if (mcGameEnd != undefined) {
mcGameEnd.removeMovieClip();
}
createEmptyMovieClip("mcGameEnd", g_numMsgDepth + 100);
createEmptyMovieClip("mcGameEndBack", g_numMsgDepth + 99);
with (mcGameEndBack) {
var backColor = 0;
beginFill(backColor, 100);
lineStyle(1, backColor, 100);
moveTo(0, 0);
lineTo(g_numGameWidth, 0);
lineTo(g_numGameWidth, g_numGameHeight);
lineTo(0, g_numGameHeight);
lineTo(0, 0);
endFill();
}
if (freeplayid != undefined) {
downloadURL = downloadURL + affiliateId;
}
loadEndGameInt = setInterval(g_fCheckGameEndLoading, 50);
loadMovie (endURL, mcGameEnd);
}
function g_fCheckGameEndLoading() {
if (mcGameEnd == undefined) {
clearInterval(loadEndGameInt);
} else if (mcGameEnd.getBytesLoaded() >= mcGameEnd.getBytesTotal()) {
if ((mcGameEnd._width > 0) && (mcGameEnd._height > 0)) {
clearInterval(loadEndGameInt);
if ((mcGameEnd._width > g_numGameWidth) || (mcGameEnd._height > g_numGameHeight)) {
var _local2 = g_numGameWidth / mcGameEnd._width;
var _local1 = g_numGameHeight / mcGameEnd._height;
mcGameEnd._xscale = (mcGameEnd._yscale = 100 * Math.min(_local2, _local1));
}
mcGameEnd._x = (g_numGameWidth - mcGameEnd._width) / 2;
mcGameEnd._y = (g_numGameHeight - mcGameEnd._height) / 2;
}
}
}
function getAffiliateId() {
return(affiliateId);
}
function getPlayerScore() {
return(mcAvatar.getScore());
}
function playAgain() {
if (mcGameEnd != undefined) {
mcGameEnd.removeMovieClip();
}
u_fRemoveGameClips();
g_blnPlayEnable = false;
g_blnGameOver = false;
g_blnGameStarted = false;
gotoAndStop ("initialize");
}
function downloadStandAlone() {
getURL (downloadURL, "_blank");
}
stop();
fscommand ("showmenu", "false");
XML.prototype.ignoreWhite = true;
var g_arrXMLToSend = new Array();
var g_arrXMLReceived = new Array();
var g_arrGameSteps = new Array();
var g_blnInitialized = false;
var g_blnAllReady = false;
var g_blnPlayEnable = false;
var g_blnRestoreGame = false;
var g_blnStepExecute = false;
var g_blnGameStarted = false;
var g_blnGameOver = false;
var g_blnPracticeGame = false;
var g_blnStandAloneGame = false;
var g_blnDisconnected = false;
var g_blnDebug = false;
var g_numConnId = -1;
var g_numGameWidth = 640;
var g_numGameHeight = 480;
var g_numBackColor = 0;
var g_numRandomSeed = 0;
var g_numMAXRandomSeed = 256000;
var g_numPrize = 0;
var g_numGameTime = 0;
var g_numDisconnectTimer = 0;
var g_numDisconnectStartAt = 0;
var g_numLoadInterval = 0;
var g_numScoreBoardLevel = 9;
var g_lvlScoreBoard = null;
var g_strGameType = "00";
var g_strGameMode = "single";
var g_strPracticeOptions = "";
var g_strGameVersion = "ver 0.000";
var g_objUser = new Object();
var g_objPlayer1 = new Object();
var g_objPlayer2 = new Object();
var g_objSAOptions = new Object({arrItems:new Array()});
var g_sndGlobalSound = new Sound();
var strXMLReceive = "";
createEmptyMovieClip("mcSBGExecuter", 10000001);
mcSBGExecuter.onEnterFrame = function () {
if (strXMLReceive != "") {
g_fReceiveFromCSA();
}
if (g_arrXMLReceived.length > 0) {
g_fParseReceivedXML();
}
if (g_blnStepExecute && (g_arrGameSteps.length > 0)) {
g_fExecuteGameStep();
}
};
var g_numMsgDepth = 1000000;
var g_arrStdAnswersToCSA = new Array();
g_arrStdAnswersToCSA.readyforreceive = "<readyforreceive/>";
g_arrStdAnswersToCSA.gamestarted = "<gamestarted/>";
g_arrStdAnswersToCSA.gamefinished = "<gamefinished/>";
g_arrStdAnswersToCSA.readytogo = "<readytogo/>";
g_arrStdAnswersToCSA.gameloaded = "<gameloaded/>";
var g_arrStdPacketsFromCSA = new Array("agmstep", "gameinitialize", "standalone", "practiceoptions", "gameresign", "gamestop", "gamerestore", "agmstartgame", "agmrestoregame");
var g_arrStdStepPackets = new Array("setturn", "exception", "allarereadytogo", "gamerstatusnotify", "chairtimerreminder", "scoreboard", "gamefinished", "timerstate", "offerdraw", "answerofferdraw", "gameover", "gameovermsg", "allowtoplay", "playerstimer");
var g_A = 3423313;
var g_C = 2435;
g_objSAOptions.addItem = function (a_name, a_value, a_type, a_modifier, a_arrConstraints) {
var _local1 = a_type;
var _local2 = a_name;
var _local3 = this;
if ((_local1 == undefined) || ((((_local1 != "checkbox") && (_local1 != "combobox")) && (_local1 != "randomseed")) && (_local1 != "integernumeric"))) {
} else if (_local3.arrItems[_local2] == undefined) {
_local3.arrItems[_local2] = new Object({name:_local2, type:_local1, value:a_value, modifier:a_modifier, arrConstraints:a_arrConstraints.slice(0)});
} else {
_local3.changeItem(_local2, a_value, _local1, a_modifier, a_arrConstraints);
}
};
g_objSAOptions.changeItem = function (a_name, a_value, a_type, a_modifier, a_arrConstraints) {
var _local1 = a_name;
var _local2 = a_type;
var _local3 = this;
if ((((_local1 == undefined) || (_local1 == "")) || (_local2 == undefined)) || ((((_local2 != "checkbox") && (_local2 != "combobox")) && (_local2 != "randomseed")) && (_local2 != "integernumeric"))) {
} else {
_local3.arrItems[_local1].type = _local2;
_local3.arrItems[_local1].value = a_value;
_local3.arrItems[_local1].modifier = a_modifier;
_local3.arrItems[_local1].arrConstraints = a_arrConstraints.splice(0);
}
};
g_objSAOptions.removeItem = function (a_name) {
var _local1 = a_name;
if (((_local1 == undefined) || (_local1 == "")) || (this.arrItems[_local1] == undefined)) {
} else {
delete this.arrItems[_local1];
}
};
g_objSAOptions.getOptions = function () {
var _local2 = this;
var _local3 = new XML("<practiceoptions/>").firstChild;
for (var item in _local2.arrItems) {
xmlItem = new XML("<item/>").firstChild;
xmlItem.attributes.name = _local2.arrItems[item].name;
xmlItem.attributes.value = _local2.arrItems[item].value;
xmlItem.attributes.type = _local2.arrItems[item].type;
xmlItem.attributes.modifier = _local2.arrItems[item].modifier;
var _local1 = 0;
while (_local1 < _local2.arrItems[item].arrConstraints.length) {
xmlConstraint = new XML("<constraint/>").firstChild;
xmlConstraint.attributes.name = _local2.arrItems[item].arrConstraints[_local1].name;
xmlConstraint.attributes.value = _local2.arrItems[item].arrConstraints[_local1].value;
xmlItem.appendChild(xmlConstraint);
_local1++;
}
_local3.appendChild(xmlItem);
}
return(_local3);
};
g_fSetGameMode("single");
g_fSendToCSA(g_arrStdAnswersToCSA.gameloaded.toString());
g_fInitUser();
System.security.allowDomain("http://freeplay.gamedek.com/");
g_blnStandAloneGame = true;
g_blnPracticeGame = true;
endURL = "http://freeplay.gamedek.com/game_ends/ending_arkadium.swf";
downloadURL = "http://www.gamedek.com/?aff=";
affiliateId = 0;
if (freeplayid == undefined) {
loadVariables ("config.txt", _root);
}
playAgain();
g_strGameVersion = "v 0.021";
var arrSets = new Array("", "");
var blnLayout2d = false;
var blnAnimation = true;
var strPrefix = "";
var numStep = 1;
var numFirstTurnUserId = 0;
var blnFirstTurn = true;
var blnReshuffling = false;
var numStartTimerInt = 0;
var numReshuffleInt = 0;
var numFreezeInt = 0;
var numPointSystem = 1;
var arrSet = new Array();
var arrDeck = new Array();
var arrTiles = new Array();
var arrRemoving = new Array();
var myBlnSoundOn = true;
var arrColorTransform = new Array({ra:"82", rb:"0", ga:"82", gb:"9", ba:"82", bb:"34", aa:"100", ab:"0"}, {ra:"86", rb:"0", ga:"86", gb:"7", ba:"86", bb:"28", aa:"100", ab:"0"}, {ra:"90", rb:"0", ga:"90", gb:"5", ba:"90", bb:"22", aa:"100", ab:"0"}, {ra:"94", rb:"0", ga:"94", gb:"3", ba:"94", bb:"16", aa:"100", ab:"0"}, {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"}, {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"}, {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"}, {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"});
var arrTilesDef = new Array({suit:"Metals", name:"", cost:1, copy:4, clipName:"mon1", match:"clip", hint:"Gold"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon2", match:"clip", hint:"Mercury"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon3", match:"clip", hint:"Iron"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon4", match:"clip", hint:"Bismuth"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon5", match:"clip", hint:"Phosphorus"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon6", match:"clip", hint:"Arsnic"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon7", match:"clip", hint:"Silver"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon8", match:"clip", hint:" Antimony"}, {suit:"Metals", name:"", cost:1, copy:4, clipName:"mon9", match:"clip", hint:"Tin"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong1", match:"clip", hint:"Water"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong2", match:"clip", hint:"Crucible"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong3", match:"clip", hint:"Stone"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong4", match:"clip", hint:"Lead"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong5", match:"clip", hint:"Nickel"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong6", match:"clip", hint:"Vinegar"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong7", match:"clip", hint:"Spirit"}, {suit:" Mysteries ", name:"", cost:2, copy:4, clipName:"tong8", match:"clip", hint:"Crystal"}, {suit:"Mysteries", name:"", cost:2, copy:4, clipName:"tong9", match:"clip", hint:"Brass"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song1", match:"clip", hint:"1 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song2", match:"clip", hint:"2 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song3", match:"clip", hint:"3 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song4", match:"clip", hint:"4 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song5", match:"clip", hint:"5 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song6", match:"clip", hint:"6 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song7", match:"clip", hint:"7 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song8", match:"clip", hint:"8 of Tools"}, {suit:"Tools", name:"", cost:3, copy:4, clipName:"song9", match:"clip", hint:"9 of Tools"}, {suit:"Wind", name:"Dawn", cost:4, copy:4, clipName:"east", match:"clip", hint:"Dawn Sun"}, {suit:"Wind", name:"Noon", cost:4, copy:4, clipName:"south", match:"clip", hint:"Noon Day Sun"}, {suit:"Wind", name:"New Moon", cost:4, copy:4, clipName:"west", match:"clip", hint:"New Moon"}, {suit:"Wind", name:"Full Moon", cost:4, copy:4, clipName:"north", match:"clip", hint:"Full Moon"}, {suit:"Dragon", name:"Black", cost:5, copy:4, clipName:"center", match:"clip", hint:"Dragon : Black"}, {suit:"Dragon", name:"Green", cost:5, copy:4, clipName:"fat", match:"clip", hint:"Dragon : Green"}, {suit:"Dragon", name:"Blue", cost:5, copy:4, clipName:"bon", match:"clip", hint:"Dragon : Blue"}, {suit:"Flower", name:"Plum", cost:6, copy:1, clipName:"flower1", match:"suit", hint:"Process : Sublime"}, {suit:"Flower", name:"Orchid", cost:6, copy:1, clipName:"flower2", match:"suit", hint:"Process Weigh"}, {suit:"Flower", name:"Chrysanthemum", cost:6, copy:1, clipName:"flower3", match:"suit", hint:"Process Burn"}, {suit:"Flower", name:"Tools", cost:6, copy:1, clipName:"flower4", match:"suit", hint:"Process Distillation"}, {suit:"Season", name:"Spring", cost:7, copy:1, clipName:"season1", match:"suit", hint:"Step 1"}, {suit:"Season", name:"Summer", cost:7, copy:1, clipName:"season2", match:"suit", hint:"Step 2"}, {suit:"Season", name:"Autumn", cost:7, copy:1, clipName:"season3", match:"suit", hint:"Step 3"}, {suit:"Season", name:"Winter", cost:7, copy:1, clipName:"season4", match:"suit", hint:"Step 4"});
var numSetX = 15;
var numSetY = 8;
var numTileThickness = 6.2;
var numTileWidth = 42;
var numTileHeight = (55 - numTileThickness);
var numGridX = ((g_numGameWidth - (numSetX * numTileWidth)) / 2);
var numGridY = (50 + (((g_numGameHeight - 50) - (numSetY * numTileHeight)) / 2));
var numDeckX = -100;
var numDeckY = -100;
var numStepX = 3;
var numStepY = 0;
var objFirstSelected = new Object();
Frame 13
stop();
g_fCenter(btnMessageBack);
g_fSetGameBackgroundColor("6E7797");
g_fSetGameSize(680, 500);
u_fInitGame();
g_fGameInitialized();
if (g_blnStandAloneGame) {
gotoAndStop ("syncronize");
} else {
u_fInitGame();
g_fLoadScoreBoard();
}
mcAvatar.setRight();
function u_fStartGame() {
fChangeLayout();
mcHint.swapDepths(14990);
mcMessage.swapDepths(500000);
mcAvatar.swapDepths(15001);
fStartTimer();
if (g_blnRestoreGame == false) {
} else {
g_blnRestoreGame = false;
fCheckNoMoreMatches();
}
mcTimer.timesRunOut = g_fGameOver;
g_blnGameStarted = true;
g_blnPlayEnable = true;
}
function u_fInitGame() {
fNextTileSet();
u_fInitSounds();
}
function u_fInitSounds() {
sndClick = new Sound();
sndClick.attachSound("Button_Click");
sndTimerWarning = new Sound();
sndTimerWarning.attachSound("Timer_Warning");
sndStart = new Sound();
sndStart.attachSound("Start");
sndCorrect = new Sound();
sndCorrect.attachSound("Correct");
sndWrong = new Sound();
sndWrong.attachSound("Wrong");
}
function u_fPreopenOptions() {
mcOptions.setBoard2d(blnLayout2d);
mcOptions.setAnimation(blnAnimation);
}
function u_fChangeOptions() {
blnAnimation = mcOptions.blnAnimation;
if (blnLayout2d != mcOptions.blnLayout2d) {
blnLayout2d = mcOptions.blnLayout2d;
fChangeLayout();
}
}
function u_fGameOver(a_winnerid, a_reason) {
}
function u_fInitPracticeGame() {
if (g_blnStandAloneGame) {
btnDealNew._visible = true;
g_objUser.blnActive = true;
g_numRandomSeed = Math.floor(Math.random() * 1000) + 1;
var _local1 = "GAFKDFKCFJBFIAFHAFLFFMEFGHEHHEIHEJHELFEKGEMDFMCFMBFLAFIFEHFEGFEHDFHCFGCFMEEMDEFAEGAEJEEKDEKGDJHDIHDHHDGHDFHDEGDDFDCEDCDDDCDEBDFADKCEJBEIAEHAEKDDMCEMBELAEKCDJBDIADHADGADLFDMEDMDDMCDMBDLADLACMBCMCCMDCMECLFCKGCJHCIHCHHCGHCFHCEGCDFCCECCDCDCCEBCFACGACHACIACJBCKCCKDCJEDJECIFDHFDGFDFEEFEDIFCHFCFDEGCEFDDFDCGCDGCCHCEHCDHCCFECGFCHDEHDDHDCLABMBBMCBMDBMEBLFBKGBJHBIHBHHBGHBFHBEGBDFBCEBHABCDBDCBEBBFABGABIABJBBKCBKDBJEBIFBHFBGFBFEBHDBFDBGCBHCB";
_local1 = _local1 + ",LFBLCBDFBDCBEFCECCKFCKCCMEBMDBLECLDCKEDKDDCEBDECEEDEDDDDCCDBIHBGHBIABGABJBBFBBFGBJGBGGDGGCIGDIGCLEBLDBKECKDCJEEKFBFDEEECEDCFEEJDEDEBDDBEFBFEDFDDFECFDCFFDFFCGFFGFEGFDGFCIFFIFEIFDIFCJFDJFCJEDJECJDDJDCKCBJCDJCCECBFCDFCCICFGCFICEGCEICDGCDGCCICCIBDIBCGBDGBCHHCHGEHGDHFGHFFHFEHEIHDIHEHHDHHEGHDGHCGHCFHBEHACHBDHCEHEFHDFHEEHDEHCDHDDHEDHFDHHBHGCHFCHECHDCHCCHBCHABHEBHDBHGBGGBIGBEEBJFBFEBFFBGFBIFBHFBJEBKEBKDBJDBFDBEDBJCBFCBIBBGBBHBBGCBHCBICB";
_local1 = _local1 + ",CBCBEBCBBBCBBDBCDBCEBCFBDEBDFBDGBEFBEGBEHBFHBFGBGFBGGBHEBHFBHGBGHBICBIEBIFBJFBKGBJEBKEBJCBKFBLFBLGBLHBMHBNGBOFBMGBNFBOEBODBNCBNDBNEBMDBMCBMBBHBCLBBLCBKABJABIABKBBJBBGCBHABHCBGABLABFBBJBCIACHACGACGCCHCCICCJCCJACBCCBDCCECDFCEGCFHCGGCHFCIECJECLGCKFCMHCNGCOFCOECMCCNDCLBCKBCBABHBBJBDICDIADHADHBDHCDKACKBDLACLBDMCDNDDOEDOFDNECNFCMDCODCNCCMBCLCCMGCLHCKGCLFCKECNGDMHDLHDLGDKFDJFCIFCJEDIEDHFDHECHGCGFCGGDGHCFGCFHDEHCEGDEFCDGCDFDDECCFCBECCDC";
_local1 = _local1 + ",CBBDBBEBBFBBBCBCCBDCBECBFCBGCBBDBCDBDDBEDBFDBGDBBEBCEBDEBEEBFEBGEBBFBCFBDFBEFBFFBGFBCGBDGBEGBFGBCCCECCDCCFCCCCDDCDECDFCDCDCDDCEDCFDCCECDECEECFECCFCDFCEFCFFCCDDDDDEDDFDDCEDDEDEEDFEDCFDDFDEFDFFDDDEEDEDEEEEEDDFEDFDEFEEFJBBKBBLBBMBBICBJCBKCBLCBMCBNCBIDBJDBKDBLDBMDBNDBJEBIEBKEBLEBMEBNEBIFBJFBKFBLFBMFBNFBJGBKGBLGBMGBJCCKCCLCCMCCJDCKDCLDCMDCJECKECLECMECJFCKFCLFCMFCJCDKCDLCDMCDJDDKDDLDDMDDJEDKEDLEDMEDJFDKFDKDELFDLDEMFDKEELEEKDFLDFKEFLEF";
_local1 = _local1 + ",HEHGDHHDHFAGFFDIFDICDFCDCCGCFGFHGIHGLFGLCGIAGGEHKDCKECHGCGGCHBCGBCDECDDCEEDEDDJEDJDDFEEFDEIEEHEGGEGGDGHDGIDEFFCFCCICCIFCJECJDCKDBKEBEECDEBEDCDDBFEDGFDHFDIEDIDDHCDGCDFDDHEFGEFGDFHDFLCFLFFIHFFHFCFFCCFFAFIAFLCELFEIHEFHECFECCEFAEIAELCDLFDIHDFHDCFDCCDFADIADLCCLFCIHCFHCCFCCCCFACIACFABGGBEEBEDBGBBHBBJEBJDBHFCGFCFECFDCIECIDCGCCHCCHEEGEEHDELFBCFBCCBLCBHGBIABFHBIHBIFBHFBIDBGFBICBIEBFCBFDBHEDHCBGCBGEDGDDGDBGEBHDBHDCHDDFEBGDEGECGDCHEBHECFFB";
arrSets = new Array();
arrSets = _local1.split(",");
numTotalTime = 900;
mcTimer.setTimer(numTotalTime);
mcAvatar.setScore(0);
} else {
g_objSAOptions.addItem("Time Limit", "1", "integernumeric", "normal", new Array({name:"MinValue", value:1}, {name:"MaxValue", value:10}));
g_objSAOptions.addItem("Game Number", "1", "randomseed", "hidden", new Array({name:"MinValue", value:1}, {name:"MaxValue", value:256000}));
}
}
function u_fXMLPracticeOptions(a_xmlPacket) {
}
function u_fRemoveGameClips() {
mcError.removeMovieClip();
mcGameOver.removeMovieClip();
mcResign.removeMovieClip();
mcHelp.removeMovieClip();
mcMessage.removeMovieClip();
mcAvatar.removeMovieClip();
mcHint.removeMovieClip();
fRemoveAllTiles();
mcGameEndBack.removeMovieClip();
if (mcGameEnd != undefined) {
unloadMovie (mcGameEnd);
mcGameEnd.removeMovieClip();
}
}
function u_fXMLGameInfo(a_xmlPacket) {
var _local1 = a_xmlPacket;
var _local2 = this;
for (var _local3 in _local1.attributes) {
_local2[_local3] = _local1.attributes[_local3];
}
g_numRandomSeed = randomseed;
var numSeconds = ((60 * Number(timer.substr(3, 2))) + Number(timer.substr(6, 2)));
var tileSetups = _local1.attributes.tilesetups_value;
arrSets = tileSetups.split(",");
mcTimer.setTimer(numSeconds);
}
function u_fXMLRemoveTiles(a_XMLPacket) {
g_blnStepExecute = false;
var numUserId = Number(a_XMLPacket.attributes.userid);
var numTimer = Number(a_XMLPacket.attributes.timer);
if (g_blnRestoreGame && (numUserId == g_objUser.numUserId)) {
var strTileName1 = String(a_XMLPacket.attributes.tile1);
var strTileName2 = String(a_XMLPacket.attributes.tile2);
if ((eval (strTileName1) != undefined) && (eval (strTileName1).removing == false)) {
if (objFirstSelected != null) {
fShowTileSelected(objFirstSelected, false);
objFirstSelected = null;
}
fSelectTile(eval (strTileName1), numUserId);
if (strTileName2 != "") {
fSelectTile(eval (strTileName2), numUserId);
}
mcTimer.setTimer(numTimer);
}
}
g_blnStepExecute = true;
}
function u_fXMLHideTiles(a_XMLPacket) {
g_blnStepExecute = false;
this.onEnterFrame = function () {
fRemovingTiles();
fRemoveNextTile();
fRemoveNextTile();
};
g_blnStepExecute = true;
}
function u_fXMLNewDeal(a_XMLPacket) {
g_blnStepExecute = false;
var _local1 = Number(a_XMLPacket.attributes.userid);
var _local2 = Number(a_XMLPacket.attributes.timer);
if (g_blnRestoreGame && (_local1 == g_objUser.numUserId)) {
fDealNewTileset();
mcTimer.setTimer(_local2);
}
g_blnStepExecute = true;
}
function fInitSetArray() {
arrSet.splice(0);
var _local2 = 0;
while (_local2 < 15) {
arrSet[_local2] = new Array(8);
var _local1 = 0;
while (_local1 < 8) {
arrSet[_local2][_local1] = new Array();
_local1++;
}
_local2++;
}
}
function fInitAllTiles() {
var _local1 = 0;
while (_local1 < arrTiles.length) {
arrTiles[_local1]._x = numDeckX;
arrTiles[_local1]._y = numDeckY;
arrTiles[_local1]._visible = false;
arrTiles[_local1].numLayer = 0;
arrTiles[_local1].removing = false;
arrTiles[_local1].freeTop = false;
arrTiles[_local1].freeSide = false;
arrTiles[_local1].arrSet = new Array({x:-1, y:-1});
arrTiles[_local1].swapDepths(100 + _local1);
_local1++;
}
arrDeck = arrTiles.slice(0);
objFirstSelected = null;
}
function fHideAllTiles() {
var _local1 = arrDeck.length - 1;
while (_local1 >= 0) {
arrDeck[_local1]._visible = false;
_local1--;
}
}
function fShowAllTiles() {
var _local1 = arrDeck.length - 1;
while (_local1 >= 0) {
arrDeck[_local1]._visible = true;
_local1--;
}
}
function fRemoveAllTiles() {
var _local1 = arrTiles.length - 1;
while (_local1 >= 0) {
arrTiles[_local1].removeMovieClip();
_local1--;
}
arrTiles.splice(0);
}
function fCreateTiles() {
fRemoveAllTiles();
var numCnt = arrTilesDef.length;
var numTilesCnt = 0;
var i = 0;
while (i < numCnt) {
var j = 0;
while (j < arrTilesDef[i].copy) {
numTilesCnt++;
createEmptyMovieClip("Tile" + numTilesCnt, 100 + numTilesCnt);
var newTile = eval ("Tile" + numTilesCnt);
newTile._visible = false;
newTile.clipName = arrTilesDef[i].clipName;
newTile.name = arrTilesDef[i].name;
newTile.suit = arrTilesDef[i].suit;
newTile.cost = arrTilesDef[i].cost;
newTile.match = arrTilesDef[i].match;
newTile.hint = arrTilesDef[i].hint;
newTile.attachMovie(strPrefix + arrTilesDef[i].clipName, "image", 1);
if (newTile.image.animation != undefined) {
newTile.image.animation.gotoAndStop(1);
}
newTile.attachMovie(strPrefix + "TileBtn", "button", 2);
newTile.button._x = numTileWidth / 2;
newTile.button._y = numTileHeight / 2;
arrTiles.push(newTile);
j++;
}
i++;
}
}
function fShowHintForTile(a_Tile) {
var _local1 = a_Tile;
mcHint.tile.removeMovieClip();
mcHint.txtTileName.text = "";
mcHint.txtPoints.text = "";
if (fIsTopFree(_local1) == false) {
} else {
if (blnAnimation && (_local1.image.animation != undefined)) {
_local1.image.animation.gotoAndPlay(2);
}
mcHint.attachMovie("front " + _local1.clipName, "Tile", 1);
mcHint.tile._x = (-mcHint.tile._width) / 2;
mcHint.tile._y = (-mcHint.tile._height) / 2;
mcHint.txtTileName.text = _local1.hint;
mcHint.txtPoints.text = "value: " + _local1.cost;
}
}
function fDecodeTilesSet(a_set) {
var numCnt = Math.floor(a_set.length / 3);
var _local1 = 0;
while (_local1 < numCnt) {
if (arrDeck[_local1] == undefined) {
return;
}
var _local2 = a_set.substr(_local1 * 3, 3);
var x = (_local2.charCodeAt(0) - 65);
var _local3 = _local2.charCodeAt(1) - 65;
var layer = (_local2.charCodeAt(2) - 65);
arrDeck[_local1].arrSet[0].x = x;
arrDeck[_local1].arrSet[0].y = _local3;
arrDeck[_local1].numLayer = layer;
arrSet[x][_local3].push(arrDeck[_local1]);
_local1++;
}
}
function fArrangeTiles2D() {
var numCnt = arrDeck.length;
var _local1 = 0;
while (_local1 < numCnt) {
var x = arrDeck[_local1].arrSet[0].x;
var _local3 = arrDeck[_local1].arrSet[0].y;
var _local2 = arrDeck[_local1].numLayer;
arrDeck[_local1]._x = numGridX + (numTileWidth * x);
arrDeck[_local1]._y = (numGridY + (numTileHeight * _local3)) - ((_local2 - 1) * numTileThickness);
arrDeck[_local1].numDepth = ((2000 + _local2) + (_local3 * 1000)) + (10 * (numSetX - x));
arrDeck[_local1].swapDepths(arrDeck[_local1].numDepth);
var newColor = new Color(arrDeck[_local1]);
newColor.setTransform(arrColorTransform[_local2 - 1]);
_local1++;
}
}
function fArrangeTiles3D() {
var numCnt = arrDeck.length;
var _local1 = 0;
while (_local1 < numCnt) {
var x = arrDeck[_local1].arrSet[0].x;
var _local3 = arrDeck[_local1].arrSet[0].y;
var _local2 = arrDeck[_local1].numLayer - 1;
arrDeck[_local1]._x = ((-10 + (36 * x)) + (22.4 * _local3)) + (_local2 * 2);
arrDeck[_local1]._y = ((190 - (12.4 * x)) + (38.4 * _local3)) - (_local2 * 13.5);
arrDeck[_local1].numDepth = ((2000 + _local2) + (_local3 * 1000)) + (10 * (numSetX - x));
arrDeck[_local1].swapDepths(arrDeck[_local1].numDepth);
var newColor = new Color(arrDeck[_local1]);
newColor.setTransform(arrColorTransform[_local2]);
_local1++;
}
}
function fSuffleTiles() {
var numLength = arrDeck.length;
var _local1 = 0;
while (_local1 < numLength) {
var _local2 = g_fGetRandomValue(numLength);
var _local3 = arrDeck[_local1];
arrDeck[_local1] = arrDeck[_local2];
arrDeck[_local2] = _local3;
_local1++;
}
}
function fClickOnTile(a_Tile) {
if ((((!g_blnGameStarted) || (!g_blnPlayEnable)) || (g_blnGameOver)) || (g_blnDisconnected)) {
return(undefined);
}
fSelectTile(a_Tile, g_objUser.numUserId);
}
function fSelectTile(a_Tile, a_UserId) {
var _local1 = a_Tile;
if (objFirstSelected != null) {
if (objFirstSelected == _local1) {
fShowTileSelected(_local1, false);
objFirstSelected = null;
} else {
if (!fCheckIsTileFree(_local1)) {
trace("============================== SECOND NOT FREE " + _local1);
sndWrong.start();
return;
}
var _local2 = objFirstSelected._name;
var _local3 = _local1._name;
if (fCheckMatchForPair(objFirstSelected, _local1)) {
fShowTileSelected(_local1, true);
fRemovePairOfTiles(objFirstSelected, _local1, a_UserId);
if (a_UserId == g_objUser.numUserId) {
mcAvatar.numRemovePairs++;
if (!g_blnRestoreGame) {
fSendStepToServer(_local2, _local3);
}
}
} else {
fShowTileSelected(objFirstSelected, false);
fShowTileSelected(_local1, true);
objFirstSelected = _local1;
}
}
} else if (!fCheckIsTileFree(_local1)) {
trace("============================== FIRST NOT FREE " + _local1);
if (!g_blnRestoreGame) {
sndWrong.start();
}
} else {
fShowTileSelected(_local1, true);
objFirstSelected = _local1;
}
}
function fCheckMatchForPair(a_Tile1, a_Tile2) {
var _local1 = a_Tile1;
var _local2 = a_Tile2;
if ((_local1 == undefined) || (_local2 == undefined)) {
return(false);
}
if ((!fIsTopFree(_local1)) || (!fIsTopFree(_local2))) {
return(false);
}
if (((_local1.match == "clip") && (_local2.match == "clip")) && (_local1.clipName == _local2.clipName)) {
return(true);
}
if (((_local1.match == "suit") && (_local2.match == "suit")) && (_local1.suit == _local2.suit)) {
return(true);
}
return(false);
}
function fRemovePairOfTiles(a_Tile1, a_Tile2, a_UserId) {
var _local1 = a_Tile1;
var _local2 = a_Tile2;
if (!g_blnRestoreGame) {
sndCorrect.start();
}
objFirstSelected = null;
var blnReshuffle = false;
var _local3 = _local1.cost;
fRemoveFromSet(_local1);
fRemoveFromDeck(_local1);
_local1.removing = true;
if (_local1.freeSide == "left") {
_local1.swapDepths((2000 + (_local1.arrSet[0].y * 1000)) + 500);
}
if ((_local1.image.animation == undefined) || (!blnAnimation)) {
_local1.step = 0;
arrRemoving.push(_local1);
} else {
_local1.image.gotoAndPlay(2);
}
if (_local2 != null) {
fRemoveFromSet(_local2);
fRemoveFromDeck(_local2);
_local2.removing = true;
if (_local2.freeSide == "left") {
_local2.swapDepths((2000 + (_local2.arrSet[0].y * 1000)) + 500);
}
if ((_local2.image.animation == undefined) || (!blnAnimation)) {
_local2.step = 0;
arrRemoving.push(_local2);
} else {
_local2.image.gotoAndPlay(2);
}
}
if (numPoints != 0) {
var numPoints = ((arrDeck.length * _local3) / 2);
mcAvatar.changeScore(numPoints);
}
if (arrDeck.length <= 1) {
if (arrSets.length > 0) {
fDealNewTileset();
} else {
fGameOver("Game Over");
}
}
fCheckNoMoreMatches();
}
function fQuickReshuffle() {
clearInterval(numReshuffleInt);
fReshuffle(0);
fEndReshuffle();
}
function fStartReshuffle() {
if (arrDeck.length <= 1) {
return(undefined);
}
blnReshuffling = true;
mcTimer.stopTimer();
g_blnPlayEnable = false;
g_blnStepExecute = false;
}
function fReshuffle(a_num) {
var numLength = arrDeck.length;
var numSlice = ((g_blnRestoreGame || (!blnAnimation)) ? (numLength) : (Math.ceil(numLength / 20)));
var numStart = (a_num * numSlice);
var numEnd = ((a_num + 1) * numSlice);
if (numEnd >= numLength) {
numEnd = numLength;
}
var _local1 = numStart;
while (_local1 < numEnd) {
var _local2 = g_fGetRandomValue(numLength);
if (arrDeck[_local1] == undefined) {
return;
}
var _local3 = new Object();
_local3.arrSet = arrDeck[_local1].arrSet.slice(0);
_local3.numLayer = arrDeck[_local1].numLayer;
_local3.numDepth = arrDeck[_local1].numDepth;
_local3.x = arrDeck[_local1]._x;
_local3.y = arrDeck[_local1]._y;
fRemoveFromSet(arrDeck[_local1]);
arrSet[arrDeck[_local2].arrSet[0].x][arrDeck[_local2].arrSet[0].y].push(arrDeck[_local1]);
arrDeck[_local1].arrSet = arrDeck[_local2].arrSet.slice(0);
arrDeck[_local1].numLayer = arrDeck[_local2].numLayer;
arrDeck[_local1].numDepth = arrDeck[_local2].numDepth;
arrDeck[_local1].freeTop = false;
arrDeck[_local1].freeSide = false;
arrDeck[_local1]._x = arrDeck[_local2]._x;
arrDeck[_local1]._y = arrDeck[_local2]._y;
arrDeck[_local1]._visible = false;
fRemoveFromSet(arrDeck[_local2]);
arrSet[_local3.arrSet[0].x][_local3.arrSet[0].y].push(arrDeck[_local2]);
arrDeck[_local2].arrSet = _local3.arrSet.slice(0);
arrDeck[_local2].numLayer = _local3.numLayer;
arrDeck[_local2].numDepth = _local3.numDepth;
arrDeck[_local2].freeTop = false;
arrDeck[_local2].freeSide = false;
arrDeck[_local2]._x = _local3.x;
arrDeck[_local2]._y = _local3.y;
arrDeck[_local1].swapDepths(arrDeck[_local1].numDepth);
var newColor1 = new Color(arrDeck[_local1]);
newColor1.setTransform(arrColorTransform[arrDeck[_local1].numLayer - 1]);
arrDeck[_local2].swapDepths(arrDeck[_local2].numDepth);
var newColor2 = new Color(arrDeck[_local2]);
newColor2.setTransform(arrColorTransform[arrDeck[_local2].numLayer - 1]);
_local1++;
}
}
function fEndReshuffle() {
blnReshuffling = false;
if (!g_blnRestoreGame) {
var _local2 = arrDeck.length;
var _local1 = 0;
while (_local1 < _local2) {
arrDeck[_local1]._visible = true;
_local1++;
}
fCheckNoMoreMatches();
if (blnAnimation) {
mcTimer.startTimer();
}
g_blnPlayEnable = true;
}
g_blnStepExecute = true;
}
function fRemoveFromSet(a_Tile) {
var _local3 = a_Tile;
var _local2 = arrSet[_local3.arrSet[0].x][_local3.arrSet[0].y];
var _local1 = _local2.length - 1;
while (_local1 >= 0) {
if (_local2[_local1] == _local3) {
_local2.splice(_local1, 1);
return;
}
_local1--;
}
}
function fRemoveFromDeck(a_Tile) {
var _local2 = a_Tile;
var _local1 = 0;
while (_local1 < arrDeck.length) {
if (arrDeck[_local1] == _local2) {
arrDeck.splice(_local1, 1);
return;
}
_local1++;
}
}
function fShowTileSelected(a_Tile, a_flag) {
var _local1 = a_Tile;
if (_local1 == undefined) {
} else if (a_flag) {
_local1.select.removeMovieClip();
_local1.attachMovie(strPrefix + "selected", "select", 3);
_local1.select._alpha = 75;
} else {
_local1.select.removeMovieClip();
}
}
function fCheckIsTileFree(a_Tile) {
var _local1 = a_Tile;
if (fIsTopFree(_local1)) {
if (fIsRightFree(_local1)) {
_local1.freeSide = "right";
return(true);
}
if (fIsLeftFree(_local1)) {
_local1.freeSide = "left";
return(true);
}
_local1.freeSide = "none";
return(false);
}
return(false);
}
function fIsTopFree(a_Tile) {
var _local3 = a_Tile;
if (_local3.freeTop) {
return(true);
}
var blnResult = true;
var _local2 = arrSet[_local3.arrSet[0].x][_local3.arrSet[0].y];
var _local1 = _local2.length - 1;
while (_local1 >= 0) {
if (_local2[_local1].numLayer > _local3.numLayer) {
blnResult = false;
break;
}
_local1--;
}
_local3.freeTop = blnResult;
return(blnResult);
}
function fIsRightFree(a_Tile) {
var _local3 = true;
var _local2 = arrSet[a_Tile.arrSet[0].x + 1][a_Tile.arrSet[0].y];
if (_local2 != undefined) {
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1].numLayer >= a_Tile.numLayer) {
_local3 = false;
break;
}
_local1++;
}
}
return(_local3);
}
function fIsLeftFree(a_Tile) {
var _local3 = true;
var _local2 = arrSet[a_Tile.arrSet[0].x - 1][a_Tile.arrSet[0].y];
if (_local2 != undefined) {
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1].numLayer >= a_Tile.numLayer) {
_local3 = false;
break;
}
_local1++;
}
}
return(_local3);
}
function fRemovingTiles() {
if (arrRemoving.length == 0) {
} else {
var _local1 = arrRemoving.length - 1;
while (_local1 >= 0) {
if (((arrRemoving[_local1].step > 4) || (!blnAnimation)) || (g_blnRestoreGame)) {
arrRemoving[_local1].removeMovieClip();
arrRemoving.splice(_local1, 1);
} else {
if (arrRemoving[_local1].freeSide == "right") {
arrRemoving[_local1]._x = arrRemoving[_local1]._x + numStepX;
arrRemoving[_local1]._y = arrRemoving[_local1]._y - numStepY;
} else if (arrRemoving[_local1].freeSide == "left") {
arrRemoving[_local1]._x = arrRemoving[_local1]._x - numStepX;
arrRemoving[_local1]._y = arrRemoving[_local1]._y + numStepY;
} else {
arrRemoving[_local1]._alpha = arrRemoving[_local1]._alpha - 20;
}
arrRemoving[_local1].step++;
}
_local1--;
}
}
}
function fChangeLayout() {
strPrefix = (blnLayout2d ? "front " : "");
fHideAllTiles();
if (blnLayout2d) {
mcGrid.gotoAndStop("2d");
numStepX = 3;
numStepY = 0;
fArrangeTiles2D();
} else {
mcGrid.gotoAndStop("3d");
numStepX = 3;
numStepY = 1;
fArrangeTiles3D();
}
var _local1 = 0;
while (_local1 < arrDeck.length) {
fChangeTileLayout(arrDeck[_local1]);
_local1++;
}
fShowAllTiles();
}
function fChangeTileLayout(a_Tile) {
var _local1 = a_Tile;
_local1.image.removeMovieClip();
_local1.attachMovie(strPrefix + _local1.clipName, "image", 1);
if (_local1.image.animation != undefined) {
_local1.image.animation.gotoAndStop(1);
}
_local1.button.removeMovieClip();
_local1.attachMovie(strPrefix + "TileBtn", "button", 2);
if (objFirstSelected == _local1) {
fShowTileSelected(_local1, true);
}
}
function fSendStepToServer(a_TileName1, a_TileName2) {
if ((a_TileName1 != undefined) && (a_TileName2 != undefined)) {
var _local1 = mcAvatar.getScore();
var _local2 = mcTimer.getTimer();
g_fSendStep(((((((("<removetiles tile1=\"" + a_TileName1) + "\" tile2=\"") + a_TileName2) + "\" score=\"") + _local1) + "\" timer=\"") + _local2) + "\" />");
}
}
function fCheckNoMoreMatches() {
if (blnReshuffling) {
} else {
var _local3 = arrDeck.length;
var _local2 = 0;
while (_local2 < _local3) {
if (fCheckIsTileFree(arrDeck[_local2])) {
if (arrDeck[_local2].match == "wand") {
return(false);
}
var _local1 = _local3 - 1;
while (_local1 >= 0) {
if ((_local2 != _local1) && (fCheckIsTileFree(arrDeck[_local1]))) {
if (fCheckMatchForPair(arrDeck[_local2], arrDeck[_local1])) {
return(undefined);
}
}
_local1--;
}
}
_local2++;
}
mcMessage.gotoAndPlay("hide");
if (arrSets.length > 0) {
fDealNewTileset();
} else {
fGameOver("No More Matches");
}
}
return(undefined);
}
function fGameOver(a_reason) {
if (g_blnGameOver) {
} else {
g_fSendStep("<hidetiles/>");
var _local1 = -1;
if (mcAvatar.numLives <= 0) {
_local1 = ((g_objUser.numUserId == g_objPlayer1.numUserId) ? (g_objPlayer2.numUserId) : (g_objPlayer1.numUserId));
} else {
var _local3 = mcAvatar1.getScore();
var _local2 = mcAvatar2.getScore();
if (_local3 > _local2) {
_local1 = g_objPlayer1.numUserId;
} else if (_local3 < _local2) {
_local1 = g_objPlayer2.numUserId;
}
}
g_fGameOver(_local1, a_reason);
}
}
function fShowMessage(a_msg, a_time) {
var _local1 = a_msg;
if ((_local1 == undefined) || (_local1 == "")) {
} else {
mcMessage.gotoAndStop(1);
mcMessage.txtMsg.text = _local1;
mcMessage.txtMsg._y = (-mcMessage.txtMsg.textHeight) / 2;
mcMessage.numDelay = a_time * 1000;
mcMessage.gotoAndPlay("show");
}
}
function fTimerWarning() {
sndTimerWarning.start();
mcTimer.timerWarning = null;
}
function fRemoveNextTile() {
if (arrDeck.length == 0) {
this.onEnterFrame = function () {
fRemovingTiles();
};
} else {
var _local2 = g_fGetRandomValue(arrDeck.length);
var _local1 = arrDeck[_local2];
fRemoveFromSet(_local1);
arrDeck.splice(_local2, 1);
_local1.step = 0;
arrRemoving.push(_local1);
}
}
function fStartTimer() {
clearInterval(numStartTimerInt);
g_blnPlayEnable = true;
mcTimer.startTimer();
}
function fDealNewTileset() {
mcTimer.stopTimer();
if (!g_blnRestoreGame) {
numStartTimerInt = setInterval(fStartTimer, 2000);
g_fSendStep(("<newdeal timer=\"" + mcTimer.getTimer()) + "\"/>");
fShowMessage("Dealing New Tileset", 2);
}
fNextTileSet();
}
function fNextTileSet() {
fCreateTiles();
fInitAllTiles();
fSuffleTiles();
fInitSetArray();
fDecodeTilesSet(arrSets[0]);
if (!g_blnRestoreGame) {
fChangeLayout();
}
arrSets.splice(0, 1);
if (arrSets.length == 0) {
btnDealNew._visible = false;
}
}
_quality = "BEST";
this.onEnterFrame = function () {
fRemovingTiles();
};
Instance of Symbol 368 MovieClip "mcMessage" in Frame 13
onClipEvent (load) {
this._visible = false;
}
Frame 21
g_fSendToCSA(g_arrStdAnswersToCSA.gamestarted);
if (g_blnStandAloneGame) {
g_fXMLStandAlone("");
gotoAndPlay ("startGame");
} else if (g_blnPracticeGame) {
gotoAndPlay ("startGame");
} else if (g_blnRestoreGame) {
g_fStopGameStepExecute();
gotoAndPlay ("restoreGame");
} else {
if (mcSynchronize == undefined) {
attachMovie("mcSynchronize", "mcSynchronize", g_numMsgDepth);
g_fCenter(mcSynchronize);
}
if ((g_strGameType.substr(1, 1) == "2") || (g_strGameType.substr(1, 1) == "3")) {
mcSynchronize.gotoAndStop("server");
} else {
mcSynchronize.gotoAndStop("opponent");
}
g_fSendStep(g_arrStdAnswersToCSA.readytogo);
g_blnStepExecute = true;
stop();
}
Frame 29
play();
Frame 36
if (g_arrGameSteps.length > 0) {
if ((g_lvlScoreBoard != null) && (g_lvlScoreBoard.blnLoaded)) {
g_fStartGameStepExecute();
}
gotoAndPlay ("restoreGame");
} else {
gotoAndPlay ("startGame");
}
Frame 37
var numCountDown;
var numStartCountDown = getTimer();
strCountDown = "05";
sndStart.start();
if (mcSynchronize != undefined) {
mcSynchronize.removeMovieClip();
}
Frame 45
numCountDown = 5 - Math.floor((getTimer() - numStartCountDown) / 1000);
if (numCountDown > 0) {
strCountDown = "0" + String(numCountDown);
} else {
strCountDown = "00";
}
Frame 47
if (numCountDown > 0) {
gotoAndPlay ("countDown");
}
Frame 58
Frame 59
stop();
curtain.removeMovieClip();
mcStart.removeMovieClip();
u_fStartGame();
Symbol 13 Button
on (release) {
_root.sndClick.start();
this.removeMovieClip();
}
Symbol 20 Button
on (release, keyPress "<Enter>") {
_parent.u_fChangeOptions();
this.removeMovieClip();
}
Symbol 28 Button
on (release) {
_root.sndClick.start();
if (_currentframe > 1) {
_parent.setBoard2d(false);
} else {
_parent.setBoard2d(true);
}
}
Symbol 30 MovieClip Frame 1
stop();
Symbol 30 MovieClip Frame 6
stop();
Symbol 32 Button
on (release) {
_root.sndClick.start();
if (_currentframe > 1) {
_parent.setBoard2d(true);
} else {
_parent.setBoard2d(false);
}
}
Symbol 33 MovieClip Frame 1
stop();
Symbol 33 MovieClip Frame 6
stop();
Symbol 40 Button
on (release) {
_root.sndClick.start();
_root.myBlnSoundOn = false;
_root.g_fSetSoundOff();
this.gotoAndStop("on");
}
Symbol 43 Button
on (release) {
_root.myBlnSoundOn = false;
_root.sndClick.start();
_root.g_fSetSoundOn();
this.gotoAndStop("off");
}
Symbol 44 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 6
stop();
Symbol 46 Button
on (release, releaseOutside) {
if (_currentframe == 1) {
_root.sndClick.start();
play();
}
}
Symbol 56 Button
on (release, releaseOutside) {
play();
}
Symbol 57 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 2
Symbol 57 MovieClip Frame 8
stop();
Symbol 57 MovieClip Frame 15
gotoAndStop (1);
Symbol 58 MovieClip [mcOptions] Frame 1
function setBoard2d(flag) {
if (flag) {
mcCBX_2d.gotoAndStop("on");
mcCBX_3d.gotoAndStop("off");
blnLayout2d = true;
} else {
mcCBX_2d.gotoAndStop("off");
mcCBX_3d.gotoAndStop("on");
blnLayout2d = false;
}
if (_root.myBlnSoundOn) {
mcSound.gotoAndStop("off");
} else {
mcSound.gotoAndStop("on");
}
}
function setAnimation(flag) {
if (flag) {
mcCBX_Animation.gotoAndStop("on");
blnAnimation = true;
} else {
mcCBX_Animation.gotoAndStop("off");
blnAnimation = false;
}
}
this._visible = false;
_parent.u_fPreopenOptions();
Symbol 58 MovieClip [mcOptions] Frame 2
stop();
this._visible = true;
Symbol 281 Button
on (release) {
this._parent._parent.fClickOnTile(this._parent);
}
on (rollOver) {
this._parent._parent.fShowHintForTile(this._parent);
}
Symbol 285 Button
on (release) {
this._parent._parent.fClickOnTile(this._parent);
}
on (rollOver) {
this._parent._parent.fShowHintForTile(this._parent);
}
Symbol 289 MovieClip Frame 1
stop();
Symbol 293 Button
on (release) {
this.removeMovieClip();
}
Symbol 297 MovieClip [mcUnknownPacket] Frame 1
stop();
Symbol 304 MovieClip [mcSynchronize] Frame 1
stop();
Symbol 304 MovieClip [mcSynchronize] Frame 10
stop();
Symbol 305 MovieClip [mcScoreboardBack] Frame 1
stop();
Symbol 308 Button
on (release) {
_parent.g_fClickResignYes();
btnYes._visible = (btnNo._visible = false);
}
Symbol 310 Button
on (release) {
_parent.g_fClickResignNo();
this.removeMovieClip();
}
Symbol 312 Button
on (release) {
_parent.g_fclickStopWatchYes();
btnYes._visible = (btnNo._visible = false);
}
Symbol 313 Button
on (release) {
_parent.g_fClickStopWatchNo();
this.removeMovieClip();
}
Symbol 315 MovieClip [mcResign] Frame 1
stop();
Symbol 320 MovieClip [mcGameOver] Frame 1
var numStartInterval = getTimer();
Symbol 320 MovieClip [mcGameOver] Frame 2
play();
Symbol 320 MovieClip [mcGameOver] Frame 7
if ((getTimer() - numStartInterval) < 5000) {
gotoAndPlay ("loop");
} else {
if (_parent.g_blnPracticeGame) {
_parent.g_fSendToCSA(_parent.g_arrStdAnswersToCSA.gamefinished);
} else {
var numType = Number(_parent.g_strGameType.substr(1, 1));
if ((numType == 2) || (numType == 3)) {
_parent.g_fSendStep("<scoreboard><gameranswer answer=\"0\"/></scoreboard>");
_parent.g_fSendToCSA(_parent.g_arrStdAnswersToCSA.gamefinished);
}
}
_parent.g_fStartGameStepExecute();
stop();
}
Symbol 321 Button
on (release) {
_parent.g_fXMLGameFinished();
}
Symbol 323 MovieClip [mcError] Frame 1
var numStartInterval = getTimer();
Symbol 323 MovieClip [mcError] Frame 2
play();
Symbol 323 MovieClip [mcError] Frame 7
if ((getTimer() - numStartInterval) < 3000) {
gotoAndPlay ("loop");
} else {
_parent.g_fXMLGameFinished();
stop();
}
Symbol 335 MovieClip [SBGAvatar] Frame 1
#initclip 2
SBGAvatar = function () {
this.init();
};
SBGAvatar.prototype = new MovieClip();
SBGAvatar.prototype.init = function () {
var _local1 = this;
_local1.strPlayerName = "PlayerName";
_local1.numPlayerId = 0;
_local1.strAvatarURL = "";
_local1.strSide = "left";
_local1.numAvatarWidth = 80;
_local1.numAvatarHeight = 81;
_local1.numScore = 0;
_local1.nameTextFormat = new TextFormat();
_local1.nameTextFormat = _local1.txtName.getTextFormat();
_local1.setPlayerName(_local1.strPlayerName);
};
SBGAvatar.prototype.loadAvatar = function (a_url) {
var _local1 = this;
_local1.strAvatarURL = a_url;
loadMovie (_local1.strAvatarURL, _local1.mcAvatar);
};
SBGAvatar.prototype.setLeft = function () {
var _local1 = this;
if (_local1.strSide != "left") {
_local1.mcAvatar._height = 81;
_local1.mcAvatar._xscale = 100;
_local1.mcAvatar._x = (-_local1.mcAvatar._width) / 2;
}
_local1.strSide = "left";
};
SBGAvatar.prototype.setRight = function () {
var _local1 = this;
if (_local1.strSide != "right") {
_local1.mcAvatar._height = 81;
_local1.mcAvatar._xscale = -100;
_local1.mcAvatar._x = _local1.mcAvatar._width / 2;
}
_local1.strSide = "right";
};
SBGAvatar.prototype.onLoadAvatar = function (a_avatar) {
var _local1 = this;
if (a_avatar.getBytesLoaded() == a_avatar.getBytesTotal()) {
if (_local1.strSide == "left") {
_local1.setLeft();
} else if (_local1.strSide == "right") {
_local1.setRight();
}
}
};
SBGAvatar.prototype.setPlayerName = function (a_name) {
var _local1 = this;
_local1.strPlayerName = a_name;
_local1.txtName.text = _local1.strPlayerName;
};
SBGAvatar.prototype.getPlayerName = function () {
return(this.strPlayerName);
};
SBGAvatar.prototype.setPlayerId = function (a_id) {
this.numPlayerId = a_id;
};
SBGAvatar.prototype.getPlayerId = function () {
return(this.numPlayerId);
};
SBGAvatar.prototype.setScore = function (a_newScore) {
this.numScore = parseInt(a_newScore);
this.showScore();
};
SBGAvatar.prototype.getScore = function () {
return(this.numScore);
};
SBGAvatar.prototype.changeScore = function (a_delta) {
this.numScore = this.numScore + parseInt(a_delta);
this.showScore();
};
SBGAvatar.prototype.showScore = function () {
this.mcScore.txtScore.text = String(this.numScore);
};
SBGAvatar.prototype.setNameTextFormat = function (a_newTextFormat) {
var _local1 = this;
_local1.nameTextFormat = a_newTextFormat;
_local1.txtName.setTextFormat(_local1.nameTextFormat);
};
SBGAvatar.prototype.getNameTextFormat = function () {
return(this.nameTextFormat);
};
Object.registerClass("SBGAvatar", SBGAvatar);
#endinitclip
Instance of Symbol 334 MovieClip "mcAvatar" in Symbol 335 MovieClip [SBGAvatar] Frame 1
onClipEvent (load) {
_parent.onLoadAvatar(this);
}
Symbol 337 MovieClip [SBGTimer] Frame 1
#initclip 1
SBGTimer = function () {
this.init();
};
SBGTimer.prototype = new MovieClip();
SBGTimer.prototype.init = function () {
var _local1 = this;
_local1.numStart = 0;
_local1.numRemainder = 0;
_local1.numLastTic = 0;
_local1.numTaskInterval = 0;
_local1.numLastTaskTime = 0;
_local1.numWarningTime = 0;
_local1.blnStop = true;
_local1.blnWarning = false;
_local1.blnBonus = false;
_local1.hColorOff = 3394815 /* 0x33CCFF */;
_local1.hColorOn = 16776960 /* 0xFFFF00 */;
_local1.showTime();
};
SBGTimer.prototype.onEnterFrame = function () {
if (!this.blnStop) {
this.tick();
}
};
SBGTimer.prototype.tick = function () {
var _local1 = this;
var _local2 = getTimer();
if (_local1.blnBonus) {
_local1.numRemainder = _local1.numRemainder - 1;
_local1.timeBonus();
} else {
_local1.numRemainder = _local1.numRemainder - ((_local2 - _local1.numLastTic) / 1000);
_local1.numLastTic = _local2;
}
_local1.showTime();
if (_local1.numRemainder <= 0) {
_local1.numRemainder = 0;
_local1.blnBonus = false;
_local1.stopTimer();
_local1.showTime();
_local1.timesRunOut();
} else if (!_local1.blnBonus) {
if ((Math.floor(_local1.numRemainder) == _local1.numWarningTime) && (!_local1.blnWarning)) {
_local1.blnWarning = true;
_local1.timerWarning();
}
if ((_local1.numTaskInterval > 0) && ((_local1.numLastTaskTime - _local1.numRemainder) >= _local1.numTaskInterval)) {
_local1.numLastTaskTime = _local1.numRemainder;
_local1.doTask();
}
}
};
SBGTimer.prototype.showTime = function () {
var _local3 = Math.round(this.numRemainder);
var _local2 = Math.floor(_local3 / 60);
var strMinutes = ((_local2 < 10) ? ("0" + String(_local2)) : (String(_local2)));
var _local1 = _local3 % 60;
var strSeconds = ((_local1 < 10) ? ("0" + String(_local1)) : (String(_local1)));
this.txtTime.text = (strMinutes + ":") + strSeconds;
};
SBGTimer.prototype.startTimer = function () {
var _local1 = this;
if (_local1.numRemainder <= 0) {
} else {
_local1.numLastTic = getTimer();
_local1.blnStop = false;
_local1.numLastTaskTime = _local1.numRemainder;
var _local2 = new Color(_local1.txtTime);
_local2.setRGB(_local1.hColorOn, 16);
_local2 = new Color(_local1.mcTime);
_local2.setRGB(_local1.hColorOn, 16);
_local1.showTime();
}
};
SBGTimer.prototype.startTimerAt = function (a_time) {
var _local1 = this;
if (a_time <= 0) {
} else {
_local1.numLastTic = getTimer();
_local1.numRemainder = a_time;
_local1.blnStop = false;
_local1.numLastTaskTime = _local1.numRemainder;
var _local2 = new Color(_local1.txtTime);
_local2.setRGB(_local1.hColorOn);
_local2 = new Color(_local1.mcTime);
_local2.setRGB(_local1.hColorOn, 16);
_local1.showTime();
}
};
SBGTimer.prototype.stopTimer = function () {
var _local1 = this;
_local1.blnStop = true;
var _local2 = new Color(_local1.txtTime);
_local2.setRGB(_local1.hColorOff);
_local2 = new Color(_local1.mcTime);
_local2.setRGB(_local1.hColorOff);
};
SBGTimer.prototype.getTimer = function () {
return(Math.floor(this.numRemainder * 10) / 10);
};
SBGTimer.prototype.setTimer = function (a_time) {
this.numRemainder = a_time;
this.showTime();
};
SBGTimer.prototype.setWarningTime = function (a_time) {
this.numWarningTime = a_time;
};
SBGTimer.prototype.setTaskInterval = function (a_time) {
this.numTaskInterval = a_time;
};
SBGTimer.prototype.startTimeBonus = function () {
this.blnBonus = true;
};
SBGTimer.prototype.timerWarning = function () {
};
SBGTimer.prototype.timesRunOut = function () {
};
SBGTimer.prototype.doTask = function () {
};
SBGTimer.prototype.timeBonus = function () {
};
Object.registerClass("SBGTimer", SBGTimer);
#endinitclip
Symbol 353 MovieClip Frame 1
stop();
Symbol 353 MovieClip Frame 6
stop();
Symbol 357 Button
on (release) {
_root.sndClick.start();
fDealNewTileset();
}
Symbol 368 MovieClip Frame 1
stop();
Symbol 368 MovieClip Frame 6
var numStartInterval = getTimer();
_visible = true;
if (_parent.g_objUser.blnTurn) {
_parent.fCheckNoMoreMatches();
}
play();
Symbol 368 MovieClip Frame 11
play();
Symbol 368 MovieClip Frame 13
if ((getTimer() - numStartInterval) < this.numDelay) {
gotoAndPlay ("loop");
} else {
gotoAndPlay ("hide");
}
Symbol 368 MovieClip Frame 14
play();
Symbol 368 MovieClip Frame 22
txtMsg.text = "";
_visible = false;
Symbol 372 MovieClip Frame 1
stop();
Symbol 375 MovieClip Frame 1
_root.mcStart.swapDepths(999999);
stop();
Symbol 379 Button
on (release) {
_root.sndClick.start();
_parent.g_fClickResign();
}
Symbol 380 MovieClip Frame 1
stop();
Symbol 383 Button
on (release) {
_root.sndClick.start();
_parent.g_fClickOptionsBtn();
}
Symbol 384 MovieClip Frame 1
stop();