Frame 1
var total = _root.getBytesTotal();
var loaded = _root.getBytesLoaded();
var perc = ((loaded / total) * 100);
percent = Math.round(perc) + "%";
setProperty("progress", _xscale , perc);
if (loaded == total) {
percent = "complete";
gotoAndPlay ("Done");
}
_root.spinnermov._rotation = amount;
amount = amount + perc;
_root.spinnermov2._rotation = amount2;
amount2 = amount2 - perc;
Frame 2
gotoAndPlay ("Nope");
Frame 11
function loadgame() {
loadNum = (getBytesLoaded() / getBytesTotal()) * 100;
loadText = "<b>Artilleround</b>\nCreated by <a href=\"http://www.quirkyanimations.co.uk\" target=\"blank\">Quirkyanimations</a>\n\nLoading Game Engine:\nPercent Loaded:" + Math.round(loadNum);
if (loadNum == 100) {
loadText = loadText + "\nVerifying game";
if (continueLoad) {
loadText = loadText + "\nGame Verified";
loadText = loadText + "\n\nLocating sounds to load";
if (loadedList != true) {
loadVariables ("http://www.weebls-stuff.com/artillery/arincludes/music.txt", "");
loadedList = true;
this.createEmptyMovieClip("music", 10);
music = new Sound(this.music);
this.createEmptyMovieClip("sfxboom", 11);
sfxboom = new Sound(this.sfxboom);
this.createEmptyMovieClip("sfxhiss", 12);
sfxhiss = new Sound(this.sfxhiss);
this.createEmptyMovieClip("sfxtarget", 13);
sfxtarget = new Sound(this.sfxtarget);
this.createEmptyMovieClip("sfxfire", 14);
sfxfire = new Sound(this.sfxfire);
} else if (music1 != "null") {
loadText = loadText + "\nSounds located";
loadText = loadText + "\nLoading Music";
if (!startLoad) {
music.loadSound(music1);
startLoad = true;
starBload = false;
}
var sloadperc = Math.round((music.getBytesLoaded() / music.getBytesTotal()) * 100);
loadText = loadText + ("\nPercent Loaded:" + sloadPerc);
if (sloadperc == 100) {
loadText = loadText + "\nLoading Explosion";
loadState.music = true;
if (!startBLoad) {
sfxboom.loadSound(ldbang);
startBLoad = true;
}
var sloadperc = Math.round((sfxboom.getBytesLoaded() / sfxboom.getBytesTotal()) * 100);
loadText = loadText + ("\nPercent Loaded:" + sloadPerc);
if (sloadperc == 100) {
loadText = loadText + "\nLoading Explosion";
if (!startHLoad) {
sfxhiss.loadSound(ldhiss);
startHLoad = true;
}
var sloadperc = Math.round((sfxhiss.getBytesLoaded() / sfxhiss.getBytesTotal()) * 100);
loadText = loadText + ("\nPercent Loaded:" + sloadPerc);
if (sloadperc == 100) {
loadText = loadText + "\nLoading Target Explosion";
if (!startTLoad) {
sfxtarget.loadSound(thit);
trace(thit);
startTLoad = true;
}
var sloadperc = Math.round((sfxtarget.getBytesLoaded() / sfxtarget.getBytesTotal()) * 100);
loadText = loadText + ("\nPercent Loaded:" + sloadPerc);
if (sloadperc == 100) {
loadText = loadText + "\nLoading Gun Fire";
if (!startFLoad) {
sfxfire.loadSound(ldfire);
trace(ldfire);
startFLoad = true;
}
var floadperc = Math.round((sfxfire.getBytesLoaded() / sfxfire.getBytesTotal()) * 100);
loadText = loadText + ("\nPercent Loaded:" + floadPerc);
if (floadperc == 100) {
loadState.sfx = true;
_root.titleMov.attachMovie("playBtn", "playBtn", 4, {_x:157, _y:353});
nextFrame();
}
}
}
}
}
}
loadText = loadText + "\nPress space to play without all sounds";
}
}
}
System.security.loadPolicyFile("xmlsocket://84.12.5.242:31337");
trace("Select X = " + _root.charSelectScreen._x);
var onlineChar = 0;
var player1CharMC;
var player2CharMC;
var enteringName = false;
var currentChoosing = 1;
var PRAWN = 0;
var TOAST = 1;
var KEITH = 2;
var SI = 3;
var HITLER = 4;
var player1Char = PRAWN;
var player2Char = PRAWN;
_root.attachMovie("titleMov", "titleMov", 2050);
continueLoad = true;
this.onEnterFrame = loadgame;
game = 20;
ndots = 0;
ncount = 0;
music1 = "null";
startLoad = false;
loadedList = false;
loadState = new Object();
stop();
Frame 12
function StartOnlineGame() {
_global.gameStarted = false;
_global.whoseTurn = 1;
_root["player" + _global.myID].name.text = _global.myName;
opponentID = ((_global.myID == 1) ? 2 : 1);
vObj = new Array();
vObj.push({name:"player" + _global.myID, val:_global.myName});
smartfox.setRoomVariables(vObj);
smartfox.onRoomVariablesUpdate = function (roomObj) {
if (inGame) {
removeMovieClip("lobby");
var rVars = roomObj.variables;
if ((rVars.player1.length > 0) && (rVars.player2.length > 0)) {
if (!_global.gameStarted) {
trace("both players in");
_global.gameStarted = true;
isonlineGame = true;
removeMovieClip("lobby");
this.attachMovie("gameChat", "gameChat", 2132);
this.gameChat._x = 50;
this.gameChat._y = 150;
_root["player" + opponentID].name.text = rVars["player" + opponentID];
tanksd[opponentID - 1].name = rVars["player" + opponentID];
tanksd[opponentID - 1].score = 0;
tanksd[opponentID - 1].human = false;
tanksd[_global.myID - 1].name = rVars["player" + _global.myID];
tanksd[_global.myID - 1].score = 0;
tanksd[_global.myID - 1].human = true;
_global.whoseTurn = 1;
handshook = false;
firstHcall = true;
set2Player();
}
} else {
hud.gotoAndStop("waiting");
}
}
};
}
function sendChatMsg() {
if (ingame) {
if (_global.gameStarted && (gameChat.input_txt.text.length > 0)) {
smartfox.sendPublicMessage(gameChat.input_txt.text);
gameChat.input_txt.text = "";
}
} else if (lobby.input_txt.text.length > 0) {
smartfox.sendPublicMessage(lobby.input_txt.text);
lobby.input_txt.text = "";
}
}
function sendPrivateMessage(m, recipient) {
hideWindow("pmWindow");
smartfox.sendPrivateMessage(m, _global.pmUid);
}
function changeRoom() {
if (!_global.isBusy) {
var item = lobby.roomList_lb.getSelectedItem();
var newRoom = item.data;
if (newRoom != smartfox.activeRoomId) {
var priv = smartfox.getRoom(newRoom).isPrivate();
if (priv) {
_global.newRoom = newRoom;
showWindow("passwordWindow");
} else {
smartfox.joinRoom(item.data);
}
}
}
}
function userSelected() {
trace("user selected");
if (!_global.isBusy) {
uid = lobby.userList_lb.getSelectedItem().data;
if (uid != smartfox.myUserId) {
_global.pmUid = uid;
var win = showWindow("pmWindow");
var uList = smartfox.getActiveRoom().getUserList();
var targetUsr = uList[uid];
win.title_txt.text = "Send a private message to " + targetUsr.getName();
}
}
}
function makeNewRoom() {
showWindow("newGameWindow");
}
function createRoom(name, pwd, max) {
hideWindow("newGameWindow");
gameRoom = {};
gameRoom.name = name;
gameRoom.password = pwd;
gameRoom.maxUsers = 2;
gameRoom.isGame = true;
gameRoom.isTemp = true;
smartfox.createRoom(gameRoom);
}
function loginProtectedRoom(pwd) {
hideWindow("passwordWindow");
smartfox.joinRoom(_global.newRoom, pwd);
}
function resetRoomSelected(id) {
var status = lobby.roomList_lb.getEnabled();
lobby.roomList_lb.setEnabled(true);
var i = 0;
while (i < lobby.roomList_lb.getLength()) {
var item = lobby.roomList_lb.getItemAt(i);
if (item.data == id) {
lobby.roomList_lb.setSelectedIndex(i);
break;
}
i++;
}
lobby.roomList_lb.setEnabled(status);
}
function updateRoomStatus(roomId) {
var room = smartfox.roomList[roomId];
var newLabel = (((room.name + " (") + room.getUserCount()) + ")");
i = 0;
while (i < lobby.roomList_lb.getLength()) {
var item = lobby.roomList_lb.getItemAt(i);
if (roomId == item.data) {
lobby.roomList_lb.replaceItemAt(i, newLabel, item.data);
return;
}
i++;
}
}
function closeConnection() {
smartfox.disconnect();
}
function open_chat() {
lobby.userName_txt.text = "Logged as: " + _global.myName;
lobby.input_txt.text = "";
lobby.chat_txt.htmlText = "";
inGame = false;
smartfox.onRoomListUpdate = function (roomList) {
lobby.roomList_lb.removeAll();
for (var i in roomList) {
var room = roomList[i];
if (room.isGame()) {
lobby.roomList_lb.addItem(((room.getName() + " (") + room.getUserCount()) + ")", room.getId());
}
}
lobby.roomList_lb.sortItemsBy("label", "ASC");
this.joinRoom("Lobby", "");
};
if (evtQueue.length > 0) {
smartfox.onRoomListUpdate(evtQueue[0]);
evtQueue = new Array();
}
smartfox.onJoinRoom = function (roomObj) {
if (roomObj.isGame()) {
inGame = true;
inOnlineGame = true;
_global.myID = this.playerId;
startOnlineGame();
} else {
var roomId = roomObj.getId();
var userList = roomObj.getUserList();
resetRoomSelected(roomId);
_global.currentRoom = roomObj;
lobby.userList_lb.removeAll();
for (var i in userList) {
var user = userList[i];
var uName = user.getName();
var uId = user.getId();
lobby.userList_lb.addItem(uName, uId);
}
lobby.userList_lb.sortItemsBy("label", "ASC");
chat_txt.htmlText = chat_txt.htmlText + (("<font color='#cc0000'>>> Room [ " + roomObj.getName()) + " ] joined</font>");
}
};
smartfox.onJoinRoomError = function (errorMsg) {
var win = showWindow("errorWindow");
win.errorMsg.text = errorMsg;
resetRoomSelected(smartfox.activeRoomId);
};
smartfox.onUserEnterRoom = function (fromRoom, user) {
userId = user.getId();
userName = user.getName();
lobby.userList_lb.addItem(userName, userId);
lobby.userList_lb.sortItemsBy("label", "ASC");
updateRoomStatus(fromRoom);
};
smartfox.onUserLeaveRoom = function (fromRoom, usrId) {
var i = 0;
while (i < lobby.userList_lb.getLength()) {
var item = lobby.userList_lb.getItemAt(i);
if (item.data == usrId) {
var usrName = item.label;
lobby.userList_lb.removeItemAt(i);
break;
}
i++;
}
lobby.userList_lb.sortItemsBy("label", "ASC");
updateRoomStatus(fromRoom);
};
smartfox.onUserCountChange = function (roomObj) {
updateRoomStatus(roomObj.getId());
};
smartfox.onPublicMessage = function (msg, user) {
lobby.chat_txt.htmlText = lobby.chat_txt.htmlText + ((("<b>[ " + user.getName()) + " ]:</b> ") + msg);
};
smartfox.onPrivateMessage = function (msg, user) {
lobby.chat_txt.htmlText = lobby.chat_txt.htmlText + ((("<b><font color='#009900'>[ PM > " + user.getName()) + " ]:</font></b> ") + msg);
};
smartfox.onRoomAdded = function (roomObj) {
lobby.roomList_lb.addItem(((roomObj.getName() + " (") + roomObj.getUserCount()) + ")", roomObj.getId());
lobby.roomList_lb.sortItemsBy("label", "ASC");
};
smartfox.onRoomDeleted = function (roomObj) {
i = 0;
while (i < lobby.roomList_lb.getLength()) {
if (roomObj.getId() == roomList_lb.getItemAt(i).data) {
lobby.roomList_lb.removeItemAt(i);
return;
}
i++;
}
};
smartfox.onCreateRoomError = function (errorMsg) {
var win = showWindow("errorWindow");
win.errorMsg.text = errorMsg;
};
}
function handleConnection(success) {
if (success) {
trace("connected");
lobby.status_txt.text = "Connected, please login:";
showLogin(true);
lobby.butt_login.onRelease = sendLogin;
} else {
lobby.status_txt.text = "Can't connect!";
lobby.status_txt._visible = true;
}
}
function sendLogin() {
if (!_global.isBusy) {
smartfox.login(zone, lobby.login_txt.text, null);
}
trace("log in sent");
}
function showLogin(bool) {
lobby.butt_login._visible = bool;
lobby.login_txt._visible = bool;
lobby.loginBox._visible = bool;
if (bool) {
lobby.Selection.setFocus("login_txt");
}
}
function showWindow(linkageName) {
_global.isBusy = true;
trace("showing " + linkageName);
disabler._visible = true;
lobby.roomList_lb.setEnabled(false);
lobby.userList_lb.setEnabled(false);
var win = lobby.attachMovie(linkageName, linkageName, 9999);
win._x = (stageW / 2) - (win._width / 2);
win._y = (stageH / 2) - (win._height / 2);
return(win);
}
function hideWindow(wName) {
lobby[wName].removeMovieClip();
trace("hiding " + wName);
lobby.roomList_lb.setEnabled(true);
lobby.userList_lb.setEnabled(true);
disabler._visible = false;
_global.isBusy = false;
}
function connectToM() {
menuMode = false;
online = true;
inOnlineGame = false;
this.attachMovie("lobby", "lobby", 2132);
lobby.gotoAndStop("connect");
lobby._y = (lobby._x = 50);
lobby._alpha = 75;
showLogin(false);
lobby.status_txt.text = "Connecting...";
var ip = "195.78.94.242";
var port = 31337;
zone = "artilleround";
smartfox = new it.gotoandplay.smartfoxserver.SmartFoxClient();
smartfox.onConnection = handleConnection;
smartFox.debug = true;
smartfox.connect(ip, port);
typing = true;
smartfox.onLogin = function (resObj) {
trace("onLogIn");
if (resObj.success) {
_global.myName = resObj.name;
trace("works");
} else {
_gloabl.isBusy = true;
var win = showWindow("errorWindow");
win.errorMsg.text = resObj.error;
trace("not success");
}
};
smartfox.onRoomListUpdate = function (o) {
evtQueue.push(o);
lobby.gotoAndStop("chat");
trace("going to chat");
};
smartfox.onConnectionLost = function () {
lobby.gotoAndStop("connect");
trace("connection lost");
};
}
System.security.loadPolicyFile("xmlsocket://195.78.94.242:31337");
stop();
Stage.showMenu = false;
stageW = 300;
stageH = 300;
disabler._visible = false;
_global.isBusy = false;
evtQueue = [];
function menuDisplay() {
var startPointer = "<b><FONT COLOR=\"#00FF00\">";
var endpointer = "</FONT COLOR=\"#00FF00\"></b>";
var pointer = " <b>***</b>";
if (!((Key.isDown(38) or Key.isDown(40)) or Key.isDown(32))) {
mencount = 10;
} else {
mencount = mencount + 1;
}
if (menCount >= 10) {
if (Key.isDown(38)) {
cmitem = cmitem - 1;
mencount = 0;
}
if (Key.isDown(40)) {
cmitem = cmitem + 1;
mencount = 0;
}
if (Key.isDown(32) && (_root.enteringName == false)) {
mencount = 0;
if (cmenu == 0) {
if (cmitem == 0) {
typing = true;
numHumans = 1;
_root.attachMovie("charSelect", "charSel1", 2134);
HUD.gotoAndStop("name1");
} else if (cmitem == 1) {
typing = true;
numHumans = 2;
_root.attachMovie("charSelect", "charSel1", 2134);
HUD.gotoAndStop("name1");
} else if (cmitem == 2) {
_root.currentChoosing = 3;
numHumans = 1;
_root.attachMovie("charSelect", "charSel1", 2134);
online = true;
ConnectToM();
} else if (cmitem == 3) {
cmenu = 3;
cmitem = 0;
} else if (cmitem == 4) {
cmenu = 1;
cmitem = 0;
} else if (cmitem == 5) {
cmenu = 2;
cmitem = 0;
}
} else if (cmenu == 1) {
if (cmitem == 0) {
sfxon = !sfxon;
if (sfxon) {
sfxboom.setVolume(svol);
sfxhiss.setVolume(svol);
sfxtarget.setVolume(svol);
sfxfire.setVolume(svol);
} else {
sfxboom.setVolume(0);
sfxhiss.setVolume(0);
sfxtarget.setVolume(0);
sfxfire.setVolume(0);
}
} else if (cmitem == 1) {
muon = !muon;
if (muon) {
music.setVolume(mvol);
} else {
music.setVolume(0);
}
} else if (cmitem == 2) {
cmenu = 0;
cmitem = 0;
}
} else if (cmenu == 2) {
if (cmitem == 0) {
getURL ("http://www.quirkyanimations.co.uk", "_blank");
} else if (cmitem == 1) {
cmenu = 0;
cmitem = 0;
}
} else if (cmenu == 3) {
if (cmitem == 0) {
cmenu = 0;
cmitem = 0;
}
}
}
}
if (cmenu == 0) {
if (cmitem < 0) {
cmitem = cmitem + 6;
}
cmitem = cmitem % 6;
display = "<b>Main Menu:</b>";
if (cmitem == 0) {
display = display + startpointer;
}
display = display + newline;
display = display + "1 Player";
if (cmitem == 0) {
display = display + endpointer;
}
display = display + newline;
if (cmitem == 1) {
display = display + startpointer;
}
display = display + "2 Players - Same PC";
if (cmitem == 1) {
display = display + endpointer;
}
display = display + newline;
if (cmitem == 2) {
display = display + startpointer;
}
display = display + "2 Players - Online Multiplayer";
if (cmitem == 2) {
display = display + endpointer;
}
display = display + newline;
if (cmitem == 3) {
display = display + startpointer;
}
display = display + "How to play";
if (cmitem == 3) {
display = display + endpointer;
}
display = display + newline;
if (cmitem == 4) {
display = display + startpointer;
}
display = display + "Options";
if (cmitem == 4) {
display = display + endpointer;
}
display = display + newline;
if (cmitem == 5) {
display = display + startpointer;
}
display = display + "Credits";
if (cmitem == 5) {
display = display + endpointer;
}
display = display + "<b><FONT COLOR=\"#FF9900\">";
display = display + "\n\n\n";
display = display + "UP/DOWN choose option";
display = display + newline;
display = display + "SPACE confirm";
display = display + newline;
display = display + "</FONT COLOR=\"#00FF00\"></b>";
} else if (cmenu == 1) {
if (cmitem < 0) {
cmitem = cmitem + 3;
}
cmitem = cmitem % 3;
display = "<b>Options:</b>";
if (cmitem == 0) {
if (loadState.sfx) {
display = display + startpointer;
} else {
cmitem = cmitem + 1;
}
}
if (!loadState.sfx) {
display = display + "<FONT COLOR=\"#999999\">";
}
display = display + newline;
display = display + "Sound Effects: ";
if (sfxon) {
display = display + "On";
} else {
display = display + "Off";
}
if (!loadState.sfx) {
display = display + "</FONT COLOR=\"#999999\">";
}
if (cmitem == 0) {
display = display + endpointer;
}
if (cmitem == 1) {
if (loadState.music) {
display = display + startpointer;
} else {
cmitem = cmitem + 1;
}
}
if (!loadState.music) {
display = display + "<FONT COLOR=\"#999999\">";
}
display = display + newline;
display = display + "Music: ";
if (muon) {
display = display + "On";
} else {
display = display + "Off";
}
if (!loadState.music) {
display = display + "</FONT COLOR=\"#999999\">";
}
if (cmitem == 1) {
display = display + endpointer;
}
if (cmitem == 2) {
display = display + startpointer;
}
display = display + newline;
display = display + "Back";
if (cmitem == 2) {
display = display + endpointer;
}
} else if (cmenu == 2) {
if (cmitem < 0) {
cmitem = cmitem + 2;
}
cmitem = cmitem % 2;
display = "<b>Credits:</b>";
if (cmitem == 0) {
display = display + startpointer;
}
display = display + newline;
display = display + "Programming: Martyn Williams";
if (cmitem == 0) {
display = display + endpointer;
}
display = display + newline;
display = display + "Programming: The Booboo";
display = display + newline;
display = display + "Graphics: Peabo";
display = display + newline;
display = display + "Music: Weebl";
display = display + newline;
if (cmitem == 1) {
display = display + startpointer;
}
display = display + "Back";
if (cmitem == 1) {
display = display + endpointer;
}
} else if (cmenu == 3) {
if (cmitem < 0) {
cmitem = cmitem + 1;
}
cmitem = cmitem % 1;
display = "<b>Controls</b>";
display = display + newline;
display = display + "Increase Power: Up";
display = display + newline;
display = display + "Decrease Power: Down";
display = display + newline;
display = display + "Increase Angle: Right";
display = display + newline;
display = display + "Decrease Angle: Left";
display = display + newline;
display = display + "Toggle Music on/off: m";
display = display + newline;
display = display + "Toggle SFX on/off: s";
display = display + newline;
display = display + "Arrows Toward Centre: Gravity Strength";
display = display + newline;
display = display + "Spinning Arrows: Wind Strength";
display = display + newline;
if (cmitem == 0) {
display = display + startpointer;
}
display = display + "Back";
if (cmitem == 0) {
display = display + endpointer;
}
}
}
function initialise() {
thits = 10;
typing = false;
maxheight = 170;
minheight = 100;
center = [200, 200];
numpoints = 20;
rotation = 0;
PI = Math.PI;
gravity = 0.16;
craterStart = 0;
numCraters = 100;
craterCounter = craterStart;
currentPlayer = 1;
currentstate = 0;
if (!inOnlineGame) {
tanksd = new Array();
tanksd[0] = new Object();
tanksd[1] = new Object();
}
sc = 0;
HUD.gotoAndStop("ingame");
trace("initialise");
}
function setMenu() {
online = false;
trace("set menu");
initialise();
targetMode = false;
tanksd[0] = new Object();
var cpuname = CPUnames[random(CPUnames.length)];
tanksd[0].name = cpuname;
tanksd[0].score = 0;
tanksd[0].human = false;
tanksd[1] = new Object();
var cpuname = CPUnames[random(CPUnames.length)];
while (cpuname.toLowerCase() == tanksd[0].name.toLowerCase()) {
trace("new name");
var cpuname = CPUnames[random(CPUnames.length)];
}
tanksd[1].name = cpuname;
tanksd[1].score = 0;
tanksd[1].human = false;
menuMode = true;
cmitem = 0;
cmenu = 0;
this.onEnterFrame = gameNormalLoop;
}
function leaveGameRoom() {
setMenu();
}
function set1player() {
trace("set1player");
initialise();
tanksd[0] = new Object();
tanksd[0].name = p1name;
tanksd[0].score = 0;
tanksd[0].human = true;
tanksd[1] = new Object();
var cpuname = CPUnames[random(CPUnames.length)];
while (cpuname.toLowerCase() == tanksd[0].name.toLowerCase()) {
var cpuname = CPUnames[random(CPUnames.length)];
}
tanksd[1].name = cpuname;
tanksd[1].score = 0;
tanksd[1].human = false;
menuMode = false;
display = "";
}
function set2player() {
trace("set 2 player");
initialise();
if (!inOnlineGame) {
tanksd[0] = new Object();
tanksd[0].name = p1name;
tanksd[0].score = 0;
tanksd[0].human = true;
tanksd[1] = new Object();
tanksd[1].name = p2name;
tanksd[1].score = 0;
tanksd[1].human = true;
} else {
hud.gotoAndStop("inGame");
currentPlayer = _global.whoseturn;
}
menuMode = false;
display = "";
}
function setTarget() {
initialise();
tanksd[0] = new Object();
tanksd[0].name = p1name;
tanksd[0].score = 0;
tanksd[0].human = true;
this.onEnterFrame = targetGame;
}
function missilegroundcheck() {
fore.missile.missile.p = {x:0, y:0};
fore.missile.missile.localToGlobal(fore.missile.missile.p);
return(world.terrain.hitTest(fore.missile.missile.p.x, fore.missile.missile.p.y, true) and (!world.craters.hitTest(fore.missile.missile.p.x, fore.missile.missile.p.y, true)));
}
function groundcheck(x, y) {
return(world.terrain.hitTest(x, y, true) and (!world.craters.hitTest(x, y, true)));
}
function missileTankCheck() {
fore.missile.missile.p = {x:0, y:0};
fore.missile.missile.localToGlobal(fore.missile.missile.p);
if (fore.tanks.hitTest(fore.missile.missile.p.x, fore.missile.missile.p.y, true)) {
if (fore.tanks.tank1.hitTest(fore.missile.missile.p.x, fore.missile.missile.p.y, true)) {
return(1);
}
if (fore.tanks.tank2.hitTest(fore.missile.missile.p.x, fore.missile.missile.p.y, true)) {
return(2);
}
}
return(false);
}
function placeCrater(x, y) {
var tempChanceChoice = random(2);
switch (tempChanceChoice) {
case 0 :
switch (currentPlayer) {
case 1 :
fore.tanks.p2Char.gotoAndPlay("opponent miss");
break;
case 2 :
fore.tanks.p1Char.gotoAndPlay("opponent miss");
break;
}
break;
case 1 :
switch (currentPlayer) {
case 1 :
fore.tanks.p1Char.gotoAndPlay("miss");
break;
case 2 :
fore.tanks.p2Char.gotoAndPlay("miss");
break;
}
break;
}
cratercounter++;
if (cratercounter > numcraters) {
craterCounter = craterStart;
}
world.craters.attachMovie("crater", "crater" + craterCounter, craterCounter);
world.skym.attachMovie("crater", "crater" + craterCounter, craterCounter);
world.craters["crater" + craterCounter]._x = x;
world.craters["crater" + craterCounter]._y = y;
world.skym["crater" + craterCounter]._x = x;
world.skym["crater" + craterCounter]._y = y;
removeMovieClip(fore.missile.missile);
}
function falltoground() {
if (fallcounter > 0) {
fallcounter = fallcounter - 1;
tanksd[0].radius = tanksd[0].radius - tanksd[0].fallspeed;
tanksd[0].fallspeed = tanksd[0].fallspeed + 0.32;
tanksd[0].currenty = tanksd[0].radius * Math.sin(tanksd[0].angle);
tanksd[0].currentx = tanksd[0].radius * Math.cos(tanksd[0].angle);
fore.tanks.tank1._x = tanksd[0].currentx;
fore.tanks.tank1._y = tanksd[0].currenty;
tanksd[1].radius = tanksd[1].radius - tanksd[1].fallspeed;
tanksd[1].fallspeed = tanksd[1].fallspeed + 0.32;
tanksd[1].currenty = tanksd[1].radius * Math.sin(tanksd[1].angle);
tanksd[1].currentx = tanksd[1].radius * Math.cos(tanksd[1].angle);
fore.tanks.tank2._x = tanksd[1].currentx;
fore.tanks.tank2._y = tanksd[1].currenty;
firsthit = true;
return(false);
}
if (firsthit) {
tanksd[0].radius = tanksd[0].radius - 4;
tanksd[0].currenty = tanksd[0].radius * Math.sin(tanksd[0].angle);
tanksd[0].currentx = tanksd[0].radius * Math.cos(tanksd[0].angle);
fore.tanks.tank1._x = tanksd[0].currentx;
fore.tanks.tank1._y = tanksd[0].currenty;
tanksd[1].radius = tanksd[1].radius - 4;
tanksd[1].currenty = tanksd[1].radius * Math.sin(tanksd[1].angle);
tanksd[1].currentx = tanksd[1].radius * Math.cos(tanksd[1].angle);
fore.tanks.tank2._x = tanksd[1].currentx;
fore.tanks.tank2._y = tanksd[1].currenty;
firsthit = false;
} else {
return(true);
}
}
function aim(player) {
if (tanksd[player - 1].human) {
if (Key.isDown(39)) {
tanksd[player - 1].fireAngle = tanksd[player - 1].fireAngle + 1;
}
if (Key.isDown(37)) {
tanksd[player - 1].fireAngle = tanksd[player - 1].fireAngle - 1;
}
if (Key.isDown(38)) {
tanksd[player - 1].power = tanksd[player - 1].power + 1;
}
if (Key.isDown(40)) {
tanksd[player - 1].power = tanksd[player - 1].power - 1;
}
if (tanksd[player - 1].power < 0) {
tanksd[player - 1].power = 0;
}
if (tanksd[player - 1].fireAngle < -90) {
tanksd[player - 1].fireAngle = -90;
}
if (tanksd[player - 1].fireAngle > 90) {
tanksd[player - 1].fireAngle = 90;
}
if (Key.isDown(32)) {
var firenow = true;
switch (player) {
case 1 :
fore.tanks.p1Char.gotoAndPlay("fire");
break;
case 2 :
fore.tanks.p2Char.gotoAndPlay("fire");
break;
}
if (isOnlineGame) {
smartfox.sendObject({type:"move", a:tanksd[player - 1].fireAngle, p:tanksd[player - 1].power});
}
}
} else {
var pready = false;
var aready = false;
if (!isOnlineGame) {
onlineReady = true;
}
smartfox.onObjectReceived = function (o) {
if (o.type == "move") {
tanksd[player - 1].nextAngle = o.a;
tanksd[player - 1].nextPower = o.p;
onlineReady = true;
}
};
if (tanksd[player - 1].nextAngle > tanksd[player - 1].fireAngle) {
tanksd[player - 1].fireAngle = tanksd[player - 1].fireAngle + 1;
} else if (tanksd[player - 1].nextAngle < tanksd[player - 1].fireAngle) {
tanksd[player - 1].fireAngle = tanksd[player - 1].fireAngle - 1;
} else {
aready = true;
}
if (Math.round(tanksd[player - 1].nextPower) > Math.round(tanksd[player - 1].power)) {
tanksd[player - 1].power = tanksd[player - 1].power + 1;
} else if (Math.round(tanksd[player - 1].nextPower) < Math.round(tanksd[player - 1].power)) {
tanksd[player - 1].power = tanksd[player - 1].power - 1;
} else {
pready = true;
tanksd[player - 1].power = tanksd[player - 1].power + (tanksd[player - 1].nextPower - tanksd[player - 1].power);
}
if ((pready and aready) and onlineReady) {
var firenow = true;
switch (player) {
case 1 :
fore.tanks.p1Char.gotoAndPlay("fire");
break;
case 2 :
fore.tanks.p2Char.gotoAndPlay("fire");
break;
}
}
}
fore.tanks["tank" + player].turret._rotation = tanksd[player - 1].fireAngle;
display = (((("<b>" + tanksd[player - 1].name) + "</b>\nAngle: ") + (tanksd[player - 1].fireangle + 90)) + "\nPower: ") + Math.round(tanksd[player - 1].power);
if (fireNow) {
return(true);
}
return(false);
}
function fireBullet(player) {
sfxfire.start(0, 0);
fore.tanks["tank" + player].turret.point.p = {x:0, y:0};
fore.tanks["tank" + player].turret.point.localToGlobal(fore.tanks["tank" + player].turret.point.p);
x = fore.tanks["tank" + player].turret.point.p.x - center[0];
y = fore.tanks["tank" + player].turret.point.p.y - center[1];
roundDetails = new XYToRadAng(x, y);
trace("Start Angle:" + radToDeg(roundDetails.angle));
roundDetails.trueAngle = roundDetails.angle;
roundDetails.angle = roundDetails.angle - ((currentPlayer - 1) * Math.PI);
trace("Corrected Angle:" + radToDeg(roundDetails.angle));
roundDetails.xspeed = ((-tanksd[player - 1].power) * Math.cos(degtorad(90 - tanksd[player - 1].fireAngle))) / 4;
roundDetails.sxspeed = roundDetails.xspeed;
roundDetails.yspeed = ((-tanksd[player - 1].power) * Math.sin(degtorad(90 - tanksd[player - 1].fireAngle))) / 4;
var positionstuff = new radHeightToXY(roundDetails.radius, roundDetails.angle);
fore.missile.attachMovie("bullet", "missile", 3);
fore.missile.missile._x = positionstuff.x;
fore.missile.missile._y = positionstuff.y;
display = "Firing!";
var oldPos = new radHeightToXY(roundDetails.radius, roundDetails.angle);
if (roundDetails.radius > 0) {
roundDetails.yspeed = roundDetails.yspeed + gravity;
} else {
roundDetails.yspeed = roundDetails.yspeed - gravity;
}
if (roundDetails.yspeed > 15) {
roundDetails.yspeed = 15;
} else if (roundDetails.yspeed < -15) {
roundDetails.yspeed = -15;
}
roundDetails.xspeed = roundDetails.xspeed + wind;
var omega = degChange(roundDetails.radius, roundDetails.xspeed);
roundDetails.angle = roundDetails.angle + omega;
roundDetails.trueAngle = roundDetails.trueAngle + omega;
rotate(RadToDeg(omega));
roundDetails.radius = roundDetails.radius - roundDetails.yspeed;
var missilePos = new radHeightToXY(roundDetails.radius, roundDetails.angle);
fore.missile.missile._x = missilePos.x;
fore.missile.missile._y = missilePos.y;
fore.missile.missile._rotation = radToDeg(Math.atan2(oldPos.y - missilePos.y, oldPos.x - missilePos.x));
return(true);
}
function MoveBullet(player) {
display = "Firing!";
var oldPos = new radHeightToXY(roundDetails.radius, roundDetails.angle);
if (roundDetails.radius > 0) {
roundDetails.yspeed = roundDetails.yspeed + gravity;
} else {
roundDetails.yspeed = roundDetails.yspeed - gravity;
}
if (roundDetails.yspeed > 15) {
roundDetails.yspeed = 15;
} else if (roundDetails.yspeed < -15) {
roundDetails.yspeed = -15;
}
roundDetails.xspeed = roundDetails.xspeed + wind;
var omega = (degChange(roundDetails.radius, roundDetails.xspeed) / 10);
var mcount = 1;
if ((sc % 5) == 0) {
fore.smoke.attachMovie("smoke", "s" + sc, sc);
fore.smoke["s" + sc]._x = fore.missile.missile._x;
fore.smoke["s" + sc]._y = fore.missile.missile._y;
}
sc = sc + 1;
while (true) {
if (mcount > 10) {
return;
}
mcount = mcount + 1;
roundDetails.angle = roundDetails.angle + omega;
roundDetails.trueAngle = roundDetails.trueAngle + omega;
rotate(RadToDeg(omega));
roundDetails.radius = roundDetails.radius - (roundDetails.yspeed / 10);
var missilePos = new radHeightToXY(roundDetails.radius, roundDetails.angle);
fore.missile.missile._x = missilePos.x;
fore.missile.missile._y = missilePos.y;
fore.missile.missile._rotation = radToDeg(Math.atan2(oldPos.y - missilePos.y, oldPos.x - missilePos.x));
var collide = missilegroundcheck();
if (collide) {
var tempChanceChoice = random(2);
sfxhiss.start(0, 0);
if (!tanksd[player - 1].human) {
if (player == 2) {
var enNum = 1;
} else {
var enNum = 0;
}
var magicnum = 10;
var mangle = standardRad(roundDetails.angle);
var angleNeeded = standardRad(tanksd[enNum].angle + 1.0471975511966);
var angleDiff = (angleNeeded - mangle);
if (roundDetails.sxspeed > 0) {
if (angleDiff > 0) {
var powerDiff = ((magicnum * gravity) * Math.abs(angleDiff));
} else {
var powerDiff = (((-magicnum) * gravity) * Math.abs(angleDiff));
}
} else if (angleDiff > 0) {
var powerDiff = (((-magicnum) * gravity) * Math.abs(angleDiff));
} else {
var powerDiff = ((magicnum * gravity) * Math.abs(angleDiff));
}
if ((roundDetails.radius < tanksd[enNum].radius) and (Math.abs(angleDiff) < 0.3)) {
PowerDiff = PowerDiff + 1;
trace("Underneath");
}
trace("Xspeed:" + roundDetails.xspeed);
trace((((("Angle needed:" + angleNeeded) + " Bullet Angle:") + mangle) + " Between:") + angleDiff);
trace("Power change:" + powerDiff);
trace("");
tanksd[player - 1].nextPower = tanksd[player - 1].nextPower + powerDiff;
}
placeCrater(missilePos.x, missilePos.y);
if (!targetmode) {
swapPlayers();
}
currentState = 3;
return;
}
var Tcollisions = missileTankCheck();
if (Tcollisions) {
if (Tcollisions == 1) {
tanksd[1].score = tanksd[1].score + 1;
deadTank = 1;
} else {
tanksd[0].score = tanksd[0].score + 1;
deadTank = 2;
}
swapPlayers();
startExplode(deadTank);
return(true);
}
if (targetMode) {
fore.missile.targetClip.p = {x:0, y:0};
fore.missile.targetClip.localToGlobal(fore.missile.targetClip.p);
fore.missile.missile.p = {x:0, y:0};
fore.missile.missile.localToGlobal(fore.missile.missile.p);
var xdiff = (fore.missile.missile.p.x - fore.missile.targetClip.p.x);
var ydiff = (fore.missile.missile.p.y - fore.missile.targetClip.p.y);
if (((xdiff * xdiff) + (ydiff * ydiff)) < 225) {
var num = random(targetHeights.length);
var pi = targetHeights[num];
fore.missile.attachMovie("texp", "texp" + thits, 10 + thits);
fore.missile["texp" + thits]._x = fore.missile.targetClip._x;
fore.missile["texp" + thits]._y = fore.missile.targetClip._y;
sfxtarget.start(0, 0);
placeTarget(pi[0], pi[1]);
thits = thits - 1;
if (thits == 0) {
endTargetGame();
}
trace("HIT!");
}
}
}
}
function startExplode(tank) {
if (isOnlineGame) {
if ((_global.whoseTurn = 1)) {
_global.whoseTurn = 2;
} else {
_global.whoseTurn = 1;
}
handshook = false;
firsthcall = true;
}
explodeParticles = new Array();
i = 0;
while (i <= 15) {
var OB = new Object();
OB.xspeed = (Math.random() * 2) - 1;
OB.yspeed = -5;
fore.tanks["tank" + tank].p = {x:0, y:0};
fore.tanks["tank" + tank].localToGlobal(fore.tanks["tank" + tank].p);
var x = ((fore.tanks["tank" + tank].p.x - center[0]) - (Math.random() * 20));
var y = ((fore.tanks["tank" + tank].p.y - center[1]) - (Math.random() * 20));
var roundDetails = new XYToRadAng(x, y);
roundDetails.angle = roundDetails.angle - ((tank - 1) * Math.PI);
OB.radius = roundDetails.radius;
OB.angle = roundDetails.angle;
fore.particles.attachMovie("particle", "p" + i, i);
fore.particles["p" + i]._x = x;
fore.particles["p" + i]._y = y;
OB.name = "p" + i;
OB.up = true;
explodeParticles[i] = OB;
i = i + 1;
}
if (tank == 1) {
var killer = 1;
} else {
var killer = 0;
}
var tempChanceChoice = random(2);
switch (tempChanceChoice) {
case 0 :
switch (killer) {
case 0 :
fore.tanks.p2Char.gotoAndPlay("killed");
break;
case 1 :
fore.tanks.p1Char.gotoAndPlay("killed");
break;
}
break;
case 1 :
switch (killer) {
case 0 :
fore.tanks.p1Char.gotoAndPlay("hit");
fore.tanks.p2Char.gotoAndPlay("killed silent");
break;
case 1 :
fore.tanks.p2Char.gotoAndPlay("hit");
fore.tanks.p2Char.gotoAndPlay("killed silent");
break;
}
break;
}
trace(((Math.round(Gravity * 100) / 100) + " ") + tanksd[killer].power);
removeMovieClip(fore.tanks["tank" + tank]);
removeMovieClip(fore.missile);
sfxboom.start(0, 0);
pup = i;
ptime = 120;
explodeTank(tank);
}
function explodeTank(tank) {
i = 0;
while (i <= 15) {
if (explodeParticles[i].radius > 0) {
explodeParticles[i].yspeed = explodeParticles[i].yspeed + gravity;
} else {
explodeParticles[i].yspeed = explodeParticles[i].yspeed - gravity;
}
explodeParticles[i].xspeed = explodeParticles[i].xspeed + wind;
var omega = degChange(explodeParticles[i].radius, explodeParticles[i].xspeed);
explodeParticles[i].angle = explodeParticles[i].angle + omega;
explodeParticles[i].radius = explodeParticles[i].radius - explodeParticles[i].yspeed;
var PartPos = new radHeightToXY(explodeParticles[i].radius, explodeParticles[i].angle);
fore.particles[explodeParticles[i].name]._x = PartPos.x;
fore.particles[explodeParticles[i].name]._y = PartPos.y;
fore.particles[explodeParticles[i].name].p = {x:0, y:0};
fore.particles[explodeParticles[i].name].localToGlobal(fore.particles[explodeParticles[i].name].p);
if (groundcheck(fore.particles[explodeParticles[i].name].p.x, fore.particles[explodeParticles[i].name].p.y) and (explodeParticles[i].up == true)) {
fore.particles[explodeParticles[i].name]._visible = false;
pup = pup - 1;
explodeParticles[i].up = false;
}
i = i + 1;
}
ptime = ptime - 1;
if ((pup < 3) or (ptime < 0)) {
return(true);
}
return(false);
}
function swapPlayers() {
if (currentPlayer == 1) {
currentPlayer = 2;
} else {
currentPlayer = 1;
}
}
function degChange(radius, speed) {
var omega = (speed / radius);
return(omega);
}
function XYToRadAng(x, y) {
adjust = PI / numPoints;
this.angle = Math.atan2(y, -x) - adjust;
this.radius = Math.sqrt((x * x) + (y * y));
}
function radHeightToXY(radius, angle) {
this.x = (-radius) * Math.sin(angle);
this.y = (-radius) * Math.cos(angle);
}
function standardDeg(deg) {
var deg2 = deg;
if (deg2 > 360) {
deg2 = deg2 - 360;
} else if (deg2 < 0) {
deg2 = deg2 + 360;
}
if ((deg2 > 360) or (deg2 < 0)) {
deg2 = standardDeg(deg2);
}
return(deg2);
}
function standardRad(rad) {
var rad2 = rad;
if (rad2 > (2 * PI)) {
rad2 = rad2 - (2 * PI);
} else if (rad2 < 0) {
rad2 = rad2 + (2 * PI);
}
if ((rad2 > (2 * PI)) or (rad2 < 0)) {
rad2 = standardRad(rad2);
}
return(rad2);
}
function radtodeg(rad) {
var deg = standardDeg((180 / PI) * rad);
return(deg);
}
function degtorad(deg) {
var rad = ((PI / 180) * deg);
return(standardRad(rad));
}
function newHeights() {
trace("new heights");
if (!online) {
wind = (Math.random() * 0.2) - 0.1;
gravity = (Math.random() * 0.5) + 0.01;
heights = new Array();
i = 0;
while (i < numpoints) {
heights[i] = random(maxheight - minheight) + minheight;
i = i + 1;
}
heights[1] = (heights[0] = random(maxheight - minheight) + minheight);
heights[(numpoints / 2) + 1] = (heights[numpoints / 2] = random(maxheight - minheight) + minheight);
return(true);
}
trace("ID = " + _global.myID);
if (_global.myID == 1) {
trace("I think it is my turn");
if (firstHcall) {
firstHcall = false;
heights = new Array();
wind = (Math.random() * 0.2) - 0.1;
gravity = (Math.random() * 0.5) + 0.01;
i = 0;
while (i < numpoints) {
heights[i] = random(maxheight - minheight) + minheight;
i = i + 1;
}
heights[1] = (heights[0] = random(maxheight - minheight) + minheight);
heights[(numpoints / 2) + 1] = (heights[numpoints / 2] = random(maxheight - minheight) + minheight);
smartfox.sendObject({type:"heights", ob:heights, wind:wind, gravity:gravity, oLC:_root.onlineChar});
smartfox.onObjectReceived = function (o) {
if (o.type == "heightsok") {
handshook = true;
_root.player2Char = o.oLC;
_root.player1Char = _root.onlineChar;
}
};
}
smartfox.sendObject({type:"heights", ob:heights, wind:wind, gravity:gravity, oLC:_root.onlineChar});
} else {
trace("I think it is NOT my turn");
smartfox.onObjectReceived = function (o) {
if (o.type == "heights") {
heights = o.ob;
wind = o.wind;
gravity = o.gravity;
smartfox.sendObject({type:"heightsok", v:true, oLC:_root.onlineChar});
handshook = true;
_root.player1Char = o.oLC;
_root.player2Char = _root.onlineChar;
}
};
}
return(handshook);
}
function render() {
var setup = settings[random(settings.length)];
this.createEmptyMovieClip("world", 2);
this.createEmptyMovieClip("fore", 5);
fore.createEmptyMovieClip("tanks", 1);
world.createEmptyMovieClip("terrain", 1);
world.createEmptyMovieClip("terrainm", 2);
world.createEmptyMovieClip("skym", 5);
fore.createEmptyMovieClip("missile", 2);
fore.createEmptyMovieClip("particles", 6);
world.createEmptyMovieClip("craters", 6);
fore.attachMovie("arrows", "arrows", 12);
fore.createEmptyMovieClip("smoke", 4);
var gi = 0;
while (gi < 4) {
fore.attachMovie("gravarrow", "grav" + gi, 13 + gi);
fore["grav" + gi]._rotation = gi * 90;
gi = gi + 1;
}
world.craters._visible = false;
world.attachMovie("texture", "texture", 3);
world.texture.gotoAndStop(setup.textFrame);
world.texture.setMask(world.terrainm);
attachMovie("skytext", "skyText", 1);
attachMovie("skytext", "skyTextF", 3);
HUD.swapDepths(4);
skyText._x = 0;
skyText._y = 0;
skyTextF.setMask(world.skym);
this.world._x = (this.fore._x = center[0]);
this.world._y = (this.fore._y = center[1]);
this.world.terrain.lineStyle(1, 0, 4);
this.world.terrain.beginFill(39168);
this.world.terrainm.lineStyle(1, 0, 0);
this.world.terrainm.beginFill(39168);
i = 0;
var sy = (heights[0] * Math.sin(((Math.PI*2) / numpoints) * i));
var sx = (heights[0] * Math.cos(((Math.PI*2) / numpoints) * i));
this.world.terrain.moveTo(sx, sy);
this.world.terrainm.moveTo(sx, sy);
i = 1;
while (i < numpoints) {
var y = (heights[i] * Math.sin(((Math.PI*2) / numpoints) * i));
var x = (heights[i] * Math.cos(((Math.PI*2) / numpoints) * i));
this.world.terrain.lineTo(x, y);
this.world.terrainm.lineTo(x, y);
i = i + 1;
}
this.world.terrain.lineTo(sx, sy);
this.world.terrain.endFill();
this.world.terrainm.lineTo(sx, sy);
this.world.terrainm.endFill();
var gi = 0;
while (gi < 4) {
fore["grav" + gi]._xscale = gravity * 200;
fore["grav" + gi].inside.gotoAndStop(setup.arrowFrame);
gi = gi + 1;
}
rotate(((currentPlayer * 2) - 1) * 90);
if (wind > 0) {
fore.arrows.gotoAndStop(2);
} else {
fore.arrows.gotoAndStop(1);
}
fore.arrows.inside.gotoAndStop(setup.arrowFrame);
tanksd[0].radius = heights[1] + 100;
tanksd[0].angle = ((Math.PI*2) / numpoints) * 1;
tanksd[0].currenty = tanksd[0].radius * Math.sin(tanksd[0].angle);
tanksd[0].currentx = tanksd[0].radius * Math.cos(tanksd[0].angle);
tanksd[0].fallspeed = 0;
tanksd[0].fireAngle = 0;
tanksd[0].power = 20;
trace("player 1 char = " + _root.player1Char);
trace("player 2 char = " + _root.player2Char);
fore.tanks.p1Char.removeMovieClip();
switch (_root.player1Char) {
case 0 :
fore.tanks.attachMovie("prawnChar", "p1Char", 1);
break;
case 1 :
fore.tanks.attachMovie("toastChar", "p1Char", 1);
break;
case 2 :
fore.tanks.attachMovie("keithChar", "p1Char", 1);
break;
case 3 :
fore.tanks.attachMovie("siChar", "p1Char", 1);
break;
case 4 :
fore.tanks.attachMovie("hitlerChar", "p1Char", 1);
break;
}
fore.tanks.p1Char._x = tanksd[0].currentx;
fore.tanks.p1Char._y = tanksd[0].currenty;
fore.tanks.p1Char._rotation = 90 + (360 / (numpoints * 2));
fore.tanks.attachMovie("tank", "tank1", 3);
fore.tanks.tank1.bodies.gotoAndPlay(setup.tankFrame);
fore.tanks.tank1._x = tanksd[0].currentx;
fore.tanks.tank1._y = tanksd[0].currenty;
fore.tanks.tank1._rotation = 90 + (360 / (numpoints * 2));
if (!targetmode) {
tanksd[1].radius = heights[(numpoints / 2) + 1] + 100;
tanksd[1].angle = ((Math.PI*2) / numpoints) * ((numpoints / 2) + 1);
tanksd[1].currenty = tanksd[1].radius * Math.sin(tanksd[1].angle);
tanksd[1].currentx = tanksd[1].radius * Math.cos(tanksd[1].angle);
tanksd[1].fallspeed = 0;
tanksd[1].fireAngle = 0;
tanksd[1].power = 20;
fore.tanks.p2Char.removeMovieClip();
switch (_root.player2Char) {
case 0 :
fore.tanks.attachMovie("prawnChar", "p2Char", 2);
break;
case 1 :
fore.tanks.attachMovie("toastChar", "p2Char", 2);
break;
case 2 :
fore.tanks.attachMovie("keithChar", "p2Char", 2);
break;
case 3 :
fore.tanks.attachMovie("siChar", "p2Char", 2);
break;
case 4 :
fore.tanks.attachMovie("hitlerChar", "p2Char", 2);
break;
}
fore.tanks.p2Char._x = tanksd[1].currentx;
fore.tanks.p2Char._y = tanksd[1].currenty;
fore.tanks.p2Char._rotation = -90 + (360 / (numpoints * 2));
fore.tanks.attachMovie("tank", "tank2", 4);
fore.tanks.tank2.bodies.gotoAndPlay(setup.tankFrame);
fore.tanks.tank2._x = tanksd[1].currentx;
fore.tanks.tank2._y = tanksd[1].currenty;
fore.tanks.tank2._rotation = -90 + (360 / (numpoints * 2));
}
fallcounter = 25;
i = 0;
while (i <= 1) {
if (tanksd[i].human == false) {
if (!online) {
tanksd[i].nextangle = (random(30) + 30) * ((random(2) * 2) - 1);
tanksd[i].nextPower = (140 * gravity) + 15;
trace((("Power:" + tanksd[i].nextPower) + " Angle:") + tanksd[i].nextAngle);
} else {
tanksd[i].nextangle = 0;
tanksd[i].nextPower = 20;
trace((("Power:" + tanksd[i].nextPower) + " Angle:") + tanksd[i].nextAngle);
}
}
i = i + 1;
}
}
function rotateTo(targetRotation, speed) {
var angleBetween = standardDeg(radToDeg(rotation) - standardDeg(targetRotation));
if (angleBetween > 180) {
if (anglebetween <= (360 - (speed * 1.5))) {
rotate(speed);
return(false);
}
rotate(-anglebetween);
return(true);
}
if (angleBetween < 180) {
if (standardDeg(anglebetween - 180) >= (speed * 1.5)) {
rotate(-speed);
return(false);
}
rotate(-anglebetween);
return(true);
}
return(true);
}
function placeTarget(i, h) {
var y = (h * Math.sin(((Math.PI*2) / numpoints) * i));
var x = (h * Math.cos(((Math.PI*2) / numpoints) * i));
fore.missile.attachMovie("target", "targetClip", 4);
fore.missile.targetClip._x = x;
fore.missile.targetClip._y = y;
}
function rotate(dist) {
rotation = rotation + degtorad(dist);
rotation = standardRad(rotation);
this.world._rotation = (fore._rotation = (((rotation * 180) / Math.PI) - 90) - (360 / (numpoints * 2)));
}
function spinArrows() {
fore.arrows._rotation = fore.arrows._rotation + (wind * -65);
}
function upDateScores() {
p1score = (tanksd[0].name + " : ") + tanksd[0].score;
if (!targetMode) {
p2score = (tanksd[1].score + " : ") + tanksd[1].name;
} else {
p2score = "";
}
}
function createCheck(num) {
total = 0;
num = Math.floor(num);
nums = num.toString();
i = 0;
while (i < nums.length) {
currents = nums.charAt(i);
currentn = Number(currents) * i;
total = total + currentn;
i = i + 1;
}
return(total);
}
function endTargetGame() {
trace("You rox!");
currentState = 11;
removeMovieClip("fore.missile.targetClip");
this.createEmptyMovieClip("highscoreHandle", 15);
game = 20;
name = tanksd[0].name;
score = Math.round(TimeTaken * 100) / 100;
checkNum = createCheck(score);
highscorehandle.checkNum = checkNum;
highscorehandle.name = tanksd[0].name;
highscorehandle.game = 20;
highscorehandle.score = Math.round(TimeTaken * 100) / 100;
highscorehandle.scoresent = null;
highscorehandle.scoresloaded = null;
loadVariables ((((((("php/sendscore.php?game=" + game) + "&name=") + name) + "&score=") + score) + "&checkNum=") + checkNum, "highscorehandle");
}
function highWaitSend() {
display = display + ("<br>Name: " + highscorehandle.name);
display = display + ("<br>Game: " + highscorehandle.game);
display = display + ("<br>Score: " + (Math.round(TimeTaken * 100) / 100));
display = display + ("<br>Debug: " + highscorehandle.message);
if (highscorehandle.scriptdone == "true") {
trace("score sent");
return(true);
}
}
function highWaitLoad() {
if (highscorehandle.scoresloaded == "true") {
trace("scores back");
display = "";
var i = 0;
while (i < 9) {
display = display + (((("<b>" + highscorehandle["s" + i]) + "</b> ") + highscorehandle["n" + i]) + "<br>");
i = i + 1;
}
display = display + (("Your score: " + (Math.round(TimeTaken * 100) / 100)) + "<br>");
display = display + highscorehandle.message;
return(true);
}
}
function toggleMS() {
if (!typing) {
if (Key.isDown(83)) {
if (!sdown) {
trace("s");
sdown = true;
sfxon = !sfxon;
if (sfxon) {
sfxboom.setVolume(svol);
sfxhiss.setVolume(svol);
sfxtarget.setVolume(svol);
sfxfire.setVolume(svol);
} else {
sfxboom.setVolume(0);
sfxhiss.setVolume(0);
sfxtarget.setVolume(0);
sfxfire.setVolume(0);
}
}
} else {
sdown = false;
}
if (Key.isDown(77)) {
if (!mdown) {
trace("m");
mdown = true;
muon = !muon;
if (muon) {
music.setVolume(mvol);
} else {
music.setVolume(0);
}
}
} else {
mdown = false;
}
}
}
function gameNormalLoop() {
fore.tanks.p1Char._x = tanksd[0].currentx;
fore.tanks.p1Char._y = tanksd[0].currenty;
fore.tanks.p2Char._x = tanksd[1].currentx;
fore.tanks.p2Char._y = tanksd[1].currenty;
if (currentstate == 0) {
currentPlayer = _global.whoseTurn;
heightsSet = newHeights();
if (inOnlineGame) {
if (handshook) {
currentState = currentState + 1;
render();
rotate(0);
}
} else if (heightsSet) {
currentState = currentState + 1;
render();
rotate(0);
}
} else if (currentstate == 1) {
var done = falltoground();
display = "Creating battlefield";
if (done) {
currentstate = currentstate + 2;
world.tank1.gotoAndStop("positioning");
world.tank2.gotoAndStop("positioning");
}
} else if (currentstate == 2) {
display = "Analysing Battlefield";
var done = rotateTo(180, 3);
if (done) {
currentState = currentState + 1;
}
} else if (currentstate == 3) {
var done = rotateTo((currentPlayer + 1) * 180, 3);
onlineReady = false;
if (done) {
currentState = currentState + 1;
}
} else if (currentstate == 4) {
var done = aim(currentPlayer);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 5) {
var done = firebullet(currentPlayer);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 6) {
var done = movebullet(currentPlayer);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 7) {
var done = explodeTank(deadTank);
if (done) {
currentState = 0;
if (inOnlineGame) {
handshook = false;
}
}
}
spinArrows();
updateScores();
if (menuMode) {
menuDisplay();
}
if (Key.isDown(27)) {
setMenu();
}
if (key.isDown(18) and (!abcd)) {
sfxfire.start(0, 0);
abcd = true;
}
toggleMS();
}
function targetGame() {
if (Key.isDown(27)) {
setMenu();
}
message = "";
if (currentstate == 0) {
timeTaken = 0;
newHeights();
heights[0] = 114;
heights[1] = 114;
heights[2] = 155;
heights[3] = 112;
heights[4] = 129;
heights[5] = 159;
heights[6] = 126;
heights[7] = 104;
heights[8] = 137;
heights[9] = 140;
heights[10] = 112;
heights[11] = 112;
heights[12] = 153;
heights[13] = 117;
heights[14] = 162;
heights[15] = 132;
heights[16] = 130;
heights[17] = 141;
heights[18] = 122;
heights[19] = 158;
targetHeights = [[2, 155], [2.25, 144.25], [2.5, 133.5], [2.75, 122.75], [3, 112], [3.25, 116.25], [3.5, 120.5], [3.75, 124.75], [4, 129], [4.25, 136.5], [4.5, 144], [4.75, 151.5], [5, 159], [5.25, 150.75], [5.5, 142.5], [5.75, 134.25], [6, 126], [6.25, 120.5], [6.5, 115], [6.75, 109.5], [7, 104], [7.25, 112.25], [7.5, 120.5], [7.75, 128.75], [8, 137], [8.25, 137.75], [8.5, 138.5], [8.75, 139.25], [9, 140], [9.25, 133], [9.5, 126], [9.75, 119], [10, 112], [10.25, 112], [10.5, 112], [10.75, 112], [11, 112], [11.25, 122.25], [11.5, 132.5], [11.75, 142.75], [12, 153], [12.25, 144], [12.5, 135], [12.75, 126], [13, 117], [13.25, 128.25], [13.5, 139.5], [13.75, 150.75], [14, 162], [14.25, 154.5], [14.5, 147], [14.75, 139.5], [15, 132], [15.25, 131.5], [15.5, 131], [15.75, 130.5], [16, 130], [16.25, 132.75], [16.5, 135.5], [16.75, 138.25], [17, 141], [17.25, 136.25], [17.5, 131.5], [17.75, 126.75], [18, 122], [18.25, 131], [18.5, 140], [18.75, 149], [19, 158]];
render();
gravity = 0.4737;
wind = 0;
rotate(0);
var num = random(targetHeights.length);
var pi = targetHeights[num];
placeTarget(pi[0], pi[1]);
currentState = currentState + 1;
} else if (currentstate == 1) {
trace("fall");
var done = falltoground();
display = "Aligning battlefield";
if (done) {
currentstate = currentstate + 2;
world.tank1.gotoAndStop("positioning");
}
} else if (currentstate == 3) {
display = "Creating battlefield";
var done = rotateTo((currentPlayer + 1) * 180, 3);
if (done) {
currentState = currentState + 1;
}
} else if (currentstate == 4) {
var done = aim(currentPlayer);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 5) {
var done = firebullet(currentPlayer);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 6) {
var done = movebullet(currentPlayer);
var rad = standardDeg(-(radToDeg(roundDetails.angle) + 90));
var left = (Math.floor(rad / 18) % 20);
var right = (Math.ceil(rad / 18) % 20);
var point = (rad / 18);
var hpoint = ((((rad - (left * 18)) * (heights[right] - heights[left])) / 18) + heights[left]);
var pointPos = new radHeightToXY(hpoint, 0);
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 7) {
message = "Commiting ritualistic suicide";
var done = explodeTank();
if (done) {
currentState = currentState + 1;
}
} else if (currentState == 8) {
setMenu();
} else if (currentState == 11) {
display = "Sending highscore";
var done = highwaitsend();
if (done) {
currentState = currentState + 1;
highscorehandle.loadVariables("php/retrievescoreasc.php?game=" + game, "", "Post");
}
} else if (currentState == 12) {
display = "<b>Score sent</b>, loading highscores";
var done = highwaitload();
if (done) {
display = display + "<br>Press escape to return to menu";
if (Key.isDown(32)) {
setMenu();
}
}
}
if (Key.isDown(16)) {
targetPlace = true;
}
spinArrows();
updateScores();
if (currentState < 7) {
display = display + (((("<br>Targets Remaining:<b>" + thits) + "</b><br>Time Taken:<b>") + (Math.round(TimeTaken * 100) / 100)) + "</b>");
timeTaken = timeTaken + 0.0285714285714286;
}
toggleMS();
}
inOnlineGame = false;
CPUnames = ["George", "Jeff", "Fred", "Ian", "Frank", "Eric", "Bob", "Nigel", "Terrance", "Cuthbert", "Dan", "Marphy!", "Jo", "Clare", "Martha", "Pam", "Cynthia", "Juliet", "Mary", "Dylan", "Beefyman", "That other one", "Gordon Freeman", "Master Chief", "Sonic", "Mario", "Shigeru Miyamoto"];
settings = new Array();
settings[0] = {textFrame:1, tankFrame:1, arrowFrame:1};
firstHcall = true;
handshook = false;
if (loadState.music) {
music.start(0, 999999);
mvol = 50;
music.setVolume(mvol);
muon = true;
}
if (loadState.sfx) {
sfxon = true;
svol = 50;
sfxboom.setVolume(svol);
sfxhiss.setVolume(svol);
sfxtarget.setVolume(svol);
sfxfire.setVolume(svol);
}
setMenu();
targetPlace = true;
this.onEnterFrame = gameNormalLoop;
stop();
trace("Gravity Power");
Instance of Symbol 418 MovieClip in Frame 12
onClipEvent (load) {
_visible = 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 7
_global.FLabelClass = function () {
if (this.hostComponent == undefined) {
this.hostComponent = ((this._parent.controller == undefined) ? (this._parent) : (this._parent.controller));
}
if (this.customTextStyle == undefined) {
if (this.hostComponent.textStyle == undefined) {
this.hostComponent.textStyle = new TextFormat();
}
this.textStyle = this.hostComponent.textStyle;
this.enable = true;
}
};
FLabelClass.prototype = new MovieClip();
Object.registerClass("FLabelSymbol", FLabelClass);
FLabelClass.prototype.setLabel = function (label) {
var val = this.hostComponent.styleTable.embedFonts.value;
if (val != undefined) {
this.labelField.embedFonts = val;
}
this.labelField.setNewTextFormat(this.textStyle);
this.labelField.text = label;
this.labelField._height = this.labelField.textHeight + 2;
};
FLabelClass.prototype.setSize = function (width) {
this.labelField._width = width;
};
FLabelClass.prototype.setEnabled = function (enable) {
this.enable = enable;
var tmpColor = this.hostComponent.styleTable[(enable ? "textColor" : "textDisabled")].value;
if (tmpColor == undefined) {
tmpColor = (enable ? 0 : 8947848);
}
this.setColor(tmpColor);
};
FLabelClass.prototype.getLabel = function () {
return(this.labelField.text);
};
FLabelClass.prototype.setColor = function (col) {
this.labelField.textColor = col;
};
#endinitclip
Symbol 7 MovieClip [FUIComponentSymbol] Frame 1
#initclip 5
function FUIComponentClass() {
this.init();
}
FUIComponentClass.prototype = new MovieClip();
FUIComponentClass.prototype.init = function () {
this.enable = true;
this.focused = false;
this.useHandCursor = false;
this._accImpl = new Object();
this._accImpl.stub = true;
this.styleTable = new Array();
if (_global.globalStyleFormat == undefined) {
_global.globalStyleFormat = new FStyleFormat();
globalStyleFormat.isGlobal = true;
_global._focusControl = new Object();
_global._focusControl.onSetFocus = function (oldFocus, newFocus) {
oldFocus.myOnKillFocus();
newFocus.myOnSetFocus();
};
Selection.addListener(_global._focusControl);
}
if (this._name != undefined) {
this._focusrect = false;
this.tabEnabled = true;
this.focusEnabled = true;
this.tabChildren = false;
this.tabFocused = true;
if (this.hostStyle == undefined) {
globalStyleFormat.addListener(this);
} else {
this.styleTable = this.hostStyle;
}
this.deadPreview._visible = false;
this.deadPreview._width = (this.deadPreview._height = 1);
this.methodTable = new Object();
this.keyListener = new Object();
this.keyListener.controller = this;
this.keyListener.onKeyDown = function () {
this.controller.myOnKeyDown();
};
this.keyListener.onKeyUp = function () {
this.controller.myOnKeyUp();
};
for (var i in this.styleFormat_prm) {
this.setStyleProperty(i, this.styleFormat_prm[i]);
}
}
};
FUIComponentClass.prototype.setEnabled = function (enabledFlag) {
this.enable = ((arguments.length > 0) ? (enabledFlag) : true);
this.tabEnabled = (this.focusEnabled = enabledFlag);
if ((!this.enable) && (this.focused)) {
Selection.setFocus(undefined);
}
};
FUIComponentClass.prototype.getEnabled = function () {
return(this.enable);
};
FUIComponentClass.prototype.setSize = function (w, h) {
this.width = w;
this.height = h;
this.focusRect.removeMovieClip();
};
FUIComponentClass.prototype.setChangeHandler = function (chng, obj) {
this.handlerObj = ((obj == undefined) ? (this._parent) : (obj));
this.changeHandler = chng;
};
FUIComponentClass.prototype.invalidate = function (methodName) {
this.methodTable[methodName] = true;
this.onEnterFrame = this.cleanUI;
};
FUIComponentClass.prototype.cleanUI = function () {
if (this.methodTable.setSize) {
this.setSize(this.width, this.height);
} else {
this.cleanUINotSize();
}
this.methodTable = new Object();
delete this.onEnterFrame;
};
FUIComponentClass.prototype.cleanUINotSize = function () {
for (var funct in this.methodTable) {
this[funct]();
}
};
FUIComponentClass.prototype.drawRect = function (x, y, w, h) {
var inner = this.styleTable.focusRectInner.value;
var outer = this.styleTable.focusRectOuter.value;
if (inner == undefined) {
inner = 16777215 /* 0xFFFFFF */;
}
if (outer == undefined) {
outer = 0;
}
this.createEmptyMovieClip("focusRect", 1000);
this.focusRect.controller = this;
this.focusRect.lineStyle(1, outer);
this.focusRect.moveTo(x, y);
this.focusRect.lineTo(x + w, y);
this.focusRect.lineTo(x + w, y + h);
this.focusRect.lineTo(x, y + h);
this.focusRect.lineTo(x, y);
this.focusRect.lineStyle(1, inner);
this.focusRect.moveTo(x + 1, y + 1);
this.focusRect.lineTo((x + w) - 1, y + 1);
this.focusRect.lineTo((x + w) - 1, (y + h) - 1);
this.focusRect.lineTo(x + 1, (y + h) - 1);
this.focusRect.lineTo(x + 1, y + 1);
};
FUIComponentClass.prototype.pressFocus = function () {
this.tabFocused = false;
this.focusRect.removeMovieClip();
Selection.setFocus(this);
};
FUIComponentClass.prototype.drawFocusRect = function () {
this.drawRect(-2, -2, this.width + 4, this.height + 4);
};
FUIComponentClass.prototype.myOnSetFocus = function () {
this.focused = true;
Key.addListener(this.keyListener);
if (this.tabFocused) {
this.drawFocusRect();
}
};
FUIComponentClass.prototype.myOnKillFocus = function () {
this.tabFocused = true;
this.focused = false;
this.focusRect.removeMovieClip();
Key.removeListener(this.keyListener);
};
FUIComponentClass.prototype.executeCallBack = function () {
this.handlerObj[this.changeHandler](this);
};
FUIComponentClass.prototype.updateStyleProperty = function (styleFormat, propName) {
this.setStyleProperty(propName, styleFormat[propName], styleFormat.isGlobal);
};
FUIComponentClass.prototype.setStyleProperty = function (propName, value, isGlobal) {
if (value == "") {
return(undefined);
}
var tmpValue = parseInt(value);
if (!isNaN(tmpValue)) {
value = tmpValue;
}
var global = ((arguments.length > 2) ? (isGlobal) : false);
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].useGlobal || (!global)) {
this.styleTable[propName].value = value;
if (this.setCustomStyleProperty(propName, value)) {
} else if (propName == "embedFonts") {
this.invalidate("setSize");
} else if (propName.subString(0, 4) == "text") {
if (this.textStyle == undefined) {
this.textStyle = new TextFormat();
}
var textProp = propName.subString(4, propName.length);
this.textStyle[textProp] = value;
this.invalidate("setSize");
} else {
for (var j in this.styleTable[propName].coloredMCs) {
var myColor = new Color(this.styleTable[propName].coloredMCs[j]);
if (this.styleTable[propName].value == undefined) {
var myTObj = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
myColor.setTransform(myTObj);
} else {
myColor.setRGB(value);
}
}
}
this.styleTable[propName].useGlobal = global;
}
};
FUIComponentClass.prototype.registerSkinElement = function (skinMCRef, propName) {
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].coloredMCs == undefined) {
this.styleTable[propName].coloredMCs = new Object();
}
this.styleTable[propName].coloredMCs[skinMCRef] = skinMCRef;
if (this.styleTable[propName].value != undefined) {
var myColor = new Color(skinMCRef);
myColor.setRGB(this.styleTable[propName].value);
}
};
_global.FStyleFormat = function () {
this.nonStyles = {listeners:true, isGlobal:true, isAStyle:true, addListener:true, removeListener:true, nonStyles:true, applyChanges:true};
this.listeners = new Object();
this.isGlobal = false;
if (arguments.length > 0) {
for (var i in arguments[0]) {
this[i] = arguments[0][i];
}
}
};
_global.FStyleFormat.prototype = new Object();
FStyleFormat.prototype.addListener = function () {
var arg = 0;
while (arg < arguments.length) {
var mcRef = arguments[arg];
this.listeners[arguments[arg]] = mcRef;
for (var i in this) {
if (this.isAStyle(i)) {
mcRef.updateStyleProperty(this, i.toString());
}
}
arg++;
}
};
FStyleFormat.prototype.removeListener = function (component) {
this.listeners[component] = undefined;
for (var prop in this) {
if (this.isAStyle(prop)) {
if (component.styleTable[prop].useGlobal == this.isGlobal) {
component.styleTable[prop].useGlobal = true;
var value = (this.isGlobal ? undefined : (globalStyleFormat[prop]));
component.setStyleProperty(prop, value, true);
}
}
}
};
FStyleFormat.prototype.applyChanges = function () {
var count = 0;
for (var i in this.listeners) {
var component = this.listeners[i];
if (arguments.length > 0) {
var j = 0;
while (j < arguments.length) {
if (this.isAStyle(arguments[j])) {
component.updateStyleProperty(this, arguments[j]);
}
j++;
}
} else {
for (var j in this) {
if (this.isAStyle(j)) {
component.updateStyleProperty(this, j.toString());
}
}
}
}
};
FStyleFormat.prototype.isAStyle = function (name) {
return((this.nonStyles[name] ? false : true));
};
#endinitclip
Symbol 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 68 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 76 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 84 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 85 MovieClip [DownArrow] Frame 1
stop();
Symbol 85 MovieClip [DownArrow] Frame 2
stop();
Symbol 85 MovieClip [DownArrow] Frame 3
stop();
Symbol 88 Button
on (press) {
trace("dragging");
startDrag (this);
}
on (release, releaseOutside) {
stopDrag();
}
Symbol 94 Button
on (press) {
startDrag (this, false, -40, -70, 40, -70);
}
on (release, releaseOutside) {
stopDrag();
}
Symbol 99 MovieClip Frame 1
var component = _parent;
component.registerSkinElement(track_mc, "scrollTrack");
Symbol 100 MovieClip [FScrollBarSymbol] Frame 1
#initclip 8
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 tmp = mnPos;
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;
tmp = Math.min(tmp, this.maxPos);
this.setScrollPosition(Math.max(tmp, 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 wasEnabled = this.enable;
if (enabledFlag && (!wasEnabled)) {
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) && (wasEnabled)) {
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 delt = this.smallScroll;
if (inc != "one") {
delt = ((this.largeScroll == 0) ? (this.pageSize) : (this.largeScroll));
}
var newPos = (this.getScrollPosition() + (mode * delt));
if (newPos > this.maxPos) {
newPos = this.maxPos;
} else if (newPos < this.minPos) {
newPos = this.minPos;
}
this.setScrollPosition(newPos);
};
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 c = this.controller;
c.scrollPosition = Math.round(((c.maxPos - c.minPos) * (this._y - c.scrollTop)) / c.trackHeight) + c.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 pos = this.textField.hscroll;
this.setScrollProperties(this.textField._width, 0, this.textField.maxhscroll);
this.setScrollPosition(Math.min(pos, this.textField.maxhscroll));
} else {
var pos = this.textField.scroll;
var pageSize = (this.textField.bottomScroll - this.textField.scroll);
this.setScrollProperties(pageSize, pos, this.textField.maxscroll);
this.setScrollPosition(Math.max(pos, 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 105 Button
on (release) {
if (!_global.isBusy) {
_parent.sendChatMsg();
}
}
Instance of Symbol 95 MovieClip in Symbol 106 MovieClip [gameChat] Frame 1
onClipEvent (enterFrame) {
this._y = -70;
alpha = this._x + 60;
_parent._alpha = alpha;
}
Instance of Symbol 100 MovieClip [FScrollBarSymbol] in Symbol 106 MovieClip [gameChat] Frame 1
//component parameters
onClipEvent (initialize) {
_targetInstanceName = "chat_txt";
horizontal = false;
}
Symbol 150 MovieClip [prawnSelect] Frame 1
this.onPress = function () {
if (_root.currentChoosing == 1) {
_root.player1Char = _root.PRAWN;
} else if (_root.currentChoosing == 2) {
_root.player2Char = _root.PRAWN;
} else if (_root.currentChoosing == 3) {
_root.onlineChar = _root.PRAWN;
}
this.gotoAndPlay("selected");
};
stop();
Symbol 150 MovieClip [prawnSelect] Frame 32
_root.charSel1.removeMovieClip();
Symbol 172 MovieClip [toastSelect] Frame 1
this.onPress = function () {
if (_root.currentChoosing == 1) {
_root.player1Char = _root.TOAST;
} else if (_root.currentChoosing == 2) {
_root.player2Char = _root.TOAST;
} else if (_root.currentChoosing == 3) {
_root.onlineChar = _root.TOAST;
}
this.gotoAndPlay("selected");
};
stop();
Symbol 172 MovieClip [toastSelect] Frame 30
_root.charSel1.removeMovieClip();
Symbol 179 MovieClip [keithSelect] Frame 1
this.onPress = function () {
if (_root.currentChoosing == 1) {
_root.player1Char = _root.KEITH;
} else if (_root.currentChoosing == 2) {
_root.player2Char = _root.KEITH;
} else if (_root.currentChoosing == 3) {
_root.onlineChar = _root.KEITH;
}
this.gotoAndPlay("selected");
};
stop();
Symbol 179 MovieClip [keithSelect] Frame 23
_root.charSel1.removeMovieClip();
Symbol 197 MovieClip [siSelect] Frame 1
this.onPress = function () {
if (_root.currentChoosing == 1) {
_root.player1Char = _root.SI;
} else if (_root.currentChoosing == 2) {
_root.player2Char = _root.SI;
} else if (_root.currentChoosing == 3) {
_root.onlineChar = _root.SI;
}
this.gotoAndPlay("selected");
};
stop();
Symbol 197 MovieClip [siSelect] Frame 21
_root.charSel1.removeMovieClip();
Symbol 217 MovieClip [hitlerSelect] Frame 1
this.onPress = function () {
if (_root.currentChoosing == 1) {
_root.player1Char = _root.HITLER;
} else if (_root.currentChoosing == 2) {
_root.player2Char = _root.HITLER;
} else if (_root.currentChoosing == 3) {
_root.onlineChar = _root.HITLER;
}
this.gotoAndPlay("selected");
};
stop();
Symbol 217 MovieClip [hitlerSelect] Frame 37
_root.charSel1.removeMovieClip();
Symbol 219 MovieClip [charSelect] Frame 1
if (_root.numHumans != 1) {
if (_root.currentChoosing == 1) {
charSelText.text = "Player 1 - Please Choose A Character (Click to Select)";
} else {
charSelText.text = "Player 2 - Please Choose A Character (Click to Select)";
}
} else {
charSelText.text = "Please Choose A Character (Click to Select)";
}
Symbol 228 MovieClip [prawnChar] Frame 9
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 43
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 93
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 141
stop();
Symbol 228 MovieClip [prawnChar] Frame 178
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 205
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 241
this.gotoAndPlay("normal");
Symbol 228 MovieClip [prawnChar] Frame 251
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 9
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 33
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 92
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 221
stop();
Symbol 237 MovieClip [toastChar] Frame 258
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 308
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 337
this.gotoAndPlay("normal");
Symbol 237 MovieClip [toastChar] Frame 347
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 9
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 70
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 152
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 272
stop();
Symbol 244 MovieClip [keithChar] Frame 311
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 344
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 367
this.gotoAndPlay("normal");
Symbol 244 MovieClip [keithChar] Frame 377
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 9
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 34
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 94
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 147
stop();
Symbol 253 MovieClip [siChar] Frame 174
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 237
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 254
this.gotoAndPlay("normal");
Symbol 253 MovieClip [siChar] Frame 264
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 9
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 32
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 94
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 152
stop();
Symbol 260 MovieClip [hitlerChar] Frame 206
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 260
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 295
this.gotoAndPlay("normal");
Symbol 260 MovieClip [hitlerChar] Frame 305
this.gotoAndPlay("normal");
Symbol 271 MovieClip [playBtn] Frame 1
this.onPress = function () {
_root.titleMov.removeMovieClip();
};
Symbol 272 MovieClip [FListItemSymbol] Frame 1
#initclip 13
function FListItemClass() {
this.init();
}
FListItemClass.prototype = new FSelectableItemClass();
Object.registerClass("FListItemSymbol", FListItemClass);
#endinitclip
Symbol 273 MovieClip [DataProviderSymbol] Frame 1
#initclip 6
_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 eventObj = {event:"updateAll"};
viewRef.modelChanged(eventObj);
};
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 eventObj = {event:"addRows", firstRow:index, lastRow:index};
this.updateViews(eventObj);
};
DataProviderClass.prototype.addItem = function (value) {
this.addItemAt(this.getLength(), value);
};
DataProviderClass.prototype.removeItemAt = function (index) {
var tmpItm = this.items[index];
this.items.splice(index, 1);
var eventObj = {event:"deleteRows", firstRow:index, lastRow:index};
this.updateViews(eventObj);
return(tmpItm);
};
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 tmpID = this.getItemID(index);
if (typeof(itemObj) == "object") {
this.items[index] = itemObj;
} else {
this.items[index].label = itemObj;
}
this.items[index].__ID__ = tmpID;
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 i = 0;
while (i < this.views.length) {
this.views[i].modelChanged(eventObj);
i++;
}
};
#endinitclip
Symbol 274 MovieClip [FSelectableItemSymbol] Frame 1
#initclip 10
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 LOWEST_DEPTH = -16384;
this.width = width;
this.layoutContent(width);
this.attachMovie("FHighlightSymbol", "highlight_mc", LOWEST_DEPTH);
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 tmpLabel = "";
if (itmObj.label != undefined) {
tmpLabel = itmObj.label;
} else if (typeof(itmObj) == "object") {
for (var i in itmObj) {
if (i != "__ID__") {
tmpLabel = (itmObj[i] + ", ") + tmpLabel;
}
}
tmpLabel = tmpLabel.substring(0, tmpLabel.length - 2);
} else {
tmpLabel = itmObj;
}
if (this.fLabel_mc.labelField.text != tmpLabel) {
this.fLabel_mc.setLabel(tmpLabel);
}
var clr = (selected ? (this.controller.styleTable.textSelected.value) : (this.controller.styleTable.textColor.value));
if (clr == undefined) {
clr = (selected ? 16777215 : 0);
}
this.fLabel_mc.setColor(clr);
};
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 275 MovieClip [FSelectableListSymbol] Frame 1
#initclip 9
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) || (!this.enable)) {
return(undefined);
}
this.dataProvider.addItemAt(index, {label:label, data:data});
};
FSelectableListClass.prototype.addItem = function (label, data) {
if (!this.enable) {
return(undefined);
}
this.dataProvider.addItem({label:label, data:data});
};
FSelectableListClass.prototype.removeItemAt = function (index) {
this.selectHolder = this.getSelectedIndex();
var item = this.getItemAt(index);
this.dataProvider.removeItemAt(index);
return(item);
};
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 uniqueID in this.selected) {
var tmpInd = this.selected[uniqueID].sIndex;
if (tmpInd != undefined) {
return(tmpInd);
}
}
};
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 item = this.getSelectedItem();
return(((item.data == undefined) ? (item.label) : (item.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 i = 0;
while (i < obj.length) {
var value = ((typeof(obj[i]) == "string") ? ({label:obj[i]}) : (obj[i]));
this.dataProvider.addItem(value);
i++;
}
} 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 limit = Math.min(this.numDisplayed, this.getLength());
var i = 0;
while (i < limit) {
this.container_mc[("fListItem" + i) + "_mc"].setEnabled(this.enable);
i++;
}
if (this.enable) {
this.invalidate("updateControl");
}
};
FSelectableListClass.prototype.updateControl = function () {
var i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].drawItem(this.getItemAt(this.topDisplayed + i), this.isSelected(this.topDisplayed + i));
i++;
}
};
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 i = 0;
while (i < this.numDisplayed) {
this.container_mc.attachMovie(this.itemSymbol, ("fListItem" + i) + "_mc", 10 + i, {controller:this, itemNum:i});
var item_mc = this.container_mc[("fListItem" + i) + "_mc"];
var offset = ((this.scrollOffset == undefined) ? 0 : (this.scrollOffset));
item_mc.setSize(this.width - offset, this.itmHgt);
item_mc._y = (this.itmHgt - 2) * i;
i++;
}
this.updateControl();
};
FSelectableListClass.prototype.modelChanged = function (eventObj) {
var firstRow = eventObj.firstRow;
var lastRow = eventObj.lastRow;
var event = eventObj.event;
if (event == "addRows") {
for (var i in this.selected) {
if ((this.selected[i].sIndex != undefined) && (this.selected[i].sIndex >= firstRow)) {
this.selected[i].sIndex = this.selected[i].sIndex + ((lastRow - firstRow) + 1);
this.setSelectedIndex(this.selected[i].sIndex, false);
}
}
} else if (event == "deleteRows") {
if (firstRow == lastRow) {
var index = firstRow;
if (this.selectHolder == index) {
this.selectionDeleted = true;
}
if (((this.topDisplayed + this.numDisplayed) >= this.getLength()) && (this.topDisplayed > 0)) {
this.topDisplayed--;
if (this.selectionDeleted && ((index - 1) >= 0)) {
this.setSelectedIndex(index - 1, false);
}
} else if (this.selectionDeleted) {
var len = this.getLength();
if (((index == (len - 1)) && (len > 1)) || (index > (len / 2))) {
this.setSelectedIndex(index - 1, false);
} else {
this.setSelectedIndex(index, false);
}
}
for (var i in this.selected) {
if (this.selected[i].sIndex > firstRow) {
this.selected[i].sIndex--;
}
}
} else {
this.clearSelected();
this.topDisplayed = 0;
}
} else if (event == "sort") {
var len = this.getLength();
var i = 0;
while (i < len) {
if (this.isSelected(i)) {
var id = this.dataProvider.getItemID(i);
if (id == this.lastSelID) {
this.lastSelected = i;
}
this.selected[String(id)].sIndex = i;
}
i++;
}
}
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 uniqueID in this.selected) {
var index = this.selected[uniqueID].sIndex;
if (((index != undefined) && (this.topDisplayed <= index)) && (index < (this.topDisplayed + this.numDisplayed))) {
this.container_mc[("fListItem" + (index - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(index), false);
}
}
delete this.selected;
this.selected = new Array();
};
FSelectableListClass.prototype.selectionHandler = function (itemNum) {
var tmpInd = (this.topDisplayed + itemNum);
if (this.getItemAt(tmpInd == undefined)) {
this.changeFlag = false;
return(undefined);
}
this.changeFlag = true;
this.clearSelected();
this.selectItem(tmpInd, true);
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(tmpInd), this.isSelected(tmpInd));
};
FSelectableListClass.prototype.moveSelBy = function (incr) {
var itmNum = this.getSelectedIndex();
var newItm = (itmNum + incr);
newItm = Math.max(0, newItm);
newItm = Math.min(this.getLength() - 1, newItm);
if (newItm == itmNum) {
return(undefined);
}
if ((itmNum < this.topDisplayed) || (itmNum >= (this.topDisplayed + this.numDisplayed))) {
this.setScrollPosition(itmNum);
}
if ((newItm >= (this.topDisplayed + this.numDisplayed)) || (newItm < this.topDisplayed)) {
this.setScrollPosition(this.topDisplayed + incr);
}
this.selectionHandler(newItm - 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 i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].highlight_mc.gotoAndStop("enabled");
i++;
}
};
FSelectableListClass.prototype.myOnKillFocus = function () {
super.myOnKillFocus();
var i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].highlight_mc.gotoAndStop("unfocused");
i++;
}
};
#endinitclip
Instance of Symbol 273 MovieClip [DataProviderSymbol] "dPAsset" in Symbol 275 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Instance of Symbol 274 MovieClip [FSelectableItemSymbol] "ItemAsset" in Symbol 275 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 276 MovieClip [FScrollSelectListSymbol] Frame 1
#initclip 11
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 pos = this.getScrollPosition();
super.setSize(w, h);
if (this.scrollBar_mc != undefined) {
this.removed = true;
}
this.scrollBar_mc = undefined;
this.initScrollBar();
this.setScrollPosition(pos);
};
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 pos = scrollBar.getScrollPosition();
this.topDisplayed = pos;
if (this.lastPosition != pos) {
this.updateControl();
}
this.lastPosition = pos;
};
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 i = 0;
while (i < this.keyCodes.length) {
if (Key.isDown(this.keyCodes[i])) {
this.moveSelBy(this.keyIncrs[i]);
return(undefined);
}
i++;
}
this.findInputText();
}
};
FScrollSelectListClass.prototype.findInputText = function () {
var tmpCode = Key.getAscii();
if ((tmpCode >= 33) && (tmpCode <= 126)) {
this.findString(String.fromCharCode(tmpCode));
}
};
FScrollSelectListClass.prototype.findString = function (str) {
if (this.getLength() == 0) {
return(undefined);
}
var itemNum = this.getSelectedIndex();
var jump = 0;
var i = (itemNum + 1);
while (i != itemNum) {
var itmStr = this.getItemAt(i).label.substring(0, str.length);
if ((str == itmStr) || (str.toUpperCase() == itmStr.toUpperCase())) {
var jump = (i - itemNum);
break;
}
if (i >= (this.getLength() - 1)) {
i = -1;
}
i++;
}
if (jump != 0) {
this.moveSelBy(jump);
}
};
#endinitclip
Instance of Symbol 100 MovieClip [FScrollBarSymbol] "scrollBarAsset" in Symbol 276 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
_targetInstanceName = "";
horizontal = false;
}
onClipEvent (load) {
this._width = (this._height = 1);
}
Instance of Symbol 275 MovieClip [FSelectableListSymbol] "superClassAsset" in Symbol 276 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 279 MovieClip [FBoundingBoxSymbol] Frame 1
var component = _parent;
component.registerSkinElement(boundingBox, "background");
stop();
Symbol 279 MovieClip [FBoundingBoxSymbol] Frame 2
component.registerSkinElement(boundingBox2, "backgroundDisabled");
stop();
Symbol 282 MovieClip [FListBoxSymbol] Frame 1
#initclip 12
function FListBoxClass() {
this.itemSymbol = "FListItemSymbol";
this.init();
this.permaScrollBar = true;
var i = 0;
while (i < this.labels.length) {
this.addItem(this.labels[i], this.data[i]);
i++;
}
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 tmpArray = new Array();
for (var i in this.selected) {
tmpArray.push(this.selected[i].sIndex);
}
return(((tmpArray.length > 0) ? (tmpArray) : undefined));
};
FListBoxClass.prototype.getSelectedItems = function () {
var indices = this.getSelectedIndices();
var tmpArray = new Array();
var i = 0;
while (i < indices.length) {
tmpArray.push(this.getItemAt(indices[i]));
i++;
}
return(((tmpArray.length > 0) ? (tmpArray) : undefined));
};
FListBoxClass.prototype.getSelectMultiple = function () {
return(this.selectMultiple);
};
FListBoxClass.prototype.getRowCount = function () {
return(this.numDisplayed);
};
FListBoxClass.prototype.setSelectedIndices = function (indexArray) {
this.clearSelected();
var i = 0;
while (i < indexArray.length) {
this.selectItem(indexArray[i], true);
i++;
}
this.updateControl();
};
FListBoxClass.prototype.setSelectMultiple = function (flag) {
this.selectMultiple = flag;
};
FListBoxClass.prototype.setRowCount = function (count) {
var hgt = ((count * (this.itmHgt - 2)) + 2);
this.setSize(this.width, hgt);
};
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, 20);
h = Math.max(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 index = (this.topDisplayed + itemNum);
if (this.getItemAt(index) == 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(index, true);
this.lastSelected = index;
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(index), this.isSelected(index));
} else if (Key.isDown(16) && (this.selectMultiple)) {
if (this.lastSelected == -1) {
this.lastSelected = index;
}
var incr = ((this.lastSelected < index) ? 1 : -1);
this.clearSelected();
var i = this.lastSelected;
while (i != index) {
this.selectItem(i, true);
if ((i >= this.topDisplayed) && (i < (this.topDisplayed + this.numDisplayed))) {
this.container_mc[("fListItem" + (i - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(i), this.isSelected(i));
}
i = i + incr;
}
this.selectItem(index, true);
this.container_mc[("fListItem" + (index - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(index), this.isSelected(index));
} else if (key.isDown(17)) {
var selectedFlag = this.isSelected(index);
if (!this.selectMultiple) {
this.clearSelected();
}
if (!((!this.selectMultiple) && (selectedFlag))) {
this.selectItem(index, !selectedFlag);
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(this.topDisplayed + itemNum), this.isSelected(this.topDisplayed + itemNum));
}
this.lastSelected = index;
}
} else {
this.clickFilter = true;
}
};
FListBoxClass.prototype.moveSelBy = function (itemNum) {
super.moveSelBy(itemNum);
this.releaseHandler();
};
#endinitclip
this.deadPreview._visible = false;
Instance of Symbol 276 MovieClip [FScrollSelectListSymbol] "superClassAsset" in Symbol 282 MovieClip [FListBoxSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 441 MovieClip [__Packages.it.gotoandplay.smartfoxserver.SmartFoxClient] Frame 0
class it.gotoandplay.smartfoxserver.SmartFoxClient extends XMLSocket
{
var objRef, os, roomList, buddyList, buddyVars, activeRoomId, myUserId, myUserName, playerId, debug, isConnected, changingRoom, amIModerator, arrayTags, messageHandlers, onConnect, onData, onXML, onClose, onBuddyList, t1, onConnection, onConnectionLost, close;
function SmartFoxClient (objRef) {
super();
this.objRef = objRef;
os = it.gotoandplay.smartfoxserver.ObjectSerializer.getInstance();
roomList = {};
buddyList = [];
buddyVars = [];
activeRoomId = null;
myUserId = null;
myUserName = "";
playerId = null;
debug = false;
isConnected = false;
changingRoom = false;
amIModerator = false;
arrayTags = {userList:true, rmList:true, vars:true, bList:true, vs:true};
messageHandlers = new Object();
onConnect = connectionEstablished;
onData = gotData;
onXML = xmlReceived;
onClose = connectionClosed;
setupMessageHandlers();
}
function getVersion() {
return((((majVersion + ".") + minVersion) + ".") + subVersion);
}
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 action = xmlObj.attributes.action;
var fromRoom = xmlObj.attributes.r;
if (action == "apiOK") {
scope.onConnection(true);
} else if (action == "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 (action == "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 (action == "logKO") {
var errorMsg = xmlObj.login.attributes.e;
scope.onLogin({success:false, name:"", error:errorMsg});
} else if (action == "rmList") {
var roomList = xmlObj.rmList.rmList;
scope.roomList = new Array();
for (var i in roomList) {
var currRoomId = roomList[i].attributes.id;
var serverData = roomList[i].attributes;
var id = serverData.id;
var name = roomList[i].n.value;
var maxUsers = Number(serverData.maxu);
var maxSpect = Number(serverData.maxs);
var isTemp = (serverData.temp ? true : false);
var isGame = (serverData.game ? true : false);
var isPrivate = (serverData.priv ? true : false);
var userCount = Number(serverData.ucnt);
var specCount = Number(serverData.scnt);
var isLimbo = (serverData.lmb ? true : false);
scope.roomList[currRoomId] = new it.gotoandplay.smartfoxserver.Room(id, name, maxUsers, maxSpect, isTemp, isGame, isPrivate);
scope.roomList[currRoomId].userCount = userCount;
scope.roomList[currRoomId].specCount = specCount;
scope.roomList[currRoomId].setIsLimbo(isLimbo);
var roomVars = roomList[i].vars.vars;
var j = 0;
while (j < roomVars.length) {
var vName = roomVars[j].attributes.n;
var vType = roomVars[j].attributes.t;
var vVal = roomVars[j].value;
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
} else if (vType == "x") {
var fn = function (n) {
return(null);
};
}
scope.roomList[currRoomId].variables[vName] = fn(vVal);
j++;
}
}
scope.onRoomListUpdate(scope.roomList);
} else if (action == "joinOK") {
var roomId = xmlObj.userList.attributes.r;
var userList = xmlObj.userList.userList;
var rVars = xmlObj.vars.vars;
scope.activeRoomId = Number(roomId);
var currRoom = scope.roomList[roomId];
currRoom.userList = new Object();
scope.playerId = xmlObj.pid.attributes.id;
currRoom.setMyPlayerId(xmlObj.pid.attributes.id);
currRoom.variables = new Object();
var j = 0;
while (j < rVars.length) {
var vName = rVars[j].attributes.n;
var vType = rVars[j].attributes.t;
var vVal = rVars[j].value;
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
} else if (vType == "x") {
var fn = function (n) {
return(null);
};
}
currRoom.variables[vName] = fn(vVal);
j++;
}
var i = 0;
while (i < userList.length) {
var name = userList[i].attributes.name;
var id = userList[i].attributes.id;
var isMod = userList[i].attributes.mod;
var isSpec = userList[i].attributes.spe;
currRoom.userList[id] = new it.gotoandplay.smartfoxserver.User(id, name);
currRoom.userList[id].isMod = ((isMod == "1") ? true : false);
currRoom.userList[id].isSpec = ((isSpec == "1") ? true : false);
var userVars = userList[i].vars.vars;
currRoom.userList[id].variables = {};
var item = currRoom.userList[id].variables;
var j = 0;
while (j < userVars.length) {
var vName = userVars[j].attributes.n;
var vType = userVars[j].attributes.t;
var vVal = userVars[j].value;
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
} else if (vType == "x") {
var fn = function (n) {
return(null);
};
}
item[vName] = fn(vVal);
j++;
}
i++;
}
scope.changingRoom = false;
scope.onJoinRoom(scope.roomList[roomId]);
} else if (action == "joinKO") {
scope.changingRoom = false;
var error = xmlObj.error.attributes.msg;
scope.onJoinRoomError(error);
} else if (action == "userEnterRoom") {
var usrId = xmlObj.user.attributes.id;
var usrName = xmlObj.user.attributes.name;
var isMod = xmlObj.user.attributes.mod;
var isSpec = xmlObj.user.attributes.spe;
var currRoom = scope.roomList[fromRoom];
currRoom.userList[usrId] = new it.gotoandplay.smartfoxserver.User(usrId, usrName);
currRoom.userList[usrId].isMod = ((isMod == "1") ? true : false);
currRoom.userList[usrId].isSpec = ((isSpec == "1") ? true : false);
currRoom.userCount++;
var userVars = xmlObj.user.vars.vars;
currRoom.userList[usrId].variables = {};
var item = currRoom.userList[usrId].variables;
var j = 0;
while (j < userVars.length) {
var vName = userVars[j].attributes.n;
var vType = userVars[j].attributes.t;
var vVal = userVars[j].value;
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
} else if (vType == "x") {
var fn = function (n) {
return(null);
};
}
item[vName] = fn(vVal);
j++;
}
scope.onUserEnterRoom(fromRoom, currRoom.userList[usrId]);
} else if (action == "userGone") {
var usrId = xmlObj.user.attributes.id;
var currRoom = scope.roomList[fromRoom];
var usrName = currRoom.userList[usrId].name;
delete currRoom.userList[usrId];
currRoom.userCount--;
scope.onUserLeaveRoom(fromRoom, usrId, usrName);
} else if (action == "pubMsg") {
var usrId = xmlObj.user.attributes.id;
var textMsg = xmlObj.txt.value;
textMsg = scope.os.decodeEntities(textMsg.toString());
scope.onPublicMessage(textMsg.toString(), scope.roomList[fromRoom].userList[usrId], fromRoom);
} else if (action == "prvMsg") {
var usrId = xmlObj.user.attributes.id;
var textMsg = xmlObj.txt.value;
textMsg = scope.os.decodeEntities(textMsg);
scope.onPrivateMessage(textMsg.toString(), scope.roomList[fromRoom].userList[usrId]);
} else if (action == "dmnMsg") {
var usrId = xmlObj.user.attributes.id;
var textMsg = xmlObj.txt.value;
textMsg = scope.os.decodeEntities(textMsg);
scope.onAdminMessage(textMsg.toString(), scope.roomList[fromRoom].userList[usrId]);
} else if (action == "dataObj") {
var senderId = xmlObj.user.attributes.id;
var obj = xmlObj.dataObj.value;
var asObj = scope.os.deserialize(obj);
scope.onObjectReceived(asObj, scope.roomList[fromRoom].userList[senderId]);
} else if (action == "uVarsUpdate") {
var usrId = xmlObj.user.attributes.id;
var variables = xmlObj.vars.vars;
var user = scope.roomList[fromRoom].userList[usrId];
if (user.variables == undefined) {
user.variables = {};
}
var j = 0;
while (j < variables.length) {
var vName = variables[j].attributes.n;
var vType = variables[j].attributes.t;
var vVal = variables[j].value;
if (vType == "x") {
delete user.variables[vName];
} else {
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
}
user.variables[vName] = fn(vVal);
}
j++;
}
scope.onUserVariablesUpdate(user);
} else if (action == "rVarsUpdate") {
var variables = xmlObj.vars.vars;
var currRoom = scope.roomList[fromRoom];
var changedVars = [];
if (currRoom.variables == undefined) {
currRoom.variables = new Object();
}
var j = 0;
while (j < variables.length) {
var vName = variables[j].attributes.n;
var vType = variables[j].attributes.t;
var vVal = variables[j].value;
changedVars.push(vName);
changedVars[vName] = true;
if (vType == "x") {
delete currRoom.variables[vName];
} else {
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
}
currRoom.variables[vName] = fn(vVal);
}
j++;
}
scope.onRoomVariablesUpdate(currRoom, changedVars);
} else if (action == "createRmKO") {
var errorMsg = xmlObj.room.attributes.e;
scope.onCreateRoomError(errorMsg);
} else if (action == "uCount") {
var uCount = xmlObj.attributes.u;
var sCount = xmlObj.attributes.s;
var room = scope.roomList[fromRoom];
room.userCount = Number(uCount);
room.specCount = Number(sCount);
scope.onUserCountChange(room);
} else if (action == "roomAdd") {
var xmlRoom = xmlObj.rm.attributes;
var rmId = xmlRoom.id;
var rmName = xmlObj.rm.name.value;
var rmMax = Number(xmlRoom.max);
var rmSpec = Number(xmlRoom.spec);
var isTemp = (xmlRoom.temp ? true : false);
var isGame = (xmlRoom.game ? true : false);
var isPriv = (xmlRoom.priv ? true : false);
var newRoom = (new it.gotoandplay.smartfoxserver.Room(rmId, rmName, rmMax, rmSpec, isTemp, isGame, isPriv));
scope.roomList[rmId] = newRoom;
var variables = xmlObj.rm.vars.vars;
newRoom.variables = new Object();
var j = 0;
while (j < variables.length) {
var vName = variables[j].attributes.n;
var vType = variables[j].attributes.t;
var vVal = variables[j].value;
if (vType == "b") {
var fn = Boolean;
} else if (vType == "n") {
var fn = Number;
} else if (vType == "s") {
var fn = String;
}
newRoom.variables[vName] = fn(vVal);
j++;
}
scope.onRoomAdded(newRoom);
} else if (action == "roomDel") {
var deletedId = xmlObj.rm.attributes.id;
var almostDeleted = scope.roomList[deletedId];
delete scope.roomList[deletedId];
scope.onRoomDeleted(almostDeleted);
} else if (action == "leaveRoom") {
var roomLeft = xmlObj.rm.attributes.id;
scope.onRoomLeft(roomLeft);
} else if (action == "roundTripRes") {
scope.t2 = getTimer();
scope.onRoundTripResponse(scope.t2 - scope.t1);
} else if (action == "swSpec") {
scope.playerId = Number(xmlObj.pid.attributes.id);
scope.onSpectatorSwitched(scope.playerId > 0, scope.playerId, scope.roomList[fromRoom]);
} else if (action == "bList") {
var bList = xmlObj.bList.bList;
if (bList == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var i = 0;
while (i < bList.length) {
var buddy = {};
buddy.isOnline = ((bList[i].attributes.s == "1") ? true : false);
buddy.name = bList[i].n.value;
buddy.id = bList[i].attributes.i;
buddy.variables = {};
var bVars = bList[i].vs.vs;
for (var j in bVars) {
var vN = bVars[j].attributes.n;
var vV = bVars[j].value;
buddy.variables[vN] = vV;
}
scope.buddyList.push(buddy);
i++;
}
scope.onBuddyList(scope.buddyList);
} else if (action == "bUpd") {
var b = xmlObj.b;
if (b == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var buddy = {};
buddy.name = b.n.value;
buddy.id = b.attributes.i;
buddy.isOnline = ((b.attributes.s == "1") ? true : false);
buddy.variables = {};
var bVars = b.vs.vs;
for (var i in bVars) {
var vN = bVars[i].attributes.n;
var vV = bVars[i].value;
buddy.variables[vN] = vV;
}
var i = 0;
while (i < scope.buddyList.length) {
if (scope.buddyList[i].name == buddy.name) {
scope.buddyList[i] = buddy;
break;
}
i++;
}
scope.onBuddyListUpdate(buddy);
} else if (action == "bAdd") {
var b = xmlObj.b;
var buddy = {};
buddy.name = b.n.value;
buddy.id = b.attributes.i;
buddy.isOnline = ((b.attributes.s == "1") ? true : false);
buddy.variables = {};
var bVars = b.vs.vs;
for (var i in bVars) {
var vN = bVars[i].attributes.n;
var vV = bVars[i].value;
buddy.variables[vN] = vV;
}
scope.buddyList.push(buddy);
scope.onBuddyList(scope.buddyList);
} else if (action == "roomB") {
var roomIds = xmlObj.br.attributes.r;
var ids = roomIds.toString().split(",");
for (var i in ids) {
ids[i] = Number(ids[i]);
}
scope.onBuddyRoom(ids);
} else if (action == "rndK") {
var key = xmlObj.k.value;
scope.onRandomKey(key);
}
}
function handleExtensionMessages(xmlObj, scope, type) {
if (type == "xml") {
var action = xmlObj.attributes.action;
var fromRoom = xmlObj.attributes.r;
if (action == "xtRes") {
var obj = xmlObj.value;
var asObj = scope.os.deserialize(obj);
scope.onExtensionResponse(asObj, "xml");
}
} else if (type == "str") {
scope.onExtensionResponse(xmlObj, type);
}
}
function sendXtMessage(xtName, cmdName, paramObj, type, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (type == undefined) {
type = "xml";
}
if (type == "xml") {
var header;
header = {t:"xt"};
var xtReq = {name:xtName, cmd:cmdName, param:paramObj};
var xmlmsg = (("<![CDATA[" + os.serialize(xtReq)) + "]]>");
send(header, "xtReq", roomId, xmlmsg);
} else if (type == "str") {
var hdr;
hdr = ((((("%xt%" + xtName) + "%") + cmdName) + "%") + roomId) + "%";
var i = 0;
while (i < paramObj.length) {
hdr = hdr + (paramObj[i].toString() + "%");
i++;
}
sendString(hdr);
}
}
function dumpObj(obj) {
if (debug) {
trace("------------------------------------------------");
trace("+ Object Dump +");
trace("------------------------------------------------");
trace("Obj TYPE:" + typeof(obj));
for (var i in obj) {
trace((i + " > ") + obj[i]);
}
}
}
function login(zone, nick, pass) {
var header = {t:"sys"};
var message = (((((("<login z='" + zone) + "'><nick><![CDATA[") + nick) + "]]></nick><pword><![CDATA[") + pass) + "]]></pword></login>");
send(header, "login", 0, message);
}
function getRoomList() {
var header = {t:"sys"};
send(header, "getRmList", (activeRoomId ? (activeRoomId) : "-1"), "");
}
function autoJoin() {
var header = {t:"sys"};
send(header, "autoJoin", (activeRoomId ? (activeRoomId) : "-1"), "");
}
function joinRoom(newRoom, pword, isSpectator, dontLeave, oldRoom) {
var newRoomId = null;
var isSpec;
if (isSpectator) {
isSpec = 1;
} else {
isSpec = 0;
}
if (!changingRoom) {
if (typeof(newRoom) == "number") {
newRoomId = newRoom;
} else {
for (var i in roomList) {
if (roomList[i].name == newRoom) {
newRoomId = roomList[i].id;
break;
}
}
}
if (newRoomId != null) {
var header = {t:"sys"};
var leaveCurrRoom = (dontLeave ? "0" : "1");
var roomToLeave;
if (oldRoom) {
roomToLeave = oldRoom;
} else {
roomToLeave = activeRoomId;
}
if (activeRoomId == null) {
leaveCurrRoom = "0";
roomToLeave = -1;
}
var message = (((((((((("<room id='" + newRoomId) + "' pwd='") + pword) + "' spec='") + isSpec) + "' leave='") + leaveCurrRoom) + "' old='") + roomToLeave) + "' />");
send(header, "joinRoom", (activeRoomId ? (activeRoomId) : -1), message);
changingRoom = true;
} else {
trace("SmartFoxError: requested room to join does not exist!");
}
}
}
function sendPublicMessage(msg, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var header = {t:"sys"};
var xmlmsg = (("<txt><![CDATA[" + os.encodeEntities(msg)) + "]]></txt>");
send(header, "pubMsg", roomId, xmlmsg);
}
function sendPrivateMessage(msg, userId, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var header = {t:"sys"};
var xmlmsg = (((("<txt rcp='" + userId) + "'><![CDATA[") + os.encodeEntities(msg)) + "]]></txt>");
send(header, "prvMsg", roomId, xmlmsg);
}
function sendObject(obj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var xmlPacket = (("<![CDATA[" + os.serialize(obj)) + "]]>");
var header = {t:"sys"};
send(header, "asObj", roomId, xmlPacket);
}
function sendObjectToGroup(obj, userList, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _$$_ = "";
for (var i in userList) {
if (!isNaN(userList[i])) {
_$$_ = _$$_ + (userList[i] + ",");
}
}
_$$_ = _$$_.substr(0, _$$_.length - 1);
obj._$$_ = _$$_;
var xmlPacket = (("<![CDATA[" + os.serialize(obj)) + "]]>");
var header = {t:"sys"};
send(header, "asObjG", roomId, xmlPacket);
}
function setUserVariables(varObj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var header = {t:"sys"};
var xmlMsg = "<vars>";
var user = roomList[roomId].userList[myUserId];
for (var vName in varObj) {
var vValue = varObj[vName];
var t = null;
if (typeof(vValue) == "boolean") {
t = "b";
vValue = (vValue ? 1 : 0);
} else if (typeof(vValue) == "number") {
t = "n";
} else if (typeof(vValue) == "string") {
t = "s";
} else if (typeof(vValue) == "null") {
t = "x";
delete user.variables[vName];
}
if (t != null) {
user.variables[vName] = vValue;
xmlMsg = xmlMsg + (((((("<var n='" + vName) + "' t='") + t) + "'><![CDATA[") + vValue) + "]]></var>");
}
}
xmlMsg = xmlMsg + "</vars>";
send(header, "setUvars", roomId, xmlMsg);
}
function setBuddyVariables(varObj) {
var header = {t:"sys"};
var xmlMsg = "<vars>";
for (var vName in varObj) {
var vValue = varObj[vName];
if (buddyVars[vName] != vValue) {
buddyVars[vName] = vValue;
xmlMsg = xmlMsg + (((("<var n='" + vName) + "'><![CDATA[") + vValue) + "]]></var>");
}
}
xmlMsg = xmlMsg + "</vars>";
send(header, "setBvars", -1, xmlMsg);
}
function dumpRoomList() {
for (var j in roomList) {
var room = roomList[j];
trace(newline);
trace("-------------------------------------");
trace(((" > Room: (" + j) + ") - ") + room.getName());
trace("isTemp: " + room.isTemp());
trace("isGame: " + room.isGame());
trace("isPriv: " + room.isPrivate());
trace((("Users: " + room.getUserCount()) + " / ") + room.getMaxUsers());
trace("Variables: ");
for (var i in room.variables) {
trace((("\t" + i) + " = ") + room.getVariable(i));
}
trace("\rUserList: ");
var uList = room.getUserList();
for (var i in uList) {
trace((("\t" + uList[i].getId()) + " > ") + uList[i].getName());
}
}
}
function createRoom(roomObj, rId) {
var roomId = ((rId == undefined) ? (activeRoomId) : (rId));
var header = {t:"sys"};
var updatable = (roomObj.updatable ? 1 : 0);
var isGame = (roomObj.isGame ? 1 : 0);
var exitCurrent = 1;
var maxSpectators = roomObj.maxSpectators;
if (isGame && (roomObj.exitCurrentRoom != undefined)) {
exitCurrent = (roomObj.exitCurrentRoom ? 1 : 0);
}
var xmlMsg = (((((((("<room upd='" + updatable) + "' tmp='1' gam='") + isGame) + "' spec='") + maxSpectators) + "' exit='") + exitCurrent) + "'>");
xmlMsg = xmlMsg + (("<name><![CDATA[" + roomObj.name) + "]]></name>");
xmlMsg = xmlMsg + (("<pwd><![CDATA[" + roomObj.password) + "]]></pwd>");
xmlMsg = xmlMsg + (("<max>" + roomObj.maxUsers) + "</max>");
if (roomObj.uCount != undefined) {
xmlMsg = xmlMsg + (("<uCnt>" + (roomObj.uCount ? "1" : "0")) + "</uCnt>");
}
if (roomObj.extension != undefined) {
xmlMsg = xmlMsg + ("<xt n='" + roomObj.extension.name);
xmlMsg = xmlMsg + (("' s='" + roomObj.extension.script) + "' />");
}
if (roomObj.vars == undefined) {
xmlMsg = xmlMsg + "<vars></vars>";
} else {
xmlMsg = xmlMsg + "<vars>";
for (var i in roomObj.vars) {
xmlMsg = xmlMsg + getXmlRoomVariable(roomObj.vars[i]);
}
xmlMsg = xmlMsg + "</vars>";
}
xmlMsg = xmlMsg + "</room>";
send(header, "createRoom", roomId, xmlMsg);
}
function leaveRoom(roomId) {
var header = {t:"sys"};
var xmlMsg = (("<rm id='" + roomId) + "' />");
send(header, "leaveRoom", roomId, xmlMsg);
}
function getRoom(roomId) {
if (typeof(roomId) == "number") {
return(roomList[roomId]);
}
if (typeof(roomId) == "string") {
for (var i in roomList) {
var r = roomList[i];
if (r.getName() == roomId) {
return(r);
}
}
}
}
function getActiveRoom() {
return(roomList[activeRoomId]);
}
function setRoomVariables(varObj, roomId, setOwnership) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (setOwnership == undefined) {
setOwnership = true;
}
var header = {t:"sys"};
if (setOwnership) {
var xmlMsg = "<vars>";
} else {
var xmlMsg = "<vars so='0'>";
}
var i = 0;
while (i < varObj.length) {
xmlMsg = xmlMsg + getXmlRoomVariable(varObj[i]);
i++;
}
xmlMsg = xmlMsg + "</vars>";
send(header, "setRvars", roomId, xmlMsg);
}
function getXmlRoomVariable(rVar) {
var vName = rVar.name;
var vValue = rVar.val;
var vPrivate = (rVar.priv ? "1" : "0");
var vPersistent = (rVar.persistent ? "1" : "0");
var t = null;
if (typeof(vValue) == "boolean") {
t = "b";
vValue = (vValue ? 1 : 0);
} else if (typeof(vValue) == "number") {
t = "n";
} else if (typeof(vValue) == "string") {
t = "s";
} else if (typeof(vValue) == "null") {
t = "x";
}
if (t != null) {
return(((((((((("<var n='" + vName) + "' t='") + t) + "' pr='") + vPrivate) + "' pe='") + vPersistent) + "'><![CDATA[") + vValue) + "]]></var>");
}
return("");
}
function loadBuddyList() {
var header = {t:"sys"};
send(header, "loadB", -1, "");
}
function addBuddy(buddyName) {
if ((buddyName != myUserName) && (!checkBuddy(buddyName))) {
var id = roomList[activeRoomId].getUserList().getUser(buddyName);
var header = {t:"sys"};
var xmlMsg = (("<n>" + buddyName) + "</n>");
send(header, "addB", -1, xmlMsg);
}
}
function removeBuddy(buddyName) {
for (var i in buddyList) {
if (buddyList[i].name == buddyName) {
delete buddyList[i];
break;
}
}
var header = {t:"sys"};
var xmlMsg = (("<n>" + buddyName) + "</n>");
send(header, "remB", -1, xmlMsg);
onBuddyList(buddyList);
}
function getBuddyRoom(buddy) {
if (buddy.id != -1) {
send({t:"sys", bid:buddy.id}, "roomB", -1, ("<b id='" + buddy.id) + "' />");
}
}
function checkBuddy(name) {
var res = false;
for (var i in buddyList) {
if (buddyList[i].name == name) {
res = true;
break;
}
}
return(res);
}
function clearBuddyList() {
buddyList = [];
send({t:"sys"}, "clearB", -1, "");
onBuddyList(buddyList);
}
function roundTripBench() {
t1 = getTimer();
var header = {t:"sys"};
send(header, "roundTrip", activeRoomId, "");
}
function switchSpectator(roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var header = {t:"sys"};
send(header, "swSpec", roomId, "");
}
function getRandomKey() {
send({t:"sys"}, "rndK", -1, "");
}
function send(header, action, fromRoom, message) {
var xmlMsg = makeHeader(header);
xmlMsg = xmlMsg + ((((((("<body action='" + action) + "' r='") + fromRoom) + "'>") + message) + "</body>") + closeHeader());
if (debug) {
trace(("[Sending]: " + xmlMsg) + newline);
}
super.send(xmlMsg);
}
function sendString(message) {
if (debug) {
trace(("[Sending]: " + message) + newline);
}
super.send(message);
}
function gotData(message) {
if (message.charAt(0) == "%") {
strReceived(message);
} else if (message.charAt(0) == "<") {
onXML(new XML(message));
}
}
function connectionEstablished(ok) {
if (ok) {
var header = {t:"sys"};
var xmlMsg = (((("<ver v='" + majVersion.toString()) + minVersion.toString()) + subVersion.toString()) + "' />");
send(header, "verChk", 0, xmlMsg);
} else {
onConnection(false);
}
}
function connectionClosed() {
onConnectionLost();
}
function connect(serverIp, serverPort) {
super.connect(serverIp, serverPort);
}
function disconnect() {
close();
onConnectionLost();
}
function xmlReceived(message) {
var xmlObj = new Object();
message2Object(message.childNodes, xmlObj);
if (debug) {
trace("[Received]: " + message);
}
var id = xmlObj.msg.attributes.t;
messageHandlers[id].handleMessage(xmlObj.msg.body, this, "xml");
}
function strReceived(message) {
var params = message.substr(1, message.length - 2).split("%");
if (debug) {
trace("[Received - Str]: " + message);
}
var id = params[0];
messageHandlers[id].handleMessage(params.splice(1, params.length - 1), this, "str");
}
function message2Object(xmlNodes, parentObj) {
var i = 0;
var currObj = null;
while (i < xmlNodes.length) {
var node = xmlNodes[i];
var nodeName = node.nodeName;
var nodeValue = node.nodeValue;
if (parentObj instanceof Array) {
currObj = {};
parentObj.push(currObj);
currObj = parentObj[parentObj.length - 1];
} else {
parentObj[nodeName] = new Object();
currObj = parentObj[nodeName];
}
for (var att in node.attributes) {
if (typeof(currObj.attributes) == "undefined") {
currObj.attributes = {};
}
var attVal = node.attributes[att];
if (!isNaN(Number(attVal))) {
attVal = Number(attVal);
}
if (attVal.toLowerCase() == "true") {
attVal = true;
} else if (attVal.toLowerCase() == "false") {
attVal = false;
}
currObj.attributes[att] = attVal;
}
if (arrayTags[nodeName]) {
currObj[nodeName] = [];
var currObj = currObj[nodeName];
}
if (node.hasChildNodes() && (node.firstChild.nodeValue == undefined)) {
var subNodes = node.childNodes;
message2Object(subNodes, currObj);
} else {
var nodeValue = node.firstChild.nodeValue;
if ((!isNaN(nodeValue)) && (node.nodeName != "txt")) {
nodeValue = Number(nodeValue);
}
currObj.value = nodeValue;
}
i++;
}
}
function makeHeader(headerObj) {
var xmlData = "<msg";
for (var item in headerObj) {
xmlData = xmlData + ((((" " + item) + "='") + headerObj[item]) + "'");
}
xmlData = xmlData + ">";
return(xmlData);
}
function closeHeader() {
return("</msg>");
}
var majVersion = 1;
var minVersion = 0;
var subVersion = 2;
}
Symbol 442 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 envelope = {};
envelope.xmlStr = "";
if (debug) {
eof = newline;
}
obj2xml(envelope, obj, 0, "");
return(envelope.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 ot = ((obj instanceof Array) ? "a" : "o");
envelope.xmlStr = envelope.xmlStr + ((((("<obj t='" + ot) + "' o='") + objn) + "'>") + eof);
}
for (var i in obj) {
var t = typeof(obj[i]);
var o = obj[i];
if ((((t == "boolean") || (t == "number")) || (t == "string")) || (t == "null")) {
if (t == "boolean") {
o = Number(o);
} else if (t == "null") {
t = "x";
o = "";
} else if (t == "string") {
o = encodeEntities(o);
}
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev + 1);
}
envelope.xmlStr = envelope.xmlStr + ((((((("<var n='" + i) + "' t='") + t.substr(0, 1)) + "'>") + o) + "</var>") + eof);
} else if (t == "object") {
obj2xml(envelope, o, lev + 1, i);
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 xmlData = new XML(xmlObj);
xmlData.ignoreWhite = true;
var resObj = new Object();
xml2obj(xmlData, resObj);
return(resObj);
}
function xml2obj(xmlNode, currObj) {
var i = 0;
var node = xmlNode.firstChild;
while (node.childNodes[i]) {
if (node.childNodes[i].nodeName == "obj") {
var n = node.childNodes[i].attributes.o;
var ot = node.childNodes[i].attributes.t;
if (ot == "a") {
currObj[n] = [];
} else if (ot == "o") {
currObj[n] = {};
}
xml2obj(new XML(node.childNodes[i]), currObj[n]);
} else {
var n = node.childNodes[i].attributes.n;
var t = node.childNodes[i].attributes.t;
var v = node.childNodes[i].firstChild.nodeValue;
var fn;
if (t == "b") {
fn = function (b) {
return(Boolean(Number(b)));
};
} else if (t == "n") {
fn = Number;
} else if (t == "s") {
fn = String;
} else if (t == "x") {
fn = function (n) {
return(null);
};
}
currObj[n] = fn(v);
}
i++;
}
}
function encodeEntities(st) {
var strbuff = "";
var i = 0;
while (i < st.length) {
var ch = st.charAt(i);
var cod = st.charCodeAt(i);
if (((cod == 9) || (cod == 10)) || (cod == 13)) {
strbuff = strbuff + ch;
} else if ((cod >= 32) && (cod <= 126)) {
if (ascTab[ch] != undefined) {
strbuff = strbuff + ascTab[ch];
} else {
strbuff = strbuff + ch;
}
} else {
strbuff = strbuff + ch;
}
i++;
}
return(strbuff);
}
function decodeEntities(st) {
var strbuff;
var ch;
var ent;
var chi;
var item;
var i = 0;
strbuff = "";
while (i < st.length) {
ch = st.charAt(i);
if (ch == "&") {
ent = ch;
do {
i++;
chi = st.charAt(i);
ent = ent + chi;
} while (chi != ";");
item = ascTabRev[ent];
if (item != undefined) {
strbuff = strbuff + item;
} else {
strbuff = strbuff + String.fromCharCode(getCharCode(ent));
}
} else {
strbuff = strbuff + ch;
}
i++;
}
return(strbuff);
}
function getCharCode(ent) {
var hex = ent.substr(3, ent.length);
hex = hex.substr(0, hex.length - 1);
return(Number("0x" + hex));
}
}
Symbol 443 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 i in userList) {
var u = userList[i];
if (u.getName() == userId) {
return(u);
}
}
}
}
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 444 MovieClip [__Packages.it.gotoandplay.smartfoxserver.User] Frame 0
class it.gotoandplay.smartfoxserver.User
{
var id, name, variables, isSpec, isMod;
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);
}
}
Symbol 301 MovieClip Frame 1
stop();
Symbol 301 MovieClip Frame 2
stop();
Symbol 302 MovieClip [tank] Frame 1
stop();
stop();
Symbol 302 MovieClip [tank] Frame 2
stop();
Symbol 302 MovieClip [tank] Frame 3
stop();
Symbol 310 MovieClip [texture] Frame 1
stop();
Symbol 310 MovieClip [texture] Frame 2
stop();
Symbol 313 Button
on (release) {
stopAllSounds();
gotoAndPlay (2);
}
Symbol 316 MovieClip Frame 1
stop();
Symbol 316 MovieClip Frame 11
stop();
Symbol 322 MovieClip [arrows] Frame 1
stop();
Symbol 322 MovieClip [arrows] Frame 2
stop();
Symbol 324 MovieClip [gravarrow] Frame 1
stop();
Symbol 332 MovieClip [smoke] Frame 18
removeMovieClip(this);
Symbol 357 MovieClip [texp] Frame 34
removeMovieClip(this);
Symbol 363 Button
on (release) {
closeMe();
}
Symbol 364 MovieClip [errorWindow] Frame 1
function closeMe() {
_parent._parent.hideWindow(this._name);
}
Selection.setFocus("roomName");
Symbol 369 Button
on (release) {
restart();
}
Symbol 370 MovieClip [gameEnd] Frame 1
function closeMe() {
_parent._parent.hideWindow(this._name);
}
function restart() {
_parent._parent.smartfox.sendObject({type:"restart"});
_parent._parent.restartGame();
}
Selection.setFocus("roomName");
Symbol 373 Button
on (release) {
closeMe();
}
Symbol 374 MovieClip [gameMessage] Frame 1
function closeMe() {
_parent._parent.leaveGameRoom();
_parent._parent.hideWindow(this._name);
}
Symbol 383 Button
on (release) {
create();
}
Symbol 384 MovieClip [newGameWindow] Frame 1
function closeMe() {
_parent._parent.hideWindow(this._name);
}
function create() {
if (roomName.text != "") {
rName = roomName.text;
rPwd = pword.text;
roomName.text = "";
pword.text = "";
_parent._parent.createRoom(rName, rPwd);
}
}
Selection.setFocus("roomName");
Symbol 388 Button
on (release) {
login();
}
Symbol 389 MovieClip [passwordWindow] Frame 1
function closeMe() {
_parent._parent.hideWindow(this._name);
}
function login() {
var p = pword.text;
if (p.length > 0) {
pword.text = "";
_parent._parent.loginProtectedRoom(p);
}
}
Selection.setFocus("roomName");
Symbol 391 Button
on (release) {
sendMessage();
}
Symbol 394 MovieClip [pmWindow] Frame 1
function closeMe() {
_parent._parent.hideWindow(this._name);
}
function sendMessage() {
var m = message.text;
if (m.length > 0) {
_parent._parent.sendPrivateMessage(m, _global.pmUid);
message.text = "";
}
}
Selection.setFocus("message");
Symbol 398 Button
on (release) {
_parent.setMenu();
_parent.closeConnection();
removeMovieClip(this);
}
Symbol 415 Button
on (release) {
if (!_global.isBusy) {
_parent.makeNewRoom();
}
}
Symbol 416 MovieClip [lobby] Frame 1
stop();
Symbol 416 MovieClip [lobby] Frame 8
_parent.open_chat();
roomList_lb.setChangeHandler("changeRoom", _parent);
userList_lb.setChangeHandler("userSelected", _parent);
stop();
Instance of Symbol 100 MovieClip [FScrollBarSymbol] "main_sb" in Symbol 416 MovieClip [lobby] Frame 8
//component parameters
onClipEvent (initialize) {
_targetInstanceName = "chat_txt";
horizontal = false;
}
Instance of Symbol 282 MovieClip [FListBoxSymbol] "userList_lb" in Symbol 416 MovieClip [lobby] Frame 8
//component parameters
onClipEvent (initialize) {
selectMultiple = false;
changeHandler = "";
}
Instance of Symbol 282 MovieClip [FListBoxSymbol] "roomList_lb" in Symbol 416 MovieClip [lobby] Frame 8
//component parameters
onClipEvent (initialize) {
selectMultiple = false;
changeHandler = "";
}
Instance of Symbol 334 MovieClip [target] "pointshow" in Symbol 418 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(1337);
}
Symbol 434 MovieClip Frame 1
stop();
Symbol 434 MovieClip Frame 2
stop();
notHit = true;
_root.currentChoosing = 1;
_root.enteringName = true;
this.onEnterFrame = function () {
_root.currentChoosing = 1;
if ((Key.isDown(9) or Key.isDown(13)) and notHit) {
trace("Enter");
_parent.p1name = p1name;
_root.enteringName = false;
notHit = false;
if (!_parent.targetMode) {
if (_parent.numHumans == 1) {
_parent.set1player();
} else {
nextFrame();
}
} else {
_parent.setTarget();
}
}
};
Symbol 434 MovieClip Frame 3
stop();
notHit = true;
delaycount = 10;
_root.currentChoosing = 2;
_root.enteringName = true;
_root.attachMovie("charSelect", "charSel1", 2042);
this.onEnterFrame = function () {
_root.currentChoosing = 2;
delaycount = delaycount - 1;
if (((Key.isDown(9) or Key.isDown(13)) and notHit) and (delaycount < 0)) {
_parent.p2name = p2name;
_root.enteringName = false;
_parent.set2player();
notHit = false;
}
};
Symbol 434 MovieClip Frame 4
stop();