Frame 1
function dateTimeParser(dateTimeIn) {
var dateTimeOut;
dateTimeOut = Date.convertTime(dateTimeIn, "milliseconds", "hours");
if (dateTimeOut == 24) {
dateTimeOut = (Date.convertTime(dateTimeIn, "milliseconds", "days") + " ") + ltxt("LC_DAY");
} else if ((dateTimeOut > 24) && (dateTimeOut < 168)) {
dateTimeOut = (Date.convertTime(dateTimeIn, "milliseconds", "days") + " ") + ltxt("LC_DAYS");
} else if (dateTimeOut < 1) {
if (parseInt(dateTimeOut) == 1) {
dateTimeOut = (dateTimeOut + " ") + ltxt("LC_HOUR");
} else {
dateTimeOut = (Date.convertTime(dateTimeOut, "hours", "minutes") + " ") + ltxt("LC_MINUTES");
}
} else if (dateTimeOut == 168) {
dateTimeOut = (Date.convertTime(dateTimeIn, "milliseconds", "weeks") + " ") + ltxt("WEEK");
} else if (dateTimeOut >= 168) {
dateTimeOut = (Date.convertTime(dateTimeIn, "milliseconds", "weeks") + " ") + ltxt("WEEKS");
} else {
dateTimeOut = (dateTimeOut + " ") + ltxt("LC_HOURS");
}
return(dateTimeOut);
}
function calcRoundEndTime(genericTourney) {
var roundCounter = 0;
var roundCalc = new Array();
var roundEndTime;
var numRounds;
var numRoundCounter;
if (genericTourney.type == Tourney.TYPE.KNOCKOUT) {
numRounds = genericTourney.playoffRounds;
numRoundCounter = numRounds;
roundCounter = 0;
while (roundCounter <= numRounds) {
roundCalc[roundCounter] = numRoundCounter;
numRoundCounter--;
roundCounter++;
}
roundEndTime = genericTourney.startDate + (genericTourney.roundLength * roundCalc[genericTourney.currentRound]);
} else {
var tCurrentRound = genericTourney.currentRound;
if (genericTourney.type == Tourney.TYPE.LEAGUE) {
trace2("League");
if (genericTourney.playoffs) {
trace2("League playoffs");
tCurrentRound = ((genericTourney.roundCount + genericTourney.playoffRounds) - genericTourney.currentRound) - 1;
}
}
trace2("curr round: " + tCurrentRound);
roundEndTime = genericTourney.startDate + (genericTourney.roundLength * (tCurrentRound + 1));
}
return(new Date(roundEndTime));
}
function inTourneyClubs(atour) {
var homeClubId = atour.club1;
var awayClubId = atour.club2;
if (userProfile.clubId == homeClubId) {
if (atour.hostClubStatus != "open") {
return(false);
}
return(true);
}
if (userProfile.clubId == awayClubId) {
if (atour.oppClubStatus != "open") {
return(false);
}
return(true);
}
return(false);
}
function calcWinningPercentage(aplayerstatsIn) {
if (isNaN(aplayerstatsIn.games) || (isNaN(aplayerstatsIn.wins))) {
return("");
}
var gamesPlayed = parseInt(aplayerstatsIn.games);
var wins = parseInt(aplayerstatsIn.wins);
var winPerc = (wins / gamesPlayed);
if (isNaN(winPerc)) {
return("0.000");
}
if (winPerc < 1) {
if (winPerc == 0) {
winPerc = "0.000";
} else {
winPerc = main.toFixed(winPerc, 3, false);
}
} else {
winPerc = main.toFixed(winPerc, 3, true);
}
return(winPerc);
}
function calcPoints(aplayerstatsIn) {
if (isNaN(aplayerstatsIn.games) || (isNaN(aplayerstatsIn.wins))) {
return("");
}
var wins = parseInt(aplayerstatsIn.wins);
var draws = parseInt(aplayerstatsIn.ties);
return((wins * 3) + draws);
}
function calcTourneyEndDate(genericTourney) {
var numRounds = genericTourney.roundCount;
var gameEndTime = (genericTourney.startDate + (genericTourney.roundLength * numRounds));
var gameEnd = new Date(gameEndTime);
var gameEndStr = ((gameEnd.getAbbrMonthString() + " ") + gameEnd.getDate());
return(gameEndStr);
}
function calcRoundFinishTime(genericTourney, nextRound) {
var currentRound = genericTourney.currentRound;
if (nextRound) {
currentRound = currentRound + 1;
}
if (currentRound == 0) {
currentRound = 1;
}
var roundEnd = new Date(genericTourney.startDate + (currentRound * genericTourney.roundLength));
var minutes = ((roundEnd.getMinutes() < 10) ? ("0" + roundEnd.getMinutes()) : (roundEnd.getMinutes()));
var roundEndStr = ((((((((roundEnd.get12Hours() + ":") + minutes) + " ") + (roundEnd.isAM() ? (ltxt("AM")) : (ltxt("PM")))) + ", ") + roundEnd.getAbbrMonthString()) + " ") + roundEnd.getDate());
return(roundEndStr);
}
function calcRoundStartTime(genericTourney, nextRound) {
var currentRound = genericTourney.currentRound;
if (nextRound) {
currentRound = currentRound + 1;
}
if (currentRound == 0) {
currentRound = 1;
}
var roundStart = ((genericTourney.startDate + (currentRound * genericTourney.roundLength)) - genericTourney.roundLength);
var now = new Date();
if (!nextRound) {
if (roundStart < now.getTime()) {
return(0);
}
}
roundStart = new Date(roundStart);
var minutes = ((roundStart.getMinutes() < 10) ? ("0" + roundStart.getMinutes()) : (roundStart.getMinutes()));
var roundEndStr = ((((((((roundStart.get12Hours() + ":") + minutes) + " ") + (roundStart.isAM() ? (ltxt("AM")) : (ltxt("PM")))) + ", ") + roundStart.getAbbrMonthString()) + " ") + roundStart.getDate());
return(roundEndStr);
}
function callJS(functionName, params) {
var arrParams = new Array();
var i = 1;
while (i < arguments.length) {
arrParams[i - 1] = arguments[i];
i++;
}
var p = arrParams.join("','");
var js = (((("javascript:" + functionName) + "('") + p) + "')");
if (_root.bBrowserHost != null) {
getURL (js);
}
}
function callJS1(functionName, params) {
var arrParams = new Array();
var i = 1;
while (i < arguments.length) {
arrParams[i - 1] = arguments[i];
i++;
}
var p = arrParams.join("','");
p = ("'" + p) + "'";
if (_root.bBrowserHost != null) {
fscommand (functionName, p);
} else {
trace2("NULL BROWSER HOST");
}
}
function setParent(childObj) {
trace(childObj._name);
var o = childObj._parent;
trace(typeof(o));
if (typeof(o) == "movieclip") {
if (o._name != "") {
str_mcPath = (o._name + "/") + str_mcPath;
}
setParent(o);
}
}
function callJS2(strRetVariableName, strFunction, params) {
var mc = this._name;
if (mc != "") {
str_mcPath = this._name;
setParent(this);
mc = "/" + str_mcPath;
strRetVariableName = (mc + ":") + strRetVariableName;
}
var arrParams = new Array();
var i = 1;
while (i < arguments.length) {
arrParams[i - 2] = arguments[i];
i++;
}
var p = arrParams.join("','");
p = ((((((("\"" + _root.flashObjectId) + "\",\"") + strRetVariableName) + "\",\"") + strFunction) + "('") + p) + "')\"";
if (_root.bBrowserHost != null) {
fscommand ("setValueFromJSFunction", p);
}
}
function getPogoAuthUrl(url, params) {
var currentDate = new Date();
var strUrl = (((((((((((((((gblHostURL + url) + "?site=") + main.gblSite) + "&game=") + _root.gblGameSite) + "&lkey=") + _global.lkey) + "&calltime=") + currentDate.toString()) + "&sku=") + _root.gameSKU) + "&locale=") + _global.gameLanguage) + "&") + params);
return(strUrl);
}
function getNodeValue(xmlString, nodeName1, nodeName2) {
var i = xmlString.indexOf(("<" + nodeName1) + ">");
if (i == -1) {
return("");
}
if (nodeName2 != null) {
i = xmlString.indexOf(("<" + nodeName2) + ">", i);
if (i == -1) {
return("");
}
i = i + (nodeName2.length + 2);
var j = xmlString.indexOf(("</" + nodeName2) + ">", i);
} else {
i = i + (nodeName1.length + 2);
var j = xmlString.indexOf(("</" + nodeName1) + ">", i);
}
var str = xmlString.substring(i, j);
if (str.length < 1) {
return("");
}
var n = 0;
while (n < (encTable.length / 2)) {
var nindex = str.indexOf(encTable[n * 2]);
while (nindex != -1) {
str = (str.slice(0, nindex) + encTable[(n * 2) + 1]) + str.slice(nindex + encTable[n * 2].length, str.length);
nindex = str.indexOf(encTable[n * 2]);
}
n++;
}
return(str);
}
function getInstallFolder() {
var tmpStr = "";
tmpStr = unescape(_root._url);
tmpStr = tmpStr.substr(0, tmpStr.lastIndexOf("\\"));
tmpStr = tmpStr.substr(0, tmpStr.lastIndexOf("\\"));
tmpStr = tmpStr.substr(0, tmpStr.lastIndexOf("\\") + 1);
return(tmpStr);
}
function checkServerError(xml) {
if (xml.childNodes[0].nodeName == "SERVER_ERROR") {
var a = (xml.toString().indexOf("::") + 2);
var b = xml.toString().indexOf(":", a);
var ret = xml.toString().substring(a, b);
main.trace2("Server Error " + ret);
if (Number(ret) == 10008) {
main.showConfirmDialog(ltxt("ESPN_NOTICE"), onSubscriptionOkCallBack, null, "");
} else {
main.showAlertDialog(ltxt("SERVER_ERROR_" + ret));
}
main.hideLoadingScreen();
if (Number(ret) == -1) {
main.navigate(main.MI_LOGOFF);
}
return(Number(ret));
}
return(0);
}
function onSubscriptionOkCallBack() {
if (_global.gameLanguage == "pt2") {
var Langcode = "pt_BR";
} else if (_global.gameLanguage == "cz") {
var Langcode = "cs";
} else if (_global.gameLanguage == "es_mx") {
var Langcode = "es_MX";
} else {
var Langcode = _global.gameLanguage;
}
trace2((((((((_root.gblSubscriptionPageUrl + "?site=") + _root.gblSite) + "&game=") + _root.gblGameSite) + "&lkey=") + _global.lkey) + "&lang=") + Langcode);
getURL ((((((((_root.gblSubscriptionPageUrl + "?site=") + _root.gblSite) + "&game=") + _root.gblGameSite) + "&lkey=") + _global.lkey) + "&lang=") + Langcode, "_new");
trace2("Lanch complete");
}
function checkServerErrorStr(string) {
if (string.indexOf("SERVER_ERROR") != -1) {
var a = (string.indexOf("::") + 2);
var b = string.indexOf(":", a);
var ret = string.substring(a, b);
main.trace2("Server Error " + ret);
main.showAlertDialog(ltxt("SERVER_ERROR_" + ret));
main.hideLoadingScreen();
if (Number(ret) == -1) {
main.navigate(main.MI_LOGOFF);
}
return(Number(ret));
}
return(0);
}
function htmlEncode(str) {
if (str.length < 1) {
return("");
}
var n = 1;
while (n < encTable.length) {
var nindex = str.indexOf(encTable[n]);
while (nindex != -1) {
str = (str.slice(0, nindex) + encTable[n - 1]) + str.slice(nindex + 1, str.length);
nindex = str.indexOf(encTable[n], nindex + 1);
}
n = n + 2;
}
return(str);
}
function easoEncode(str) {
trace2("easoEncode is being used; please remove!");
return(str);
}
function easoDecode(str) {
trace2("easoDecode is being used; please remove!");
return(str);
}
function selectField(fieldName) {
Selection.fieldName = fieldName;
_selectFieldIntervalId = setInterval(selectFieldCallback, 300);
}
function selectFieldCallback() {
clearInterval(_selectFieldIntervalId);
Selection.setFocus(Selection.fieldName);
Selection.getFocus();
}
function addKeyListener(callbackFunction) {
_keyListener.onKeyUp = function () {
if (Key.getCode() == 13) {
callbackFunction();
}
};
Key.addListener(_keyListener);
}
function removeKeyListener() {
Key.removeListener(_keyListener);
}
function toFixed(num, nDecimals, leadingZero) {
if (isNan(num)) {
return("0");
}
if (nDecimals == 0) {
return(Math.round(num));
}
if (leadingZero == null) {
leadingZero = true;
}
var zeroString = "";
var cnt = 0;
while (cnt <= nDecimals) {
zeroString = zeroString + "0";
cnt++;
}
if (Number(num) == 0) {
var zeros = ((leadingZero ? "0." : ".") + zeroString);
zeros = zeros.substring(0, (nDecimals + 1) + (leadingZero ? 1 : 0));
return(zeros);
}
var n1 = String(Math.round(num * Math.pow(10, nDecimals)) / Math.pow(10, nDecimals));
var cnt = n1.indexOf(".");
if (cnt == -1) {
cnt = n1.length;
n1 = n1 + ".";
}
if ((((cnt == 1) && (Number(n1) < 1)) && (!leadingZero)) && (Number(n1) > 0)) {
cnt = cnt - 1;
n1 = n1.substr(1);
}
n1 = n1 + zeroString;
cnt = cnt + (nDecimals + 1);
return(n1.substr(0, cnt));
}
function getHeadShotFromProfileObj(pObj) {
var profileCard = parseInt(pObj.profileCard);
if (profileCard < 0) {
return("../../commonImages/cards/default.jpg");
}
return(("../../commonImages/cards/" + profileCard) + "a.jpg");
}
function getCardImageFromProfileObj(pObj) {
var profileCard = parseInt(pObj.profileCard);
if (profileCard < 0) {
return("../../commonImages/cards/default.jpg");
}
return(("../../commonImages/cards/" + profileCard) + ".jpg");
}
function getSportsWrapper() {
return(spWrapperObject);
}
function initialize(_callBack) {
main.trace2("Initializing Next Game");
if (!riMatchupRoom) {
tourneyDM.getTourneyRooms(_callBack);
} else {
_callBack(true);
}
}
function prepareGame(_callBack) {
if (riMatchupRoom) {
main.trace2("is there a game for this tourney?? --> " + ntgCurrentGame.id);
main.trace2("the away user name is ==> " + ntgCurrentGame.awayUserName);
main.trace2("the home user name is ==> " + ntgCurrentGame.homeUserName);
if (parseInt(ntgCurrentGame.homeUserID) == parseInt(main.userProfile.id)) {
if (ntgCurrentGame.awayUserID > 0) {
main.profileDM.loadProfile(ntgCurrentGame.awayUserName, _callBack);
}
} else if (parseInt(ntgCurrentGame.awayUserID) == parseInt(main.userProfile.id)) {
if (ntgCurrentGame.homeUserID > 0) {
main.profileDM.loadProfile(ntgCurrentGame.homeUserName, _callBack);
}
}
} else {
main.trace2("\n****ERROR NO ROOM FOUND****");
_callBack(null);
}
}
function createGame() {
if (ntgCurrentGame.gameSettings == "") {
main.trace2("No Game settings.. getting");
main.showAlertDialog("Error: Game settings invalid");
} else {
main.trace2("Creating game: " + ntgCurrentGame.id);
spWrapperObject.createTourneyGame(ntgCurrentGame);
}
}
function _getNextTourneyGameCallBack(bSuccess, sXML) {
if (bSuccess) {
main.trace2("Calling create tourney game..");
} else {
main.trace2("\n******ERROR GETTING GAME SETTINGS******\n");
}
}
function isPlayerInNextTourneyGame(aplayer) {
var retVal = false;
if (aplayer && (ntgCurrentGame)) {
if ((parseInt(aplayer.pfid) == parseInt(ntgCurrentGame.homeUserID)) || (parseInt(aplayer.pfid) == parseInt(ntgCurrentGame.awayUserID))) {
retVal = true;
}
}
return(retVal);
}
function isMatchupGameMyNextTourneyGame(agame) {
var retVal = false;
if (agame && (ntgCurrentGame)) {
if (parseInt(agame.gTourMatchId) == parseInt(ntgCurrentGame.id)) {
retVal = true;
}
}
return(retVal);
}
function isPlayerHostOfNextTourneyGame(aplayer) {
var retVal = false;
if (aplayer && (ntgCurrentGame)) {
if (parseInt(aplayer.pfid) == parseInt(ntgCurrentGame.homeUserID)) {
retVal = true;
}
}
return(retVal);
}
function getPlayerByProfileID(profileID) {
var retPlayer = null;
var playerList = null;
var playerIterator = null;
var aplayer = null;
if (spWrapperObject) {
playerList = spWrapperObject.getPlayerList();
if (playerList) {
playerIterator = playerList.players.iterator();
while (playerIterator.hasNext()) {
aplayer = playerIterator.next();
if (aplayer) {
if (parseInt(aplayer.pfid) == parseInt(profileID)) {
retPlayer = aplayer;
break;
}
}
}
}
}
return(retPlayer);
}
function isPlayerMe(aplayer) {
var retVal = false;
if (aplayer) {
if (parseInt(aplayer.pfid) == parseInt(userProfile.id)) {
retVal = true;
} else if (parseInt(uniqueMpPlayerID) == parseInt(aplayer.pid)) {
main.trace2("uniqueMpPlayerID = aplayer.pid");
retVal = true;
} else if (piMe && (parseInt(piMe.pid) == parseInt(aplayer.pid))) {
main.trace2("piMe && piMe.pid = aplayer.pid");
retVal = true;
} else if ((aplayer == piMe) || (aplayer == piMe)) {
main.trace2("aplayer == piMe || aplayer == piMe");
retVal = true;
}
}
return(retVal);
}
function getMatchupGamePlayers() {
var homePlayer = (new main.PlayerInfo());
var awayPlayer = (new main.PlayerInfo());
var arRetPlayers = null;
if (ntgCurrentGame) {
if (ntgCurrentGame.homeUserID > 0) {
homePlayer = getPlayerByProfileID(ntgCurrentGame.homeUserID);
if (!homePlayer) {
homePlayer = new main.PlayerInfo();
homePlayer.pcardId = ntgCurrentGame.homeUserProfile.profileCard;
homePlayer.pfcId = ntgCurrentGame.homeUserProfile.profileCard;
homePlayer.playerObject.pdisconnects = Math.ceil(parseFloat(ntgCurrentGame.homeUserProfile.titleDisconnects) * 100);
homePlayer.playerObject.prating = ntgCurrentGame.homeUserProfile.titleRating;
}
}
if (ntgCurrentGame.awayUserID > 0) {
awayPlayer = getPlayerByProfileID(ntgCurrentGame.awayUserID);
if (!awayPlayer) {
awayPlayer = new main.PlayerInfo();
awayPlayer.pcardId = ntgCurrentGame.awayUserProfile.profileCard;
awayPlayer.pfcId = ntgCurrentGame.awayUserProfile.profileCard;
awayPlayer.playerObject.pdisconnects = Math.ceil(parseFloat(ntgCurrentGame.awayUserProfile.titleDisconnects) * 100);
awayPlayer.playerObject.prating = ntgCurrentGame.awayUserProfile.titleRating;
}
}
homePlayer.pfid = ntgCurrentGame.homeUserID;
homePlayer.pname = ntgCurrentGame.homeUserName;
homePlayer.pFullName = ntgCurrentGame.homeUserName;
homePlayer.teamId = ntgCurrentGame.homeTeamID;
if (ntgCurrentGame.homeUserID < 0) {
homePlayer.pcardId = -999;
homePlayer.pfcId = -999;
homePlayer.playerObject.pdisconnects = "-";
homePlayer.playerObject.prating = "-";
}
awayPlayer.pfid = ntgCurrentGame.awayUserID;
awayPlayer.pname = ntgCurrentGame.awayUserName;
awayPlayer.pFullName = ntgCurrentGame.awayUserName;
awayPlayer.teamId = ntgCurrentGame.awayTeamID;
if (ntgCurrentGame.awayUserID < 0) {
awayPlayer.pcardId = -999;
awayPlayer.pfcId = -999;
awayPlayer.playerObject.pdisconnects = "-";
awayPlayer.playerObject.prating = "-";
}
arRetPlayers = new Array(homePlayer, awayPlayer);
}
return(arRetPlayers);
}
function handleGUIErrorEvent(errCode, errMsg, isFatal) {
var errorCode = parseInt(errCode + "");
var errorMsg = null;
trace2((((("gui handlGUIEvent" + errorCode) + ":") + msg) + ":") + isFatal);
if (errorCode == _root.ERR_ROOM_FULL) {
_root.main.showAlertDialog(_root.ltxt("ALERT_ALL_ROOMS_FULL_TRY_AGAIN"));
} else {
switch (errorCode) {
case _root.ERR_UNAUTHORIZED_USER :
errorMsg = (((_root.ltxt("ERROR") + ":") + errorCode) + ": ") + _root.ltxt("ERR_UNAUTHORIZED_USER");
_root.showError(errorCode, "ERR_GENERAL_2");
goBackToHome();
return;
case _root.ERR_VERSION_TOO_OLD :
_root.showError(errorCode, "ERR_VERSION_TOO_OLD");
goBackToHome();
return;
case _root.ERR_BAD_QUALITY_CONN :
_root.showError(errorCode, "ERR_BAD_QUALITY_NETWORK_CONNECT");
goBackToHome();
return;
case _root.ERR_BOOTRED_PLAYER :
_root.showError(errorCode, "ERR_BOOTRED_USER");
goBackToHome();
return;
case _root.ERR_BAD_PASSWORD :
_root.showError(errorCode, "ERR_WRONG_PASSWORD");
return;
case _root.ERR_CREATOR_DESTROYED_GAME :
_root.showError(errorCode, "ERR_CREATOR_DESTROYED_GAME");
return;
case _root.ERR_GAME_ALREADY_LAUNCHED :
_root.showError(errorCode, "ERR_MATCHUP_GAME_ALREADY_LAUNCHED");
goBackToHome();
return;
case _root.ERR_PLAY_NOW_FAILED :
_root.showError(errorCode, "ERR_FAILED_TO_LAUNCH_GAME");
return;
case _root.ERR_BAD_ARENA_PASSWORD :
case _root.ERR_ROOM_NOT_FOUND :
case _root.ERR_TOO_MANY_PLAYERS :
case _root.ERR_BAD_SECOND_ARENA :
case _root.ERR_NON_CREATOR_LAUNCH :
case _root.ERR_KICKED_OFF :
case _root.ERR_NO_SUCH_SERVICE :
case _root.ERR_CHAT_SUPPRESSED :
case _root.ERR_BAD_PROTOCOL :
case _root.ERR_UNDER_PRIVILEGED :
errorMsg = (((_root.ltxt("ERROR") + ":") + errorCode) + ": ") + _root.ltxt("GENERAL_ERROR_2");
_root.showError(errorCode, "ERR_GENERAL_2");
return;
case _root.ERR_GAME_NOT_FOUND :
case _root.ERR_GAME_NOT_CREATED :
case _root.ERR_BAD_SECOND_GAME :
case _root.ERR_UNKNOWN_GAME :
case _root.ERR_GAME_LOCKED :
case _root.ERR_CHAT_AREA_GONE :
case _root.ERR_CHAT_AREA_FULL :
case _root.ERR_STILL_IN_GAME :
case _root.ERR_LEFT_GAME_ALREADY :
case _root.ERR_IS_MUTED :
case _root.ERR_NO_RANK_STATS :
case _root.ERR_OUTSIDE_RANK_RANGE :
case _root.ERR_IN_ANOTHER_ARENA :
case _root.ERR_GAME_NOT_READY :
case _root.ERR_INVALID_RATEPLAN :
case _root.ERR_GAME_RATE_EXCEEDED :
trace2("********SHOWING ERROR ****");
_root.showError(errorCode, "ERR_GENERAL_2");
return;
case _root.ERR_DUPE_UNIQUE_GAME_INFO :
case _root.ERR_DUPE_UNIQUE_PLAYER_INFO :
if (!spWrapperObject.isInInstantMatchup) {
_root.showError(errorCode, "ERR_ITEM_NOT_AVAILABLE");
} else {
doInstantMatchup(_root.bGInInstantMatchup);
}
return;
case _root.ERR_TOO_MUCH_BABBLE :
_root.showError(errorCode, "ERR_TOO_MUCH_BABBLE");
return;
case _root.ERR_PREVIOUSLY_DISMISSED :
case _root.ERR_RECONNECT_REPLACEMENT :
return;
default :
_root.showError(errorCode, "ERR_GENERAL_1");
goBackToHome();
}
}
}
function processGuiEvent() {
trace2(" ");
trace2("==============================NEW EVENT=========================================");
trace2("EVENT: " + this.eventId);
_mpEvent = this;
_playerID = _mpEvent.playerId;
switch (parseInt(_mpEvent.eventId)) {
case EVENT_ON_INITIALIZATION :
onInitialization();
return;
case EVENT_ON_CONNECTION_ERROR :
onConnectionError();
return;
case EVENT_ON_ERROR :
onError();
return;
case EVENT_ON_ERROR_RECEIVED :
onErrorReceived();
return;
case EVENT_ON_CHAT_RECEIVED :
onChatReceived();
return;
case EVENT_ON_GAME_REMOVED :
onGameRemoved();
return;
case EVENT_ON_GAME_STATE_UPDATE :
onGameStateUpdate();
return;
case EVENT_ON_LAUNCH_GAME :
onLaunchGame();
return;
case EVENT_ON_NEW_GAME :
onNewGame();
return;
case EVENT_ON_NEW_PLAYER :
onPlayerEntersRoom();
return;
case EVENT_ON_PLAYER_ENTERS_GAME :
onPlayerEntersGame();
return;
case EVENT_ON_PLAYER_GAME_STATE_UPDATE :
onPlayerGameStateUpdate();
return;
case EVENT_ON_PLAYER_LEAVES_GAME :
onPlayerLeavesGame();
return;
case EVENT_ON_PLAYER_LEAVES_ROOM :
onPlayerLeavesRoom();
return;
case EVENT_ON_PLAYER_ROOM_STATE_UPDATE :
onPlayerRoomStateUpdate();
return;
case EVENT_ON_ROOM_STATE_UPDATE :
onRoomStateUpdate();
return;
case EVENT_ON_RECONECTED :
onReconnected();
}
}
function onInitialization() {
main.trace2("on init");
uniqueMpPlayerID = parseInt(_playerID);
}
function onConnectionError() {
main.trace2("on connection error");
main.showAlertDialog("Could not connect to tournament room server");
MOVIE_CLIP.gotoAndStop(1);
}
function onError() {
main.trace2("on error");
main.showAlertDialog("An error occurred while communicating with the room server");
MOVIE_CLIP.gotoAndStop(1);
}
function onErrorReceived() {
main.trace2("on error received");
handleGUIErrorEvent(_mpEvent.errorCode, _mpEvent.errorMessage, _root.stringToBoolean(_mpEvent.errorIsFatal));
}
function onChatReceived() {
if (CHAT_MOVIE_CLIP) {
CHAT_MOVIE_CLIP.addMessage(_playerID, _mpEvent.chatMessage, spWrapperObject);
}
}
function onGameRemoved() {
main.trace2("on game removed");
if (giMatchupGame) {
if (giMatchupGame.id == _mpEvent.gameId) {
giMatchupGame = null;
}
}
}
function onGameStateUpdate() {
main.trace2("on game state update");
if (giMatchupGame) {
if (parseInt(_mpEvent.gameId) == parseInt(giMatchupGame.id)) {
updateHomeGUI(spWrapperObject.getPlayer(giMatchGame.getHostId()), false);
updateAwayGUI(spWrapperObject.getPlayer(giMatchGame.getOpponentId()), false);
}
}
}
function onLaunchGame() {
main.trace2((((("on launch game " + _mpEvent.gameId) + "/") + _mpEvent.launchCount) + "/") + _mpEvent.joinType);
var etype = null;
var CPUHost = null;
var CPUTeamId = null;
var CPUName = null;
if (ntgCurrentGame.awayUserID < 0) {
CPUTeamId = ntgCurrentGame.awayTeamID;
CPUName = ntgCurrentGame.awayUserName;
etype = 1;
CPUHost = false;
}
if (ntgCurrentGame.homeUserID < 0) {
CPUTeamId = ntgCurrentGame.homeTeamID;
CPUName = ntgCurrentGame.homeUserName;
etype = 1;
CPUHost = true;
}
main.trace2((("GEC etype in launch: " + etype) + " CPUTeamID: ") + CPUTeamId);
var canEndInTie = true;
if (ntgCurrentGame.isPlayoff) {
canEndInTie = false;
}
_root.mp_OnLaunch(canEndInTie, spWrapperObject, "L", etype, CPUHost, CPUTeamId, CPUName);
}
function onNewGame() {
main.trace2("*******EVENT ON NEW GAME**********");
trace2("Game ID: " + _mpEvent.gameId);
agame = spWrapperObject.getGame(parseInt(_mpEvent.gameId));
trace2("Got a game: " + agame);
if (agame) {
if (!giMatchupGame) {
if (parseInt(agame.gTourMatchId) == parseInt(ntgCurrentGame.id)) {
main.trace2("setting current game");
giMatchupGame = agame;
}
}
}
agame = null;
}
function onPlayerEntersRoom() {
main.trace2("****EVENT ON PLAYER ENTERS ROOM*****");
if (ntgCurrentGame.tourneyId != tSelectedLeague.id) {
return(undefined);
}
updateFormControls();
aplayer = spWrapperObject.getPlayer(parseInt(_playerID));
trace2("Player ID: " + _playerID);
var playerIsMe = isPlayerMe(aplayer);
var playerIsInNextGame = isPlayerInNextTourneyGame(aplayer);
var playerIsHost = isPlayerHostOfNextTourneyGame(aplayer);
if (playerIsMe) {
trace2("Player is ME!");
if (playerIsHost) {
main.trace2("I am the host, NO game has been created.. show create button!");
main.trace2("Checking if other player is CPU: " + ntgCurrentGame.awayUserID);
if (ntgCurrentGame.awayUserID < 0) {
main.trace2("Away player is CPU .. show create game buttons!!");
lblHomeStatus.text = "Start Game";
lblAwayStatus.text = "NA";
awayPlayerID = _playerID;
updateAwayGUI(null, true);
} else {
main.trace2("Away player is not CPU");
lblHomeStatus.text = "Create Game";
}
btnCreateGame._visible = true;
btnPlayNow._visible = false;
homePlayerID = _playerID;
updateHomeGUI(aplayer, false);
} else {
main.trace2("I am not the host of the next game");
main.trace2("Checking if other player is CPU...");
if (ntgCurrentGame.homeUserID < 0) {
main.trace2("Home player is CPU .. show create game buttons!!");
lblHomeStatus.text = "NA";
lblAwayStatus.text = "Start Game";
btnCreateGame._visible = true;
homePlayerID = _playerID;
updateHomeGUI(null, true);
} else {
main.trace2("player not CPU");
lblAwayStatus.text = "Waiting..";
btnCreateGame._visible = false;
}
btnPlayNow._visible = false;
awayPlayerID = _playerID;
updateAwayGUI(aplayer, false);
}
} else {
trace2("Player is NOT ME!");
if (playerIsInNextGame) {
trace2("Player is my opponent");
if (playerIsHost) {
main.trace2("player is the host, NO game has been created.. so we wait!");
lblHomeStatus.text = "Create Game";
homePlayerID = _playerID;
updateHomeGUI(aplayer, false);
} else {
main.trace2("player is not the host of the next game, I must be, so he waits");
awayPlayerID = _playerID;
updateAwayGUI(aplayer, false);
}
lblAwayStatus.text = "Waiting..";
} else {
trace2("Player is not my opponent");
}
}
aplayer = null;
if (getPlayerList()) {
getPlayerList().update(spWrapperObject);
}
}
function onPlayerEntersGame() {
main.trace2("****EVENT ON PLAYER ENTERS GAME*****");
main.startGame(spWrapperObject);
updateFormControls();
aplayer = spWrapperObject.getPlayer(parseInt(_playerID));
main.trace2((("This player is: " + parseInt(_playerID)) + ": ") + aplayer.pname);
main.trace2("This game is is: " + _mpEvent.gameId);
agame = spWrapperObject.getGame(parseInt(_mpEvent.gameId));
var playerIsMe = isPlayerMe(aplayer);
if (!giMatchupGame) {
if (parseInt(agame.gTourMatchId) == parseInt(ntgCurrentGame.id)) {
main.trace2("No matchup game created... weird..");
giMatchupGame = agame;
}
}
if (isPlayerInNextTourneyGame(aplayer)) {
trace2("Checking if the player in the game is the HOST: " + aplayer.pname);
if (isPlayerHostOfNextTourneyGame(aplayer)) {
main.trace2("player is the host");
if (playerIsMe) {
main.trace2("player is me");
main.trace2("Home is me, visitor ID: " + ntgCurrentGame.awayUserID);
btnPlayNow._visible = false;
btnCreateGame._visible = false;
updateHomeGUI(aplayer, false);
} else {
main.trace2("the player is NOT me, is th eplayer in a game?");
if (aplayer.isInGame) {
main.trace2("Player is in a game..");
lblHomeStatus.text = "In Game";
btnPlayNow._visible = false;
btnCreateGame._visible = false;
} else {
main.trace2("All good");
btnPlayNow._visible = true;
btnCreateGame._visible = false;
}
updateHomeGUI(aplayer, false);
}
} else {
main.trace2("player is NOT the host");
if (playerIsMe) {
main.trace2("player is me");
main.trace2("GEC Visitor is me, home ID: " + ntgCurrentGame.homeUserID);
if (ntgCurrentGame.homeUserID < 0) {
main.trace2("GEC AWAY: Opponent is CPU.. joining game");
var playerInfo = spWrapperObject.getMyselfAsPlayer();
playerInfo.teamId = ntgCurrentGame.awayTeamID;
}
}
}
}
aplayer = null;
}
function onPlayerGameStateUpdate() {
aplayer = spWrapperObject.getPlayer(_playerID);
if (isPlayerHostOfNextTourneyGame(aplayer)) {
updateHomeGUI(aplayer, false);
} else {
updateAwayGUI(aplayer, false);
}
aplayer = null;
}
function onPlayerLeavesGame() {
main.trace2("******EVENT_ON_PLAYER_LEAVES_GAME************");
if (giMatchupGame) {
aplayer = spWrapperObject.getPlayer(_playerID);
agame = spWrapperObject.getGame(_mpEvent.gameId);
if (parseInt(agame.gTourMatchId) == parseInt(ntgCurrentGame.id)) {
main.trace2("game is a my tourney game");
if (isPlayerInNextTourneyGame(aplayer)) {
main.trace2("player is in my tourney game");
if (isPlayerMe(aplayer)) {
main.trace2("player is me");
if (isPlayerHostOfNextTourneyGame(aplayer)) {
main.trace2("player is host");
btnCreateGame._visible = true;
btnCancelCreateGame._visible = false;
giMatchupGame = null;
} else {
main.trace2("player is away dude");
btnPlayNow._visible = false;
giMatchupGame = null;
}
} else {
main.trace2("player is not me, but away guy hasnt joined yet");
btnPlayNow._visible = false;
giMatchupGame = null;
}
}
}
aplayer = (agame = null);
}
}
function onPlayerLeavesRoom() {
main.trace2("******EVENT_ON_PLAYER_LEAVES_ROOM************");
var homePlayerInRoom = false;
var awayPlayerInRoom = false;
var itr = spWrapperObject.getPlayerList().players.iterator();
while (itr.hasNext()) {
myPlayer = itr.next();
if (myPlayer != null) {
if (myPlayer.pfid == ntgCurrentGame.homeUserID) {
homePlayerInRoom = true;
}
if (myPlayer.pfid == ntgCurrentGame.awayUserID) {
awayPlayerInRoom = true;
}
}
}
updateFormControls();
if (!homePlayerInRoom) {
lblHomeStatus.text = "Not in Room";
updateHomeGUI(null, false);
}
if (!awayPlayerInRoom) {
lblAwayStatus.text = "Not in Room";
updateAwayGUI(null, false);
}
if (getPlayerList()) {
getPlayerList().update(spWrapperObject);
}
}
function onPlayerRoomStateUpdate() {
main.trace2("******EVENT_ON_PLAYER_ROOM_STATE_UPDATE************");
aplayer = spWrapperObject.getPlayer(parseInt(_playerID));
if (aplayer == null) {
return(undefined);
}
var playerIsMe = isPlayerMe(aplayer);
if (playerIsMe) {
aplayer.pname = main.userProfile.name;
aplayer.playerObject.prating = main.userProfile.titleRating;
}
main.trace2("updating ping times for dialog");
if (isPlayerHostOfNextTourneyGame(aplayer)) {
updateHomeGUI(aplayer, false);
} else {
updateAwayGUI(aplayer, false);
}
if (getPlayerList()) {
getPlayerList().update(spWrapperObject);
}
}
function onRoomStateUpdate() {
main.trace2("on room state update");
}
function onReconnected() {
main.trace2("on reconected");
}
var Tourney = _root.Tourney;
var TourneyGame = _root.TourneyGame;
var TourneyPlayer = _root.TourneyPlayer;
var TourneyStats_NFL = _root.TourneyStats_NFL;
var TourneyStats_TW = _root.TourneyStats_TW;
var TourneyStats_FIFA = _root.TourneyStats_FIFA;
var TourneyStats_WC = _root.TourneyStats_WC;
var TourneyStats_NHL = _root.TourneyStats_NHL;
var TourneyStats_MVP = _root.TourneyStats_MVP;
var TourneyStats_NBA = _root.TourneyStats_NBA;
var NextTourneyGame = _root.NextTourneyGame;
var userTourneys = _global.userTourneys;
var userMyTourneys = _global.userMyTourneys;
var userNextTourneyGames = _global.userNextTourneyGames;
var tourneyDM = _global.tourneyDM;
var TOURNAMENT_MAX = 10;
var TOURNAMENT_CREATE_MAX = 5;
var LEAGUE_MAX = 10;
var LEAGUE_CREATE_MAX = 5;
var MAX_ROUNDS = 6;
var regionLabelArray = new Array(ltxt("All"), "---", ltxt("AMERICAS"), ltxt("EUROPE"), ltxt("KOREA"), "---", ltxt("AUSTRALIA"), ltxt("AUSTRIA"), ltxt("BELGIUM"), ltxt("BRAZIL"), ltxt("CANADA"), ltxt("CZECH_REP"), ltxt("DENMARK"), ltxt("FINLAND"), ltxt("FRANCE"), ltxt("GERMANY"), ltxt("GREECE"), ltxt("HUNGARY"), ltxt("ICELAND"), ltxt("ISRAEL"), ltxt("ITALY"), ltxt("JAPAN"), ltxt("MEXICO"), ltxt("NETHERLANDS"), ltxt("NORWAY"), ltxt("POLAND"), ltxt("PORTUGAL"), ltxt("RUSSIA"), ltxt("SOUTH_KOREA"), ltxt("SPAIN"), ltxt("SWEDEN"), ltxt("SWITZERLAND"), ltxt("TURKEY"), ltxt("UNITED_KINGDOM"), ltxt("UNITED_STATES"), "---", ltxt("OTHER"));
var regionDataArray = new Array("All", "---", "Americas", "Europe", "Korea", "---", "au", "at", "be", "br", "ca", "cz", "dk", "fi", "fr", "de", "gr", "hu", "is", "il", "it", "jp", "mx", "nl", "no", "pl", "pt", "ru", "kr", "es", "se", "ch", "tr", "uk", "us", "---", "Other");
var americasArray = new Array("Americas", "br", "ca", "mx", "us");
var europeArray = new Array("Europe", "at", "be", "cz", "dk", "fi", "fr", "de", "gr", "hu", "is", "it", "nl", "no", "pl", "pt", "ru", "es", "se", "ch", "tr", "uk");
var koreaArray = new Array("Korea", "kr");
var str_mcPath;
var encTable = ["&", "&", "<", "<", ">", ">", """, "\"", "'", "'"];
_root.gblInstallFolder = getInstallFolder();
var _keyListener = new Object();
var EVENT_ON_CONNECTION_ERROR = 1;
var EVENT_ON_ERROR = 2;
var EVENT_ON_ERROR_RECEIVED = 3;
var EVENT_ON_CHAT_RECEIVED = 4;
var EVENT_ON_GAME_REMOVED = 5;
var EVENT_ON_GAME_STATE_UPDATE = 6;
var EVENT_ON_INITIALIZATION = 7;
var EVENT_ON_LAUNCH_GAME = 8;
var EVENT_ON_NEW_GAME = 9;
var EVENT_ON_NEW_PLAYER = 10;
var EVENT_ON_PLAYER_ENTERS_GAME = 11;
var EVENT_ON_LOAD_STATE = 12;
var EVENT_ON_PLAYER_GAME_STATE_UPDATE = 13;
var EVENT_ON_PLAYER_LEAVES_GAME = 14;
var EVENT_ON_PLAYER_LEAVES_ROOM = 15;
var EVENT_ON_PLAYER_ROOM_STATE_UPDATE = 16;
var EVENT_ON_ROOM_STATE_UPDATE = 17;
var EVENT_ON_QUERY_GAME_RESPONSE = 18;
var EVENT_ON_RECONECTED = 19;
var ERR_DLL_NOT_REGISTERED = 888;
var MSG_GENERAL_SERVER_ERROR = "GENERAL_ERROR";
var MSG_CONNECTION_ERROR = "CONNECTION_ERROR";
var MSG_ERR_ROOM_IS_FULL = "ROOM_FULL_ERROR";
var spWrapperObject = null;
var xmlRooms = new XML();
var riMatchupRoom = null;
var uniqueMpPlayerID = -100;
var sRoomFilter = "tournament";
var piMe = null;
var tTourneyForGame = null;
var bTourneysLoaded = false;
var bShowNewTourney = false;
var nHomePlayerTeamID = -100;
var nAwayPlayerTeamID = -100;
var nClockTimerID = 0;
var nGUIActionsTimerID = 0;
var fNoTourneyGameCallBack = null;
var teamRatingObject = null;
var ntgCurrentGame = null;
this.onUnload = function () {
main.trace2("******** unload tourney lobby **********");
if (!spWrapperObject.isLaunchingGame) {
spWrapperObject.disconnect();
}
};
var _playerID;
var giMatchupGame = null;
var aplayer = null;
var agame = null;
var errorStr = null;
var mpGamePlayers = null;
var _mpEvent = null;
var homePlayerID = null;
var awayPlayerID = null;
var MOVIE_CLIP = this;
var NUM_MOVIES = 2;
var tSelectedLeague = null;
var summaryLoaded = false;
var nextGameLoaded = false;
var joinLeagueLoaded = false;
var mpEvent = null;
var ntgCurrentGame = null;
var movieCounter = 0;
var currentTab = 0;
var leagueClosed = false;
var oldRow;
var spAwayPlayer;
var spHomePlayer;
var lblWaiting;
var btnCancelCreateGame;
var lblAwayStatus;
var lblHomeStatus;
var btnPlayNow;
var btnCreateGame;
var btnCancelCreateGame;
Instance of Symbol 49 Imported [easoTable] "tblLeagues" in Frame 1
//component parameters
onClipEvent (initialize) {
name = "defaultValue";
tableWidth = 565;
rows = 7;
cols = 13;
colWidths = [];
colWidths[0] = 75;
colWidths[1] = 75;
colWidths[2] = 50;
colWidths[3] = 50;
colWidths[4] = 75;
colWidths[5] = 75;
colWidths[6] = 125;
colWidths[7] = 50;
colWidths[8] = 100;
colWidths[9] = 86;
colWidths[10] = 69;
colWidths[11] = 0;
colWidths[12] = 0;
colWidths[13] = 0;
nLockedCols = 2;
cellHeight = 20;
headerHeight = 20;
bHasCellBorder = false;
bHasCellDivider = false;
}
Instance of Symbol 50 Imported [easoVSlider] "vsb" in Frame 1
//component parameters
onClipEvent (initialize) {
height = 127;
range = 10;
value = 0;
targetTable = "";
}
Instance of Symbol 51 Imported [easoHSlider] "hsb" in Frame 1
//component parameters
onClipEvent (initialize) {
width = 311;
range = 10;
value = 0;
targetTable = "tblLeagues";
}
Instance of Symbol 57 Imported [easoButtonMedium] "btnLeaguesCreate" in Frame 1
//component parameters
onClipEvent (initialize) {
label = "CREATE LEAGUE";
bLocalize = false;
bcolor = "blue";
}
Frame 2
function initLeagueLobby() {
main.showLoadingScreen();
getTabpaneLeagueNextGame();
getTabpaneLeagueSummary();
btnFilter._visible = false;
lblNoLeagues._visible = false;
initLeagueTable();
}
function movieHasLoaded(loadedMovie) {
movieCounter++;
main.trace2("Main Movie Loaded: " + loadedMovie);
if (movieCounter == NUM_MOVIES) {
main.trace2("Loading leagues");
loadLeagues();
}
}
function getTabpaneLeagueSummary() {
if (!summaryLoaded) {
MOVIE_CLIP.createEmptyMovieClip("tabpaneLeagueSummary", 445);
MOVIE_CLIP.tabpaneLeagueSummary._visible = false;
MOVIE_CLIP.tabpaneLeagueSummary.loadMovie("../../commonSWF/leagues/leagueSummary2.swf");
MOVIE_CLIP.tabpaneLeagueSummary._x = 194;
MOVIE_CLIP.tabpaneLeagueSummary._y = 341;
summaryLoaded = true;
}
return(MOVIE_CLIP.tabpaneLeagueSummary);
}
function getTabpaneLeagueNextGame() {
if (!nextGameLoaded) {
MOVIE_CLIP.createEmptyMovieClip("tabpaneLeagueNextGame", 446);
MOVIE_CLIP.tabpaneLeagueNextGame._visible = false;
MOVIE_CLIP.tabpaneLeagueNextGame.loadMovie("../leagues/leagueNextGame.swf");
MOVIE_CLIP.tabpaneLeagueNextGame._x = 194;
MOVIE_CLIP.tabpaneLeagueNextGame._y = 341;
nextGameLoaded = true;
}
return(MOVIE_CLIP.tabpaneLeagueNextGame);
}
function loadLeagues() {
main.showLoadingScreen();
_global.userTourneys.removeAll();
_global.userMyTourneys.removeAll();
main.tourneyDM.getTourneyList(Tourney.TYPE.LEAGUE, null, null, _getLeagueListCallBack);
vsb.setTargetTable("tblLeagues");
vsb.setValue(0);
}
function _getLeagueListCallBack(bSuccess) {
if (bSuccess) {
getTabpaneLeagueNextGame().loadLeagueData();
} else {
main.hideLoadingScreen();
main.showAlertDialog("Error retrieving data from server..");
}
}
function initLeagueTable() {
var widths = new Array(70, 170, 60, 50, 50, 60, 80, 60, 60, 50, 0, 0, 0);
var headers = new Array("Status", "Name", "Type", "Fee", "Rated", "Ranked", "Skill", "Season", "Schedule", "Players", "", "", "");
tblLeagues.setDefaultRowColor(14933459, 15789544);
tblLeagues.setDefaultHeaderColor(0);
tblLeagues.setDefaultHeaderTextFormat(_global.tfTableHeader_L);
tblLeagues.setDefaultCellTextFormat(_global.tfTableCell_L);
tblLeagues.addHeaders(headers);
tblLeagues.setColWidths(widths);
tblLeagues.onClickCallback = leagueTableClicked;
tblLeagues.draw();
vsb.setValue(0);
hsb.setValue(0);
hsb.setRange(145);
lblNoLeagues.setFont(tfN1);
}
function fillLeagueTable() {
var leagueCount = userTourneys.getLength();
var idx = 0;
var aLeague;
tblLeagues.clear();
if (leagueCount == 0) {
getTabpaneLeagueSummary()._visible = false;
getTabpaneLeagueNextGame()._visible = false;
tblLeagues.refresh();
lblNoLeagues.text = "There are currently no leagues to display";
lblNoLeagues._visible = true;
main.hideLoadingScreen();
this._visible = true;
return(undefined);
}
getTabpaneLeagueSummary().clearLeagues();
while (idx < leagueCount) {
aLeague = userTourneys.getItem(idx);
tblLeagues.unhighlightRow(idx);
switch (aLeague.status) {
case "completed" :
case "started" :
tblLeagues.setCellValue(idx, 0, "Closed");
leagueClosed = true;
break;
case "created" :
if (aLeague.isInTourney || (aLeague.maxPlayers == aLeague.memberCount)) {
tblLeagues.setCellValue(idx, 0, "Closed");
leagueClosed = true;
} else {
leagueClosed = false;
tblLeagues.setCellValue(idx, 0, "Join Now!");
}
}
tblLeagues.setCellValue(idx, 1, aLeague.name);
if (aLeague.isPrivate) {
tblLeagues.setCellValue(idx, 2, "Private");
} else {
tblLeagues.setCellValue(idx, 2, "Public");
}
tblLeagues.setCellValue(idx, 3, aLeague.entryFee);
tblLeagues.setCellValue(idx, 4, (aLeague.isRanked ? "Yes" : "No"));
tblLeagues.setCellValue(idx, 5, (aLeague.isProPlay ? "Yes" : "No"));
tblLeagues.setCellValue(idx, 6, aLeague.skill);
tblLeagues.setCellValue(idx, 7, aLeague.roundCount + " games");
tblLeagues.setCellValue(idx, 8, dateTimeParser(aLeague.roundLength));
tblLeagues.setCellValue(idx, 9, (aLeague.memberCount + "/") + aLeague.maxPlayers);
tblLeagues.setCellValue(idx, 10, aLeague.isInTourney);
tblLeagues.setCellValue(idx, 11, aLeague.id);
if (leagueClosed) {
tblLeagues.setCellValue(idx, 12, 0);
} else {
tblLeagues.setCellValue(idx, 12, 1);
}
idx++;
}
vsb.setRange(leagueCount - 1);
tblLeagues.sortCol(10);
tblLeagues.sortCol(10);
idx = 0;
while (idx < leagueCount) {
var leagueID = parseInt(tblLeagues.getCellValue(idx, 11));
aLeague = userTourneys.getNamedItem("tour_" + leagueID);
if (aLeague.isInTourney) {
getTabpaneLeagueSummary().addLeague(aLeague);
}
idx++;
}
tblLeagues.refresh();
var curRow = _global.tourneyRow;
if (curRow > (leagueCount - 1)) {
curRow = 0;
}
leagueTableClicked(1, curRow, 0, 0);
}
function leagueTableClicked(col, row, xoffset, yoffset) {
var leagueID = parseInt(tblLeagues.getCellValue(row, 11));
_global.tourneyRow = row;
if (!isNaN(leagueID)) {
main.showLoadingScreen();
tSelectedLeague = userTourneys.getNamedItem("tour_" + leagueID);
tblLeagues.unhighlightRow(oldRow);
highlightMyLeagues(tSelectedLeague);
tblLeagues.highlightRow(row, "0xDAD49E", "0x000000");
oldRow = row;
if (tSelectedLeague.isInTourney) {
if (tSelectedLeague.status == main.Tourney.STATUS.STARTED) {
getTabpaneLeagueNextGame().setNextGame(tSelectedLeague);
getTabpaneLeagueSummary()._visible = false;
lblNoLeagues._visible = false;
} else {
getTabpaneLeagueSummary().showLeague(tSelectedLeague);
getTabpaneLeagueSummary()._visible = true;
getTabpaneLeagueNextGame()._visible = false;
lblNoLeagues._visible = false;
}
} else {
getTabpaneLeagueSummary().showLeague(tSelectedLeague);
getTabpaneLeagueSummary()._visible = true;
getTabpaneLeagueNextGame()._visible = false;
lblNoLeagues._visible = false;
var isJoinable = tblLeagues.getCellValue(row, 12);
if ((col == 0) && (isJoinable == 1)) {
_root.mcDialog.loadMovie("../../commonSWF/leagues/leagueJoin.swf");
} else {
main.hideLoadingScreen();
}
}
}
}
function highlightMyLeagues(league) {
var idx = 0;
var leagueCount = userTourneys.getLength();
while (idx < leagueCount) {
if (tblLeagues.getCellValue(idx, 10) && (tblLeagues.getCellValue(idx, 11) != league.id)) {
tblLeagues.highlightRow(idx, "0xFFFFFF", "0x011D3B");
}
idx++;
}
}
function highlightCurrentRow(leagueIn) {
var row = 0;
var leagueCount = userTourneys.getLength();
while (row < leagueCount) {
var leagueID = parseInt(tblLeagues.getCellValue(row, 11));
if (leagueID == leagueIn.id) {
tblLeagues.highlightRow(row, "0xDAD49E", "0x011D3B");
} else {
tblLeagues.unhighlightRow(row);
}
row++;
}
highlightMyLeagues(leagueIn);
}
function connectToRoom() {
getTabpaneLeagueNextGame().connectToRoom();
}
function updateFormControls() {
lblWaiting = getTabpaneLeagueNextGame().lblWaiting;
btnCancelCreateGame = getTabpaneLeagueNextGame().btnCancelCreateGame;
lblAwayStatus = getTabpaneLeagueNextGame().lblAwayStatus;
lblHomeStatus = getTabpaneLeagueNextGame().lblHomeStatus;
btnPlayNow = getTabpaneLeagueNextGame().btnPlayNow;
btnCreateGame = getTabpaneLeagueNextGame().btnCreateGame;
btnCancelCreateGame = getTabpaneLeagueNextGame().btnCancelCreateGame;
}
function updateAwayGUI(piAwayPlayer, cpuTeam) {
if (ntgCurrentGame) {
if (cpuTeam) {
getTabpaneLeagueNextGame().lblAwayRating.text = (ltxt("RATING:") + " ") + ltxt("NA");
getTabpaneLeagueNextGame().lblAwayDisconnects.text = (ltxt("DISCONNECTS:") + " ") + ltxt("NA");
getTabpaneLeagueNextGame().lblAwayPing.text = (ltxt("PING:") + " ") + ltxt("NA");
} else {
getTabpaneLeagueNextGame().lblAwayName.text = (ltxt("AWAY:") + " ") + ntgCurrentGame.awayUserName;
getTabpaneLeagueNextGame().lblAwayTeam.text = main.getTeamName(ntgCurrentGame.awayTeamID);
getTabpaneLeagueNextGame().awayNameCM._x = (getTabpaneLeagueNextGame().lblAwayName._x + getTabpaneLeagueNextGame().lblAwayName.textWidth) + 5;
if (piAwayPlayer) {
spAwayPlayer = piAwayPlayer;
getTabpaneLeagueNextGame().lblAwayRating.text = (ltxt("RATING:") + " ") + piAwayPlayer.playerObject.prating;
getTabpaneLeagueNextGame().lblAwayDisconnects.text = ((ltxt("DISCONNECTS:") + " ") + Math.ceil(piAwayPlayer.playerObject.pdisconnects)) + "%";
getTabpaneLeagueNextGame().lblAwayPing.text = (ltxt("PING:") + " ") + Math.round(piAwayPlayer.ping);
var speed = _root.getSpeed(piAwayPlayer.ping);
if (speed == 0) {
getTabpaneLeagueNextGame().p11._visible = true;
getTabpaneLeagueNextGame().p12._visible = true;
getTabpaneLeagueNextGame().p13._visible = true;
} else if (speed == 1) {
getTabpaneLeagueNextGame().p11._visible = true;
getTabpaneLeagueNextGame().p12._visible = true;
} else {
getTabpaneLeagueNextGame().p11._visible = true;
}
} else {
getTabpaneLeagueNextGame().lblAwayRating.text = ltxt("RATING:");
getTabpaneLeagueNextGame().lblAwayDisconnects.text = ltxt("DISCONNECTS:");
getTabpaneLeagueNextGame().lblAwayPing.text = ltxt("PING:");
}
}
}
}
function updateHomeGUI(piHomePlayer, cpuTeam) {
if (ntgCurrentGame) {
if (cpuTeam) {
getTabpaneLeagueNextGame().lblHomeRating.text = (ltxt("RATING:") + " ") + ltxt("NA");
getTabpaneLeagueNextGame().lblHomeDisconnects.text = (ltxt("DISCONNECTS:") + " ") + ltxt("NA");
getTabpaneLeagueNextGame().lblHomePing.text = (ltxt("PING:") + " ") + ltxt("NA");
} else {
getTabpaneLeagueNextGame().lblHomeName.text = (ltxt("HOME:") + " ") + ntgCurrentGame.homeUserName;
getTabpaneLeagueNextGame().lblHomeTeam.text = main.getTeamName(ntgCurrentGame.homeTeamID);
getTabpaneLeagueNextGame().homeNameCM._x = (getTabpaneLeagueNextGame().lblHomeName._x + getTabpaneLeagueNextGame().lblHomeName.textWidth) + 5;
if (piHomePlayer) {
spHomePlayer = piHomePlayer;
getTabpaneLeagueNextGame().lblHomeRating.text = (ltxt("RATING:") + " ") + piHomePlayer.playerObject.prating;
getTabpaneLeagueNextGame().lblHomeDisconnects.text = ((ltxt("DISCONNECTS:") + " ") + Math.ceil(piHomePlayer.playerObject.pdisconnects)) + "%";
getTabpaneLeagueNextGame().lblHomePing.text = (ltxt("PING:") + " ") + Math.round(piHomePlayer.ping);
var speed = _root.getSpeed(piHomePlayer.ping);
if (speed == 0) {
getTabpaneLeagueNextGame().p21._visible = true;
getTabpaneLeagueNextGame().p22._visible = true;
getTabpaneLeagueNextGame().p23._visible = true;
} else if (speed == 1) {
getTabpaneLeagueNextGame().p21._visible = true;
getTabpaneLeagueNextGame().p22._visible = true;
} else {
getTabpaneLeagueNextGame().p21._visible = true;
}
} else {
getTabpaneLeagueNextGame().lblHomeRating.text = ltxt("RATING:");
getTabpaneLeagueNextGame().lblHomeDisconnects.text = ltxt("DISCONNECTS:");
getTabpaneLeagueNextGame().lblHomePing.text = ltxt("PING:");
}
}
}
}
function handleTeamRatings() {
main.createEmptyMovieClip("teamRatings", 447);
main.teamRatings.loadMovie("../matchup/teamRating.swf");
}
function teamRatingOnLoad() {
var mpGamePlayers = getMatchupGamePlayers();
if (mpGamePlayers) {
if (mpGamePlayers[0] != null) {
mpGamePlayers[0].ping = ((spHomePlayer == null) ? "-" : (spHomePlayer.ping));
if (isNaN(mpGamePlayers[0].playerObject.pdisconnects)) {
mpGamePlayers[0].playerObject.pdisconnects = "-";
}
}
if (mpGamePlayers[1] != null) {
mpGamePlayers[1].ping = ((spAwayPlayer == null) ? "-" : (spAwayPlayer.ping));
if (isNaN(mpGamePlayers[1].playerObject.pdisconnects)) {
mpGamePlayers[1].playerObject.pdisconnects = "-";
}
}
main.teamRatings.update(mpGamePlayers[1], mpGamePlayers[0]);
main.teamRatings._visible = true;
}
}
function refresh() {
loadLeagues();
}
stop();
this.tabEnabled = false;
this.tabChildren = false;
initLeagueLobby();
btnRefresh.onPress = function () {
loadLeagues();
};
btnLeaguesCreate.onPress = function () {
main.navigate("5130");
};
btnFilter.onPress = function () {
getFilterDialog()._visible = true;
};
lblLeageHeader.setFont(tfN1);
lblLeageHeader.text = "LEAGUES";
Symbol 5 MovieClip [FLabelSymbol] Frame 1
#initclip 2
_global.FLabelClass = function () {
if (this.hostComponent == undefined) {
this.hostComponent = ((this._parent.controller == undefined) ? (this._parent) : (this._parent.controller));
}
if (this.customTextStyle == undefined) {
if (this.hostComponent.textStyle == undefined) {
this.hostComponent.textStyle = new TextFormat();
}
this.textStyle = this.hostComponent.textStyle;
this.enable = true;
}
};
FLabelClass.prototype = new MovieClip();
Object.registerClass("FLabelSymbol", FLabelClass);
FLabelClass.prototype.setLabel = function (label) {
var val = this.hostComponent.styleTable.embedFonts.value;
if (val != undefined) {
this.labelField.embedFonts = val;
}
this.labelField.setNewTextFormat(this.textStyle);
this.labelField.text = label;
this.labelField._height = this.labelField.textHeight + 2;
};
FLabelClass.prototype.setSize = function (width) {
this.labelField._width = width;
};
FLabelClass.prototype.setEnabled = function (enable) {
this.enable = enable;
var tmpColor = this.hostComponent.styleTable[(enable ? "textColor" : "textDisabled")].value;
if (tmpColor == undefined) {
tmpColor = (enable ? 0 : 8947848);
}
this.setColor(tmpColor);
};
FLabelClass.prototype.getLabel = function () {
return(this.labelField.text);
};
FLabelClass.prototype.setColor = function (col) {
this.labelField.textColor = col;
};
#endinitclip
Symbol 14 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(frame5, "face");
component.registerSkinElement(frame3, "shadow");
component.registerSkinElement(frame1, "darkshadow");
component.registerSkinElement(frame4, "highlight");
component.registerSkinElement(frame2, "highlight3D");
Symbol 20 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(frame5, "face");
component.registerSkinElement(frame3, "shadow");
component.registerSkinElement(frame1, "darkshadow");
component.registerSkinElement(frame4, "highlight");
component.registerSkinElement(frame2, "highlight3D");
Symbol 26 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(frame5, "face");
component.registerSkinElement(frame4, "shadow");
component.registerSkinElement(frame2, "darkshadow");
component.registerSkinElement(frame3, "highlight");
component.registerSkinElement(frame1, "highlight3D");
Symbol 32 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(frame5, "face");
component.registerSkinElement(frame3, "shadow");
component.registerSkinElement(frame1, "darkshadow");
component.registerSkinElement(frame4, "highlight");
component.registerSkinElement(frame2, "highlight3D");
Symbol 33 MovieClip [fpb_states] Frame 1
stop();
Symbol 33 MovieClip [fpb_states] Frame 2
stop();
Symbol 33 MovieClip [fpb_states] Frame 3
stop();
Symbol 33 MovieClip [fpb_states] Frame 4
stop();
Symbol 34 MovieClip [FUIComponentSymbol] Frame 1
#initclip 1
function FUIComponentClass() {
this.init();
}
FUIComponentClass.prototype = new MovieClip();
FUIComponentClass.prototype.init = function () {
this.enable = true;
this.focused = false;
this.useHandCursor = false;
this._accImpl = new Object();
this._accImpl.stub = true;
this.styleTable = new Array();
if (_global.globalStyleFormat == undefined) {
_global.globalStyleFormat = new FStyleFormat();
globalStyleFormat.isGlobal = true;
_global._focusControl = new Object();
_global._focusControl.onSetFocus = function (oldFocus, newFocus) {
oldFocus.myOnKillFocus();
newFocus.myOnSetFocus();
};
Selection.addListener(_global._focusControl);
}
if (this._name != undefined) {
this._focusrect = false;
this.tabEnabled = true;
this.focusEnabled = true;
this.tabChildren = false;
this.tabFocused = true;
if (this.hostStyle == undefined) {
globalStyleFormat.addListener(this);
} else {
this.styleTable = this.hostStyle;
}
this.deadPreview._visible = false;
this.deadPreview._width = (this.deadPreview._height = 1);
this.methodTable = new Object();
this.keyListener = new Object();
this.keyListener.controller = this;
this.keyListener.onKeyDown = function () {
this.controller.myOnKeyDown();
};
this.keyListener.onKeyUp = function () {
this.controller.myOnKeyUp();
};
for (var i in this.styleFormat_prm) {
this.setStyleProperty(i, this.styleFormat_prm[i]);
}
}
};
FUIComponentClass.prototype.setEnabled = function (enabledFlag) {
this.enable = ((arguments.length > 0) ? (enabledFlag) : true);
this.tabEnabled = (this.focusEnabled = enabledFlag);
if ((!this.enable) && (this.focused)) {
Selection.setFocus(undefined);
}
};
FUIComponentClass.prototype.getEnabled = function () {
return(this.enable);
};
FUIComponentClass.prototype.setSize = function (w, h) {
this.width = w;
this.height = h;
this.focusRect.removeMovieClip();
};
FUIComponentClass.prototype.setChangeHandler = function (chng, obj) {
this.handlerObj = ((obj == undefined) ? (this._parent) : (obj));
this.changeHandler = chng;
};
FUIComponentClass.prototype.invalidate = function (methodName) {
this.methodTable[methodName] = true;
this.onEnterFrame = this.cleanUI;
};
FUIComponentClass.prototype.cleanUI = function () {
if (this.methodTable.setSize) {
this.setSize(this.width, this.height);
} else {
this.cleanUINotSize();
}
this.methodTable = new Object();
delete this.onEnterFrame;
};
FUIComponentClass.prototype.cleanUINotSize = function () {
for (var funct in this.methodTable) {
this[funct]();
}
};
FUIComponentClass.prototype.drawRect = function (x, y, w, h) {
var inner = this.styleTable.focusRectInner.value;
var outer = this.styleTable.focusRectOuter.value;
if (inner == undefined) {
inner = 16777215 /* 0xFFFFFF */;
}
if (outer == undefined) {
outer = 0;
}
this.createEmptyMovieClip("focusRect", 1000);
this.focusRect.controller = this;
this.focusRect.lineStyle(1, outer);
this.focusRect.moveTo(x, y);
this.focusRect.lineTo(x + w, y);
this.focusRect.lineTo(x + w, y + h);
this.focusRect.lineTo(x, y + h);
this.focusRect.lineTo(x, y);
this.focusRect.lineStyle(1, inner);
this.focusRect.moveTo(x + 1, y + 1);
this.focusRect.lineTo((x + w) - 1, y + 1);
this.focusRect.lineTo((x + w) - 1, (y + h) - 1);
this.focusRect.lineTo(x + 1, (y + h) - 1);
this.focusRect.lineTo(x + 1, y + 1);
};
FUIComponentClass.prototype.pressFocus = function () {
this.tabFocused = false;
this.focusRect.removeMovieClip();
Selection.setFocus(this);
};
FUIComponentClass.prototype.drawFocusRect = function () {
this.drawRect(-2, -2, this.width + 4, this.height + 4);
};
FUIComponentClass.prototype.myOnSetFocus = function () {
this.focused = true;
Key.addListener(this.keyListener);
if (this.tabFocused) {
this.drawFocusRect();
}
};
FUIComponentClass.prototype.myOnKillFocus = function () {
this.tabFocused = true;
this.focused = false;
this.focusRect.removeMovieClip();
Key.removeListener(this.keyListener);
};
FUIComponentClass.prototype.executeCallBack = function () {
this.handlerObj[this.changeHandler](this);
};
FUIComponentClass.prototype.updateStyleProperty = function (styleFormat, propName) {
this.setStyleProperty(propName, styleFormat[propName], styleFormat.isGlobal);
};
FUIComponentClass.prototype.setStyleProperty = function (propName, value, isGlobal) {
if (value == "") {
return(undefined);
}
var tmpValue = parseInt(value);
if (!isNaN(tmpValue)) {
value = tmpValue;
}
var global = ((arguments.length > 2) ? (isGlobal) : false);
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].useGlobal || (!global)) {
this.styleTable[propName].value = value;
if (this.setCustomStyleProperty(propName, value)) {
} else if (propName == "embedFonts") {
this.invalidate("setSize");
} else if (propName.subString(0, 4) == "text") {
if (this.textStyle == undefined) {
this.textStyle = new TextFormat();
}
var textProp = propName.subString(4, propName.length);
this.textStyle[textProp] = value;
this.invalidate("setSize");
} else {
for (var j in this.styleTable[propName].coloredMCs) {
var myColor = new Color(this.styleTable[propName].coloredMCs[j]);
if (this.styleTable[propName].value == undefined) {
var myTObj = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
myColor.setTransform(myTObj);
} else {
myColor.setRGB(value);
}
}
}
this.styleTable[propName].useGlobal = global;
}
};
FUIComponentClass.prototype.registerSkinElement = function (skinMCRef, propName) {
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].coloredMCs == undefined) {
this.styleTable[propName].coloredMCs = new Object();
}
this.styleTable[propName].coloredMCs[skinMCRef] = skinMCRef;
if (this.styleTable[propName].value != undefined) {
var myColor = new Color(skinMCRef);
myColor.setRGB(this.styleTable[propName].value);
}
};
_global.FStyleFormat = function () {
this.nonStyles = {listeners:true, isGlobal:true, isAStyle:true, addListener:true, removeListener:true, nonStyles:true, applyChanges:true};
this.listeners = new Object();
this.isGlobal = false;
if (arguments.length > 0) {
for (var i in arguments[0]) {
this[i] = arguments[0][i];
}
}
};
_global.FStyleFormat.prototype = new Object();
FStyleFormat.prototype.addListener = function () {
var arg = 0;
while (arg < arguments.length) {
var mcRef = arguments[arg];
this.listeners[arguments[arg]] = mcRef;
for (var i in this) {
if (this.isAStyle(i)) {
mcRef.updateStyleProperty(this, i.toString());
}
}
arg++;
}
};
FStyleFormat.prototype.removeListener = function (component) {
this.listeners[component] = undefined;
for (var prop in this) {
if (this.isAStyle(prop)) {
if (component.styleTable[prop].useGlobal == this.isGlobal) {
component.styleTable[prop].useGlobal = true;
var value = (this.isGlobal ? undefined : (globalStyleFormat[prop]));
component.setStyleProperty(prop, value, true);
}
}
}
};
FStyleFormat.prototype.applyChanges = function () {
var count = 0;
for (var i in this.listeners) {
var component = this.listeners[i];
if (arguments.length > 0) {
var j = 0;
while (j < arguments.length) {
if (this.isAStyle(arguments[j])) {
component.updateStyleProperty(this, arguments[j]);
}
j++;
}
} else {
for (var j in this) {
if (this.isAStyle(j)) {
component.updateStyleProperty(this, j.toString());
}
}
}
}
};
FStyleFormat.prototype.isAStyle = function (name) {
return((this.nonStyles[name] ? false : true));
};
#endinitclip
Symbol 38 MovieClip [FBoundingBoxSymbol] Frame 1
var component = _parent;
component.registerSkinElement(boundingBox, "background");
stop();
Symbol 38 MovieClip [FBoundingBoxSymbol] Frame 2
component.registerSkinElement(boundingBox2, "backgroundDisabled");
stop();
Symbol 41 MovieClip [FPushButtonSymbol] Frame 1
#initclip 3
function FPushButtonClass() {
this.init();
}
FPushButtonClass.prototype = new FUIComponentClass();
Object.registerClass("FPushButtonSymbol", FPushButtonClass);
FPushButtonClass.prototype.init = function () {
super.setSize(this._width, this._height);
this.boundingBox_mc.unloadMovie();
this.attachMovie("fpb_states", "fpbState_mc", 1);
this.attachMovie("FLabelSymbol", "fLabel_mc", 2);
this.attachMovie("fpb_hitArea", "fpb_hitArea_mc", 3);
super.init();
this.btnState = false;
this.setClickHandler(this.clickHandler);
this._xscale = 100;
this._yscale = 100;
this.setSize(this.width, this.height);
if (this.label != undefined) {
this.setLabel(this.label);
}
this.ROLE_SYSTEM_PUSHBUTTON = 43;
this.STATE_SYSTEM_PRESSED = 8;
this.EVENT_OBJECT_STATECHANGE = 32778;
this.EVENT_OBJECT_NAMECHANGE = 32780;
this._accImpl.master = this;
this._accImpl.stub = false;
this._accImpl.get_accRole = this.get_accRole;
this._accImpl.get_accName = this.get_accName;
this._accImpl.get_accState = this.get_accState;
this._accImpl.get_accDefaultAction = this.get_accDefaultAction;
this._accImpl.accDoDefaultAction = this.accDoDefaultAction;
};
FPushButtonClass.prototype.setHitArea = function (w, h) {
var hit = this.fpb_hitArea_mc;
this.hitArea = hit;
hit._visible = false;
hit._width = w;
hit._height = ((arguments.length > 1) ? (h) : (hit._height));
};
FPushButtonClass.prototype.setSize = function (w, h) {
w = ((w < 6) ? 6 : (w));
if (arguments.length > 1) {
if (h < 6) {
h = 6;
}
}
super.setSize(w, h);
this.setLabel(this.getLabel());
this.arrangeLabel();
this.setHitArea(w, h);
this.boundingBox_mc._width = w;
this.boundingBox_mc._height = h;
this.drawFrame();
if (this.focused) {
super.myOnSetFocus();
}
this.initContentPos("fLabel_mc");
};
FPushButtonClass.prototype.arrangeLabel = function () {
var label = this.fLabel_mc;
var h = this.height;
var w = (this.width - 2);
var b = 1;
this.fLabel_mc.setSize(w - (b * 4));
label._x = b * 3;
label._y = (h / 2) - (label._height / 2);
};
FPushButtonClass.prototype.getLabel = function () {
return(this.fLabel_mc.labelField.text);
};
FPushButtonClass.prototype.setLabel = function (label) {
this.fLabel_mc.setLabel(label);
this.txtFormat();
this.arrangeLabel();
if (Accessibility.isActive()) {
Accessibility.sendEvent(this, 0, this.EVENT_OBJECT_NAMECHANGE);
}
};
FPushButtonClass.prototype.getEnabled = function () {
return(this.enabled);
};
FPushButtonClass.prototype.setEnabled = function (enable) {
if (enable || (enable == undefined)) {
this.gotoFrame(1);
this.drawFrame();
this.flabel_mc.setEnabled(true);
this.enabled = true;
super.setEnabled(true);
} else {
this.gotoFrame(4);
this.drawFrame();
this.flabel_mc.setEnabled(false);
this.enabled = false;
super.setEnabled(false);
}
};
FPushButtonClass.prototype.txtFormat = function () {
var txtS = this.textStyle;
var sTbl = this.styleTable;
txtS.align = ((sTbl.textAlign.value == undefined) ? ((txtS.align = "center")) : undefined);
txtS.leftMargin = ((sTbl.textLeftMargin.value == undefined) ? ((txtS.leftMargin = 1)) : undefined);
txtS.rightMargin = ((sTbl.textRightMargin.value == undefined) ? ((txtS.rightMargin = 1)) : undefined);
if (this.fLabel_mc._height > this.height) {
super.setSize(this.width, this.fLabel_mc._height);
} else {
super.setSize(this.width, this.height);
}
this.fLabel_mc.labelField.setTextFormat(this.textStyle);
this.setEnabled(this.enable);
};
FPushButtonClass.prototype.drawFrame = function () {
var b = 1;
var x1 = 0;
var y1 = 0;
var x2 = this.width;
var y2 = this.height;
var mc_array = ["up_mc", "over_mc", "down_mc", "disabled_mc"];
var frame = mc_array[this.fpbState_mc._currentframe - 1];
var mc = "frame";
var i = 0;
while (i < 6) {
x1 = x1 + ((i % 2) * b);
y1 = y1 + ((i % 2) * b);
x2 = x2 - (((i + 1) % 2) * b);
y2 = y2 - (((i + 1) % 2) * b);
var w = (Math.abs(x1 - x2) + (2 * b));
var h = (Math.abs(y1 - y2) + (2 * b));
this.fpbState_mc[frame][mc + i]._width = w;
this.fpbState_mc[frame][mc + i]._height = h;
this.fpbState_mc[frame][mc + i]._x = x1 - b;
this.fpbState_mc[frame][mc + i]._y = y1 - b;
i++;
}
};
FPushButtonClass.prototype.setClickHandler = function (chng, obj) {
this.handlerObj = ((arguments.length < 2) ? (this._parent) : (obj));
this.clickHandler = chng;
};
FPushButtonClass.prototype.executeCallBack = function () {
this.handlerObj[this.clickHandler](this);
};
FPushButtonClass.prototype.initContentPos = function (mc) {
this.incrVal = 1;
this.initx = this[mc]._x - (this.getBtnState() * this.incrVal);
this.inity = this[mc]._y - (this.getBtnState() * this.incrVal);
this.togx = this.initx + this.incrVal;
this.togy = this.inity + this.incrVal;
};
FPushButtonClass.prototype.setBtnState = function (state) {
this.btnState = state;
if (state) {
this.fLabel_mc._x = this.togx;
this.fLabel_mc._y = this.togy;
} else {
this.fLabel_mc._x = this.initx;
this.fLabel_mc._y = this.inity;
}
};
FPushButtonClass.prototype.getBtnState = function () {
return(this.btnState);
};
FPushButtonClass.prototype.myOnSetFocus = function () {
this.focused = true;
super.myOnSetFocus();
};
FPushButtonClass.prototype.onPress = function () {
this.pressFocus();
this.fpbState_mc.gotoAndStop(3);
this.drawFrame();
this.setBtnState(true);
if (Accessibility.isActive()) {
Accessibility.sendEvent(this, 0, this.EVENT_OBJECT_STATECHANGE, true);
}
};
FPushButtonClass.prototype.onRelease = function () {
this.fpbState_mc.gotoAndStop(2);
this.drawFrame();
this.executeCallBack();
this.setBtnState(false);
if (Accessibility.isActive()) {
Accessibility.sendEvent(this, 0, this.EVENT_OBJECT_STATECHANGE, true);
}
};
FPushButtonClass.prototype.onRollOver = function () {
this.fpbState_mc.gotoAndStop(2);
this.drawFrame();
};
FPushButtonClass.prototype.onRollOut = function () {
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
};
FPushButtonClass.prototype.onReleaseOutside = function () {
this.setBtnState(false);
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
};
FPushButtonClass.prototype.onDragOut = function () {
this.setBtnState(false);
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
};
FPushButtonClass.prototype.onDragOver = function () {
this.setBtnState(true);
this.fpbState_mc.gotoAndStop(3);
this.drawFrame();
};
FPushButtonClass.prototype.myOnKeyDown = function () {
if ((Key.getCode() == 32) && (this.pressOnce == undefined)) {
this.onPress();
this.pressOnce = 1;
}
};
FPushButtonClass.prototype.myOnKeyUp = function () {
if (Key.getCode() == 32) {
this.onRelease();
this.pressOnce = undefined;
}
};
FPushButtonClass.prototype.get_accRole = function (childId) {
return(this.master.ROLE_SYSTEM_PUSHBUTTON);
};
FPushButtonClass.prototype.get_accName = function (childId) {
return(this.master.getLabel());
};
FPushButtonClass.prototype.get_accState = function (childId) {
if (this.pressOnce) {
return(this.master.STATE_SYSTEM_PRESSED);
}
return(this.master.STATE_SYSTEM_DEFAULT);
};
FPushButtonClass.prototype.get_accDefaultAction = function (childId) {
return("Press");
};
FPushButtonClass.prototype.accDoDefaultAction = function (childId) {
this.master.onPress();
this.master.onRelease();
};
#endinitclip
boundingBox_mc._visible = false;
deadPreview._visible = false;
Symbol 43 MovieClip [iconCM] Frame 1
stop();