Frame 1
function SaveStateMoveLocation(saveName, oldLocation, newLocation) {
var _local2 = SharedObject.getLocal(saveName);
if ((_local2 == null) || (!_local2.data.d)) {
return(false);
}
var _local3 = SharedObject.getLocal(saveName, newLocation);
if (_local3 == null) {
return(false);
}
_local3.data.d = new Array();
var _local1 = 0;
while (_local1 < _local2.data.d.length) {
_local3.data.d.push(_local2.data.d[_local1]);
_local1++;
}
for (var obj in _local2.data.d) {
delete _local2.data.d[obj];
}
delete _local2.data.d;
return(true);
}
function ValidateEmailAddress(emailAddr) {
var _local1 = emailAddr;
if (_local1.length < 9) {
return(false);
}
charA = _local1.indexOf("@");
if (charA == -1) {
return(false);
}
if (charA < 2) {
return(false);
}
charP = _local1.lastIndexOf(".");
if (charP == -1) {
return(false);
}
if ((charP != (_local1.length - 3)) && (charP != (_local1.length - 4))) {
return(false);
}
if (Math.abs(charP - charA) < 2) {
return(false);
}
return(true);
}
stop();
trackObj = new ViralTracker2(6, "http://stats.fishinabottle.com/scripts/stats2/get_viral_tracking.php", "");
trackObj.beginTracking(this.getBytesTotal());
SaveState = function (labelList, dataSource, localPath) {
var _local1 = this;
_local1.dataLabels = labelList;
_local1.fileName = dataSource;
_local1.filePath = localPath;
var _local2 = SharedObject.getLocal(_local1.fileName, _local1.filePath);
if (_local2.data.d == null) {
_local2.data.d = new Array();
}
};
SaveState.prototype.findLabel = function (labelName) {
var _local2 = this;
var _local3 = labelName;
var _local1 = 0;
while (_local1 < _local2.dataLabels.length) {
if (_local2.dataLabels[_local1] == _local3) {
return(_local1);
}
_local1++;
}
return(-1);
};
SaveState.prototype.getValue = function (labelName) {
var _local2 = this;
var _local1 = _local2.findLabel(labelName);
if (_local1 == -1) {
return(null);
}
var _local3 = SharedObject.getLocal(_local2.fileName, _local2.filePath);
return(_local3.data.d[_local1]);
};
SaveState.prototype.setValue = function (labelName, value) {
var _local2 = this;
var _local3 = _local2.findLabel(labelName);
var _local1 = SharedObject.getLocal(_local2.fileName, _local2.filePath);
_local1.data.d[_local3] = value;
_local1.flush();
};
SaveState.prototype.dump = function () {
var _local2 = this;
var dumpSO = SharedObject.getLocal(_local2.fileName, _local2.filePath);
trace("===============================");
trace(" ");
trace("Dumping contents of the saved state:");
trace(" ");
trace("Data label Value");
trace("---------- -----");
var _local3 = "";
var _local1 = 0;
while (_local1 < _local2.dataLabels.length) {
_local3 = (_local2.dataLabels[_local1] + " ") + dumpSO.data.d[_local1];
trace(_local3);
_local1++;
}
trace(" ");
trace("Data label items total count = " + _local2.dataLabels.length);
trace("Local data items total count = " + dumpSO.data.d.length);
trace(("Total size of SharedObject = " + dumpSO.getSize()) + " bytes");
trace(" ");
trace("Saved state dump done.");
trace("===============================");
trace(" ");
};
Stage.scaleMode = "noScale";
Stage.showMenu = false;
var nameEntry = "";
_global.sfxUI = new Sound();
restoreVolume = _global.sfxUI.getVolume();
onEnterFrame = function () {
var _local1 = (getBytesLoaded() / getBytesTotal()) * 100;
if (isNaN(_local1)) {
_local1 = 0;
}
LoadingBarInst._xscale = _local1;
if ((getBytesTotal() > 0) && (getBytesLoaded() >= getBytesTotal())) {
delete onEnterFrame;
gotoAndPlay ("Title");
}
};
Frame 20
function AudioMute(state) {
if (state) {
_global.sfxUI.setVolume(0);
} else {
_global.sfxUI.setVolume(restoreVolume);
}
}
stop();
hiScoresInst1.configure("http://service.fishinabottle.com/hiscores2/hiscores_general.php", 3, this, 15907383);
hiScoresInst2.configure("http://service.fishinabottle.com/hiscores2/hiscores_general.php", 4, this, 15907383);
hiScoresInst3.configure("http://service.fishinabottle.com/hiscores2/hiscores_general.php", 5, this, 15907383);
var currScoreTable = 1;
stopAllSounds();
musicFade = 0;
soundHolderInst.sfxTitleLoop.setVolume(musicFade);
soundHolderInst.sfxTitleLoop.start(0, 9999);
levelID = 0;
var scoreMode = "view";
instructionsBoxInst._visible = false;
titleInstructInst.onRelease = function () {
_global.sfxUI.start();
instructionsBoxInst._visible = true;
titlePlayInst.enabled = false;
titleHiscoreInst.enabled = false;
titleInstructInst.enabled = false;
titleSendToFriendInst.enabled = false;
};
instructionsBoxInst.instructCloseInst.onRelease = function () {
_global.sfxUI.start();
instructionsBoxInst._visible = false;
titlePlayInst.enabled = true;
titleHiscoreInst.enabled = true;
titleInstructInst.enabled = true;
titleSendToFriendInst.enabled = true;
};
titlePlayInst.onRelease = function () {
_global.sfxUI.start();
gotoAndPlay ("LevelSelect");
};
titleHiscoreInst.onRelease = function () {
_global.sfxUI.start();
currScoreTable = 1;
gotoAndPlay ("ViewHiscores");
};
titleSendToFriendInst.onRelease = function () {
_global.sfxUI.start();
gotoAndPlay ("SendToFriend");
};
onEnterFrame = function () {
if (soundHolderInst.sfxTitleLoop.getVolume() < 100) {
musicFade = musicFade + 2;
soundHolderInst.sfxTitleLoop.setVolume(musicFade);
}
};
Frame 30
stop();
levelsAvailable = 3;
levelID = 0;
levelSelectInst.gotoAndPlay(1);
lockedBox._visible = false;
lockedOverlay._visible = false;
levelFilenames = ["http://www.fishinabottle.com/uploads/maps/level1.xml", "http://www.fishinabottle.com/uploads/maps/level2.xml", "http://www.fishinabottle.com/uploads/maps/level3.xml"];
levelselectNextInst.onRelease = function () {
_global.sfxUI.start();
if (levelSelectInst._currentframe != levelSelectInst._totalframes) {
levelSelectInst.nextFrame();
} else {
levelSelectInst.gotoAndPlay(1);
}
if (levelSelectInst._currentframe > levelsAvailable) {
lockedOverlay._visible = true;
} else {
lockedOverlay._visible = false;
}
};
levelselectPrevInst.onRelease = function () {
_global.sfxUI.start();
if (levelSelectInst._currentframe != 1) {
levelSelectInst.prevFrame();
} else {
levelSelectInst.gotoAndPlay(levelSelectInst._totalframes);
}
if (levelSelectInst._currentframe > levelsAvailable) {
lockedOverlay._visible = true;
} else {
lockedOverlay._visible = false;
}
};
levelselectPlayInst.onRelease = function () {
_global.sfxUI.start();
if (levelSelectInst._currentframe > levelsAvailable) {
lockedBox._visible = true;
levelselectPlayInst.enabled = false;
levelselectBackInst.enabled = false;
} else {
soundHolderInst.sfxTitleLoop.stop();
levelID = levelSelectInst._currentframe;
currScoreTable = levelID;
levelToLoad = levelFilenames[levelID - 1];
trackObj.continueTracking("PL");
gotoAndPlay ("GameRunning");
}
};
levelselectBackInst.onRelease = function () {
_global.sfxUI.start();
soundHolderInst.sfxTitleLoop.stop();
gotoAndPlay ("Title");
};
Frame 40
function levelIsComplete(time, coins, score, abort) {
levelTime = int(80 - time);
levelCoins = coins;
gotoAndPlay ("LevelComplete");
}
stop();
_quality = "LOW";
musicFade = 0;
soundHolderInst.sfxGameLoop.setVolume(musicFade);
soundHolderInst.sfxGameLoop.start(0, 9999);
levelTime = 0;
levelCoins = 0;
levelScore = 0;
if ((levelID % 2) == 0) {
GameManInst.setBackground(2);
} else {
GameManInst.setBackground(1);
}
GameManInst.setNotifyCallback(levelIsComplete);
GameManInst.setKeys(37, 39, 40, 32);
GameManInst.loadLevel(levelToLoad);
GameManInst.stop();
var ticks = 0;
var fStart = getTimer();
onEnterFrame = function () {
if (soundHolderInst.sfxGameLoop.getVolume() < 100) {
musicFade = musicFade + 2;
soundHolderInst.sfxGameLoop.setVolume(musicFade);
}
};
Frame 50
stop();
_quality = "HIGH";
soundHolderInst.sfxGameLoop.stop();
musicFade = 0;
soundHolderInst.sfxTitleLoop.setVolume(musicFade);
soundHolderInst.sfxTitleLoop.start(0, 9999);
levelScore = int((levelCoins + levelTime) * 100);
if (levelScore < 0) {
levelScore = 0;
}
completeCoins.text = levelCoins * 100;
completeTime.text = levelTime * 100;
completeScore.text = levelScore;
completePlayAgainInst.onRelease = function () {
_global.sfxUI.start();
gotoAndPlay ("GameRunning");
};
completeDiffLevelInst.onRelease = function () {
_global.sfxUI.start();
gotoAndPlay ("LevelSelect");
};
completeEnterNameInst.onRelease = function () {
_global.sfxUI.start();
scoreMode = "enter";
gotoAndPlay ("ViewHiscores");
};
onEnterFrame = function () {
if (soundHolderInst.sfxTitleLoop.getVolume() < 100) {
musicFade = musicFade + 2;
soundHolderInst.sfxTitleLoop.setVolume(musicFade);
}
};
Frame 60
function showButtons() {
hiscoresPrevInst._visible = true;
hiscoresNextInst._visible = true;
}
function setLevel(level) {
hiscoresPrevInst._visible = true;
hiscoresNextInst._visible = true;
hiScoresInst1._visible = false;
hiScoresInst2._visible = false;
hiScoresInst3._visible = false;
switch (level) {
case 1 :
hiScoresInst1.justView();
hiScoresInst1.theTitle.text = "LEVEL 01";
return;
case 2 :
hiScoresInst2.justView();
hiScoresInst2.theTitle.text = "LEVEL 02";
return;
case 3 :
hiScoresInst3.justView();
hiScoresInst3.theTitle.text = "LEVEL 03";
}
}
function closeHiScores() {
gotoAndPlay ("Title");
}
stop();
if (scoreMode == "enter") {
hiscoresPrevInst._visible = false;
hiscoresNextInst._visible = false;
switch (currScoreTable) {
case 1 :
hiScoresInst1.submit(levelScore, showButtons, cancel);
hiScoresInst1.theTitle.text = "LEVEL 01";
break;
case 2 :
hiScoresInst2.submit(levelScore, showButtons, cancel);
hiScoresInst2.theTitle.text = "LEVEL 02";
break;
case 3 :
hiScoresInst3.submit(levelScore, showButtons, cancel);
hiScoresInst3.theTitle.text = "LEVEL 03";
}
} else {
setLevel(currScoreTable);
}
hiscoresPrevInst.onRelease = function () {
currScoreTable--;
if (currScoreTable < 1) {
currScoreTable = 3;
}
setLevel(currScoreTable);
};
hiscoresNextInst.onRelease = function () {
currScoreTable++;
if (currScoreTable > 3) {
currScoreTable = 1;
}
setLevel(currScoreTable);
};
hiScoresInst1.onHide = closeHiScores;
hiScoresInst2.onHide = closeHiScores;
hiScoresInst3.onHide = closeHiScores;
Frame 70
stop();
back._visible = true;
back.enabled = true;
back.onRelease = function () {
gotoAndPlay ("Title");
};
Symbol 20 MovieClip Frame 20
gotoAndPlay (2);
Symbol 48 MovieClip Frame 1
stop();
Symbol 51 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 1
stop();
Symbol 60 MovieClip Frame 1
stop();
Symbol 159 MovieClip Frame 1
gotoAndStop ("blank");
Symbol 208 MovieClip [highScoresSymbol] Frame 1
#initclip 3
Object.registerClass("highScoresSymbol", HighScores2);
#endinitclip
stop();
Symbol 650 MovieClip [__Packages.ViralTracker2] Frame 0
class ViralTracker2
{
var trackerAddress;
function ViralTracker2 (viralID, address, referer) {
var _local1 = this;
var _local3 = new Date();
var _local2 = new LoadVars();
_local1.dat = new LoadVars();
_local1.dat.fiab_viral_id = viralID;
_local2.fiab_initial_ping = "true";
_local2.fiab_viral_id = viralID;
_local1.trackerAddress = address;
_local1.referer = referer;
_local1.first_ping = _local3.getTime();
_local1.sendVars(_local2);
}
function continueTracking(activity) {
var _local1 = this;
var myDate;
_local1.dat.fiab_action = activity;
_local1.sendVars(_local1.dat);
delete _local1.dat.fiab_action;
}
function beginTracking(appSize) {
var _local1 = this;
var _local3 = appSize;
_local1.dat.fiab_start_tracking = "true";
var timeInSeconds;
var myDate = new Date();
_local1.second_ping = myDate.getTime();
timeInSeconds = (_local1.second_ping - _local1.first_ping) / 1000;
_local3 = _local3 / 1024;
_local1.dat.dl_speed = Math.round(_local3 / timeInSeconds);
if (_local1.dat.dl_speed == Infinity) {
_local1.dat.dl_speed = 0;
}
_local1.dat.language = System.capabilities.language;
_local1.dat.os = System.capabilities.os;
_local1.dat.screenx = System.capabilities.screenResolutionX;
_local1.dat.screeny = System.capabilities.screenResolutionY;
_local1.dat.player = getVersion();
if (Camera.get() == null) {
_local1.dat.camera = 0;
} else {
_local1.dat.camera = 1;
}
if (Microphone.get() == null) {
_local1.dat.mic = 0;
} else {
_local1.dat.mic = 1;
}
_local1.dat.fiab_referer = _local1.referer;
var _local2 = _url;
if (_local2.substr(0, 5) == "file:") {
_local1.dat.fiab_host = "LOCAL";
} else if (_local2.substr(0, 7) == "http://") {
_local1.dat.fiab_host = _local2.substr(7, _local2.indexOf("/", 7) - 7);
} else if (_local2.substr(0, 8) == "https://") {
_local1.dat.fiab_host = _local2.substr(8, _local2.indexOf("/", 8) - 8);
} else {
_local1.dat.fiab_host = _url;
}
_local1.sendVars(_local1.dat);
delete _local1.dat.language;
delete _local1.dat.os;
delete _local1.dat.screenx;
delete _local1.dat.screeny;
delete _local1.dat.player;
delete _local1.dat.fiab_start_tracking;
delete _local1.dat.camera;
delete _local1.dat.mic;
delete _local1.dat.fiab_referer;
delete _local1.dat.fiab_host;
delete _local1.dat.dl_speed;
}
function trackFrameRate(frameRate) {
var _local1 = this;
_local1.dat.framerate = frameRate;
_local1.sendVars(_local1.dat);
delete _local1.dat.framerate;
}
function sendVars(senderObj) {
var _local2 = senderObj;
trace("SENDING VARS: ");
var _local1;
var _local3 = new Date();
for (_local1 in _local2) {
trace((_local1 + " : ") + _local2[_local1]);
}
_local2.rnd = _local3.getTime();
trace(trackerAddress);
_local2.sendAndLoad(trackerAddress, _local2, "GET");
trace(newline);
delete _local2.rnd;
}
}
Symbol 651 MovieClip [__Packages.HighScores2] Frame 0
class HighScores2 extends MovieClip
{
var loadingMovie, _visible, onHide, countryCodeArray;
function HighScores2 () {
var _local1 = this;
super();
_local1.attemptCounter = new Number(0);
_local1.configured = new Boolean(false);
_local1.canConnect = new Boolean(true);
_local1.score_runner = new LoadVars();
_local1.onEnterFrame = _local1.loadLoop;
_local1.activityList = new Array();
_local1._visible = false;
_local1.confirm._visible = false;
_local1.countryCodeArray = new Array("AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "AX", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BA", "BW", "BR", "IO", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "KY", "CF", "CL", "CN", "CO", "CD", "CK", "CR", "HR", "CU", "CY", "CZ", "DK", "DJ", "DO", "EC", "EG", "SV", "ER", "EE", "ET", "EU", "FO", "FJ", "FI", "FR", "GF", "PF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GW", "GY", "HT", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KI", "KR", "KW", "KG", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT", "MR", "MU", "MX", "FM", "MD", "MC", "MN", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "AN", "NC", "NZ", "NI", "NE", "NG", "NU", "AP", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PL", "PT", "PR", "QA", "ZZ", "RO", "RU", "RW", "KN", "LC", "WS", "SM", "SA", "SN", "RS", "CS", "SC", "SL", "SG", "SK", "SI", "SB", "ZA", "ES", "LK", "SD", "SR", "SZ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TG", "TO", "TT", "TN", "TR", "TM", "TV", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "YE", "ZM", "ZW", "00");
_local1.leagueNamesSoFar = new Number();
_local1.leagueNameHolder = new Object();
}
function showSpan() {
var _local2 = this;
var _local1;
var spanArray = new Array("ALL", "MONTH", "WEEK", "DAY", "LEAGUE");
var spanID = _local2.returnArrayIndex(_local2.currentSpan, spanArray);
var _local3 = new Array(_local2.allMovie, _local2.monthMovie, _local2.weekMovie, _local2.todayMovie, _local2.leagueMovie);
trace("DEACTIVEATEING BUTTONS");
_local1 = 0;
while (_local1 < _local3.length) {
trace(_local3[_local1]);
_local3[_local1].gotoAndStop("dormant");
_local1++;
}
trace(spanID);
_local3[spanID].gotoAndStop("active");
_local2.allButton = _local2.allMovie.allButton;
_local2.monthButton = _local2.monthMovie.monthButton;
_local2.weekButton = _local2.weekMovie.weekButton;
_local2.todayButton = _local2.todayMovie.todayButton;
_local2.leagueButton = _local2.leagueMovie.leagueButton;
if (_local2.currentSpan == "LEAGUE") {
if ((_local2.leagueNameString == undefined) || (_local2.leagueNameString == "")) {
} else {
_local2.theTitle.text = _local2.leagueNameString.toUpperCase();
}
}
}
function configure(theHost, theID, theRoot, highLight) {
var _local1 = this;
var _local2 = highLight;
var _local3 = theHost;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("CONFIGURE", _local3, theID, theRoot, _local2));
} else {
_local1.currentActivity = Array("CONFIGURE", _local3, theID, theRoot, _local2);
_local1.canConnect = false;
var myDate = new Date();
var self = _local1;
_local1.theRoot = theRoot;
_local1.checkForLeagues();
_local1.serviceURL = _local3;
_local1.viralID = theID;
if (_local2 == undefined) {
_local1.highLightColor = 16711680 /* 0xFF0000 */;
} else {
_local1.highLightColor = _local2;
}
_local1.quitButton.onRelease = function () {
self.hideScores();
self.onHide();
};
_local1.score_runner.fiab_viral_id = _local1.viralID;
_local1.score_runner.rnd = myDate.getTime();
_local1.score_runner.fiab_score_action = "CONFIGURE";
_local1.score_runner.league_id = _local1.league;
_local1.score_runner.fiab_league_player = _local1.league_player;
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
if (success) {
trace("CONFIGURED SUCCESS");
if (_local1.errmsg != undefined) {
self.handleError(_local1.errmsg);
} else {
if (_local1.fiab_league_player == 0) {
self.league_player = 0;
}
if (_local1.league_id == 0) {
self.league_id = 0;
}
self.leagueNameString = _local1.league_name;
self.attemptCounter = 0;
if (_local1.leaguesOn == "true") {
self.leaguesOn = true;
} else {
self.leaguesOn = false;
}
if (_local1.global_scores == "true") {
self.globalScoresOn = true;
} else {
self.globalScoresOn = false;
}
if (_local1.scoresAsTime == "false") {
self.scoresAsTime = false;
} else {
self.scoresAsTime = true;
}
self.maxScore = Number(_local1.max_score);
self.minScore = Number(_local1.min_score);
self.scoresPerPage = Number(_local1.scoresPerPage);
self.viralName = _local1.game_name;
self.defaultSpan = _local1.default_span;
self.currentSpan = _local1.default_span;
if (((((self.league != 0) && (self.league != undefined)) && (self.league_player != 0)) && (self.league_player != undefined)) && (self.leaguesOn == true)) {
self.currentSpan = "LEAGUE";
}
if (_local1.player_name != undefined) {
self.player_name = _local1.player_name;
}
self.configured = true;
}
} else {
trace("ERROR CONFIGURING " + self.attemptCounter);
self.handleError("FAILED");
}
self.canConnect = true;
delete _local1.rnd;
delete _local1.fiab_score_action;
delete _local1.errmsg;
delete _local1.default_span;
delete _local1.leaguesOn;
delete _local1.global_scores;
delete _local1.max_score;
delete _local1.min_score;
delete _local1.game_name;
delete _local1.scoresAsTime;
delete _local1.scoresPerPage;
delete _local1.league_id;
delete _local1.fiab_league_player;
delete _local1.player_name;
delete _local1.league_name;
};
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
}
}
function loadLoop() {
var _local1 = this;
if (_local1.canConnect == false) {
} else if (_local1.activityList.length < 1) {
} else {
_local1.currentActivity = _local1.activityList.shift();
trace("ACTIVITY : " + _local1.currentActivity);
switch (_local1.currentActivity[0]) {
case "RANK" :
_local1.returnRank(_local1.currentActivity[1]);
return;
case "SUBMIT" :
_local1.submitScore(_local1.currentActivity[1], _local1.currentActivity[2], _local1.currentActivity[3], _local1.currentActivity[4]);
return;
case "CONFIGURE" :
_local1.configure(_local1.currentActivity[1], _local1.currentActivity[2], _local1.currentActivity[3], _local1.currentActivity[4]);
return;
case "GET SCORES" :
_local1.get_scores();
return;
case "START_LEAGUE" :
_local1.submitLeagueStart();
return;
case "LEAVE_LEAGUE" :
_local1.leaveForEver();
}
}
}
function submitScore(myName, myScore, onSuccess, isGlobal) {
var _local1 = this;
var _local2 = myScore;
var _local3 = isGlobal;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("SUBMIT", myName, _local2, onSuccess, _local3));
} else {
_local1.currentActivity = Array("SUBMIT", myName, _local2, onSuccess, _local3);
_local1.canConnect = false;
trace("SUBMITING SCORE : " + _local1.serviceURL);
var i;
var myDate = new Date();
var self = _local1;
_local1.score_runner.scorerName = myName;
_local1.score_runner.score = _local2;
_local1.score_runner.score_id = _local1.score_id;
_local1.score_runner.fiab_score_action = "SUBMIT";
_local1.score_runner.league_id = _local1.league;
_local1.score_runner.league_player = _local1.league_player;
_local1.score_runner.rnd = myDate.getTime();
_local1.score_runner.globalScore = _local3;
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
if (success) {
trace("SUBMIT SUCCESS");
if (_local1.errmsg == undefined) {
self.attemptCounter = 0;
if (_local1.globalScore == 0) {
trace("WAS NOT A GLOBAL SCORE");
self.gotoAndStop("submited");
self.populateSubmited();
} else {
trace("WAS A GLOBAL SCORE");
self.score_id = _local1.score_id;
}
self.player_name = _local1.player_name;
} else if (_local1.errmsg != undefined) {
self.handleError(_local1.errmsg);
}
} else {
trace("SUBMIT ERROR" + self.attemptCounter);
self.handleError("FAILED");
}
delete _local1.scorerName;
delete _local1.score;
delete _local1.rnd;
delete _local1.fiab_score_action;
delete _local1.errmsg;
delete _local1.league_id;
delete _local1.league_player;
delete _local1.globalScore;
delete _local1.more_available;
delete _local1.currentSpan;
delete _local1.score_id;
delete _local1.globalScore;
delete _local1.player_name;
self.canConnect = true;
};
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
if (_local1.score_runner.globalScore == 0) {
_local1.doLoading();
}
}
}
function populateSubmited() {
var _local1 = this;
var _local2;
var self = _local1;
var _local3;
_local1.currentFirstPos = Number(_local1.score_runner.first_pos);
_local1.confirm._visible = false;
_local1.showSpan();
_local2 = 0;
while (_local2 < _local1.scoresPerPage) {
if (((_local1.score_runner["score" + _local2] == "NONE") && (_local1.score_runner["name" + _local2] == "NONE")) && ((_local1.score_runner["location" + _local2] = "NONE"))) {
_local1["score" + _local2]._visible = false;
_local1["flag" + _local2]._visible = false;
_local1["name" + _local2]._visible = false;
_local1["rank" + _local2]._visible = false;
} else {
_local1["score" + _local2]._visible = true;
_local1["flag" + _local2]._visible = true;
_local1["name" + _local2]._visible = true;
_local1["rank" + _local2]._visible = true;
_local1["score" + _local2].text = _local1.score_runner["score" + _local2];
if (_local1.scoresAsTime == true) {
_local1["score" + _local2].text = _local1.secondsToString(Number(_local1["score" + _local2].text));
} else {
_local1["score" + _local2].text = _local1.addCommas(_local1["score" + _local2].text);
}
_local1.upDateFlag(_local1["flag" + _local2], _local1.score_runner["location" + _local2]);
_local1["name" + _local2].text = _local1.score_runner["name" + _local2];
_local1["rank" + _local2].text = Number(Number(_local1.score_runner.first_pos) + Number(_local2));
if (_local1.score_runner["highlight" + _local2] == "YES") {
trace("WE HAVE SCORE");
_local3 = new TextFormat();
_local3.color = _local1.highLightColor;
_local1["score" + _local2].setTextFormat(_local3);
_local1["name" + _local2].setTextFormat(_local3);
_local1["rank" + _local2].setTextFormat(_local3);
}
}
_local2++;
}
if (_local1.score_runner.first_pos > 1) {
_local1.previousButton._visible = true;
_local1.previousButton.onRelease = function () {
trace("PREVIOUS PRESSED");
self.currentFirstPos = self.currentFirstPos - self.scoresPerPage;
self.get_scores();
};
} else {
_local1.previousButton._visible = false;
_local1.previousButton.onRelease = null;
}
trace("MORE SCORES : " + _local1.score_runner.more_available);
trace("SPAN : " + _local1.score_runner.currentSpan);
_local1.currentSpan = _local1.score_runner.currentSpan;
if (_local1.score_runner.more_available == "true") {
_local1.nextButton._visible = true;
_local1.nextButton.onRelease = function () {
trace("NEXT PRESSED");
self.currentFirstPos = self.currentFirstPos + self.scoresPerPage;
self.get_scores();
};
} else {
_local1.nextButton._visible = false;
_local1.nextButton.onRelease = null;
}
if (((_local1.leaguesOn == true) && (_local1.league != 0)) && (_local1.league != undefined)) {
trace("LEAGUES ARE ON");
_local1.leaveLeagueButton._visible = true;
_local1.leaveLeagueButton.onRelease = function () {
trace("LEAVE LEAGUE");
self.setupLeaveLeague();
};
} else {
trace("LEAGUES AE OFF");
_local1.leaveLeagueButton._visible = false;
_local1.leaveLeagueButton.onRelease = null;
}
if ((_local1.leaguesOn == true) && (_local1.league == 0)) {
_local1.startLeagueButton._visible = true;
_local1.startLeagueButton.onRelease = function () {
trace("START A LEAGUE");
self.gotoAndStop("start_league");
self.setupLeagueStartPage();
};
} else {
_local1.startLeagueButton._visible = false;
_local1.startLeagueButton.onRelease = null;
}
if ((_local1.leaguesOn == true) && (_local1.league != 0)) {
_local1.leagueButton._visible = true;
trace("SHOW LEAGUE BUTTON");
_local1.leagueButton.onRelease = function () {
trace("VIEW LEAGUE");
self.currentSpan = "LEAGUE";
self.currentFirstPos = 0;
self.get_scores();
};
} else {
trace("HIDE LEAGE BUTTON");
_local1.leagueButton._visible = false;
_local1.leagueButton.onRelease = null;
}
_local1.allButton.onRelease = function () {
trace("VIEW ALL SCORES");
self.currentSpan = "ALL";
self.currentFirstPos = 0;
self.get_scores();
};
_local1.monthButton.onRelease = function () {
trace("VIEW MONTHS SCORES");
self.currentSpan = "MONTH";
self.currentFirstPos = 0;
self.get_scores();
};
_local1.weekButton.onRelease = function () {
trace("VIEW WEEKS SCORES");
self.currentSpan = "WEEK";
self.currentFirstPos = 0;
self.get_scores();
};
_local1.todayButton.onRelease = function () {
trace("VIEW DAYS SCORES");
self.currentSpan = "DAY";
self.currentFirstPos = 0;
self.get_scores();
};
_local2 = 0;
while (_local2 < 10) {
delete _local1.score_runner["score" + _local2];
delete _local1.score_runner["location" + _local2];
delete _local1.score_runner["name" + _local2];
delete _local1.score_runner["highlight" + _local2];
_local2++;
}
delete _local1.score_runner.first_pos;
delete _local1.score_runner.more_available;
}
function populateRanking() {
}
function get_scores() {
var _local1 = this;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("GET SCORES"));
} else {
_local1.currentActivity = Array("GET SCORES");
_local1.canConnect = false;
var self = _local1;
var _local3 = new Date();
_local1.score_runner.score_interval = _local1.currentSpan;
if (_local1.currentSpan == "LEAGUE") {
_local1.score_runner.league_id = _local1.league;
} else {
_local1.score_runner.league_id = 0;
}
_local1.score_runner.start_pos = _local1.currentFirstPos;
_local1.score_runner.fiab_score_action = "GET_SCORE";
_local1.score_runner.rnd = _local3.getTime();
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
if (success) {
if (_local1.errmsg == undefined) {
_local1.attemptCounter = 0;
trace("GET SCORES SUCCESSFULL!");
self.gotoAndStop("submited");
self.populateSubmited();
} else if (_local1.errmsg != undefined) {
self.handleError(_local1.errmsg);
}
} else {
trace("ERROR GETTING SCORES");
self.handleError("FAILED");
return;
}
self.canConnect = true;
delete _local1.score_interval;
delete _local1.rnd;
delete _local1.start_pos;
delete _local1.fiab_score_action;
delete _local1.league_id;
delete _local1.more_available;
delete _local1.currentSpan;
delete _local1.errmsg;
};
var _local2;
for (_local2 in _local1.score_runner) {
trace((_local2 + " : ") + _local1.score_runner[_local2]);
}
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
trace("GOING TO LOADING");
_local1.doLoading();
}
}
function checkForLeagues() {
var _local1 = this;
trace("CHECKING FOR LEAGUES");
trace("ROOT : " + _local1.theRoot);
trace("THIS : " + _local1);
trace("DEBUG : " + _local1.debugArea);
_local1.debugArea.text = "BOO!! CHECKING FOR LEAGUES";
_local1.debugArea.text = _local1.debugArea.text + (("\nROOT : " + _local1.theRoot) + newline);
trace("DEBUG TEXT " + _local1.debugArea.text);
if (_local1.theRoot.fiab_league_id != undefined) {
_local1.league = _local1.theRoot.fiab_league_id;
} else {
_local1.league = 0;
}
if (_local1.theRoot.fiab_league_player != undefined) {
_local1.league_player = _local1.theRoot.fiab_league_player;
} else {
_local1.league_player = 0;
}
trace("END CHECK FOR LEAGUES");
}
function submit(theScore, onSubmit, onCancel) {
var _local1 = this;
var _local2 = theScore;
var self = _local1;
_local1.score_id = new Number(0);
_local1.theScore = _local2;
_local1.onSubmit = onSubmit;
_local1.onCancel = onCancel;
_local1._visible = true;
_local1.gotoAndStop("submit");
_local1.confirm._visible = false;
_local1.theScoreBox.text = String(_local2);
trace("PLAYER NAME " + _local1.player_name);
if (_local1.player_name != undefined) {
_local1.nameInput.text = _local1.player_name;
}
if (_local1.scoresAsTime == true) {
_local1.theScoreBox.text = _local1.secondsToString(Number(_local1.theScoreBox.text));
} else {
_local1.theScoreBox.text = _local1.addCommas(_local1.theScoreBox.text);
}
_local1.returnRank(_local2);
_local1.submitButton.onRelease = function () {
if (self.nameInput.text == "") {
return(undefined);
}
self.submitScore(self.nameInput.text, self.theScore, self.onSubmit, 0);
};
_local1.skipitButton.onRelease = function () {
trace("GLOBAL SCORES : " + self.globalScoresOn);
self.get_scores();
};
if (self.globalScoresOn == true) {
self.submitScore("", self.theScore, self.onCancel, 1);
}
Selection.setFocus(_local1.nameInput);
}
function justView() {
var _local1 = this;
var self = _local1;
_local1.gotoAndStop("view");
_local1._visible = true;
_local1.get_scores();
}
function returnRank(theScoreToRank) {
var _local1 = this;
var _local2 = theScoreToRank;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("RANK", _local2));
} else {
var self = _local1;
_local1.canConnect = false;
_local1.currentActivity = Array("RANK", _local2);
trace("RETURNING REANK");
_local1.score_runner.fiab_score_action = "JUST_RANK";
_local1.score_runner.score = _local2;
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
if (success) {
if (_local1.errmsg != undefined) {
self.handleError(_local1.errmsg);
} else {
self.attemptCounter = 0;
trace("RANK SUCCESS");
self.rankingText.text = self.generateRankText(_local1.first_pos, _local1.currentSpan);
}
} else {
trace("ERROR GETTING RANK");
self.handleError("FAILED");
}
delete _local1.first_pos;
delete _local1.fiab_score_action;
delete _local1.name;
delete _local1.score;
delete _local1.location;
delete _local1.currentSpan;
delete _local1.errmsg;
self.canConnect = true;
};
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
}
}
function generateRankText(position, theSpan) {
trace("GENERATING RANK TEXT");
var _local1 = new String();
switch (theSpan) {
case "LEAGUE" :
_local1 = "in your league.";
break;
case "ALL" :
_local1 = "in the world ever!";
break;
case "YEAR" :
_local1 = "in the world this year.";
break;
case "MONTH" :
_local1 = "in the world this month.";
break;
case "WEEK" :
_local1 = "in the world this week.";
break;
case "DAY" :
_local1 = "in the world today.";
break;
default :
_local1 = ".";
}
return((("You ranked " + Number(Number(position) + Number(1))) + " ") + _local1);
}
function setupLeagueStartPage() {
var _local2 = this;
var _local1;
var self = _local2;
var myself = _local2;
_local2.confirm._visible = false;
_local2.startLeagueButton._visible = false;
_local2.leagueNamesSoFar = 0;
_local2.previousButton._visible = false;
_local2.nextButton._visible = false;
delete _local2.leagueNameHolder.leagueStaterName;
delete _local2.leagueNameHolder.leagueStaterEmail;
_local1 = 1;
while (_local2.leagueNameHolder["name" + _local1] != undefined) {
delete _local2.leagueNameHolder["name" + _local1];
delete _local2.leagueNameHolder["email" + _local1];
_local1++;
}
_local1 = 1;
_local2.leagueStarterName.text = "";
_local2.leagueStarterEmail.text = "";
_local2.leagueStarterName.tabEnabled = true;
_local2.leagueStarterName.tabIndex = 1;
_local2.leagueStarterEmail.tabEnabled = true;
_local2.leagueStarterEmail.tabIndex = 2;
while (_local2["name" + _local1] != undefined) {
_local2["name" + _local1].text = "";
_local2["email" + _local1].text = "";
_local2["name" + _local1].tabEnabled = true;
_local2["email" + _local1].tabEnabled = true;
_local2["name" + _local1].tabIndex = 2 + (_local1 * 2);
_local2["email" + _local1].tabIndex = 3 + (_local1 * 2);
_local1++;
}
_local2.submitLeagueButton.onRelease = function () {
self.submitLeagueButtonRelease();
};
_local2.addMoreButton.onRelease = function () {
self.addMoreToLeague();
};
}
function submitLeagueButtonRelease() {
var _local1 = this;
var _local2;
var _local3;
var stored;
stored = _local1.leagueNamesSoFar;
trace((("LEAGE NAME " + _local1.leagueName) + " : ") + _local1.leagueName.text);
_local2 = 1;
while (_local1["name" + _local2] != undefined) {
trace("THIS NAME : " + _local3);
if (_local1["name" + _local2].text == "") {
_local2++;
continue;
}
_local3 = _local2 + stored;
_local1.leagueNameHolder["name" + _local3] = new String();
_local1.leagueNameHolder["email" + _local3] = new String();
_local1.leagueNameHolder["name" + _local3] = _local1["name" + _local2].text;
_local1.leagueNameHolder["email" + _local3] = _local1["email" + _local2].text;
_local2++;
_local1.leagueNamesSoFar++;
}
_local1.leagueNameHolder.leagueStarterName = new String();
_local1.leagueNameHolder.leagueStarterEmail = new String();
_local1.leagueNameHolder.leagueStarterEmail = _local1.leagueStarterEmail.text;
_local1.leagueNameHolder.leagueStarterName = _local1.leagueStarterName.text;
_local1.leagueNameHolder.leagueName = new String();
_local1.leagueNameHolder.leagueName = _local1.leagueName.text;
trace("SUBMITTING LEAGUE");
for (_local2 in _local1.leagueNameHolder) {
trace((_local2 + " : ") + _local1.leagueNameHolder[_local2]);
}
trace(_local1.leagueNameHolder);
_local1.submitLeagueStart();
}
function addMoreToLeague() {
var _local1 = this;
trace("ADDING MORE");
var _local2;
var _local3;
var stored;
stored = _local1.leagueNamesSoFar;
_local2 = 1;
while (_local1["name" + _local2] != undefined) {
trace("THIS NAME : " + _local3);
if (_local1["name" + _local2].text == "") {
_local2++;
continue;
}
_local3 = _local2 + stored;
_local1.leagueNameHolder["name" + _local3] = new String();
_local1.leagueNameHolder["email" + _local3] = new String();
_local1.leagueNameHolder["name" + _local3] = _local1["name" + _local2].text;
_local1.leagueNameHolder["email" + _local3] = _local1["email" + _local2].text;
_local1["name" + _local2].text = "";
_local1["email" + _local2].text = "";
_local1.leagueNamesSoFar++;
_local2++;
}
}
function submitLeagueStart() {
var _local1 = this;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("START_LEAGUE"));
} else {
trace("CONNECTING FOR NEW LEAGUE");
_local1.currentActivity = Array("START_LEAGUE");
var _local3 = new Date();
var _local2;
var self = _local1;
_local1.score_runner.rnd = _local3.getTime();
_local1.score_runner.fiab_score_action = "START_LEAGUE";
_local1.score_runner.leagueStarterName = _local1.leagueNameHolder.leagueStarterName;
_local1.score_runner.leagueStarterEmail = _local1.leagueNameHolder.leagueStarterEmail;
_local1.score_runner.leagueName = _local1.leagueNameHolder.leagueName;
_local1.score_runner.viralName = _local1.viralName;
trace("PREPAREING FOR LEAGUE\n\n");
for (_local2 in _local1.leagueNameHolder) {
trace((_local2 + " : ") + _local1.leagueNameHolder[_local2]);
_local1.score_runner[_local2] = _local1.leagueNameHolder[_local2];
}
trace("LEAGUE PREPAED\n\n");
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
var _local2;
trace("NEW LEAGUE ON LOAD");
if (success) {
if (_local1.errmsg != undefined) {
self.handleError(_local1.errmsg);
} else {
self.attemptCounter = 0;
trace("THE LEAGUE HAS BEEN STARTED : " + _local1.league);
self.league = _local1.league;
self.league_player = _local1.league_player;
_local1.theRoot.fiab_league_id = _local1.league;
_local1.theRoot.fiab_league_player = _local1.league_player;
self.leagueNameString = _local1.league_name;
self.gotoAndStop("leagueSuccess");
self.currentSpan = "LEAGUE";
self.populateSubmited();
}
} else {
self.handleError("FAILED");
}
delete _local1.rnd;
for (_local2 in self.leagueNameHolder) {
delete _local1[_local2];
}
delete _local1.fiab_score_action;
delete _local1.league;
delete _local1.league_player;
delete _local1.viralName;
delete _local1.league_name;
delete _local1.errmsg;
};
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
_local1.doLoading();
}
}
function setupLeaveLeague() {
var _local1 = this;
var self = _local1;
_local1.confirm._visible = true;
_local1.confirm.noButton.onRelease = function () {
self.confirm._visible = false;
};
_local1.confirm.yesButton.onRelease = function () {
trace("LEAVE FOREVER");
self.doLoading();
self.leaveForEver();
};
}
function leaveForEver() {
var _local1 = this;
if (_local1.canConnect == false) {
_local1.activityList.push(Array("LEAVE_LEAGUE"));
} else {
_local1.currentActivity = Array("LEAVE_LEAGUE");
var _local2 = new Date();
var self = _local1;
_local1.score_runner.rnd = _local2.getTime();
_local1.score_runner.fiab_score_action = "LEAVE_LEAGUE";
_local1.score_runner.league_player = _local1.league_player;
_local1.score_runner.onLoad = function (success) {
var _local1 = this;
self.loadingMovie._visible = false;
if (success) {
self.attemptCounter = 0;
trace("SUCESSFULLY LEFT THE LEAGUE");
trace("LEAVE FOR EVER");
self.theRoot.fiab_league_id = 0;
self.theRoot.fiab_league_player = 0;
self.league = 0;
self.league_player = 0;
self.get_scores();
} else {
trace("leaving league failure");
self.handleError("FAILED");
}
delete _local1.rnd;
delete _local1.fiab_score_action;
delete _local1.errmsg;
};
_local1.score_runner.sendAndLoad(_local1.serviceURL, _local1.score_runner, "GET");
_local1.doLoading();
}
}
function doLoading() {
loadingMovie._visible = true;
}
function hideScores() {
_visible = false;
onHide();
}
function handleError(theError) {
var _local2 = this;
trace("theError : " + theError);
var errorMessage = new String();
switch (theError) {
case "LEAGUE LEFT" :
case "BEST SCORE" :
return;
case "SCORE TOO HIGH" :
case "SCORE TOO LOW" :
// unexpected jump
case "NO NAME" :
default :
case "NO SCORE" :
case "NO CONNECTION" :
case "BAD LOCATION" :
case "BAD WORD" :
case "INVALID ID" :
case "NO REQUEST" :
case "NO LEAGUE CREATOR NAME" :
case "NO LEAGUE CREATOR EMAIL" :
case "NO LEAGUE BUDDIES" :
case "BAD SPAN" :
case "FAILED" :
if ((++_local2.attemptCounter) > 5) {
_local2.gotoAndStop("error");
} else {
_local2.activityList.unshift(_local2.currentActivity);
}
var _local1;
var _local3 = new Boolean(true);
_local2.debugArea.text = _local2.debugArea.text + "\nDELETING THESE ITEMS:";
for (_local1 in _local2.score_runner) {
_local3 = false;
switch (_local1) {
case "fiab_viral_id" :
case "league" :
case "league_player" :
case "viralID" :
_local3 = true;
break;
default :
_local3 = false;
}
if (_local3 == true) {
continue;
}
_local2.debugArea.text = _local2.debugArea.text + (((newline + _local1) + " : ") + _local2.score_runner[_local1]);
delete _local2.score_runner[_local1];
}
_local2.debugArea.text = _local2.debugArea.text + "\nDELETING COMPLETE\n";
}
}
function upDateFlag(theFlag, theFlagCode) {
var _local1;
_local1 = returnArrayIndex(theFlagCode, countryCodeArray);
if (_local1 < 0) {
theFlag.gotoAndStop("blank");
} else {
_local1++;
theFlag.gotoAndStop(_local1);
}
}
function returnArrayIndex(needle, haystack) {
var _local2 = haystack;
var _local3 = needle;
var _local1;
_local1 = 0;
while (_local1 < _local2.length) {
if (_local3 == _local2[_local1]) {
return(_local1);
}
_local1++;
}
return(-1);
}
function secondsToString(seconds) {
var _local1 = seconds;
var _local2 = "";
var _local3 = new Number(0);
var minutes = new Number(0);
while (_local1 > 3600) {
_local1 = _local1 - 3600;
_local3++;
}
if (_local3 < 10) {
_local2 = "0" + _local3.toString();
} else {
_local2 = _local3.toString();
}
_local2 = _local2 + ":";
while (_local1 > 60) {
_local1 = _local1 - 60;
minutes++;
}
if (minutes < 10) {
_local2 = _local2 + ("0" + minutes.toString());
} else {
_local2 = _local2 + minutes.toString();
}
_local2 = _local2 + ":";
if (_local1 < 10) {
_local2 = _local2 + ("0" + _local1.toString());
} else {
_local2 = _local2 + _local1.toString();
}
return(_local2);
}
function addCommas(myString) {
if (myString == "NONE") {
return("NONE");
}
var _local2;
var _local1;
var subLen;
var _local3 = "";
_local2 = 0;
while (_local2 < myString.length) {
if (_local2 > 0) {
_local3 = "," + _local3;
}
_local1 = myString.length - (_local2 + 3);
if (_local1 < 0) {
subLen = 3 + _local1;
_local1 = 0;
} else {
subLen = 3;
}
_local3 = myString.substr(_local1, subLen) + _local3;
if (_local1 == 0) {
break;
}
_local2 = _local2 + 3;
}
return(_local3);
}
}
Symbol 500 MovieClip Frame 1
stop();
_visible = false;
sfxTitleLoop = new Sound(this);
sfxTitleLoop.attachSound("tnttitle.wav");
sfxGameLoop = new Sound(this);
sfxGameLoop.attachSound("tntingame.wav");
Symbol 513 MovieClip Frame 36
stop();
Symbol 524 Button
on (release) {
_parent.AudioMute(true);
gotoAndStop ("Mute");
}
Symbol 527 Button
on (release) {
_parent.AudioMute(false);
gotoAndStop ("UnMute");
}
Symbol 528 MovieClip Frame 1
stop();
Symbol 528 MovieClip Frame 10
stop();
Symbol 533 Button
on (release) {
getURL ("http://www.fishinabottle.com", "_blank");
trackObj.continueTracking("CT");
}
Symbol 558 MovieClip Frame 1
_root.StrTable.populate();
Symbol 575 MovieClip Frame 1
stop();
Symbol 575 MovieClip Frame 2
stop();
Symbol 575 MovieClip Frame 3
stop();
Symbol 589 MovieClip Frame 1
stop();
Symbol 594 MovieClip Frame 1
LabelInst._visible = false;
Symbol 602 MovieClip Frame 1
stop();
Symbol 602 MovieClip Frame 40
stop();
Symbol 604 MovieClip Frame 1
stop();
Symbol 610 MovieClip Frame 1
LabelInst._visible = false;
Symbol 620 MovieClip Frame 24
_parent.start();
Symbol 620 MovieClip Frame 40
stop();
this._visible = false;
Symbol 622 MovieClip Frame 1
function Point(x, y) {
this.x = x;
this.y = y;
}
function setKeys(keyCodeRunLeft, keyCodeRunRight, keyCodeCrouch, keyCodeJump) {
pKeys[0] = keyCodeRunLeft;
pKeys[1] = keyCodeRunRight;
pKeys[2] = keyCodeCrouch;
pKeys[3] = keyCodeJump;
}
function loadLevel(levelFilenameXML) {
currentMap = new MapLoader(levelFilenameXML, tiles, props);
gotoAndPlay ("Loading");
}
function setBackground(backgroundId) {
BkHolderInst.gotoAndStop(backgroundId);
}
function setNotifyCallback(callbackFunction) {
notifyCallback = callbackFunction;
}
function start() {
isRunning = true;
}
function stop() {
isRunning = false;
}
function reset() {
coins = 0;
time = 0;
penalty = 0;
HUDCoinsInst.text = 0;
player.reset();
player.setPos((currentMap.pStartColumn * TILE_WIDTH) + (TILE_WIDTH / 2), (currentMap.pStartRow * TILE_HEIGHT) + (TILE_HEIGHT / 2));
}
function exit() {
notifyCallback(time, coins, true);
}
function MapLoader(mapName, retTileArray, retPropertyArray) {
var _local1 = this;
_local1.loaded = false;
_local1.loadError = false;
_local1.tileset = "";
_local1.mapWidth = 0;
_local1.mapHeight = 0;
_local1.tileArray = retTileArray;
_local1.propertyArray = retPropertyArray;
_local1.pStartRow = 0;
_local1.pStartColumn = 0;
_local1.mapXML = null;
_local1.load(mapName);
}
function prepareLevel() {
var _local3 = 0;
while (_local3 < SCREEN_WIDTH) {
var columnHolder = MapHolderInst.createEmptyMovieClip("Col" + _local3, _local3);
columnHolder._x = _local3 * TILE_WIDTH;
columnHolder._y = 0;
var _local1 = 0;
while (_local1 < SCREEN_HEIGHT) {
var tile = columnHolder.attachMovie("TileHolder", "Tile" + _local1, _local1);
tile.gotoAndStop(tiles[_local1][_local3]);
var _local2 = props[_local1][_local3];
if (_local2 != 0) {
if (_local2 & 128) {
scrollSpeed = SCROLL_SPEED[SCROLL_FAST];
} else if (_local2 & 64) {
scrollSpeed = SCROLL_SPEED[SCROLL_MEDIUM];
} else if (_local2 & 32) {
scrollSpeed = SCROLL_SPEED[SCROLL_SLOW];
}
}
tile._x = 0;
tile._y = _local1 * TILE_HEIGHT;
_local1++;
}
_local3++;
}
}
function dumpMap() {
trace("-----");
trace("Dumping the tile array");
var _local2 = 0;
while (_local2 < WORLD_HEIGHT) {
var _local3 = "";
var _local1 = 0;
while (_local1 < WORLD_WIDTH) {
_local3 = _local3 + (" " + tiles[_local2][_local1]);
_local1++;
}
trace(_local3);
_local2++;
}
trace("Dumping the properties array");
_local2 = 0;
while (_local2 < WORLD_HEIGHT) {
var _local3 = "";
var _local1 = 0;
while (_local1 < WORLD_WIDTH) {
_local3 = _local3 + (" " + props[_local2][_local1]);
_local1++;
}
trace(_local3);
_local2++;
}
trace("-----");
}
function update() {
if (!isRunning) {
} else {
time = (int((++ticks) / 1.8) / 10) + penalty;
if (time < 10) {
timeString = "0" + time;
} else {
timeString = "" + time;
}
if (timeString.indexOf(".") < 0) {
timeString = timeString + ".0";
}
if (kf[0]) {
player.left();
}
if (kf[1]) {
player.right();
}
if (kf[3]) {
player.jump();
if (player.state == PLR_STATE_GRND) {
sndJump.start();
}
}
if (scrolling) {
mapPos = mapPos + scrollSpeed;
scrollOffset = scrollOffset - scrollSpeed;
if (scrollOffset <= (-TILE_WIDTH)) {
scrollOffset = scrollOffset + TILE_WIDTH;
tileOffset++;
var _local2 = MapHolderInst["Col" + stackOffset];
_local2._x = ((SCREEN_WIDTH + tileOffset) - 1) * TILE_WIDTH;
var _local3 = SCREEN_HEIGHT;
for (var tile in _local2) {
_local3--;
_local2[tile].gotoAndStop(tiles[_local3][(SCREEN_WIDTH + tileOffset) - 1]);
var _local1 = props[_local3][(SCREEN_WIDTH + tileOffset) - 1];
if (_local1 != 0) {
if (_local1 & 128) {
scrollSpeed = SCROLL_SPEED[SCROLL_FAST];
} else if (_local1 & 64) {
scrollSpeed = SCROLL_SPEED[SCROLL_MEDIUM];
} else if (_local1 & 32) {
scrollSpeed = SCROLL_SPEED[SCROLL_SLOW];
} else if (_local1 & 16) {
VanInst._x = _local2._x - mapPos;
VanInst._y = (_local2[tile]._y - VanInst._height) + TILE_HEIGHT;
VanInst._visible = true;
}
}
}
if ((++stackOffset) >= SCREEN_WIDTH) {
stackOffset = 0;
}
}
MapHolderInst._x = MapHolderInst._x - scrollSpeed;
if (VanInst._visible) {
VanInst._x = VanInst._x - scrollSpeed;
if ((VanInst._x + VanInst._width) < SCREEN_HORZREZ) {
scrolling = false;
}
}
}
if ((!scrolling) && (levelDone)) {
gotoAndPlay ("LevelComplete");
}
player.isCrouch = player.state == PLR_STATE_CROUCH;
player.update();
mColl();
}
}
function dumpContents(target) {
var _local1 = target;
trace("Dumping " + _local1);
for (obj in _local1) {
trace(obj);
if (_local1[obj] instanceof Object) {
dumpContents(_local1[obj]);
}
}
}
function mColl() {
if (player.state == PLR_STATE_CRASHING) {
} else if (player.y > SCREEN_VERTREZ) {
player.pitFall();
} else {
if (((player.x + player.xOffs) - mapPos) >= SCREEN_HORZREZ) {
player.x = (SCREEN_HORZREZ - player.xOffs) + mapPos;
player.stopX();
}
if (((player.x - player.xOffs) - mapPos) <= 0) {
player.x = player.xOffs + mapPos;
if (player.currV.x < 0) {
player.stopX();
}
}
var _local2 = new Object();
_local2.x = 0;
_local2.y = 0;
var tileX = ((player.x - player.currV.x) >> 5);
var tileY = ((player.y - player.currV.y) >> 5);
if ((player.x - (tileX << 5)) > 16) {
var overlapX = (tileX + 1);
} else {
var overlapX = (tileX - 1);
}
pTile(tileY, tileX);
if (!player.isCrouch) {
pTile(tileY - 1, tileX);
if (props[tileY - 1][tileX] & 1) {
if (player.crash()) {
sndFall.start();
}
return;
}
} else {
var isRight = (player.currV.x >= 0);
var isUp = (player.currV.y < 0);
var _local1 = 0;
var _local3 = 0;
if (isRight) {
var hTile = (tileX + 1);
} else {
var hTile = (tileX - 1);
}
if (isUp) {
if (!player.isCrouch) {
var vTile = (tileY - 2);
} else {
var vTile = (tileY - 1);
}
} else {
var vTile = (tileY + 1);
}
if (props[tileY][hTile] & 1) {
if (rOv(player.x - 16, player.y - 16, 32, 32, hTile << 5, tileY << 5, TILE_WIDTH, TILE_HEIGHT, _local2)) {
_local1 = _local2.x;
}
}
if ((!player.isCrouch) && (props[tileY - 1][hTile] & 1)) {
if (rOv(player.x - 16, player.y - 16, 32, 32, hTile << 5, (tileY - 1) << 5, TILE_WIDTH, TILE_HEIGHT, _local2)) {
_local1 = ((_local2.x > _local1) ? (_local2.x) : (_local1));
}
}
var pFall = true;
var overlapHit = false;
if (props[vTile][tileX] & 1) {
if (rOv(player.x - 16, player.y - 48, 32, 64, tileX << 5, vTile << 5, TILE_WIDTH, TILE_HEIGHT, _local2)) {
_local3 = _local2.y;
pFall = false;
}
}
if ((!isUp) && (props[vTile][overlapX] & 1)) {
if (rOv(player.x - 16, player.y - 48, 32, 64, overlapX << 5, vTile << 5, TILE_WIDTH, TILE_HEIGHT, _local2)) {
_local3 = ((_local2.y > _local3) ? (_local2.y) : (_local3));
if (pFall) {
pFall = false;
overlapHit = true;
}
}
}
if (pFall) {
player.falling();
}
var hitGround = false;
if (isUp) {
if (isRight) {
if ((_local1 > 0) || (_local3 > 0)) {
if (player.crash()) {
return;
}
player.setPos(player.x - _local1, player.y + _local3);
player.stopX();
player.stopY();
}
} else if (_local1 > 0) {
player.setPos(player.x + _local1, player.y);
player.stopX();
} else if (_local3 > 0) {
player.setPos(player.x, player.y + _local3);
player.stopY();
if (player.crash()) {
sndFall.start();
return;
}
}
} else if (isRight) {
if (_local3 > 0) {
player.setPos(player.x, player.y - _local3);
if ((overlapHit && (_local1 == 0)) || (!overlapHit)) {
player.stopY();
player.grounded();
hitGround = true;
}
}
if ((!hitGround) && (_local1 > 0)) {
player.setPos(player.x - _local1, player.y);
player.stopX();
if (player.crash()) {
sndFall.start();
return;
}
}
} else {
if (_local1 > 0) {
player.setPos(player.x + _local1, player.y);
player.stopX();
}
if (_local3 > 0) {
player.setPos(player.x, player.y - _local3);
if ((overlapHit && (_local1 == 0)) || (!overlapHit)) {
player.stopY();
player.grounded();
hitGround = true;
}
}
}
}
}
}
function rOv(x1, y1, w1, h1, x2, y2, w2, h2, ret) {
ret.x = 0;
ret.y = 0;
var _local2 = x1;
var right1 = (x1 + w1);
var _local1 = x2;
var right2 = (x2 + w2);
var top1 = y1;
var base1 = (y1 + h1);
var _local3 = y2;
var base2 = (y2 + h2);
if (base1 < _local3) {
return(false);
}
if (base2 < top1) {
return(false);
}
if (right1 < _local1) {
return(false);
}
if (right2 < _local2) {
return(false);
}
var overTop = ((top1 > _local3) ? (top1) : (_local3));
var overBase = ((base1 < base2) ? (base1) : (base2));
var overLeft = ((_local2 > _local1) ? (_local2) : (_local1));
var overRight = ((right1 < right2) ? (right1) : (right2));
ret.x = overRight - overLeft;
ret.y = overBase - overTop;
return(true);
}
function pTile(row, column) {
var _local2 = row;
var _local3 = column;
if (props[_local2][_local3] != 0) {
if (props[_local2][_local3] & 2) {
currentMap.setTile(_local2, _local3, 1, 0);
var _local1 = (_local3 - tileOffset) + stackOffset;
if (_local1 >= SCREEN_WIDTH) {
_local1 = _local1 - SCREEN_WIDTH;
}
MapHolderInst["Col" + _local1]["Tile" + _local2].gotoAndStop(1);
coins++;
sndCoin.start();
HUDCoinsInst.text = coins;
}
if (props[_local2][_local3] & 8) {
stop();
levelDone = true;
player.mClip._visible = false;
}
}
}
function penalise() {
penalty = penalty + 3;
}
Vector2d = function (x, y) {
this.x = x;
this.y = y;
};
Vector2d.prototype.magnitude = function () {
var _local1 = this;
return(Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y)));
};
Vector2d.prototype.setLength = function (length) {
var _local2 = this;
var _local1 = length / _local2.magnitude();
_local2.x = _local2.x * _local1;
_local2.y = _local2.y * _local1;
};
Vector2d.prototype.addVector = function (vector) {
this.x = this.x + vector.x;
this.y = this.y + vector.y;
};
Vector2d.prototype.flip = function () {
var _local1 = this;
_local1.x = -_local1.x;
_local1.y = -_local1.y;
};
PLR_PIT_DEPTH = 450;
PLR_STATE_GRND = 1;
PLR_STATE_CROUCH = 2;
PLR_STATE_AIR = 3;
PLR_STATE_CRASHING = 4;
PLR_GRAVITY = 2;
PLR_CTRL_THRUST = 6;
PLR_AIR_FACTOR = 0.2;
PLR_JUMP_THRUST = 20;
PLR_REST_FACTOR = 0.3;
PLR_MAX_SPD_FWD = 20;
PLR_MAX_SPD_BKWD = 10;
PLR_MAX_SPD_VERT = 20;
PLR_RIGHT = 0;
PLR_LEFT = 5;
PLR_INVINCIBLE_TIME = 40;
Player = function (playerObj, anchorX, anchorY) {
var _local1 = this;
_local1.mClip = playerObj;
_local1.currV = new Vector2d(0, 0);
_local1.restV = new Vector2d(0, 0);
_local1.grav = new Vector2d(0, PLR_GRAVITY);
_local1.ctrl = new Vector2D(0, 0);
_local1.jmp = new Vector2D(0, 0);
_local1.xOffs = anchorX;
_local1.yOffs = anchorY;
_local1.x = 0;
_local1.y = 0;
_local1.invTimer = 0;
_local1.dir = 0;
_local1.state = PLR_STATE_GRND;
};
Player.prototype.reset = function () {
var _local1 = this;
_local1.currV.x = 0;
_local1.currV.y = 0;
_local1.restV.x = 0;
_local1.restV.y = 0;
_local1.jmp.x = 0;
_local1.jmp.y = 0;
_local1.invTimer = 0;
_local1.dir = 0;
_local1.state = PLR_STATE_GRND;
};
Player.prototype.setPos = function (x, y) {
var _local1 = this;
_local1.x = x;
_local1.y = y;
_local1.mClip._x = (_local1.x + _local1.xOffs) - mapPos;
_local1.mClip._y = _local1.y + _local1.yOffs;
};
Player.prototype.update = function () {
var _local1 = this;
if (_local1.currV.x >= 0) {
var _local2 = PLR_MAX_SPD_FWD;
} else {
var _local2 = PLR_MAX_SPD_BKWD;
}
switch (_local1.state) {
case PLR_STATE_CROUCH :
_local1.currV.addVector(_local1.ctrl);
_local1.currV.addVector(_local1.jmp);
_local1.currV.x = ((Math.abs(_local1.currV.x) > _local2) ? ((_local2 * _local1.currV.x) / Math.abs(_local1.currV.x)) : (_local1.currV.x));
_local1.currV.y = ((Math.abs(_local1.currV.y) > PLR_MAX_SPD_VERT) ? ((PLR_MAX_SPD_VERT * _local1.currV.y) / Math.abs(_local1.currV.y)) : (_local1.currV.y));
_local1.restV.x = _local1.currV.x * PLR_REST_FACTOR;
_local1.restV.y = _local1.currV.y * PLR_REST_FACTOR;
_local1.restV.flip();
_local1.restV.x = ((Math.abs(_local1.restV.x) > _local2) ? ((_local2 * _local1.restV.x) / Math.abs(_local1.restV.x)) : (_local1.restV.x));
_local1.restV.y = ((Math.abs(_local1.restV.y) > PLR_MAX_SPD_VERT) ? ((PLR_MAX_SPD_VERT * _local1.restV.y) / Math.abs(_local1.restV.y)) : (_local1.restV.y));
_local1.currV.addVector(_local1.restV);
if (_local1.currV.y < 0) {
_local1.state = PLR_STATE_AIR;
} else {
_local1.state = PLR_STATE_GRND;
}
_local1.mClip.gotoAndStop(3 + _local1.dir);
break;
case PLR_STATE_GRND :
_local1.currV.addVector(_local1.ctrl);
_local1.currV.addVector(_local1.jmp);
_local1.currV.x = ((Math.abs(_local1.currV.x) > _local2) ? ((_local2 * _local1.currV.x) / Math.abs(_local1.currV.x)) : (_local1.currV.x));
_local1.currV.y = ((Math.abs(_local1.currV.y) > PLR_MAX_SPD_VERT) ? ((PLR_MAX_SPD_VERT * _local1.currV.y) / Math.abs(_local1.currV.y)) : (_local1.currV.y));
_local1.restV.x = _local1.currV.x * PLR_REST_FACTOR;
_local1.restV.y = _local1.currV.y * PLR_REST_FACTOR;
_local1.restV.flip();
_local1.restV.x = ((Math.abs(_local1.restV.x) > _local2) ? ((_local2 * _local1.restV.x) / Math.abs(_local1.restV.x)) : (_local1.restV.x));
_local1.restV.y = 0;
_local1.currV.addVector(_local1.restV);
if (_local1.currV.y < 0) {
_local1.state = PLR_STATE_AIR;
}
if (Math.abs(_local1.currV.x) < 1) {
_local1.mClip.gotoAndStop(1 + _local1.dir);
} else {
_local1.mClip.gotoAndStop(5 + _local1.dir);
}
break;
case PLR_STATE_AIR :
_local1.ctrl.x = _local1.ctrl.x * PLR_AIR_FACTOR;
_local1.ctrl.y = _local1.ctrl.y * PLR_AIR_FACTOR;
_local1.currV.addVector(_local1.ctrl);
_local1.currV.x = ((Math.abs(_local1.currV.x) > _local2) ? ((_local2 * _local1.currV.x) / Math.abs(_local1.currV.x)) : (_local1.currV.x));
_local1.currV.addVector(_local1.grav);
_local1.currV.y = ((Math.abs(_local1.currV.y) > PLR_MAX_SPD_VERT) ? ((PLR_MAX_SPD_VERT * _local1.currV.y) / Math.abs(_local1.currV.y)) : (_local1.currV.y));
_local1.mClip.gotoAndStop(2 + _local1.dir);
break;
case PLR_STATE_CRASHING :
_local1.currV.addVector(_local1.grav);
_local1.mClip.gotoAndStop(4 + _local1.dir);
if (_local1.y <= PLR_PIT_DEPTH) {
break;
}
_local1.recover();
}
_local1.setPos(_local1.x + _local1.currV.x, _local1.y + _local1.currV.y);
_local1.ctrl.x = 0;
_local1.jmp.y = 0;
if (_local1.invTimer > 0) {
_local1.mClip._visible = !_local1.mClip._visible;
if ((--_local1.invTimer) <= 0) {
_local1.invTimer = 0;
_local1.mClip._visible = true;
}
}
};
Player.prototype.stopX = function () {
var _local1 = this;
_local1.currV.x = 0;
_local1.restV.x = 0;
_local1.jmp.x = 0;
_local1.ctrl.x = 0;
};
Player.prototype.stopY = function () {
var _local1 = this;
_local1.currV.y = 0;
_local1.restV.y = 0;
_local1.jmp.y = 0;
_local1.ctrl.y = 0;
};
Player.prototype.grounded = function () {
this.currV.y = 0;
this.state = PLR_STATE_GRND;
};
Player.prototype.falling = function () {
this.state = PLR_STATE_AIR;
};
Player.prototype.crash = function () {
if (this.invTimer <= 0) {
this.state = PLR_STATE_CRASHING;
return(true);
}
return(false);
};
Player.prototype.recover = function () {
var _local1 = this;
_local1.setPos(300 + mapPos, -40);
_local1.state = PLR_STATE_AIR;
_local1.invincible();
penalise();
};
Player.prototype.pitFall = function () {
this.state = PLR_STATE_CRASHING;
};
Player.prototype.left = function () {
this.ctrl.x = -PLR_CTRL_THRUST;
};
Player.prototype.right = function () {
this.ctrl.x = PLR_CTRL_THRUST;
};
Player.prototype.jump = function () {
this.jmp.y = -PLR_JUMP_THRUST;
};
Player.prototype.crouch = function () {
if (this.state == PLR_STATE_GRND) {
this.state = PLR_STATE_CROUCH;
}
};
Player.prototype.invincible = function () {
this.invTimer = PLR_INVINCIBLE_TIME;
};
_global.APP_FRAMERATE = 18;
var SCREEN_HORZREZ = 600;
var SCREEN_VERTREZ = 400;
var TILE_WIDTH = 32;
var TILE_HEIGHT = 32;
var currentMap = null;
var isRunning = false;
var scrolling = true;
var levelDone = false;
var notifyCallback = null;
var time = 0;
var timeString = "00.0";
var penalty = 0;
var coins = 0;
var ticks = 0;
var pKeys = [0, 0, 0, 0];
VanInst._visible = false;
MapLoader.prototype.load = function (mapName) {
this.mapXML = new XML();
this.mapXML.ignoreWhite = true;
this.mapXML.mapLoader = this;
this.mapXML.onLoad = function (success) {
if (success) {
var rootNode = this.firstChild;
var map = rootNode.childNodes;
var columnPos = 0;
var i = 0;
while (i < map.length) {
switch (map[i].nodeName) {
case "mapcolumns" :
this.mapLoader.mapWidth = map[i].firstChild.nodeValue;
if (this.mapLoader.mapHeight > 0) {
this.mapLoader.buildArrays();
}
break;
case "maprows" :
this.mapLoader.mapHeight = map[i].firstChild.nodeValue;
if (this.mapLoader.mapHeight > 0) {
this.mapLoader.buildArrays();
}
break;
case "tileset" :
this.mapLoader.tileset = map[i].firstChild.nodeValue;
break;
case "column" :
var columnProperties = map[i].childNodes;
var j = 0;
while (j < columnProperties.length) {
if (!(columnProperties[j].nodeName === "tile")) {
} else {
var _local3 = 0;
var _local2 = columnProperties[j].childNodes;
var _local1 = 0;
while (_local1 < _local2.length) {
switch (_local2[_local1].nodeName) {
case "id" :
var tileId = _local2[_local1].firstChild.nodeValue;
break;
case "row" :
var rowPos = _local2[_local1].firstChild.nodeValue;
break;
case "flag1" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 1;
}
break;
case "flag2" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 2;
}
break;
case "flag3" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 4;
}
break;
case "flag4" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 8;
}
break;
case "flag5" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 16;
}
break;
case "flag6" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 32;
}
break;
case "flag7" :
if (_local2[_local1].firstChild.nodeValue == "yes") {
_local3 = _local3 | 64;
}
break;
case "flag8" :
if (_local2[_local1].firstChild.nodeValue != "yes") {
break;
}
_local3 = _local3 | 128;
}
_local1++;
}
}
this.mapLoader.setTile(rowPos, columnPos, tileId, _local3);
j++;
}
columnPos++;
}
i++;
}
this.mapLoader.loaded = true;
} else {
trace("Load failed!");
this.mapLoader.loadError = false;
}
delete this;
};
this.mapXML.load(mapName);
};
MapLoader.prototype.getPercentLoaded = function () {
return((this.mapXML.getBytesLoaded() / this.mapXML.getBytesTotal()) * 100);
};
MapLoader.prototype.buildArrays = function () {
var _local1 = this;
var _local3 = 0;
while (_local3 < _local1.mapHeight) {
_local1.tileArray[_local3] = new Array(_local1.mapWidth);
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
_local1.tileArray[_local3][_local2] = 1;
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _local1.mapHeight) {
_local1.propertyArray[_local3] = new Array(_local1.mapWidth);
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
_local1.propertyArray[_local3][_local2] = 0;
_local2++;
}
_local3++;
}
};
MapLoader.prototype.setTile = function (row, column, id, properties) {
var _local3 = this;
_local3.tileArray[row][column] = id;
_local3.propertyArray[row][column] = properties;
if (properties & 4) {
_local3.pStartRow = row;
_local3.pStartColumn = column;
}
if (properties & 16) {
var _local1 = 0;
while (_local1 < 8) {
var _local2 = (Number(column) + 2) + _local1;
_local3.tileArray[row][_local2] = 2;
_local3.propertyArray[row][_local2] = _local3.propertyArray[row][_local2] | 8;
_local1++;
}
}
};
MapLoader.prototype.dumpMap = function () {
var _local1 = this;
trace("-----");
trace((("Map size: " + _local1.mapWidth) + " x ") + _local1.mapHeight);
trace("Dumping the map array");
var _local3 = 0;
while (_local3 < _local1.mapHeight) {
var traceLine = "";
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
traceLine = traceLine + (" " + _local1.tileArray[_local3][_local2]);
_local2++;
}
trace(traceLine);
_local3++;
}
trace("-----");
trace("Dumping the properties array");
_local3 = 0;
while (_local3 < _local1.mapHeight) {
var traceLine = "";
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
traceLine = traceLine + (" " + _local1.propertyArray[_local3][_local2]);
_local2++;
}
trace(traceLine);
_local3++;
}
trace("-----");
};
var SCREEN_WIDTH = (Math.ceil(SCREEN_HORZREZ / TILE_WIDTH) + 1);
var SCREEN_HEIGHT = Math.ceil(SCREEN_VERTREZ / TILE_HEIGHT);
var WORLD_WIDTH = 50;
var WORLD_HEIGHT = 15;
SCROLL_SLOW = 0;
SCROLL_MEDIUM = 1;
SCROLL_FAST = 2;
SCROLL_SPEED = [6, 9, 12];
var COLLISION_THRESHOLD = 4;
var tiles = new Array();
var props = new Array();
var scrollSpeed = SCROLL_SPEED[SCROLL_SLOW];
var mapPos = 0;
var scrollOffset = 0;
var tileOffset = 0;
var stackOffset = 0;
var ke = new Object();
Key.addListener(ke);
var playerMC = PlayerHolderInst.attachMovie("PlayerChar", "player", 500);
playerMC.gotoAndStop(1);
var player = new Player(playerMC, 16, 16);
player.gotoAndStop(1);
player.isCrouch = false;
var kf = new Array(false, false, false, false);
sndFall = new Sound();
sndFall.attachSound("SfxFall");
sndJump = new Sound();
sndJump.attachSound("SfxJump");
sndCoin = new Sound();
sndCoin.attachSound("SfxCoin");
ke.onKeyDown = function () {
switch (Key.getCode()) {
case pKeys[0] :
kf[0] = true;
return;
case pKeys[1] :
kf[1] = true;
return;
case pKeys[2] :
kf[2] = true;
return;
case pKeys[3] :
kf[3] = true;
}
};
ke.onKeyUp = function () {
switch (Key.getCode()) {
case pKeys[0] :
kf[0] = false;
return;
case pKeys[1] :
kf[1] = false;
return;
case pKeys[2] :
kf[2] = false;
return;
case pKeys[3] :
kf[3] = false;
}
};
stop();
Symbol 622 MovieClip Frame 10
onEnterFrame = function () {
LoadingBarInst._xscale = currentMap.getPercentLoaded();
if (currentMap.loaded) {
delete onEnterFrame;
gotoAndPlay ("GameRunning");
}
};
stop();
Symbol 622 MovieClip Frame 20
prepareLevel();
reset();
onEnterFrame = function () {
update();
};
stop();
Symbol 622 MovieClip Frame 30
delete onEnterFrame;
trace("LevelComplete frame");
play();
VanInst.play();
Symbol 622 MovieClip Frame 72
stop();
notifyCallback(time, coins, false);
Symbol 640 MovieClip Frame 1
_root.StrTable.populate();