Frame 1
function extendString(istring) {
ostring = istring;
while (length(ostring) < 10) {
icharnum = Math.round(Math.random() * 255);
ostring = ostring + String.fromCharCode(icharnum);
}
return(ostring);
}
function encryptString(istring) {
var _local1;
key = Math.round(Math.random() * 255);
_local1 = "" + key;
n = 0;
while (n < length(istring)) {
ichar = istring.charCodeAt(n);
ochar = (ichar + key) % 255;
_local1 = (_local1 + ",") + ochar;
key = (key + 171) % 255;
n++;
}
return(_local1);
}
function decryptString(istring) {
stringArray = istring.split(",");
key = parseInt(stringArray[0]);
trace(stringArray.length);
trace(key);
ostring = "";
n = 1;
while (n < stringArray.length) {
trace(parseInt(stringArray[n]));
icharnum = ((parseInt(stringArray[n]) + 255) - key) % 255;
trace(icharnum);
ochar = String.fromCharCode(icharnum);
ostring = ostring + ochar;
key = (key + 171) % 255;
n++;
}
return(ostring);
}
if ((getBytesLoaded() / getBytesTotal()) >= 1) {
gotoAndStop ("connect");
}
TextField.prototype.onKeyDown = function () {
if (((Key.getCode() == 13) && (this.pressedOnce == undefined)) && (this.isFocused())) {
trace(this._name);
if (this._name == "login_txt") {
sendLogin();
} else if (this._name == "input_txt") {
if (!_global.isBusy) {
sendChatMsg();
}
}
this.pressedOnce = true;
}
};
TextField.prototype.onKeyUp = function () {
if (Key.getCode() == 13) {
this.pressedOnce = undefined;
}
};
TextField.prototype.isFocused = function () {
if (Selection.getFocus() == targetPath(this)) {
return(true);
}
return(false);
};
Frame 2
gotoAndPlay (1);
Frame 9
function handleConnection(success) {
if (success) {
status_txt.text = "Connected, please login:";
showLogin(true);
butt_login.onRelease = sendLogin;
} else {
status_txt.text = "Can't connect!";
}
}
function sendLogin() {
if (!_global.isBusy) {
if (login_txt.text.length > 2) {
smartfox.login(zone, login_txt.text, null);
} else {
status_txt.text = "Your username must be at least 3 characters long...";
}
}
}
function showLogin(bool) {
butt_login._visible = bool;
login_txt._visible = bool;
loginBox._visible = bool;
if (bool) {
Selection.setFocus("login_txt");
}
}
function showWindow(linkageName) {
_global.isBusy = true;
disabler._visible = true;
roomList_lb.setEnabled(false);
userList_lb.setEnabled(false);
var _local3 = _root.attachMovie(linkageName, linkageName, 9999);
_local3._x = (stageW / 2) - (_local3._width / 2);
_local3._y = (stageH / 2) - (_local3._height / 2);
return(_local3);
}
function hideWindow(wName) {
this[wName].removeMovieClip();
roomList_lb.setEnabled(true);
userList_lb.setEnabled(true);
disabler._visible = false;
_global.isBusy = false;
}
System.security.loadPolicyFile("xmlsocket://195.78.94.242:31337");
stop();
Stage.showMenu = false;
var stageW = 640;
var stageH = 650;
disabler._visible = false;
_global.isBusy = false;
showLogin(false);
status_txt.text = "Connecting to Weebl's Stuff...";
var ip = "195.78.94.242";
var port = 31337;
var zone = "rsp";
var smartfox = (new it.gotoandplay.smartfoxserver.SmartFoxClient());
smartfox.onConnection = handleConnection;
smartfox.debug = true;
smartfox.connect(ip, port);
smartfox.onLogin = function (resObj) {
if (resObj.success) {
_global.myName = resObj.name;
gotoAndStop ("chat");
} else {
_gloabl.isBusy = true;
var _local3 = showWindow("errorWindow");
_local3.errorMsg.text = resObj.error;
}
};
smartfox.onConnectionLost = function () {
gotoAndStop ("connect");
};
Key.addListener(login_txt);
Frame 16
function sendChatMsg() {
if (ingame) {
if (_global.gameStarted && (input_txt.text.length > 0)) {
smartfox.sendPublicMessage(input_txt.text);
input_txt.text = "";
}
} else if (input_txt.text.length > 0) {
smartfox.sendPublicMessage(input_txt.text);
input_txt.text = "";
}
}
function sendPrivateMessage(m, recipient) {
hideWindow("pmWindow");
smartfox.sendPrivateMessage(m, _global.pmUid);
}
function changeRoom() {
if (!_global.isBusy) {
var _local3 = roomList_lb.getSelectedItem();
var _local2 = _local3.data;
if (_local2 != smartfox.activeRoomId) {
var _local4 = smartfox.getRoom(_local2).isPrivate();
if (_local4) {
_global.newRoom = _local2;
showWindow("passwordWindow");
} else {
smartfox.joinRoom(_local3.data);
}
}
}
}
function userSelected() {
if (!_global.isBusy) {
var _local2 = userList_lb.getSelectedItem().data;
if (_local2 != smartfox.myUserId) {
_global.pmUid = _local2;
var _local5 = showWindow("pmWindow");
var _local3 = smartfox.getActiveRoom().getUserList();
var _local4 = _local3[_local2];
_local5.title_txt.text = "Send a private message to " + _local4.getName();
}
}
}
function makeNewRoom() {
showWindow("newGameWindow");
}
function createRoom(name, pwd, max) {
hideWindow("newGameWindow");
var _local1 = new Object();
_local1.name = name;
_local1.password = pwd;
_local1.maxUsers = 2;
_local1.isGame = true;
_local1.isTemp = true;
smartfox.createRoom(_local1);
}
function loginProtectedRoom(pwd) {
hideWindow("passwordWindow");
smartfox.joinRoom(_global.newRoom, pwd);
}
function resetRoomSelected(id) {
var _local4 = roomList_lb.getEnabled();
roomList_lb.setEnabled(true);
var _local1 = 0;
while (_local1 < roomList_lb.getLength()) {
var _local2 = roomList_lb.getItemAt(_local1);
if (_local2.data == id) {
roomList_lb.setSelectedIndex(_local1);
break;
}
_local1++;
}
roomList_lb.setEnabled(_local4);
}
function updateRoomStatus(roomId) {
var _local5 = smartfox.roomList[roomId];
var _local3 = ((_local5.getName() + " (") + _local5.getUserCount()) + ")";
var _local1 = 0;
while (_local1 < roomList_lb.getLength()) {
var _local2 = roomList_lb.getItemAt(_local1);
if (roomId == _local2.data) {
roomList_lb.replaceItemAt(_local1, _local3, _local2.data);
break;
}
_local1++;
}
}
function closeConnection() {
smartfox.disconnect();
gotoAndStop ("connect");
}
stop();
roomList_lb.setChangeHandler("changeRoom");
userList_lb.setChangeHandler("userSelected");
userName_txt.text = "Logged in as: " + _global.myName;
input_txt.text = "";
Selection.setFocus("input_txt");
var inGame = false;
smartfox.onRoomListUpdate = function (roomList) {
roomList_lb.removeAll();
for (var _local4 in roomList) {
var _local2 = roomList[_local4];
if (_local2.isGame()) {
roomList_lb.addItem(((_local2.getName() + " (") + _local2.getUserCount()) + ")", _local2.getId());
}
}
roomList_lb.sortItemsBy("label", "ASC");
this.joinRoom("Rock Scissors Paper", "");
};
smartfox.onJoinRoom = function (roomObj) {
if (roomObj.isGame()) {
_global.myID = this.playerId;
if (_global.myID == 1) {
_global.myColor = "green";
} else {
_global.myColor = "red";
}
gotoAndStop ("game");
} else {
var _local9 = roomObj.getId();
var _local6 = roomObj.getUserList();
resetRoomSelected(_local9);
_global.currentRoom = roomObj;
userList_lb.removeAll();
for (var _local7 in _local6) {
var _local3 = _local6[_local7];
var _local4 = _local3.getName();
var _local5 = _local3.getId();
userList_lb.addItem(_local4, _local5);
}
userList_lb.sortItemsBy("label", "ASC");
chat_txt.htmlText = chat_txt.htmlText + (("<font color='#cc0000'>>><b> Room <em>" + roomObj.getName()) + " joined. To join a game click one with only 1 other player in. To start a game click the NEW button. Please don't swear.</em></b></font>");
}
};
smartfox.onJoinRoomError = function (errorMsg) {
var _local1 = showWindow("errorWindow");
_local1.errorMsg.text = errorMsg;
resetRoomSelected(smartfox.activeRoomId);
};
smartfox.onUserEnterRoom = function (fromRoom, user) {
var _local2 = user.getId();
var _local1 = user.getName();
userList_lb.addItem(_local1, _local2);
userList_lb.sortItemsBy("label", "ASC");
updateRoomStatus(fromRoom);
};
smartfox.onUserLeaveRoom = function (fromRoom, usrId) {
var _local1 = 0;
while (_local1 < userList_lb.getLength()) {
var _local2 = userList_lb.getItemAt(_local1);
if (_local2.data == usrId) {
var _local3 = _local2.label;
userList_lb.removeItemAt(_local1);
break;
}
_local1++;
}
userList_lb.sortItemsBy("label", "ASC");
updateRoomStatus(fromRoom);
};
smartfox.onUserCountChange = function (roomObj) {
updateRoomStatus(roomObj.getId());
};
smartfox.onPublicMessage = function (msg, user) {
chat_txt.htmlText = chat_txt.htmlText + ((("<b>" + user.getName()) + " :</b> ") + msg);
main_sb.setScrollPosition(chat_txt.maxscroll);
};
smartfox.onPrivateMessage = function (msg, user) {
chat_txt.htmlText = chat_txt.htmlText + ((("<b><font color='#009900'>[ PM > " + user.getName()) + " ]:</font></b> ") + msg);
main_sb.setScrollPosition(chat_txt.maxscroll);
};
smartfox.onRoomAdded = function (roomObj) {
roomList_lb.addItem(((roomObj.getName() + " (") + roomObj.getUserCount()) + ")", roomObj.getId());
roomList_lb.sortItemsBy("label", "ASC");
};
smartfox.onRoomDeleted = function (roomObj) {
var _local1 = 0;
while (_local1 < roomList_lb.getLength()) {
if (roomObj.getId() == roomList_lb.getItemAt(_local1).data) {
roomList_lb.removeItemAt(_local1);
break;
}
_local1++;
}
};
smartfox.onCreateRoomError = function (errorMsg) {
var _local1 = showWindow("errorWindow");
_local1.errorMsg.text = errorMsg;
};
Key.addListener(input_txt);
Instance of Symbol 144 MovieClip [FListBoxSymbol] "roomList_lb" in Frame 16
//component parameters
onClipEvent (construct) {
selectMultiple = false;
changeHandler = "";
}
Instance of Symbol 144 MovieClip [FListBoxSymbol] "userList_lb" in Frame 16
//component parameters
onClipEvent (construct) {
selectMultiple = false;
changeHandler = "";
}
Frame 23
function sendMoveObject(pc) {
crypt = Math.random(256);
smartfox.sendObject({type:"move", val:encryptString(extendString(pc)), key:crypt});
}
function leaveGameRoom() {
inGame = false;
gotoAndStop ("chat");
_global.oppname = "";
smartfox.getRoomList();
}
function quitGame() {
if (!_global.isBusy) {
_global.oppname = "";
leaveGameRoom();
}
}
function restartGame() {
hideWindow("gameEnd");
_global.gameStarted = true;
gameMovie.gotoAndPlay(1);
}
function sendRestart() {
smartfox.sendObject({type:"restart"});
}
stop();
var inGame = true;
_global.gameStarted = false;
var opponentID = ((_global.myID == 1) ? 2 : 1);
_global.oppName = "";
var vObj = new Array();
vObj.push({name:"player" + _global.myID, val:_global.myName});
gameMovie.localPlayer.text = _global.myName;
smartfox.setRoomVariables(vObj);
smartfox.onRoomVariablesUpdate = function (roomObj) {
if (inGame) {
var _local3 = roomObj.getVariables();
if ((_local3.player1.length > 0) && (_local3.player2.length > 0)) {
if (!_global.gameStarted) {
_global.gameStarted = true;
hideWindow("gameMessage");
_root["player" + opponentID].name.text = _local3["player" + opponentID];
_global.oppname = _local3["player" + opponentID];
if (_global.oppname != null) {
gameMovie.playername2 = _global.oppname;
}
}
} else {
_global.gameStarted = false;
var _local4 = showWindow("gameMessage");
_local4.message_txt.text = ((("Waiting for player " + ((_global.myID == 1) ? "2" : "1")) + newline) + newline) + "press [cancel] to leave the game";
}
}
};
smartfox.onObjectReceived = function (obj) {
if (obj.type == "move") {
var _local1;
var _local2;
_local2 = decryptString(obj.val);
if (_local2.indexOf("rock") != -1) {
_local1 = 0;
}
if (_local2.indexOf("scissors") != -1) {
_local1 = 1;
}
if (_local2.indexOf("paper") != -1) {
_local1 = 2;
}
gameMovie.opponentMove = _local1;
gameMovie.gotMove = true;
if (gameMovie.playerchoice != null) {
gameMovie.play();
}
}
if (obj.type == "restart") {
restartGame();
}
};
Instance of Symbol 132 MovieClip [FScrollBarSymbol] "main_sb" in Frame 23
//component parameters
onClipEvent (construct) {
_targetInstanceName = "chat_txt";
horizontal = false;
}
Symbol 3 MovieClip [FHighlightSymbol] Frame 1
var component = _parent.controller;
component.registerSkinElement(highlight_mc, "selection");
stop();
Symbol 3 MovieClip [FHighlightSymbol] Frame 2
component.registerSkinElement(highlight_mc2, "selectionDisabled");
stop();
Symbol 3 MovieClip [FHighlightSymbol] Frame 3
component.registerSkinElement(highlight_mc3, "selectionUnfocused");
stop();
Symbol 6 MovieClip [FLabelSymbol] Frame 1
#initclip 13
_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 _local2 = this.hostComponent.styleTable.embedFonts.value;
if (_local2 != undefined) {
this.labelField.embedFonts = _local2;
}
this.labelField.setNewTextFormat(this.textStyle);
this.labelField.text = ((label == undefined) ? "" : (label));
if (this.labelField.text != "") {
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 _local2 = this.hostComponent.styleTable[(enable ? "textColor" : "textDisabled")].value;
if (_local2 == undefined) {
_local2 = (enable ? 0 : 8947848);
}
this.setColor(_local2);
};
FLabelClass.prototype.getLabel = function () {
return(this.labelField.text);
};
FLabelClass.prototype.setColor = function (col) {
this.labelField.textColor = col;
};
#endinitclip
Symbol 7 MovieClip [FUIComponentSymbol] Frame 1
#initclip 11
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 _local3 in this.styleFormat_prm) {
this.setStyleProperty(_local3, this.styleFormat_prm[_local3]);
}
}
};
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 _local2 in this.methodTable) {
this[_local2]();
}
};
FUIComponentClass.prototype.drawRect = function (x, y, w, h) {
var _local4 = this.styleTable.focusRectInner.value;
var _local5 = this.styleTable.focusRectOuter.value;
if (_local4 == undefined) {
_local4 = 16777215 /* 0xFFFFFF */;
}
if (_local5 == undefined) {
_local5 = 0;
}
this.createEmptyMovieClip("focusRect", 1000);
this.focusRect.controller = this;
this.focusRect.lineStyle(1, _local5);
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, _local4);
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 _local19 = parseInt(value);
if (!isNaN(_local19)) {
value = _local19;
}
var _local18 = ((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 || (!_local18)) {
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 _local15 = propName.substring(4, propName.length);
var _local17 = _local15.substring(0, 1);
_local17 = _local17.toLowerCase();
_local15 = _local17 + _local15.substring(1, _local15.length);
this.textStyle[_local15] = value;
this.invalidate("setSize");
} else {
for (var _local16 in this.styleTable[propName].coloredMCs) {
var _local4 = new Color(this.styleTable[propName].coloredMCs[_local16]);
if (this.styleTable[propName].value == undefined) {
var _local5 = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
_local4.setTransform(_local5);
} else {
_local4.setRGB(value);
}
}
}
this.styleTable[propName].useGlobal = _local18;
}
};
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 _local4 = new Color(skinMCRef);
_local4.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 _local3 in arguments[0]) {
this[_local3] = arguments[0][_local3];
}
}
};
_global.FStyleFormat.prototype = new Object();
FStyleFormat.prototype.addListener = function () {
var _local3 = 0;
while (_local3 < arguments.length) {
var _local4 = arguments[_local3];
this.listeners[arguments[_local3]] = _local4;
for (var _local5 in this) {
if (this.isAStyle(_local5)) {
_local4.updateStyleProperty(this, _local5.toString());
}
}
_local3++;
}
};
FStyleFormat.prototype.removeListener = function (component) {
this.listeners[component] = undefined;
for (var _local4 in this) {
if (this.isAStyle(_local4)) {
if (component.styleTable[_local4].useGlobal == this.isGlobal) {
component.styleTable[_local4].useGlobal = true;
var _local3 = (this.isGlobal ? undefined : (globalStyleFormat[_local4]));
component.setStyleProperty(_local4, _local3, true);
}
}
}
};
FStyleFormat.prototype.applyChanges = function () {
var _local6 = 0;
for (var _local5 in this.listeners) {
var _local3 = this.listeners[_local5];
if (arguments.length > 0) {
var _local4 = 0;
while (_local4 < arguments.length) {
if (this.isAStyle(arguments[_local4])) {
_local3.updateStyleProperty(this, arguments[_local4]);
}
_local4++;
}
} else {
for (var _local4 in this) {
if (this.isAStyle(_local4)) {
_local3.updateStyleProperty(this, _local4.toString());
}
}
}
}
};
FStyleFormat.prototype.isAStyle = function (name) {
return((this.nonStyles[name] ? false : true));
};
#endinitclip
Symbol 20 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 30 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 39 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "foregroundDisabled");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 40 MovieClip [UpArrow] Frame 1
stop();
Symbol 40 MovieClip [UpArrow] Frame 2
stop();
Symbol 40 MovieClip [UpArrow] Frame 3
stop();
Symbol 47 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 54 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 59 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(highlight3D_mc, "highlight3D");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
Symbol 60 MovieClip [ScrollThumb] Frame 1
stop();
Symbol 69 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 77 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 85 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "foregroundDisabled");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 86 MovieClip [DownArrow] Frame 1
stop();
Symbol 86 MovieClip [DownArrow] Frame 2
stop();
Symbol 86 MovieClip [DownArrow] Frame 3
stop();
Symbol 100 Button
on (release) {
closeMe();
}
Symbol 102 Button
on (release) {
sendMessage();
}
Symbol 103 MovieClip [pmWindow] Frame 1
function closeMe() {
_parent.hideWindow(this._name);
}
function sendMessage() {
var _local3 = message.text;
if (_local3.length > 0) {
_parent.sendPrivateMessage(_local3, _global.pmUid);
message.text = "";
}
}
Selection.setFocus(message);
TextField.prototype.onKeyDown = function () {
if (((Key.getCode() == 13) && (this.pressedOnce == undefined)) && (this.isFocused())) {
if (this._name == "message") {
sendMessage();
}
this.pressedOnce = true;
}
};
TextField.prototype.onKeyUp = function () {
if (Key.getCode() == 13) {
this.pressedOnce = undefined;
}
};
TextField.prototype.isFocused = function () {
if (Selection.getFocus() == targetPath(this)) {
return(true);
}
return(false);
};
Symbol 107 Button
on (release) {
closeMe();
}
Symbol 109 Button
on (release) {
restart();
}
Symbol 110 MovieClip [gameEnd] Frame 1
function closeMe() {
_parent.leaveGameRoom();
_parent.hideWindow(this._name);
}
function restart() {
_parent.smartfox.sendObject({type:"restart"});
_parent.restartGame();
}
Symbol 112 MovieClip [gameMessage] Frame 1
function closeMe() {
_parent.leaveGameRoom();
_parent.hideWindow(this._name);
}
Symbol 115 Button
on (release) {
closeMe();
}
Symbol 116 MovieClip [errorWindow] Frame 1
function closeMe() {
_parent.hideWindow(this._name);
}
Selection.setFocus("roomName");
Symbol 122 Button
on (release) {
create();
}
Symbol 123 MovieClip [newGameWindow] Frame 1
function closeMe() {
_parent.hideWindow(this._name);
}
function create() {
if (roomName.text != "") {
rName = roomName.text;
rPwd = pword.text;
roomName.text = "";
pword.text = "";
_parent.createRoom(rName, rPwd);
}
}
Selection.setFocus(roomName);
Key.addListener(roomName);
Key.addListener(pword);
TextField.prototype.onKeyDown = function () {
if (((Key.getCode() == 13) && (this.pressedOnce == undefined)) && (this.isFocused())) {
if (this._name == "roomName") {
create();
} else if (this._name == "pword") {
create();
}
this.pressedOnce = true;
}
};
TextField.prototype.onKeyUp = function () {
if (Key.getCode() == 13) {
this.pressedOnce = undefined;
}
};
TextField.prototype.isFocused = function () {
if (Selection.getFocus() == targetPath(this)) {
return(true);
}
return(false);
};
Symbol 127 Button
on (release) {
login();
}
Symbol 128 MovieClip [passwordWindow] Frame 1
function closeMe() {
_parent.hideWindow(this._name);
}
function login() {
var _local2 = pword.text;
if (_local2.length > 0) {
pword.text = "";
_parent.loginProtectedRoom(_local2);
}
}
Selection.setFocus("roomName");
Symbol 131 MovieClip Frame 1
var component = _parent;
component.registerSkinElement(track_mc, "scrollTrack");
Symbol 132 MovieClip [FScrollBarSymbol] Frame 1
#initclip 14
FScrollBarClass = function () {
if (this._height == 4) {
return(undefined);
}
this.init();
this.minPos = (this.maxPos = (this.pageSize = (this.largeScroll = 0)));
this.smallScroll = 1;
this.width = (this.horizontal ? (this._width) : (this._height));
this._xscale = (this._yscale = 100);
this.setScrollPosition(0);
this.tabEnabled = false;
if (this._targetInstanceName.length > 0) {
this.setScrollTarget(this._parent[this._targetInstanceName]);
}
this.tabChildren = false;
this.setSize(this.width);
};
FScrollBarClass.prototype = new FUIComponentClass();
FScrollBarClass.prototype.setHorizontal = function (flag) {
if (this.horizontal && (!flag)) {
this._xscale = 100;
this._rotation = 0;
} else if (flag && (!this.horizontal)) {
this._xscale = -100;
this._rotation = -90;
}
this.horizontal = flag;
};
FScrollBarClass.prototype.setScrollProperties = function (pSize, mnPos, mxPos) {
if (!this.enable) {
return(undefined);
}
this.pageSize = pSize;
this.minPos = Math.max(mnPos, 0);
this.maxPos = Math.max(mxPos, 0);
this.scrollPosition = Math.max(this.minPos, this.scrollPosition);
this.scrollPosition = Math.min(this.maxPos, this.scrollPosition);
if ((this.maxPos - this.minPos) <= 0) {
this.scrollThumb_mc.removeMovieClip();
this.upArrow_mc.gotoAndStop(3);
this.downArrow_mc.gotoAndStop(3);
this.downArrow_mc.onPress = (this.downArrow_mc.onRelease = (this.downArrow_mc.onDragOut = null));
this.upArrow_mc.onPress = (this.upArrow_mc.onRelease = (this.upArrow_mc.onDragOut = null));
this.scrollTrack_mc.onPress = (this.scrollTrack_mc.onRelease = null);
this.scrollTrack_mc.onDragOut = (this.scrollTrack_mc.onRollOut = null);
this.scrollTrack_mc.useHandCursor = false;
} else {
var _local2 = this.getScrollPosition();
this.upArrow_mc.gotoAndStop(1);
this.downArrow_mc.gotoAndStop(1);
this.upArrow_mc.onPress = (this.upArrow_mc.onDragOver = this.startUpScroller);
this.upArrow_mc.onRelease = (this.upArrow_mc.onDragOut = this.stopScrolling);
this.downArrow_mc.onPress = (this.downArrow_mc.onDragOver = this.startDownScroller);
this.downArrow_mc.onRelease = (this.downArrow_mc.onDragOut = this.stopScrolling);
this.scrollTrack_mc.onPress = (this.scrollTrack_mc.onDragOver = this.startTrackScroller);
this.scrollTrack_mc.onRelease = this.stopScrolling;
this.scrollTrack_mc.onDragOut = this.stopScrolling;
this.scrollTrack_mc.onRollOut = this.stopScrolling;
this.scrollTrack_mc.useHandCursor = false;
this.attachMovie("ScrollThumb", "scrollThumb_mc", 3);
this.scrollThumb_mc._x = 0;
this.scrollThumb_mc._y = this.upArrow_mc._height;
this.scrollThumb_mc.onPress = this.startDragThumb;
this.scrollThumb_mc.controller = this;
this.scrollThumb_mc.onRelease = (this.scrollThumb_mc.onReleaseOutside = this.stopDragThumb);
this.scrollThumb_mc.useHandCursor = false;
this.thumbHeight = (this.pageSize / ((this.maxPos - this.minPos) + this.pageSize)) * this.trackSize;
this.thumbMid_mc = this.scrollThumb_mc.mc_sliderMid;
this.thumbTop_mc = this.scrollThumb_mc.mc_sliderTop;
this.thumbBot_mc = this.scrollThumb_mc.mc_sliderBot;
this.thumbHeight = Math.max(this.thumbHeight, 6);
this.midHeight = (this.thumbHeight - this.thumbTop_mc._height) - this.thumbBot_mc._height;
this.thumbMid_mc._yscale = (this.midHeight * 100) / this.thumbMid_mc._height;
this.thumbMid_mc._y = this.thumbTop_mc._height;
this.thumbBot_mc._y = this.thumbTop_mc._height + this.midHeight;
this.scrollTop = this.scrollThumb_mc._y;
this.trackHeight = this.trackSize - this.thumbHeight;
this.scrollBot = this.trackHeight + this.scrollTop;
_local2 = Math.min(_local2, this.maxPos);
this.setScrollPosition(Math.max(_local2, this.minPos));
}
};
FScrollBarClass.prototype.getScrollPosition = function () {
return(this.scrollPosition);
};
FScrollBarClass.prototype.setScrollPosition = function (pos) {
this.scrollPosition = pos;
if (this.scrollThumb_mc != undefined) {
pos = Math.min(pos, this.maxPos);
pos = Math.max(pos, this.minPos);
}
this.scrollThumb_mc._y = (((pos - this.minPos) * this.trackHeight) / (this.maxPos - this.minPos)) + this.scrollTop;
this.executeCallBack();
};
FScrollBarClass.prototype.setLargeScroll = function (lScroll) {
this.largeScroll = lScroll;
};
FScrollBarClass.prototype.setSmallScroll = function (sScroll) {
this.smallScroll = sScroll;
};
FScrollBarClass.prototype.setEnabled = function (enabledFlag) {
var _local3 = this.enable;
if (enabledFlag && (!_local3)) {
this.enable = enabledFlag;
if (this.textField != undefined) {
this.setScrollTarget(this.textField);
} else {
this.setScrollProperties(this.pageSize, this.cachedMinPos, this.cachedMaxPos);
this.setScrollPosition(this.cachedPos);
}
this.clickFilter = undefined;
} else if ((!enabledFlag) && (_local3)) {
this.textField.removeListener(this);
this.cachedPos = this.getScrollPosition();
this.cachedMinPos = this.minPos;
this.cachedMaxPos = this.maxPos;
if (this.clickFilter == undefined) {
this.setScrollProperties(this.pageSize, 0, 0);
} else {
this.clickFilter = true;
}
this.enable = enabledFlag;
}
};
FScrollBarClass.prototype.setSize = function (hgt) {
if (this._height == 1) {
return(undefined);
}
this.width = hgt;
this.scrollTrack_mc._yscale = 100;
this.scrollTrack_mc._yscale = (100 * this.width) / this.scrollTrack_mc._height;
if (this.upArrow_mc == undefined) {
this.attachMovie("UpArrow", "upArrow_mc", 1);
this.attachMovie("DownArrow", "downArrow_mc", 2);
this.downArrow_mc.controller = (this.upArrow_mc.controller = this);
this.upArrow_mc.useHandCursor = (this.downArrow_mc.useHandCursor = false);
this.upArrow_mc._x = (this.upArrow_mc._y = 0);
this.downArrow_mc._x = 0;
}
this.scrollTrack_mc.controller = this;
this.downArrow_mc._y = this.width - this.downArrow_mc._height;
this.trackSize = this.width - (2 * this.downArrow_mc._height);
if (this.textField != undefined) {
this.onTextChanged();
} else {
this.setScrollProperties(this.pageSize, this.minPos, this.maxPos);
}
};
FScrollBarClass.prototype.scrollIt = function (inc, mode) {
var _local3 = this.smallScroll;
if (inc != "one") {
_local3 = ((this.largeScroll == 0) ? (this.pageSize) : (this.largeScroll));
}
var _local2 = this.getScrollPosition() + (mode * _local3);
if (_local2 > this.maxPos) {
_local2 = this.maxPos;
} else if (_local2 < this.minPos) {
_local2 = this.minPos;
}
this.setScrollPosition(_local2);
};
FScrollBarClass.prototype.startDragThumb = function () {
this.lastY = this._ymouse;
this.onMouseMove = this.controller.dragThumb;
};
FScrollBarClass.prototype.dragThumb = function () {
this.scrollMove = this._ymouse - this.lastY;
this.scrollMove = this.scrollMove + this._y;
if (this.scrollMove < this.controller.scrollTop) {
this.scrollMove = this.controller.scrollTop;
} else if (this.scrollMove > this.controller.scrollBot) {
this.scrollMove = this.controller.scrollBot;
}
this._y = this.scrollMove;
var _local2 = this.controller;
_local2.scrollPosition = Math.round(((_local2.maxPos - _local2.minPos) * (this._y - _local2.scrollTop)) / _local2.trackHeight) + _local2.minPos;
this.controller.isScrolling = true;
updateAfterEvent();
this.controller.executeCallBack();
};
FScrollBarClass.prototype.stopDragThumb = function () {
this.controller.isScrolling = false;
this.onMouseMove = null;
};
FScrollBarClass.prototype.startTrackScroller = function () {
this.controller.trackScroller();
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "page", -1);
};
FScrollBarClass.prototype.scrollInterval = function (inc, mode) {
clearInterval(this.scrolling);
if (inc == "page") {
this.trackScroller();
} else {
this.scrollIt(inc, mode);
}
this.scrolling = setInterval(this, "scrollInterval", 35, inc, mode);
};
FScrollBarClass.prototype.trackScroller = function () {
if ((this.scrollThumb_mc._y + this.thumbHeight) < this._ymouse) {
this.scrollIt("page", 1);
} else if (this.scrollThumb_mc._y > this._ymouse) {
this.scrollIt("page", -1);
}
};
FScrollBarClass.prototype.stopScrolling = function () {
this.controller.downArrow_mc.gotoAndStop(1);
this.controller.upArrow_mc.gotoAndStop(1);
clearInterval(this.controller.scrolling);
};
FScrollBarClass.prototype.startUpScroller = function () {
this.controller.upArrow_mc.gotoAndStop(2);
this.controller.scrollIt("one", -1);
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "one", -1);
};
FScrollBarClass.prototype.startDownScroller = function () {
this.controller.downArrow_mc.gotoAndStop(2);
this.controller.scrollIt("one", 1);
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "one", 1);
};
FScrollBarClass.prototype.setScrollTarget = function (tF) {
if (tF == undefined) {
this.textField.removeListener(this);
delete this.textField[(this.horizontal ? "hScroller" : "vScroller")];
if ((this.textField.hScroller != undefined) && (this.textField.vScroller != undefined)) {
this.textField.unwatch("text");
this.textField.unwatch("htmlText");
}
}
this.textField = undefined;
if (!(tF instanceof TextField)) {
return(undefined);
}
this.textField = tF;
this.textField[(this.horizontal ? "hScroller" : "vScroller")] = this;
this.onTextChanged();
this.onChanged = function () {
this.onTextChanged();
};
this.onScroller = function () {
if (!this.isScrolling) {
if (!this.horizontal) {
this.setScrollPosition(this.textField.scroll);
} else {
this.setScrollPosition(this.textField.hscroll);
}
}
};
this.textField.addListener(this);
this.textField.watch("text", this.callback);
this.textField.watch("htmlText", this.callback);
};
FScrollBarClass.prototype.callback = function (prop, oldVal, newVal) {
clearInterval(this.hScroller.synchScroll);
clearInterval(this.vScroller.synchScroll);
this.hScroller.synchScroll = setInterval(this.hScroller, "onTextChanged", 50);
this.vScroller.synchScroll = setInterval(this.vScroller, "onTextChanged", 50);
return(newVal);
};
FScrollBarClass.prototype.onTextChanged = function () {
if ((!this.enable) || (this.textField == undefined)) {
return(undefined);
}
clearInterval(this.synchScroll);
if (this.horizontal) {
var _local3 = this.textField.hscroll;
this.setScrollProperties(this.textField._width, 0, this.textField.maxhscroll);
this.setScrollPosition(Math.min(_local3, this.textField.maxhscroll));
} else {
var _local3 = this.textField.scroll;
var _local2 = this.textField.bottomScroll - this.textField.scroll;
this.setScrollProperties(_local2, 1, this.textField.maxscroll);
this.setScrollPosition(Math.min(_local3, this.textField.maxscroll));
}
};
FScrollBarClass.prototype.executeCallBack = function () {
if (this.textField == undefined) {
super.executeCallBack();
} else if (this.horizontal) {
this.textField.hscroll = this.getScrollPosition();
} else {
this.textField.scroll = this.getScrollPosition();
}
};
Object.registerClass("FScrollBarSymbol", FScrollBarClass);
#endinitclip
Symbol 133 MovieClip [FListItemSymbol] Frame 1
#initclip 19
function FListItemClass() {
this.init();
}
FListItemClass.prototype = new FSelectableItemClass();
Object.registerClass("FListItemSymbol", FListItemClass);
#endinitclip
Symbol 134 MovieClip [DataProviderSymbol] Frame 1
#initclip 12
_global.DataProviderClass = function () {
this.init();
};
DataProviderClass.prototype.init = function () {
this.items = new Array();
this.uniqueID = 0;
this.views = new Array();
};
DataProviderClass.prototype.addView = function (viewRef) {
this.views.push(viewRef);
var _local2 = {event:"updateAll"};
viewRef.modelChanged(_local2);
};
DataProviderClass.prototype.addItemAt = function (index, value) {
if (index < this.getLength()) {
this.items.splice(index, 0, "tmp");
}
this.items[index] = new Object();
if (typeof(value) == "object") {
this.items[index] = value;
} else {
this.items[index].label = value;
}
this.items[index].__ID__ = this.uniqueID++;
var _local4 = {event:"addRows", firstRow:index, lastRow:index};
this.updateViews(_local4);
};
DataProviderClass.prototype.addItem = function (value) {
this.addItemAt(this.getLength(), value);
};
DataProviderClass.prototype.removeItemAt = function (index) {
var _local4 = this.items[index];
this.items.splice(index, 1);
var _local3 = {event:"deleteRows", firstRow:index, lastRow:index};
this.updateViews(_local3);
return(_local4);
};
DataProviderClass.prototype.removeAll = function () {
this.items = new Array();
this.updateViews({event:"deleteRows", firstRow:0, lastRow:this.getLength() - 1});
};
DataProviderClass.prototype.replaceItemAt = function (index, itemObj) {
if ((index < 0) || (index >= this.getLength())) {
return(undefined);
}
var _local4 = this.getItemID(index);
if (typeof(itemObj) == "object") {
this.items[index] = itemObj;
} else {
this.items[index].label = itemObj;
}
this.items[index].__ID__ = _local4;
this.updateViews({event:"updateRows", firstRow:index, lastRow:index});
};
DataProviderClass.prototype.getLength = function () {
return(this.items.length);
};
DataProviderClass.prototype.getItemAt = function (index) {
return(this.items[index]);
};
DataProviderClass.prototype.getItemID = function (index) {
return(this.items[index].__ID__);
};
DataProviderClass.prototype.sortItemsBy = function (fieldName, order) {
this.items.sortOn(fieldName);
if (order == "DESC") {
this.items.reverse();
}
this.updateViews({event:"sort"});
};
DataProviderClass.prototype.updateViews = function (eventObj) {
var _local2 = 0;
while (_local2 < this.views.length) {
this.views[_local2].modelChanged(eventObj);
_local2++;
}
};
#endinitclip
Symbol 135 MovieClip [FSelectableItemSymbol] Frame 1
#initclip 16
function FSelectableItemClass() {
this.init();
}
FSelectableItemClass.prototype = new FUIComponentClass();
FSelectableItemClass.prototype.init = function () {
if (this._name != "itemAsset") {
this.highlighted = false;
this.layoutContent(100);
}
};
FSelectableItemClass.prototype.drawItem = function (itmObj, selected) {
this.displayContent(itmObj, selected);
if ((this.highlighted != selected) || ((this.controller.focused != this.oldFocus) && (selected))) {
this.setHighlighted(selected);
}
this.oldFocus = this.controller.focused;
};
FSelectableItemClass.prototype.setSize = function (width, height) {
var _local2 = -16384;
this.width = width;
this.layoutContent(width);
this.attachMovie("FHighlightSymbol", "highlight_mc", _local2);
this.highlight_mc._x = 0.5;
this.highlight_mc._width = width - 0.5;
this.highlight_mc._height = height;
this.highlight_mc.controller = this;
this.highlight_mc._alpha = 0;
this.highlight_mc.trackAsMenu = true;
this.highlight_mc.onPress = function () {
if (this.controller.enable) {
this.controller.controller.clickHandler(this.controller.itemNum);
}
};
this.highlight_mc.onDragOver = function () {
if (this.controller.controller.focused) {
this.onPress();
}
};
this.highlight_mc.useHandCursor = false;
this.highlight_mc.trackAsMenu = true;
};
FSelectableItemClass.prototype.setEnabled = function (enabledFlag) {
this.enable = enabledFlag;
this.fLabel_mc.setEnabled(enabledFlag);
this.highlight_mc.gotoAndStop((enabledFlag ? "unfocused" : "disabled"));
};
FSelectableItemClass.prototype.layoutContent = function (width) {
this.attachMovie("FLabelSymbol", "fLabel_mc", 2, {hostComponent:this.controller});
this.fLabel_mc._x = 2;
this.fLabel_mc._y = 0;
this.fLabel_mc.setSize(width - 2);
this.fLabel_mc.labelField.selectable = false;
};
FSelectableItemClass.prototype.displayContent = function (itmObj, selected) {
var _local2 = "";
if (itmObj.label != undefined) {
_local2 = itmObj.label;
} else if (typeof(itmObj) == "object") {
for (var _local4 in itmObj) {
if (_local4 != "__ID__") {
_local2 = (itmObj[_local4] + ", ") + _local2;
}
}
_local2 = _local2.substring(0, _local2.length - 2);
} else {
_local2 = itmObj;
}
if (this.fLabel_mc.labelField.text != _local2) {
this.fLabel_mc.setLabel(_local2);
}
var _local5 = (selected ? (this.controller.styleTable.textSelected.value) : (this.controller.styleTable.textColor.value));
if (_local5 == undefined) {
_local5 = (selected ? 16777215 : 0);
}
this.fLabel_mc.setColor(_local5);
};
FSelectableItemClass.prototype.getItemIndex = function () {
return(this.controller.getScrollPosition() + this.itemNum);
};
FSelectableItemClass.prototype.getItemModel = function () {
return(this.controller.getItemAt(this.getItemIndex()));
};
FSelectableItemClass.prototype.getHostDataProvider = function () {
return(this.controller.dataProvider);
};
FSelectableItemClass.prototype.setHighlighted = function (flag) {
fade = this.controller.styleTable.fadeRate.value;
if (((fade == undefined) || (fade == 0)) || (!flag)) {
this.highlight_mc._alpha = (flag ? 100 : 0);
delete this.onEnterFrame;
} else {
this.fadeN = fade;
this.fadeX = 1;
this.highlight_mc._alpha = 20;
this.onEnterFrame = function () {
this.highlight_mc._alpha = (60 * Math.sqrt((this.fadeX++) / this.fadeN)) + 40;
if (this.fadeX > this.fadeN) {
delete this.onEnterFrame;
}
};
}
this.highlighted = flag;
};
#endinitclip
Symbol 136 MovieClip [FSelectableListSymbol] Frame 1
#initclip 15
function FSelectableListClass() {
this.init();
}
FSelectableListClass.prototype = new FUIComponentClass();
FSelectableListClass.prototype.init = function () {
super.init();
this.enable = true;
this.selected = new Array();
this.topDisplayed = (this.numDisplayed = 0);
this.lastSelected = 0;
this.tabChildren = false;
if (this._name != undefined) {
this.dataProvider = new DataProviderClass();
this.dataProvider.addView(this);
}
};
FSelectableListClass.prototype.addItemAt = function (index, label, data) {
if (index < 0) {
return(undefined);
}
this.dataProvider.addItemAt(index, {label:label, data:data});
};
FSelectableListClass.prototype.addItem = function (label, data) {
this.dataProvider.addItem({label:label, data:data});
};
FSelectableListClass.prototype.removeItemAt = function (index) {
this.selectHolder = this.getSelectedIndex();
var _local2 = this.getItemAt(index);
this.dataProvider.removeItemAt(index);
return(_local2);
};
FSelectableListClass.prototype.removeAll = function () {
this.dataProvider.removeAll();
};
FSelectableListClass.prototype.replaceItemAt = function (index, newLabel, newData) {
this.dataProvider.replaceItemAt(index, {label:newLabel, data:newData});
};
FSelectableListClass.prototype.sortItemsBy = function (fieldName, order) {
this.lastSelID = this.dataProvider.getItemID(this.lastSelected);
this.dataProvider.sortItemsBy(fieldName, order);
};
FSelectableListClass.prototype.getLength = function () {
return(this.dataProvider.getLength());
};
FSelectableListClass.prototype.getSelectedIndex = function () {
for (var _local3 in this.selected) {
var _local2 = this.selected[_local3].sIndex;
if (_local2 != undefined) {
return(_local2);
}
}
};
FSelectableListClass.prototype.getSelectedItem = function () {
return(this.getItemAt(this.getSelectedIndex()));
};
FSelectableListClass.prototype.getItemAt = function (index) {
return(this.dataProvider.getItemAt(index));
};
FSelectableListClass.prototype.getEnabled = function () {
return(this.enable);
};
FSelectableListClass.prototype.getValue = function () {
var _local2 = this.getSelectedItem();
return(((_local2.data == undefined) ? (_local2.label) : (_local2.data)));
};
FSelectableListClass.prototype.setSelectedIndex = function (index, flag) {
if (((index >= 0) && (index < this.getLength())) && (this.enable)) {
this.clearSelected();
this.selectItem(index, true);
this.lastSelected = index;
this.invalidate("updateControl");
if (flag != false) {
this.executeCallBack();
}
}
};
FSelectableListClass.prototype.setDataProvider = function (obj) {
this.setScrollPosition(0);
this.clearSelected();
if (obj instanceof Array) {
this.dataProvider = new DataProviderClass();
var _local2 = 0;
while (_local2 < obj.length) {
var _local4 = ((typeof(obj[_local2]) == "string") ? ({label:obj[_local2]}) : (obj[_local2]));
this.dataProvider.addItem(_local4);
_local2++;
}
} else {
this.dataProvider = obj;
}
this.dataProvider.addView(this);
};
FSelectableListClass.prototype.setItemSymbol = function (linkID) {
this.tmpPos = this.getScrollPosition();
this.itemSymbol = linkID;
this.invalidate("setSize");
this.setScrollPosition(this.tmpPos);
};
FSelectableListClass.prototype.setEnabled = function (enabledFlag) {
this.cleanUI();
super.setEnabled(enabledFlag);
this.enable = enabledFlag;
this.boundingBox_mc.gotoAndStop((this.enable ? "enabled" : "disabled"));
var _local4 = Math.min(this.numDisplayed, this.getLength());
var _local3 = 0;
while (_local3 < _local4) {
this.container_mc[("fListItem" + _local3) + "_mc"].setEnabled(this.enable);
_local3++;
}
if (this.enable) {
this.invalidate("updateControl");
}
};
FSelectableListClass.prototype.updateControl = function () {
var _local2 = 0;
while (_local2 < this.numDisplayed) {
this.container_mc[("fListItem" + _local2) + "_mc"].drawItem(this.getItemAt(this.topDisplayed + _local2), this.isSelected(this.topDisplayed + _local2));
_local2++;
}
};
FSelectableListClass.prototype.setSize = function (w, h) {
super.setSize(w, h);
this.boundingBox_mc._xscale = (this.boundingBox_mc._yscale = 100);
this.boundingBox_mc._xscale = (this.width * 100) / this.boundingBox_mc._width;
this.boundingBox_mc._yscale = (this.height * 100) / this.boundingBox_mc._height;
var _local3 = 0;
while (_local3 < this.numDisplayed) {
this.container_mc.attachMovie(this.itemSymbol, ("fListItem" + _local3) + "_mc", 10 + _local3, {controller:this, itemNum:_local3});
var _local4 = this.container_mc[("fListItem" + _local3) + "_mc"];
var _local5 = ((this.scrollOffset == undefined) ? 0 : (this.scrollOffset));
_local4.setSize(this.width - _local5, this.itmHgt);
_local4._y = (this.itmHgt - 2) * _local3;
_local3++;
}
this.updateControl();
};
FSelectableListClass.prototype.modelChanged = function (eventObj) {
var _local4 = eventObj.firstRow;
var _local6 = eventObj.lastRow;
var _local8 = eventObj.event;
if (_local8 == "addRows") {
for (var _local2 in this.selected) {
if ((this.selected[_local2].sIndex != undefined) && (this.selected[_local2].sIndex >= _local4)) {
this.selected[_local2].sIndex = this.selected[_local2].sIndex + ((_local6 - _local4) + 1);
this.setSelectedIndex(this.selected[_local2].sIndex, false);
}
}
} else if (_local8 == "deleteRows") {
if (_local4 == _local6) {
var _local5 = _local4;
if (this.selectHolder == _local5) {
this.selectionDeleted = true;
}
if (((this.topDisplayed + this.numDisplayed) >= this.getLength()) && (this.topDisplayed > 0)) {
this.topDisplayed--;
if (this.selectionDeleted && ((_local5 - 1) >= 0)) {
this.setSelectedIndex(_local5 - 1, false);
}
} else if (this.selectionDeleted) {
var _local7 = this.getLength();
if (((_local5 == (_local7 - 1)) && (_local7 > 1)) || (_local5 > (_local7 / 2))) {
this.setSelectedIndex(_local5 - 1, false);
} else {
this.setSelectedIndex(_local5, false);
}
}
for (var _local2 in this.selected) {
if (this.selected[_local2].sIndex > _local4) {
this.selected[_local2].sIndex--;
}
}
} else {
this.clearSelected();
this.topDisplayed = 0;
}
} else if (_local8 == "sort") {
var _local7 = this.getLength();
var _local2 = 0;
while (_local2 < _local7) {
if (this.isSelected(_local2)) {
var _local3 = this.dataProvider.getItemID(_local2);
if (_local3 == this.lastSelID) {
this.lastSelected = _local2;
}
this.selected[String(_local3)].sIndex = _local2;
}
_local2++;
}
}
this.invalidate("updateControl");
};
FSelectableListClass.prototype.measureItmHgt = function () {
this.attachMovie(this.itemSymbol, "tmpItem_mc", 0, {controller:this});
this.tmpItem_mc.drawItem({label:"Sizer: PjtTopg"}, false);
this.itmHgt = this.tmpItem_mc._height;
this.tmpItem_mc.removeMovieClip();
};
FSelectableListClass.prototype.selectItem = function (index, selectedFlag) {
if (selectedFlag && (!this.isSelected(index))) {
this.selected[String(this.dataProvider.getItemID(index))] = {sIndex:index};
} else if (!selectedFlag) {
delete this.selected[String(this.dataProvider.getItemID(index))];
}
};
FSelectableListClass.prototype.isSelected = function (index) {
return(this.selected[String(this.dataProvider.getItemID(index))].sIndex != undefined);
};
FSelectableListClass.prototype.clearSelected = function () {
for (var _local3 in this.selected) {
var _local2 = this.selected[_local3].sIndex;
if (((_local2 != undefined) && (this.topDisplayed <= _local2)) && (_local2 < (this.topDisplayed + this.numDisplayed))) {
this.container_mc[("fListItem" + (_local2 - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(_local2), false);
}
}
delete this.selected;
this.selected = new Array();
};
FSelectableListClass.prototype.selectionHandler = function (itemNum) {
var _local2 = this.topDisplayed + itemNum;
if (this.getItemAt(_local2 == undefined)) {
this.changeFlag = false;
return(undefined);
}
this.changeFlag = true;
this.clearSelected();
this.selectItem(_local2, true);
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(_local2), this.isSelected(_local2));
};
FSelectableListClass.prototype.moveSelBy = function (incr) {
var _local3 = this.getSelectedIndex();
var _local2 = _local3 + incr;
_local2 = Math.max(0, _local2);
_local2 = Math.min(this.getLength() - 1, _local2);
if (_local2 == _local3) {
return(undefined);
}
if ((_local3 < this.topDisplayed) || (_local3 >= (this.topDisplayed + this.numDisplayed))) {
this.setScrollPosition(_local3);
}
if ((_local2 >= (this.topDisplayed + this.numDisplayed)) || (_local2 < this.topDisplayed)) {
this.setScrollPosition(this.topDisplayed + incr);
}
this.selectionHandler(_local2 - this.topDisplayed);
};
FSelectableListClass.prototype.clickHandler = function (itmNum) {
this.focusRect.removeMovieClip();
if (!this.focused) {
this.pressFocus();
}
this.selectionHandler(itmNum);
this.onMouseUp = this.releaseHandler;
};
FSelectableListClass.prototype.releaseHandler = function () {
if (this.changeFlag) {
this.executeCallBack();
}
this.changeFlag = false;
this.onMouseUp = undefined;
};
FSelectableListClass.prototype.myOnSetFocus = function () {
super.myOnSetFocus();
var _local3 = 0;
while (_local3 < this.numDisplayed) {
this.container_mc[("fListItem" + _local3) + "_mc"].highlight_mc.gotoAndStop("enabled");
_local3++;
}
};
FSelectableListClass.prototype.myOnKillFocus = function () {
super.myOnKillFocus();
var _local3 = 0;
while (_local3 < this.numDisplayed) {
this.container_mc[("fListItem" + _local3) + "_mc"].highlight_mc.gotoAndStop("unfocused");
_local3++;
}
};
#endinitclip
Instance of Symbol 134 MovieClip [DataProviderSymbol] "dPAsset" in Symbol 136 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (construct) {
}
Instance of Symbol 135 MovieClip [FSelectableItemSymbol] "ItemAsset" in Symbol 136 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (construct) {
}
Symbol 137 MovieClip [FScrollSelectListSymbol] Frame 1
#initclip 17
function FScrollSelectListClass() {
this.init();
}
FScrollSelectListClass.prototype = new FSelectableListClass();
FScrollSelectListClass.prototype.getScrollPosition = function () {
return(this.topDisplayed);
};
FScrollSelectListClass.prototype.setScrollPosition = function (pos) {
if (this.enable) {
pos = Math.min(pos, this.getLength() - this.numDisplayed);
pos = Math.max(pos, 0);
this.scrollBar_mc.setScrollPosition(pos);
}
};
FScrollSelectListClass.prototype.setAutoHideScrollBar = function (flag) {
this.permaScrollBar = !flag;
this.setSize(this.width, this.height);
};
FScrollSelectListClass.prototype.setEnabled = function (enabledFlag) {
super.setEnabled(enabledFlag);
this.scrollBar_mc.setEnabled(this.enable);
};
FScrollSelectListClass.prototype.setSize = function (w, h) {
var _local3 = this.getScrollPosition();
super.setSize(w, h);
if (this.scrollBar_mc != undefined) {
this.removed = true;
}
this.scrollBar_mc = undefined;
this.initScrollBar();
this.setScrollPosition(_local3);
};
FScrollSelectListClass.prototype.modelChanged = function (eventObj) {
super.modelChanged(eventObj);
this.invalidate("initScrollBar");
};
FScrollSelectListClass.prototype.initScrollBar = function () {
if ((!this.permaScrollBar) && (this.getLength() <= this.numDisplayed)) {
if (this.removed) {
this.scrollBar_mc.removeMovieClip();
this.scrollBar_mc = undefined;
this.scrollOffset = undefined;
this.invalidate("setSize");
}
} else {
if (this.scrollBar_mc == undefined) {
this.container_mc.attachMovie("FScrollBarSymbol", "scrollBar_mc", 3000, {hostStyle:this.styleTable});
this.scrollBar_mc = this.container_mc.scrollBar_mc;
this.scrollBar_mc.setChangeHandler("scrollHandler", this);
this.scrollBar_mc.setSize(this.height);
this.scrollBar_mc._x = this.width - this.scrollBar_mc._width;
this.scrollBar_mc._y = 0;
this.scrollBar_mc.setLargeScroll(this.numDisplayed - 1);
this.scrollOffset = this.scrollBar_mc._width;
this.invalidate("setSize");
}
this.scrollBar_mc.setScrollProperties(this.numDisplayed, 0, this.getLength() - this.numDisplayed);
}
};
FScrollSelectListClass.prototype.scrollHandler = function (scrollBar) {
var _local2 = scrollBar.getScrollPosition();
this.topDisplayed = _local2;
if (this.lastPosition != _local2) {
this.updateControl();
}
this.lastPosition = _local2;
};
FScrollSelectListClass.prototype.clickHandler = function (itmNum) {
super.clickHandler(itmNum);
if ((this.dragScrolling == undefined) && (this.scrollBar_mc != undefined)) {
this.dragScrolling = setInterval(this, "dragScroll", 15);
}
};
FScrollSelectListClass.prototype.releaseHandler = function () {
clearInterval(this.dragScrolling);
this.dragScrolling = undefined;
super.releaseHandler();
};
FScrollSelectListClass.prototype.dragScroll = function () {
clearInterval(this.dragScrolling);
if (this.container_mc._ymouse < 0) {
this.setScrollPosition(this.getScrollPosition() - 1);
this.selectionHandler(0);
this.scrollInterval = Math.max(25, (-23.8 * (-this.container_mc._ymouse)) + 500);
this.dragScrolling = setInterval(this, "dragScroll", this.scrollInterval);
} else if (this.container_mc._ymouse > ((this.itmHgt - 2) * this.numDisplayed)) {
this.setScrollPosition(this.getScrollPosition() + 1);
this.selectionHandler(this.numDisplayed - 1);
this.scrollInterval = Math.max(25, (-23.8 * Math.abs((this.container_mc._ymouse - ((this.itmHgt - 2) * this.numDisplayed)) - 2)) + 500);
this.dragScrolling = setInterval(this, "dragScroll", this.scrollInterval);
} else {
this.dragScrolling = setInterval(this, "dragScroll", 15);
}
};
FScrollSelectListClass.prototype.myOnKeyDown = function () {
if (this.focused) {
this.keyCodes = new Array(40, 38, 34, 33, 36, 35);
this.keyIncrs = new Array(1, -1, this.numDisplayed - 1, -(this.numDisplayed - 1), -this.getLength(), this.getLength());
var _local2 = 0;
while (_local2 < this.keyCodes.length) {
if (Key.isDown(this.keyCodes[_local2])) {
this.moveSelBy(this.keyIncrs[_local2]);
return(undefined);
}
_local2++;
}
this.findInputText();
}
};
FScrollSelectListClass.prototype.findInputText = function () {
var _local2 = Key.getAscii();
if ((_local2 >= 33) && (_local2 <= 126)) {
this.findString(String.fromCharCode(_local2));
}
};
FScrollSelectListClass.prototype.findString = function (str) {
if (this.getLength() == 0) {
return(undefined);
}
var _local4 = this.getSelectedIndex();
var _local6 = 0;
var _local2 = _local4 + 1;
while (_local2 != _local4) {
var _local3 = this.getItemAt(_local2).label.substring(0, str.length);
if ((str == _local3) || (str.toUpperCase() == _local3.toUpperCase())) {
_local6 = _local2 - _local4;
break;
}
if (_local2 >= (this.getLength() - 1)) {
_local2 = -1;
}
_local2++;
}
if (_local6 != 0) {
this.moveSelBy(_local6);
}
};
#endinitclip
Instance of Symbol 132 MovieClip [FScrollBarSymbol] "scrollBarAsset" in Symbol 137 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (construct) {
_targetInstanceName = "";
horizontal = false;
}
onClipEvent (load) {
this._width = (this._height = 1);
}
Instance of Symbol 136 MovieClip [FSelectableListSymbol] "superClassAsset" in Symbol 137 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (construct) {
}
Symbol 141 MovieClip [FBoundingBoxSymbol] Frame 1
var component = _parent;
component.registerSkinElement(boundingBox, "background");
stop();
Symbol 141 MovieClip [FBoundingBoxSymbol] Frame 2
component.registerSkinElement(boundingBox2, "backgroundDisabled");
stop();
Symbol 144 MovieClip [FListBoxSymbol] Frame 1
#initclip 18
function FListBoxClass() {
this.itemSymbol = "FListItemSymbol";
this.init();
this.permaScrollBar = true;
var _local2 = 0;
while (_local2 < this.labels.length) {
this.addItem(this.labels[_local2], this.data[_local2]);
_local2++;
}
this.boundingBox_mc.gotoAndStop(1);
this.width = this._width;
this.height = this._height;
this._yscale = (this._xscale = 100);
this.setSize(this.width, this.height);
if (this.changeHandler.length > 0) {
this.setChangeHandler(this.changeHandler);
}
}
FListBoxClass.prototype = new FScrollSelectListClass();
Object.registerClass("FListBoxSymbol", FListBoxClass);
FListBoxClass.prototype.getSelectedIndices = function () {
var _local2 = new Array();
for (var _local3 in this.selected) {
_local2.push(this.selected[_local3].sIndex);
}
return(((_local2.length > 0) ? (_local2) : undefined));
};
FListBoxClass.prototype.getSelectedItems = function () {
var _local3 = this.getSelectedIndices();
var _local4 = new Array();
var _local2 = 0;
while (_local2 < _local3.length) {
_local4.push(this.getItemAt(_local3[_local2]));
_local2++;
}
return(((_local4.length > 0) ? (_local4) : undefined));
};
FListBoxClass.prototype.getSelectMultiple = function () {
return(this.selectMultiple);
};
FListBoxClass.prototype.getRowCount = function () {
return(this.numDisplayed);
};
FListBoxClass.prototype.setSelectedIndices = function (indexArray) {
this.clearSelected();
var _local2 = 0;
while (_local2 < indexArray.length) {
this.selectItem(indexArray[_local2], true);
_local2++;
}
this.updateControl();
};
FListBoxClass.prototype.setSelectMultiple = function (flag) {
this.selectMultiple = flag;
};
FListBoxClass.prototype.setRowCount = function (count) {
var _local2 = (count * (this.itmHgt - 2)) + 2;
this.setSize(this.width, _local2);
};
FListBoxClass.prototype.setWidth = function (wdt) {
this.setSize(wdt, this.height);
};
FListBoxClass.prototype.setSize = function (w, h) {
if (!this.enable) {
return(undefined);
}
w = Math.max(((w == undefined) ? 0 : (w)), 20);
h = Math.max(((h == undefined) ? 0 : (h)), 40);
this.container_mc.removeMovieClip();
this.container_mc = this.createEmptyMovieClip("container", 3);
this.measureItmHgt();
this.numDisplayed = Math.floor(h / (this.itmHgt - 2));
this.height = (this.numDisplayed * (this.itmHgt - 2)) + 2;
super.setSize(w, this.height);
};
FListBoxClass.prototype.removeItemAt = function (index) {
this.selectHolder = this.getSelectedIndices();
return(super.removeItemAt(index));
};
FListBoxClass.prototype.selectionHandler = function (itemNum) {
if (this.clickFilter) {
var _local3 = this.topDisplayed + itemNum;
if (this.getItemAt(_local3) == undefined) {
this.changeFlag = false;
return(undefined);
}
this.changeFlag = true;
if (((!this.selectMultiple) && (!Key.isDown(17))) || ((!Key.isDown(16)) && (!Key.isDown(17)))) {
this.clearSelected();
this.selectItem(_local3, true);
this.lastSelected = _local3;
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(_local3), this.isSelected(_local3));
} else if (Key.isDown(16) && (this.selectMultiple)) {
if (this.lastSelected == -1) {
this.lastSelected = _local3;
}
var _local4 = ((this.lastSelected < _local3) ? 1 : -1);
this.clearSelected();
var _local2 = this.lastSelected;
while (_local2 != _local3) {
this.selectItem(_local2, true);
if ((_local2 >= this.topDisplayed) && (_local2 < (this.topDisplayed + this.numDisplayed))) {
this.container_mc[("fListItem" + (_local2 - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(_local2), this.isSelected(_local2));
}
_local2 = _local2 + _local4;
}
this.selectItem(_local3, true);
this.container_mc[("fListItem" + (_local3 - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(_local3), this.isSelected(_local3));
} else if (Key.isDown(17)) {
var _local6 = this.isSelected(_local3);
if (!this.selectMultiple) {
this.clearSelected();
}
if (!((!this.selectMultiple) && (_local6))) {
this.selectItem(_local3, !_local6);
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(this.topDisplayed + itemNum), this.isSelected(this.topDisplayed + itemNum));
}
this.lastSelected = _local3;
}
} else {
this.clickFilter = true;
}
};
FListBoxClass.prototype.moveSelBy = function (itemNum) {
super.moveSelBy(itemNum);
this.releaseHandler();
};
#endinitclip
this.deadPreview._visible = false;
Instance of Symbol 137 MovieClip [FScrollSelectListSymbol] "superClassAsset" in Symbol 144 MovieClip [FListBoxSymbol] Frame 1
//component parameters
onClipEvent (construct) {
}
Symbol 198 MovieClip [__Packages.it.gotoandplay.smartfoxserver.SmartFoxClient] Frame 0
class it.gotoandplay.smartfoxserver.SmartFoxClient extends XMLSocket
{
var objRef, os, isConnected, debug, arrayTags, messageHandlers, httpConnection, onConnect, onData, onXML, onClose, fpMajorVersion, pollingDelayFn, roomList, buddyList, myBuddyVars, activeRoomId, myUserId, myUserName, playerId, changingRoom, amIModerator, configLoader, onConfigLoadFailure, ipAddress, blueBoxIpAddress, port, onConfigLoadSuccess, onBuddyListUpdate, onBuddyList, t1, socketConnectionTimeoutThread, onConnection, onConnectionLost, close;
function SmartFoxClient (objRef) {
super();
this.objRef = objRef;
os = it.gotoandplay.smartfoxserver.ObjectSerializer.getInstance();
isConnected = false;
debug = false;
initialize();
arrayTags = {uLs:true, rmList:true, vars:true, bList:true, vs:true, mv:true};
messageHandlers = new Object();
httpConnection = new it.gotoandplay.smartfoxserver.http.HttpConnection(mx.utils.Delegate.create(this, handleHttpConnect), mx.utils.Delegate.create(this, handleHttpClose), mx.utils.Delegate.create(this, handleHttpData), mx.utils.Delegate.create(this, handleHttpError));
onConnect = connectionEstablished;
onData = gotData;
onXML = xmlReceived;
onClose = connectionClosed;
fpMajorVersion = getFpMajorVersion();
if (fpMajorVersion < 8) {
pollingDelayFn = _global.setInterval;
} else {
pollingDelayFn = _global.setTimeout;
}
setupMessageHandlers();
}
function get httpPollSpeed() {
return(_httpPollSpeed);
}
function set httpPollSpeed(sp) {
if ((sp >= MIN_POLL_SPEED) && (sp <= MAX_POLL_SPEED)) {
_httpPollSpeed = sp;
}
//return(httpPollSpeed);
}
function getFpMajorVersion() {
var _local1 = System.capabilities.version.indexOf(",");
return(Number(System.capabilities.version.substr(_local1 - 1, 1)));
}
function initialize(isLogout) {
if (isLogout == undefined) {
isLogout = false;
}
roomList = {};
buddyList = [];
myBuddyVars = [];
activeRoomId = null;
myUserId = null;
myUserName = "";
playerId = null;
changingRoom = false;
amIModerator = false;
if (!isLogout) {
isConnected = false;
isHttpMode = false;
preConnection = true;
}
}
function loadConfig(configFile, autoConnect) {
if (configFile == undefined) {
configFile = DEFAULT_CONFIG_FILE;
}
if (autoConnect == undefined) {
autoConnectOnConfigSuccess = DEFAULT_AUTO_CONNECT;
} else {
autoConnectOnConfigSuccess = autoConnect;
}
configLoader = new XML();
configLoader.ignoreWhite = true;
configLoader.onLoad = mx.utils.Delegate.create(this, onConfigLoadSucceeded);
configLoader.load(configFile);
}
function onConfigLoadSucceeded(ok) {
if (!ok) {
onConfigLoadFailure("Could not load config file!");
return(undefined);
}
var _local6 = configLoader.childNodes[0].childNodes;
var _local4 = 0;
while (_local4 < _local6.length) {
var _local5 = _local6[_local4];
var _local2 = _local5.nodeName.toLowerCase();
var _local3 = _local5.firstChild.nodeValue;
if (_local2 == "ip") {
ipAddress = (blueBoxIpAddress = _local3);
} else if (_local2 == "port") {
port = Number(_local3);
} else if (_local2 == "zone") {
defaultZone = _local3;
} else if (_local2 == "smartconnect") {
smartConnect = ((_local3 == "true") ? true : false);
} else if (_local2 == "blueboxipaddress") {
blueBoxIpAddress = _local3;
} else if (_local2 == "blueboxport") {
blueBoxPort = _local3;
} else if (_local2 == "debug") {
debug = ((_local3 == "true") ? true : false);
} else if (_local2 == "httpport") {
httpPort = Number(_local3);
} else if (_local2 == "httppollspeed") {
httpPollSpeed = (Number(_local3));
} else if (_local2 == "socketconnectiontimeout") {
socketConnectionTimeout = Number(_local3);
} else if (_local2 == "rawprotocolseparator") {
rawProtocolSeparator = _local3;
}
_local4++;
}
if (autoConnectOnConfigSuccess) {
connect(ipAddress, port);
} else {
onConfigLoadSuccess();
}
}
function onConfigLoadFailed(code) {
if (code == 404) {
onConfigLoadFailure("Could not find configuration file.");
} else {
onConfigLoadFailure("Could not load configuration file. Http status = " + code);
}
}
function getVersion() {
return((((majVersion + ".") + minVersion) + ".") + subVersion);
}
function connected() {
return(isConnected);
}
function getConnectionMode() {
var _local2 = CONNECTION_MODE_DISCONNECTED;
if (isConnected) {
if (isHttpMode) {
_local2 = CONNECTION_MODE_HTTP;
} else {
_local2 = CONNECTION_MODE_SOCKET;
}
}
return(_local2);
}
function setupMessageHandlers() {
addMessageHandler("sys", handleSysMessages);
addMessageHandler("xt", handleExtensionMessages);
}
function addMessageHandler(handlerId, handlerMethod) {
if (messageHandlers[handlerId] == undefined) {
messageHandlers[handlerId] = new Object();
messageHandlers[handlerId].handleMessage = handlerMethod;
} else {
trace(("Warning: [" + handlerId) + "] handler could not be created. A handler with this name already exist!");
}
}
function isModerator() {
return(amIModerator);
}
function handleSysMessages(xmlObj, scope) {
var _local9 = xmlObj.attributes.action;
var _local20 = xmlObj.attributes.r;
if (_local9 == "apiOK") {
scope.isConnected = true;
scope.onConnection(true);
} else if (_local9 == "apiKO") {
scope.onConnection(false);
trace("--------------------------------------------------------");
trace(" WARNING! The API you are using are not compatible with ");
trace(" the SmartFoxServer instance you're trying to connect to");
trace("--------------------------------------------------------");
} else if (_local9 == "logOK") {
scope.myUserId = xmlObj.login.attributes.id;
scope.myUserName = xmlObj.login.attributes.n;
scope.amIModerator = ((xmlObj.login.attributes.mod == "0") ? false : true);
scope.onLogin({success:true, name:scope.myUserName, error:""});
scope.getRoomList();
} else if (_local9 == "logKO") {
var _local62 = xmlObj.login.attributes.e;
scope.onLogin({success:false, name:"", error:_local62});
} else if (_local9 == "logout") {
scope.initialize(true);
scope.onLogout();
} else if (_local9 == "rmList") {
var _local10 = xmlObj.rmList.rmList;
scope.roomList = new Array();
for (var _local43 in _local10) {
var _local6 = _local10[_local43].attributes.id;
var _local2 = _local10[_local43].attributes;
var _local4 = _local2.id;
var _local22 = _local10[_local43].n.value;
var _local23 = Number(_local2.maxu);
var _local24 = Number(_local2.maxs);
var _local66 = (_local2.temp ? true : false);
var _local54 = (_local2.game ? true : false);
var _local30 = (_local2.priv ? true : false);
var _local31 = Number(_local2.ucnt);
var _local25 = Number(_local2.scnt);
var _local71 = (_local2.lmb ? true : false);
scope.roomList[_local6] = new it.gotoandplay.smartfoxserver.Room(_local4, _local22, _local23, _local24, _local66, _local54, _local30);
scope.roomList[_local6].userCount = _local31;
scope.roomList[_local6].specCount = _local25;
scope.roomList[_local6].setIsLimbo(_local71);
var _local3 = _local10[_local43].vars.vars;
var _local37 = 0;
while (_local37 < _local3.length) {
var _local28 = _local3[_local37].attributes.n;
var _local12 = _local3[_local37].attributes.t;
var _local11 = _local3[_local37].value;
var _local13;
if (_local12 == "b") {
_local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
_local13 = Number;
} else if (_local12 == "s") {
_local13 = String;
} else if (_local12 == "x") {
_local13 = function (x) {
return(null);
};
}
scope.roomList[_local6].variables[_local28] = _local13(_local11);
_local37++;
}
}
scope.onRoomListUpdate(scope.roomList);
} else if (_local9 == "joinOK") {
var _local49 = xmlObj.uLs.attributes.r;
var _local7 = xmlObj.uLs.uLs;
var _local16 = xmlObj.vars.vars;
scope.activeRoomId = Number(_local49);
var _local50 = scope.roomList[_local49];
_local50.userList = new Object();
scope.playerId = xmlObj.pid.attributes.id;
_local50.setMyPlayerIndex(xmlObj.pid.attributes.id);
_local50.variables = new Object();
var _local37 = 0;
while (_local37 < _local16.length) {
var _local28 = _local16[_local37].attributes.n;
var _local12 = _local16[_local37].attributes.t;
var _local11 = _local16[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local50.variables[_local28] = _local13(_local11);
_local37++;
}
var _local72 = 0;
var _local59 = 0;
var _local43 = 0;
while (_local43 < _local7.length) {
var _local22 = _local7[_local43].n.value;
var _local4 = _local7[_local43].attributes.i;
var _local63 = _local7[_local43].attributes.m;
var _local75 = _local7[_local43].attributes.s;
var _local51 = _local7[_local43].attributes.p;
_local50.userList[_local4] = new it.gotoandplay.smartfoxserver.User(_local4, _local22);
_local50.userList[_local4].isMod = ((_local63 == "1") ? true : false);
_local50.userList[_local4].isSpec = ((_local75 == "1") ? true : false);
_local50.userList[_local4].pid = ((_local51 == undefined) ? -1 : _local51);
if (_local50.isGame() && (_local75 == "1")) {
_local59++;
} else {
_local72++;
}
var _local14 = _local7[_local43].vars.vars;
_local50.userList[_local4].variables = {};
var _local41 = _local50.userList[_local4].variables;
_local37 = 0;
while (_local37 < _local14.length) {
var _local28 = _local14[_local37].attributes.n;
var _local12 = _local14[_local37].attributes.t;
var _local11 = _local14[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local41[_local28] = _local13(_local11);
_local37++;
}
_local43++;
}
_local50.userCount = _local72;
_local50.specCount = _local59;
scope.changingRoom = false;
scope.onJoinRoom(scope.roomList[_local49]);
} else if (_local9 == "joinKO") {
scope.changingRoom = false;
var _local65 = xmlObj.error.attributes.msg;
scope.onJoinRoomError(_local65);
} else if (_local9 == "uER") {
var _local69 = xmlObj.u.attributes.i;
var _local64 = xmlObj.u.n.value;
var _local63 = xmlObj.u.attributes.m;
var _local75 = xmlObj.u.attributes.s;
var _local51 = xmlObj.u.attributes.p;
var _local50 = scope.roomList[_local20];
_local50.userList[_local69] = new it.gotoandplay.smartfoxserver.User(_local69, _local64);
_local50.userList[_local69].isMod = ((_local63 == "1") ? true : false);
_local50.userList[_local69].isSpec = ((_local75 == "1") ? true : false);
_local50.userList[_local69].pid = ((_local51 == undefined) ? -1 : _local51);
if (_local50.isGame() && (_local75 == "1")) {
_local50.specCount++;
} else {
_local50.userCount++;
}
var _local14 = xmlObj.u.vars.vars;
_local50.userList[_local69].variables = {};
var _local41 = _local50.userList[_local69].variables;
var _local37 = 0;
while (_local37 < _local14.length) {
var _local28 = _local14[_local37].attributes.n;
var _local12 = _local14[_local37].attributes.t;
var _local11 = _local14[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local41[_local28] = _local13(_local11);
_local37++;
}
scope.onUserEnterRoom(_local20, _local50.userList[_local69]);
} else if (_local9 == "userGone") {
var _local69 = xmlObj.user.attributes.id;
var _local50 = scope.roomList[_local20];
var _local64 = _local50.userList[_local69].name;
var _local75 = _local50.userList[_local69].isSpec;
delete _local50.userList[_local69];
if (_local50.isGame() && _local75) {
_local50.specCount--;
} else {
_local50.userCount--;
}
scope.onUserLeaveRoom(_local20, _local69, _local64);
} else if (_local9 == "pubMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47.toString());
scope.onPublicMessage(_local47.toString(), scope.roomList[_local20].userList[_local69], _local20);
} else if (_local9 == "prvMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onPrivateMessage(_local47.toString(), scope.roomList[_local20].userList[_local69], _local69, _local20);
} else if (_local9 == "dmnMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onAdminMessage(_local47.toString(), scope.roomList[_local20].userList[_local69]);
} else if (_local9 == "modMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onModeratorMessage(_local47.toString(), scope.roomList[_local20].userList[_local69]);
} else if (_local9 == "dataObj") {
var _local73 = xmlObj.user.attributes.id;
var _local60 = xmlObj.dataObj.value;
var _local61 = scope.os.deserialize(_local60);
scope.onObjectReceived(_local61, scope.roomList[_local20].userList[_local73]);
} else if (_local9 == "uVarsUpdate") {
var _local69 = xmlObj.user.attributes.id;
var _local15 = xmlObj.vars.vars;
var _local33 = scope.roomList[_local20].userList[_local69];
if (_local33.variables == undefined) {
_local33.variables = {};
}
var _local34 = [];
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
_local34.push(_local28);
_local34[_local28] = true;
if (_local12 == "x") {
delete _local33.variables[_local28];
} else {
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local33.variables[_local28] = _local13(_local11);
}
_local37++;
}
scope.onUserVariablesUpdate(_local33, _local34);
} else if (_local9 == "rVarsUpdate") {
var _local15 = xmlObj.vars.vars;
var _local50 = scope.roomList[_local20];
var _local34 = [];
if (_local50.variables == undefined) {
_local50.variables = new Object();
}
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
_local34.push(_local28);
_local34[_local28] = true;
if (_local12 == "x") {
delete _local50.variables[_local28];
} else {
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local50.variables[_local28] = _local13(_local11);
}
_local37++;
}
scope.onRoomVariablesUpdate(_local50, _local34);
} else if (_local9 == "createRmKO") {
var _local62 = xmlObj.room.attributes.e;
scope.onCreateRoomError(_local62);
} else if (_local9 == "uCount") {
var _local72 = xmlObj.attributes.u;
var _local59 = xmlObj.attributes.s;
var _local44 = scope.roomList[_local20];
_local44.userCount = Number(_local72);
_local44.specCount = Number(_local59);
scope.onUserCountChange(_local44);
} else if (_local9 == "roomAdd") {
var _local38 = xmlObj.rm.attributes;
var _local52 = _local38.id;
var _local67 = xmlObj.rm.name.value;
var _local74 = Number(_local38.max);
var _local58 = Number(_local38.spec);
var _local66 = (_local38.temp ? true : false);
var _local54 = (_local38.game ? true : false);
var _local68 = (_local38.priv ? true : false);
var _local71 = (_local38.limbo ? true : false);
var _local36 = new it.gotoandplay.smartfoxserver.Room(_local52, _local67, _local74, _local58, _local66, _local54, _local68);
_local36.setIsLimbo(_local71);
scope.roomList[_local52] = _local36;
var _local15 = xmlObj.rm.vars.vars;
_local36.variables = new Object();
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local36.variables[_local28] = _local13(_local11);
_local37++;
}
scope.onRoomAdded(_local36);
} else if (_local9 == "roomDel") {
var _local53 = xmlObj.rm.attributes.id;
var _local55 = scope.roomList[_local53];
delete scope.roomList[_local53];
scope.onRoomDeleted(_local55);
} else if (_local9 == "leaveRoom") {
var _local76 = xmlObj.rm.attributes.id;
scope.onRoomLeft(_local76);
} else if (_local9 == "roundTripRes") {
scope.t2 = getTimer();
scope.onRoundTripResponse(scope.t2 - scope.t1);
} else if (_local9 == "swSpec") {
var _local46 = Number(xmlObj.pid.attributes.id);
var _local48 = Number(xmlObj.pid.attributes.u);
if (_local46 > 0) {
scope.roomList[_local20].userCount++;
scope.roomList[_local20].specCount--;
}
if (!isNaN(_local48)) {
var _local50 = scope.roomList[_local20];
_local50.userList[_local48].pid = _local46;
_local50.userList[_local48].isSpec = false;
} else {
scope.playerId = _local46;
scope.onSpectatorSwitched(scope.playerId > 0, scope.playerId, scope.roomList[_local20]);
}
} else if (_local9 == "bList") {
var _local8 = xmlObj.bList.bList;
if (_local8 == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var _local18 = xmlObj.mv.mv;
if (_local18 != undefined) {
for (var it in _local18) {
var _local32 = _local18[it].attributes.n;
var _local27 = _local18[it].value;
scope.myBuddyVars[_local32] = _local27;
}
}
var _local43 = 0;
while (_local43 < _local8.length) {
var _local35 = {};
_local35.isOnline = ((_local8[_local43].attributes.s == "1") ? true : false);
_local35.name = _local8[_local43].n.value;
_local35.id = _local8[_local43].attributes.i;
_local35.isBlocked = ((_local8[_local43].attributes.x == "1") ? true : false);
_local35.variables = {};
var _local21 = _local8[_local43].vs.vs;
for (var _local37 in _local21) {
var _local29 = _local21[_local37].attributes.n;
var _local26 = _local21[_local37].value;
_local35.variables[_local29] = _local26;
}
scope.buddyList.push(_local35);
_local43++;
}
scope.onBuddyList(scope.buddyList);
} else if (_local9 == "bUpd") {
var _local39 = false;
var _local42 = xmlObj.b;
if (_local42 == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var _local35 = {};
_local35.name = _local42.n.value;
_local35.id = _local42.attributes.i;
_local35.isOnline = ((_local42.attributes.s == "1") ? true : false);
_local35.isBlocked = ((_local42.attributes.x == "1") ? true : false);
var _local21 = _local42.vs.vs;
var _local17 = null;
for (var it in scope.buddyList) {
_local17 = scope.buddyList[it];
if (_local17.name == _local35.name) {
scope.buddyList[it] = _local35;
_local35.isBlocked = _local17.isBlocked;
_local35.variables = _local17.variables;
for (var _local43 in _local21) {
var _local29 = _local21[_local43].attributes.n;
var _local26 = _local21[_local43].value;
_local35.variables[_local29] = _local26;
}
_local39 = true;
break;
}
}
if (_local39) {
scope.onBuddyListUpdate(_local35);
}
} else if (_local9 == "bAdd") {
var _local42 = xmlObj.b;
var _local35 = {};
_local35.name = _local42.n.value;
_local35.id = _local42.attributes.i;
_local35.isOnline = ((_local42.attributes.s == "1") ? true : false);
_local35.isBlocked = ((_local42.attributes.x == "1") ? true : false);
_local35.variables = {};
var _local21 = _local42.vs.vs;
for (var _local43 in _local21) {
var _local29 = _local21[_local43].attributes.n;
var _local26 = _local21[_local43].value;
_local35.variables[_local29] = _local26;
}
scope.buddyList.push(_local35);
scope.onBuddyList(scope.buddyList);
} else if (_local9 == "remB") {
var _local40 = xmlObj.n.value;
var _local35 = null;
for (var it in scope.buddyList) {
_local35 = scope.buddyList[it];
if (_local35.name == _local40) {
delete scope.buddyList[it];
scope.onBuddyList(scope.buddyList);
break;
}
}
} else if (_local9 == "bPrm") {
var _local56 = xmlObj.n.value;
var _local45 = "";
if (xmlObj.txt != undefined) {
_local45 = scope.os.decodeEntities(_local45);
}
scope.onBuddyPermissionRequest(_local56, _local45);
} else if (_local9 == "roomB") {
var _local70 = xmlObj.br.attributes.r;
var _local19 = _local70.toString().split(",");
for (var _local43 in _local19) {
_local19[_local43] = Number(_local19[_local43]);
}
scope.onBuddyRoom(_local19);
} else if (_local9 == "rndK") {
var _local57 = xmlObj.k.value;
scope.onRandomKey(_local57);
}
}
function handleExtensionMessages(dataObj, scope, type) {
if (type == undefined) {
type = "xml";
}
if (type == "xml") {
var _local6 = dataObj.attributes.action;
var _local7 = dataObj.attributes.r;
if (_local6 == "xtRes") {
var _local4 = dataObj.value;
var _local5 = scope.os.deserialize(_local4);
scope.onExtensionResponse(_local5, type);
}
} else if (type == "str") {
scope.onExtensionResponse(dataObj, type);
} else if (type == "json") {
scope.onExtensionResponse(dataObj.o, type);
}
}
function sendXtMessage(xtName, cmdName, paramObj, type, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (type == undefined) {
type = "xml";
}
if (type == "xml") {
var _local11;
_local11 = {t:"xt"};
var _local10 = {name:xtName, cmd:cmdName, param:paramObj};
var _local12 = ("<![CDATA[" + os.serialize(_local10)) + "]]>";
send(_local11, "xtReq", roomId, _local12);
} else if (type == "str") {
var _local4;
_local4 = (((((((rawProtocolSeparator + "xt") + rawProtocolSeparator) + xtName) + rawProtocolSeparator) + cmdName) + rawProtocolSeparator) + roomId) + rawProtocolSeparator;
var _local2 = 0;
while (_local2 < paramObj.length) {
_local4 = _local4 + (paramObj[_local2].toString() + rawProtocolSeparator);
_local2++;
}
sendString(_local4);
} else if (type == "json") {
var _local5 = {};
_local5.x = xtName;
_local5.c = cmdName;
_local5.r = roomId;
_local5.p = paramObj;
var _local6 = {};
_local6.t = "xt";
_local6.b = _local5;
try {
var _local13 = it.gotoandplay.smartfoxserver.JSON.stringify(_local6);
sendJson(_local13);
} catch(ex) {
if (debug) {
trace("Error in sending JSON message.");
trace((((((ex.name + " : ") + ex.message) + " : ") + ex.at) + " : ") + ex.text);
}
}
}
}
function dumpObj(obj, depth) {
if (depth == undefined) {
depth = 0;
}
if (debug) {
if (depth == 0) {
trace("+-----------------------------------------------+");
trace("+ Object Dump +");
trace("+-----------------------------------------------+");
}
for (var _local8 in obj) {
var _local4 = obj[_local8];
var _local5 = typeof(_local4);
if (_local5 != "object") {
var _local3 = "";
var _local2 = 0;
while (_local2 < depth) {
_local3 = _local3 + "\t";
_local2++;
}
_local3 = _local3 + (((((_local8 + " : ") + _local4) + " ( ") + _local5) + " )");
trace(_local3);
} else {
dumpObj(_local4, depth + 1);
}
}
}
}
function login(zone, name, pass) {
var _local3 = {t:"sys"};
var _local2 = ((((("<login z='" + zone) + "'><nick><![CDATA[") + name) + "]]></nick><pword><![CDATA[") + pass) + "]]></pword></login>";
send(_local3, "login", 0, _local2);
}
function logout() {
var _local2 = {t:"sys"};
send(_local2, "logout", -1, "");
}
function getRoomList() {
var _local2 = {t:"sys"};
send(_local2, "getRmList", (activeRoomId ? (activeRoomId) : -1), "");
}
function autoJoin() {
var _local2 = {t:"sys"};
send(_local2, "autoJoin", (activeRoomId ? (activeRoomId) : -1), "");
}
function joinRoom(newRoom, pword, isSpectator, dontLeave, oldRoom) {
var _local2 = null;
var _local7;
if (isSpectator) {
_local7 = 1;
} else {
_local7 = 0;
}
if (!changingRoom) {
if (typeof(newRoom) == "number") {
_local2 = newRoom;
} else {
for (var _local4 in roomList) {
if (roomList[_local4].name == newRoom) {
_local2 = roomList[_local4].id;
break;
}
}
}
if (_local2 != null) {
var _local9 = {t:"sys"};
var _local6 = (dontLeave ? "0" : "1");
var _local5;
if (oldRoom) {
_local5 = oldRoom;
} else {
_local5 = activeRoomId;
}
if (activeRoomId == null) {
_local6 = "0";
_local5 = -1;
}
var _local8 = ((((((((("<room id='" + _local2) + "' pwd='") + pword) + "' spec='") + _local7) + "' leave='") + _local6) + "' old='") + _local5) + "' />";
send(_local9, "joinRoom", (activeRoomId ? (activeRoomId) : -1), _local8);
changingRoom = true;
} else {
trace("SmartFoxError: requested room to join does not exist!");
}
}
}
function sendBuddyPermissionResponse(allowBuddy, targetBuddy) {
var _local2 = ((("<n res='" + (allowBuddy ? "g" : "r")) + "'><![CDATA[") + targetBuddy) + "]]></n>";
send({t:"sys"}, "bPrm", -1, _local2);
}
function sendPublicMessage(message, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
var _local3 = ("<txt><![CDATA[" + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "pubMsg", roomId, _local3);
}
function sendPrivateMessage(message, recipientId, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
var _local3 = ((("<txt rcp='" + recipientId) + "'><![CDATA[") + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "prvMsg", roomId, _local3);
}
function sendModeratorMessage(message, type, id) {
var _local2 = {t:"sys"};
var _local3 = ((((("<txt t='" + type) + "' id='") + id) + "'><![CDATA[") + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "modMsg", activeRoomId, _local3);
}
function sendObject(obj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = ("<![CDATA[" + os.serialize(obj)) + "]]>";
var _local3 = {t:"sys"};
send(_local3, "asObj", roomId, _local2);
}
function sendObjectToGroup(obj, userList, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local3 = "";
for (var _local4 in userList) {
if (!isNaN(userList[_local4])) {
_local3 = _local3 + (userList[_local4] + ",");
}
}
_local3 = _local3.substr(0, _local3.length - 1);
obj._$$_ = _local3;
var _local5 = ("<![CDATA[" + os.serialize(obj)) + "]]>";
var _local6 = {t:"sys"};
send(_local6, "asObjG", roomId, _local5);
}
function setBuddyBlockStatus(buddyName, status) {
var _local2 = getBuddyByName(buddyName);
if (_local2 != null) {
if (_local2.blocked != status) {
_local2.isBlocked = status;
var _local3 = ((("<n x='" + (status ? "1" : "0")) + "'><![CDATA[") + buddyName) + "]]></n>";
send({t:"sys"}, "setB", -1, _local3);
onBuddyListUpdate(_local2);
}
}
}
function setUserVariables(varObj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local9 = {t:"sys"};
var _local6 = "<vars>";
var _local4 = roomList[roomId].userList[myUserId];
for (var _local7 in varObj) {
var _local2 = varObj[_local7];
var _local3 = null;
if (typeof(_local2) == "boolean") {
_local3 = "b";
_local2 = (_local2 ? 1 : 0);
} else if (typeof(_local2) == "number") {
_local3 = "n";
} else if (typeof(_local2) == "string") {
_local3 = "s";
} else if (typeof(_local2) == "null") {
_local3 = "x";
delete _local4.variables[_local7];
}
if (_local3 != null) {
_local4.variables[_local7] = _local2;
_local6 = _local6 + (((((("<var n='" + _local7) + "' t='") + _local3) + "'><![CDATA[") + _local2) + "]]></var>");
}
}
_local6 = _local6 + "</vars>";
send(_local9, "setUvars", roomId, _local6);
}
function setBuddyVariables(varList) {
var _local6 = {t:"sys"};
var _local4 = "<vars>";
for (var _local5 in varList) {
var _local2 = varList[_local5];
if (myBuddyVars[_local5] != _local2) {
myBuddyVars[_local5] = _local2;
_local4 = _local4 + (((("<var n='" + _local5) + "'><![CDATA[") + _local2) + "]]></var>");
}
}
_local4 = _local4 + "</vars>";
send(_local6, "setBvars", -1, _local4);
}
function dumpRoomList() {
for (var _local5 in roomList) {
var _local2 = roomList[_local5];
trace(newline);
trace("-------------------------------------");
trace(((" > Room: (" + _local5) + ") - ") + _local2.getName());
trace("isTemp: " + _local2.isTemp());
trace("isGame: " + _local2.isGame());
trace("isPriv: " + _local2.isPrivate());
trace((("Users: " + _local2.getUserCount()) + " / ") + _local2.getMaxUsers());
trace("Variables: ");
for (var _local4 in _local2.variables) {
trace((("\t" + _local4) + " = ") + _local2.getVariable(_local4));
}
trace("\rUserList: ");
var _local3 = _local2.getUserList();
for (var _local4 in _local3) {
trace((("\t" + _local3[_local4].getId()) + " > ") + _local3[_local4].getName());
}
}
}
function createRoom(roomObj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local7 = {t:"sys"};
var _local10 = (roomObj.updatable ? 1 : 0);
var _local5 = (roomObj.isGame ? 1 : 0);
var _local6 = 1;
var _local8 = roomObj.maxSpectators;
if (_local5 && (roomObj.exitCurrentRoom != undefined)) {
_local6 = (roomObj.exitCurrentRoom ? 1 : 0);
}
var _local3 = ((((((("<room upd='" + _local10) + "' tmp='1' gam='") + _local5) + "' spec='") + _local8) + "' exit='") + _local6) + "'>";
_local3 = _local3 + (("<name><![CDATA[" + roomObj.name) + "]]></name>");
_local3 = _local3 + (("<pwd><![CDATA[" + ((roomObj.password == undefined) ? "" : (roomObj.password))) + "]]></pwd>");
_local3 = _local3 + (("<max>" + roomObj.maxUsers) + "</max>");
if (roomObj.uCount != undefined) {
_local3 = _local3 + (("<uCnt>" + (roomObj.uCount ? "1" : "0")) + "</uCnt>");
}
if (roomObj.extension != undefined) {
_local3 = _local3 + ("<xt n='" + roomObj.extension.name);
_local3 = _local3 + (("' s='" + roomObj.extension.script) + "' />");
}
if (roomObj.vars == undefined) {
_local3 = _local3 + "<vars></vars>";
} else {
_local3 = _local3 + "<vars>";
for (var _local4 in roomObj.vars) {
_local3 = _local3 + getXmlRoomVariable(roomObj.vars[_local4]);
}
_local3 = _local3 + "</vars>";
}
_local3 = _local3 + "</room>";
send(_local7, "createRoom", roomId, _local3);
}
function leaveRoom(roomId) {
var _local3 = {t:"sys"};
var _local2 = ("<rm id='" + roomId) + "' />";
send(_local3, "leaveRoom", roomId, _local2);
}
function getRoom(roomId) {
if (typeof(roomId) == "number") {
return(roomList[roomId]);
}
if (typeof(roomId) == "string") {
for (var _local4 in roomList) {
var _local2 = roomList[_local4];
if (_local2.getName() == roomId) {
return(_local2);
}
}
}
}
function getActiveRoom() {
return(roomList[activeRoomId]);
}
function setRoomVariables(varList, roomId, setOwnership) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (setOwnership == undefined) {
setOwnership = true;
}
var _local5 = {t:"sys"};
var _local4;
if (setOwnership) {
_local4 = "<vars>";
} else {
_local4 = "<vars so='0'>";
}
var _local2 = 0;
while (_local2 < varList.length) {
_local4 = _local4 + getXmlRoomVariable(varList[_local2]);
_local2++;
}
_local4 = _local4 + "</vars>";
send(_local5, "setRvars", roomId, _local4);
}
function getXmlRoomVariable(rVar) {
var _local5 = rVar.name;
var _local1 = rVar.val;
var _local6 = (rVar.priv ? "1" : "0");
var _local4 = (rVar.persistent ? "1" : "0");
var _local2 = null;
if (typeof(_local1) == "boolean") {
_local2 = "b";
_local1 = (_local1 ? 1 : 0);
} else if (typeof(_local1) == "number") {
_local2 = "n";
} else if (typeof(_local1) == "string") {
_local2 = "s";
} else if (typeof(_local1) == "null") {
_local2 = "x";
}
if (_local2 != null) {
return(((((((((("<var n='" + _local5) + "' t='") + _local2) + "' pr='") + _local6) + "' pe='") + _local4) + "'><![CDATA[") + _local1) + "]]></var>");
}
return("");
}
function loadBuddyList() {
var _local2 = {t:"sys"};
send(_local2, "loadB", -1, "");
}
function addBuddy(buddyName) {
if ((buddyName != myUserName) && (!checkBuddy(buddyName))) {
var _local6 = roomList[activeRoomId].getUserList().getUser(buddyName);
var _local4 = {t:"sys"};
var _local3 = ("<n>" + buddyName) + "</n>";
send(_local4, "addB", -1, _local3);
}
}
function removeBuddy(buddyName) {
for (var _local3 in buddyList) {
if (buddyList[_local3].name == buddyName) {
delete buddyList[_local3];
break;
}
}
var _local5 = {t:"sys"};
var _local4 = ("<n>" + buddyName) + "</n>";
send(_local5, "remB", -1, _local4);
onBuddyList(buddyList);
}
function getBuddyByName(buddyName) {
var _local2;
for (var _local4 in buddyList) {
_local2 = buddyList[_local4];
if (_local2.name == buddyName) {
return(_local2);
}
}
return(null);
}
function getBuddyById(id) {
var _local2;
for (var _local4 in buddyList) {
_local2 = buddyList[_local4];
if (_local2.id == id) {
return(_local2);
}
}
return(null);
}
function getBuddyRoom(buddy) {
if (buddy.id != -1) {
send({t:"sys", bid:buddy.id}, "roomB", -1, ("<b id='" + buddy.id) + "' />");
}
}
function checkBuddy(name) {
var _local2 = false;
for (var _local4 in buddyList) {
if (buddyList[_local4].name == name) {
_local2 = true;
break;
}
}
return(_local2);
}
function clearBuddyList() {
buddyList = [];
send({t:"sys"}, "clearB", -1, "");
onBuddyList(buddyList);
}
function roundTripBench() {
t1 = getTimer();
var _local2 = {t:"sys"};
send(_local2, "roundTrip", activeRoomId, "");
}
function switchSpectator(roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
send(_local2, "swSpec", roomId, "");
}
function getRandomKey() {
send({t:"sys"}, "rndK", -1, "");
}
function send(header, action, fromRoom, message) {
var _local3 = makeHeader(header);
_local3 = _local3 + ((((((("<body action='" + action) + "' r='") + fromRoom) + "'>") + message) + "</body>") + closeHeader());
if (debug) {
trace(("[Sending]: " + _local3) + newline);
}
if (isHttpMode) {
httpConnection.send(_local3);
} else {
super.send(_local3);
}
}
function uploadFile(fileRef, id, nick, port) {
if (id == undefined) {
id = myUserId;
}
if (nick == undefined) {
nick = myUserName;
}
if (port == undefined) {
port = httpPort;
}
fileRef.upload((((((("http://" + ipAddress) + ":") + port) + "/default/Upload.py?id=") + id) + "&nick=") + nick);
if (debug) {
trace((((((("[UPLOAD]: http://" + ipAddress) + ":") + port) + "/default/Upload.py?id=") + id) + "&nick=") + nick);
}
}
function getUploadPath() {
return(((("http://" + ipAddress) + ":") + httpPort) + "/default/uploads/");
}
function sendString(message) {
if (debug) {
trace(("[Sending]: " + message) + newline);
}
if (isHttpMode) {
httpConnection.send(message);
} else {
super.send(message);
}
}
function sendJson(message) {
if (debug) {
trace(("[Sending - json]: " + message) + newline);
}
if (isHttpMode) {
httpConnection.send(message);
} else {
super.send(message);
}
}
function gotData(message) {
if (message.charAt(0) == rawProtocolSeparator) {
strReceived(message);
} else if (message.charAt(0) == "<") {
onXML(new XML(message));
} else if (message.charAt(0) == "{") {
jsonReceived(message);
}
}
function connectionEstablished(ok) {
if (ok) {
clearInterval(socketConnectionTimeoutThread);
preConnection = false;
var _local3 = {t:"sys"};
var _local2 = ((("<ver v='" + majVersion.toString()) + minVersion.toString()) + subVersion.toString()) + "' />";
send(_local3, "verChk", 0, _local2);
} else if (smartConnect && (preConnection)) {
if (debug) {
trace("** Socket connection failed. Trying BlueBox **");
}
isHttpMode = true;
var _local4 = ((blueBoxIpAddress != null) ? (blueBoxIpAddress) : (ipAddress));
var _local5 = ((blueBoxPort != 0) ? (blueBoxPort) : (httpPort));
httpConnection.connect(_local4, _local5);
} else {
preConnection = false;
onConnection(false);
}
}
function connectionClosed() {
isConnected = false;
if (preConnection) {
connectionEstablished(false);
} else {
initialize();
onConnectionLost();
}
}
function connect(ipAdr, port) {
if (!isConnected) {
ipAddress = ipAdr;
this.port = port;
super.connect(ipAdr, port);
socketConnectionTimeoutThread = setInterval(mx.utils.Delegate.create(this, socketTimeoutHandler), socketConnectionTimeout);
} else {
trace((("WARNING! You're already connected to -> " + ipAddress) + ":") + this.port);
}
}
function disconnect() {
close();
isConnected = false;
if (isHttpMode) {
httpConnection.close();
}
initialize();
onConnectionLost();
}
function xmlReceived(message) {
var _local2 = new Object();
message2Object(message.childNodes, _local2);
if (debug) {
trace("[Received]: " + message);
}
var _local3 = _local2.msg.attributes.t;
messageHandlers[_local3].handleMessage(_local2.msg.body, this, "xml");
}
function socketTimeoutHandler() {
clearInterval(socketConnectionTimeoutThread);
close();
}
function strReceived(message) {
var _local2 = message.substr(1, message.length - 2).split(rawProtocolSeparator);
if (debug) {
trace("[Received - Str]: " + message);
}
var _local4 = _local2[0];
messageHandlers[_local4].handleMessage(_local2.splice(1, _local2.length - 1), this, "str");
}
function jsonReceived(message) {
var _local2 = it.gotoandplay.smartfoxserver.JSON.parse(message);
if (debug) {
trace("[Received - json]: " + message);
}
var _local3 = _local2.t;
messageHandlers[_local3].handleMessage(_local2.b, this, "json");
}
function message2Object(xmlNodes, parentObj) {
var _local8 = 0;
var _local3 = null;
while (_local8 < xmlNodes.length) {
var _local4 = xmlNodes[_local8];
var _local5 = _local4.nodeName;
var _local6 = _local4.nodeValue;
if (parentObj instanceof Array) {
_local3 = {};
parentObj.push(_local3);
_local3 = parentObj[parentObj.length - 1];
} else {
parentObj[_local5] = new Object();
_local3 = parentObj[_local5];
}
for (var _local11 in _local4.attributes) {
if (typeof(_local3.attributes) == "undefined") {
_local3.attributes = {};
}
var _local2 = _local4.attributes[_local11];
if (!isNaN(Number(_local2))) {
_local2 = Number(_local2);
}
if (_local2.toLowerCase() == "true") {
_local2 = true;
} else if (_local2.toLowerCase() == "false") {
_local2 = false;
}
_local3.attributes[_local11] = _local2;
}
if (arrayTags[_local5]) {
_local3[_local5] = [];
_local3 = _local3[_local5];
}
if (_local4.hasChildNodes() && (_local4.firstChild.nodeValue == undefined)) {
var _local9 = _local4.childNodes;
message2Object(_local9, _local3);
} else {
_local6 = _local4.firstChild.nodeValue;
if (((!isNaN(_local6)) && (_local4.nodeName != "txt")) && (_local4.nodeName != "var")) {
_local6 = Number(_local6);
}
_local3.value = _local6;
}
_local8++;
}
}
function makeHeader(headerObj) {
var _local2 = "<msg";
for (var _local3 in headerObj) {
_local2 = _local2 + ((((" " + _local3) + "='") + headerObj[_local3]) + "'");
}
_local2 = _local2 + ">";
return(_local2);
}
function closeHeader() {
return("</msg>");
}
function handleDelayedPoll() {
httpConnection.send(HTTP_POLL_REQUEST);
if (fpMajorVersion < 8) {
clearInterval(pollingThread);
}
}
function handleHttpConnect(params) {
isConnected = true;
preConnection = false;
connectionEstablished(true);
httpConnection.send(HTTP_POLL_REQUEST);
}
function handleHttpClose(params) {
initialize();
onConnectionLost();
}
function handleHttpData(params) {
var _local5 = params.data;
var _local4 = _local5.split(newline);
var _local3;
var _local2 = 0;
while (_local2 < (_local4.length - 1)) {
_local3 = _local4[_local2];
if (_local3.length > 0) {
gotData(_local3);
}
_local2++;
}
if (_httpPollSpeed > 0) {
pollingThread = pollingDelayFn(mx.utils.Delegate.create(this, handleDelayedPoll), _httpPollSpeed);
} else {
httpConnection.send(HTTP_POLL_REQUEST);
}
}
function handleHttpError(params) {
if (!isConnected) {
onConnection(false);
} else {
connectionClosed();
}
}
static var MIN_POLL_SPEED = 0;
static var DEFAULT_POLL_SPEED = 750;
static var MAX_POLL_SPEED = 10000;
static var HTTP_POLL_REQUEST = "poll";
static var MODMSG_TO_USER = "u";
static var MODMSG_TO_ROOM = "r";
static var MODMSG_TO_ZONE = "z";
static var PROTOCOL_XML = "xml";
static var PROTOCOL_STR = "str";
static var PROTOCOL_JSON = "json";
static var CONNECTION_MODE_DISCONNECTED = "disconnected";
static var CONNECTION_MODE_SOCKET = "socket";
static var CONNECTION_MODE_HTTP = "http";
var DEFAULT_CONFIG_FILE = "config.xml";
var DEFAULT_AUTO_CONNECT = true;
var majVersion = 1;
var minVersion = 5;
var subVersion = 4;
var autoConnectOnConfigSuccess = true;
var defaultZone = "";
var httpPort = 8080;
var rawProtocolSeparator = "%";
var blueBoxPort = 0;
var smartConnect = true;
var socketConnectionTimeout = 5000;
var isHttpMode = false;
var _httpPollSpeed = DEFAULT_POLL_SPEED;
var pollingThread = -1;
var preConnection = true;
}
Symbol 199 MovieClip [__Packages.it.gotoandplay.smartfoxserver.ObjectSerializer] Frame 0
class it.gotoandplay.smartfoxserver.ObjectSerializer
{
static var __instance;
var tabs, xmlStr, debug, eof, ascTab, ascTabRev, hexTable;
function ObjectSerializer () {
init();
}
static function getInstance() {
if (__instance == null) {
__instance = new it.gotoandplay.smartfoxserver.ObjectSerializer();
}
return(__instance);
}
function init() {
tabs = "\t\t\t\t\t\t\t\t\t\t";
xmlStr = "";
debug = false;
eof = "";
ascTab = [];
ascTab[">"] = ">";
ascTab["<"] = "<";
ascTab["&"] = "&";
ascTab["'"] = "'";
ascTab["\""] = """;
ascTabRev = [];
ascTabRev[">"] = ">";
ascTabRev["<"] = "<";
ascTabRev["&"] = "&";
ascTabRev["'"] = "'";
ascTabRev["""] = "\"";
hexTable = new Array();
hexTable["0"] = 0;
hexTable["1"] = 1;
hexTable["2"] = 2;
hexTable["3"] = 3;
hexTable["4"] = 4;
hexTable["5"] = 5;
hexTable["6"] = 6;
hexTable["7"] = 7;
hexTable["8"] = 8;
hexTable["9"] = 9;
hexTable.A = 10;
hexTable.B = 11;
hexTable.C = 12;
hexTable.D = 13;
hexTable.E = 14;
hexTable.F = 15;
}
function serialize(obj) {
var _local2 = {};
_local2.xmlStr = "";
if (debug) {
eof = newline;
}
obj2xml(_local2, obj, 0, "");
return(_local2.xmlStr);
}
function obj2xml(envelope, obj, lev, objn) {
if (lev == 0) {
envelope.xmlStr = envelope.xmlStr + ("<dataObj>" + eof);
} else {
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev);
}
var _local8 = ((obj instanceof Array) ? "a" : "o");
envelope.xmlStr = envelope.xmlStr + ((((("<obj t='" + _local8) + "' o='") + objn) + "'>") + eof);
}
for (var _local7 in obj) {
var _local2 = typeof(obj[_local7]);
var _local3 = obj[_local7];
if ((((_local2 == "boolean") || (_local2 == "number")) || (_local2 == "string")) || (_local2 == "null")) {
if (_local2 == "boolean") {
_local3 = Number(_local3);
} else if (_local2 == "null") {
_local2 = "x";
_local3 = "";
} else if (_local2 == "string") {
_local3 = encodeEntities(_local3);
}
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev + 1);
}
envelope.xmlStr = envelope.xmlStr + ((((((("<var n='" + _local7) + "' t='") + _local2.substr(0, 1)) + "'>") + _local3) + "</var>") + eof);
} else if (_local2 == "object") {
obj2xml(envelope, _local3, lev + 1, _local7);
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev + 1);
}
envelope.xmlStr = envelope.xmlStr + ("</obj>" + eof);
}
}
if (lev == 0) {
envelope.xmlStr = envelope.xmlStr + ("</dataObj>" + eof);
}
}
function deserialize(xmlObj) {
var _local3 = new XML(xmlObj);
_local3.ignoreWhite = true;
var _local2 = new Object();
xml2obj(_local3, _local2);
return(_local2);
}
function xml2obj(xmlNode, currObj) {
var _local2 = 0;
var _local3 = xmlNode.firstChild;
while (_local3.childNodes[_local2]) {
if (_local3.childNodes[_local2].nodeName == "obj") {
var _local9 = _local3.childNodes[_local2].attributes.o;
var _local7 = _local3.childNodes[_local2].attributes.t;
if (_local7 == "a") {
currObj[_local9] = [];
} else if (_local7 == "o") {
currObj[_local9] = {};
}
xml2obj(new XML(_local3.childNodes[_local2]), currObj[_local9]);
} else {
var _local9 = _local3.childNodes[_local2].attributes.n;
var _local4 = _local3.childNodes[_local2].attributes.t;
var _local8 = _local3.childNodes[_local2].firstChild.nodeValue;
var _local5;
if (_local4 == "b") {
_local5 = function (b) {
return(Boolean(Number(b)));
};
} else if (_local4 == "n") {
_local5 = Number;
} else if (_local4 == "s") {
_local5 = String;
} else if (_local4 == "x") {
_local5 = function (x) {
return(null);
};
}
currObj[_local9] = _local5(_local8);
}
_local2++;
}
}
function encodeEntities(st) {
var _local5 = "";
var _local4 = 0;
while (_local4 < st.length) {
var _local3 = st.charAt(_local4);
var _local2 = st.charCodeAt(_local4);
if (((_local2 == 9) || (_local2 == 10)) || (_local2 == 13)) {
_local5 = _local5 + _local3;
} else if ((_local2 >= 32) && (_local2 <= 126)) {
if (ascTab[_local3] != undefined) {
_local5 = _local5 + ascTab[_local3];
} else {
_local5 = _local5 + _local3;
}
} else {
_local5 = _local5 + _local3;
}
_local4++;
}
return(_local5);
}
function decodeEntities(st) {
var _local7;
var _local6;
var _local5;
var _local3;
var _local8;
var _local2 = 0;
_local7 = "";
while (_local2 < st.length) {
_local6 = st.charAt(_local2);
if (_local6 == "&") {
_local5 = _local6;
do {
_local2++;
_local3 = st.charAt(_local2);
_local5 = _local5 + _local3;
} while ((_local3 != ";") && (_local2 < st.length));
_local8 = ascTabRev[_local5];
if (_local8 != undefined) {
_local7 = _local7 + _local8;
} else {
_local7 = _local7 + String.fromCharCode(getCharCode(_local5));
}
} else {
_local7 = _local7 + _local6;
}
_local2++;
}
return(_local7);
}
function getCharCode(ent) {
var _local1 = ent.substr(3, ent.length);
_local1 = _local1.substr(0, _local1.length - 1);
return(Number("0x" + _local1));
}
}
Symbol 200 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.HttpConnection] Frame 0
class it.gotoandplay.smartfoxserver.http.HttpConnection
{
var codec, handlers, sessionId, ipAddr, port, webUrl, loaderFactory, _classRef;
function HttpConnection (httpConnectHandler, httpCloseHandler, httpDataHandler, httpErrorHandler) {
codec = new it.gotoandplay.smartfoxserver.http.RawProtocolCodec();
handlers = [];
handlers[onHttpConnect] = httpConnectHandler;
handlers[onHttpClose] = httpCloseHandler;
handlers[onHttpData] = httpDataHandler;
handlers[onHttpError] = httpErrorHandler;
}
function getSessionId() {
return(sessionId);
}
function isConnected() {
return(connected);
}
function connect(addr, port) {
if (port == undefined) {
port = 8080;
}
ipAddr = addr;
this.port = port;
webUrl = (((("http://" + ipAddr) + ":") + this.port) + "/") + servletUrl;
sessionId = null;
loaderFactory = new it.gotoandplay.smartfoxserver.http.LoaderFactory(this, handleResponse, webUrl, paramName);
send(HANDSHAKE);
}
function close() {
send(DISCONNECT);
}
function send(message) {
if ((connected || ((!connected) && (message == HANDSHAKE))) || ((!connected) && (message == "poll"))) {
if (message != "poll") {
trace("[ Send ]: " + codec.encode(sessionId, message));
}
loaderFactory.sendAndLoad(codec.encode(sessionId, message));
}
}
function handleResponse(data) {
var _local2 = _classRef;
if (data != undefined) {
var _local3 = {};
if (data.charAt(0) == HANDSHAKE_TOKEN) {
if (_local2.sessionId == null) {
_local2.sessionId = _local2.codec.decode(data);
_local2.connected = true;
_local3.sessionId = _local2.sessionId;
_local3.success = true;
_local2.dispatchEvent(onHttpConnect, _local3);
} else {
trace("**ERROR** SessionId is being rewritten");
}
} else if (data.indexOf(CONN_LOST) == 0) {
_local3.data = {};
_local2.dispatchEvent(onHttpClose, _local3);
} else {
_local3.data = data;
_local2.dispatchEvent(onHttpData, _local3);
}
} else if (!_local2.connected) {
_local2.handleIOError("I/O error: null response from server");
}
}
function handleIOError(error) {
var _local2 = {};
_local2.message = error;
dispatchEvent(onHttpError, _local2);
}
function dispatchEvent(type, params) {
handlers[type](params);
}
static var HANDSHAKE = "connect";
static var DISCONNECT = "disconnect";
static var CONN_LOST = "ERR#01";
static var HANDSHAKE_TOKEN = "#";
static var servletUrl = "BlueBox/HttpBox.do";
static var paramName = "sfsHttp";
static var onHttpData = "onHttpData";
static var onHttpError = "onHttpError";
static var onHttpConnect = "onHttpConnect";
static var onHttpClose = "onHttpClose";
var connected = false;
}
Symbol 201 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.LoaderFactory] Frame 0
class it.gotoandplay.smartfoxserver.http.LoaderFactory
{
var poolSize, webUrl, loaderParamName, sendersPool, loadersPool, currentIndex;
function LoaderFactory (httpConnection, responseHandler, _webUrl, _loaderParamName, _poolSize) {
if (_poolSize > 0) {
poolSize = _poolSize;
} else {
poolSize = DEFAULT_POOL_SIZE;
}
webUrl = _webUrl;
loaderParamName = _loaderParamName;
sendersPool = [];
loadersPool = [];
var _local3 = 0;
while (_local3 < poolSize) {
var _local4 = new LoadVars();
var _local2 = new LoadVars();
_local2._classRef = httpConnection;
_local2.onData = responseHandler;
sendersPool.push(_local4);
loadersPool.push(_local2);
_local3++;
}
currentIndex = 0;
}
function sendAndLoad(message) {
var _local2 = sendersPool[currentIndex];
var _local3 = loadersPool[currentIndex];
_local2[loaderParamName] = message;
_local2.sendAndLoad(webUrl, _local3);
currentIndex++;
if (currentIndex >= poolSize) {
currentIndex = 0;
}
}
function handleHTTPStatus(status) {
trace("---> Status received: " + status);
}
static var DEFAULT_POOL_SIZE = 8;
}
Symbol 202 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec] Frame 0
interface it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec
{
}
Symbol 203 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.RawProtocolCodec] Frame 0
class it.gotoandplay.smartfoxserver.http.RawProtocolCodec implements it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec
{
function RawProtocolCodec () {
}
function encode(sessionId, message) {
return(((sessionId == null) ? "" : (sessionId)) + message);
}
function decode(message) {
var _local1;
if (message.charAt(0) == it.gotoandplay.smartfoxserver.http.HttpConnection.HANDSHAKE_TOKEN) {
_local1 = message.substr(1, SESSION_ID_LEN);
}
return(_local1);
}
static var SESSION_ID_LEN = 32;
}
Symbol 204 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 205 MovieClip [__Packages.it.gotoandplay.smartfoxserver.Room] Frame 0
class it.gotoandplay.smartfoxserver.Room
{
var id, name, maxUsers, maxSpectators, temp, game, priv, limbo, updatable, description, userCount, specCount, userList, variables, myPlayerIndex;
function Room (id, name, maxUsers, maxSpectators, isTemp, isGame, isPrivate) {
this.id = id;
this.name = name;
this.maxUsers = maxUsers;
this.maxSpectators = maxSpectators;
temp = isTemp;
game = isGame;
priv = isPrivate;
limbo = false;
updatable = false;
description = "";
userCount = 0;
specCount = 0;
userList = new Object();
variables = new Array();
}
function getUserList() {
return(userList);
}
function getUser(userId) {
if (typeof(userId) == "number") {
return(userList[userId]);
}
if (typeof(userId) == "string") {
for (var _local4 in userList) {
var _local2 = userList[_local4];
if (_local2.getName() == userId) {
return(_local2);
}
}
}
}
function getVariable(varName) {
return(variables[varName]);
}
function getVariables() {
return(variables);
}
function getName() {
return(name);
}
function getId() {
return(id);
}
function isTemp() {
return(temp);
}
function isGame() {
return(game);
}
function isPrivate() {
return(priv);
}
function getUserCount() {
return(userCount);
}
function getSpectatorCount() {
return(specCount);
}
function getMaxUsers() {
return(maxUsers);
}
function getMaxSpectators() {
return(maxSpectators);
}
function setMyPlayerIndex(id) {
myPlayerIndex = id;
}
function getMyPlayerIndex() {
return(myPlayerIndex);
}
function setIsLimbo(b) {
limbo = b;
}
function isLimbo() {
return(limbo);
}
}
Symbol 206 MovieClip [__Packages.it.gotoandplay.smartfoxserver.User] Frame 0
class it.gotoandplay.smartfoxserver.User
{
var id, name, variables, isSpec, isMod, pid;
function User (id, name) {
this.id = id;
this.name = name;
variables = new Object();
isSpec = false;
}
function getId() {
return(id);
}
function getName() {
return(name);
}
function getVariable(varName) {
return(variables[varName]);
}
function getVariables() {
return(variables);
}
function setIsSpectator(b) {
isSpec = b;
}
function isSpectator() {
return(isSpec);
}
function setModerator(b) {
isMod = b;
}
function isModerator() {
return(isMod);
}
function getPlayerId() {
return(pid);
}
function setPlayerId(pid) {
this.pid = pid;
}
}
Symbol 207 MovieClip [__Packages.it.gotoandplay.smartfoxserver.JSON] Frame 0
class it.gotoandplay.smartfoxserver.JSON
{
function JSON () {
}
static function stringify(arg) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
switch (typeof(arg)) {
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = stringify(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = stringify(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((stringify(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
_local1 = "\"";
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + "\"");
case "boolean" :
return(String(arg));
}
return("null");
}
static function parse(text) {
var at = 0;
var ch = " ";
var _value;
var _error = function (m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
};
var _next = function () {
ch = text.charAt(at);
at = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\b";
break;
case "f" :
_local1 = _local1 + "\f";
break;
case "n" :
_local1 = _local1 + newline;
break;
case "r" :
_local1 = _local1 + "\r";
break;
case "t" :
_local1 = _local1 + "\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
var _word = function () {
switch (ch) {
case "t" :
if (((_next() == "r") && (_next() == "u")) && (_next() == "e")) {
_next();
return(true);
}
break;
case "f" :
if ((((_next() == "a") && (_next() == "l")) && (_next() == "s")) && (_next() == "e")) {
_next();
return(false);
}
break;
case "n" :
if (!(((_next() == "u") && (_next() == "l")) && (_next() == "l"))) {
break;
}
_next();
return(null);
}
_error("Syntax error");
};
_value = function () {
_white();
switch (ch) {
case "{" :
return(_object());
case "[" :
return(_array());
case "\"" :
return(_string());
case "-" :
return(_number());
}
return((((ch >= "0") && (ch <= "9")) ? (_number()) : (_word())));
};
return(_value());
}
}
Symbol 179 Button
on (release) {
if (!_global.isBusy) {
closeConnection();
}
}
Symbol 181 Button
on (release) {
if (!_global.isBusy) {
makeNewRoom();
}
}
Symbol 191 Button
on (release, keyPress "<Enter>") {
if (!_global.isBusy) {
sendChatMsg();
}
}
Symbol 196 Button
on (release) {
if (!_global.isBusy) {
leaveGameRoom();
}
}
Symbol 197 MovieClip Frame 1
loadMovie ("http://www.weebls-stuff.com/flash/rspm.swf", this);