Frame 1
function fadeOut() {
v = Math.max(0, bgsound.getVolume() - VOLUME_DELTA);
bgsound.setVolume(v);
if (v == 0) {
bgsound.stop();
delete this.onEnterFrame;
}
}
function fadeIn() {
v = bgsound.getVolume();
if (v == 0) {
bgsound.stop();
bgsound.start(0, 999);
}
v = Math.min(MAX_BG_VOLUME, v + VOLUME_DELTA);
bgsound.setVolume(v);
if (v == MAX_BG_VOLUME) {
delete this.onEnterFrame;
}
}
function startBgSound() {
if (isBgSnd) {
this.onEnterFrame = fadeIn;
}
}
function stopBgSound() {
if (isBgSnd) {
this.onEnterFrame = fadeOut;
}
}
function toggleBgSnd() {
isBgSnd = !isBgSnd;
if (!isBgSnd) {
this.onEnterFrame = fadeOut;
} else {
this.onEnterFrame = fadeIn;
}
cgdc4Prefs.data.bgsound = isBgSnd;
cgdc4Prefs.flush();
}
stop();
var MAX_BG_VOLUME = 80;
var isBgSnd;
var cgdc4Prefs = SharedObject.getLocal("cgdc4");
var bExist = (cgdc4Prefs.data.bgsound != undefined);
if (bExist) {
isBgSnd = ((cgdc4Prefs.data.bgsound == false) ? false : true);
} else {
isBgSnd = true;
}
var my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
my_cm.builtInItems.print = true;
my_cm.builtInItems.zoom = true;
my_cm.builtInItems.quality = true;
this.menu = my_cm;
gameID = ((gameID == undefined) ? 0 : (gameID));
asv = ((asv == undefined) ? 0 : (asv));
lb = ((lb == undefined) ? 1 : (lb));
var soundmc = this.createEmptyMovieClip("soundlib", this.getNextHighestDepth());
var bgsound = new Sound(soundmc);
bgsound.onLoad = function (success) {
if (success) {
if ((asv == 2) || (isBgSnd == false)) {
bgsound.setVolume(0);
} else {
bgsound.setVolume(80);
bgsound.start(0, 999);
}
}
};
bgsound.loadSound("bgsound1.mp3", false);
var VOLUME_DELTA = 1;
var v;
GameManager.getInstance().init(gameID, asv, lb);
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
__com_mochibot__("0a388536", this, 10301, true);
Symbol 25 MovieClip Frame 1
function loadedIndicatorFrame() {
if (_parent.totalBytes > 0) {
var _local2 = int((_parent.loaded_mc.getBytesLoaded() / _parent.totalBytes) * 65) + 2;
if ((_local2 - lastFrame) > 4) {
lastFrame = lastFrame + 4;
loadedText = ((int(((_parent.totalBytes / 1024) * (lastFrame - 2)) / 65) + "kb of ") + int(_parent.totalBytes / 1024)) + "kb";
} else if ((_local2 - lastFrame) > 0) {
lastFrame++;
loadedText = ((int(_parent.loaded_mc.getBytesLoaded() / 1024) + "kb of ") + int(_parent.totalBytes / 1024)) + "kb";
} else {
loadedText = ((int(_parent.loaded_mc.getBytesLoaded() / 1024) + "kb of ") + int(_parent.totalBytes / 1024)) + "kb";
}
}
return(lastFrame);
}
stop();
lastFrame = 1;
Symbol 26 MovieClip [preloader] Frame 1
function onEnterFrame() {
totalBytes = LoadManager.getInstance().currTotalBytes;
if ((totalBytes > 0) && (loaded_mc.getBytesLoaded() >= totalBytes)) {
if (loaded_mc.getBytesLoaded() >= totalBytes) {
this.gotoAndStop(2);
}
}
preloader.gotoAndStop(preloader.loadedIndicatorFrame());
}
stop();
var totalBytes = 0;
Symbol 26 MovieClip [preloader] Frame 2
this.removeMovieClip();
stop();
Symbol 29 MovieClip [cart] Frame 1
#initclip 17
Object.registerClass("cart", Cart);
#endinitclip
Symbol 49 MovieClip [actionmenu] Frame 1
#initclip 13
Object.registerClass("actionmenu", ActionMenu);
#endinitclip
Symbol 54 MovieClip [background] Frame 1
#initclip 14
Object.registerClass("background", Background);
#endinitclip
stop();
Symbol 54 MovieClip [background] Frame 19
stop();
Symbol 54 MovieClip [background] Frame 37
stop();
Symbol 70 MovieClip Frame 1
stop();
Symbol 70 MovieClip Frame 5
stop();
Symbol 88 MovieClip Frame 1
stop();
Symbol 88 MovieClip Frame 5
stop();
Symbol 124 MovieClip [handheld] Frame 1
#initclip 15
Object.registerClass("handheld", Handheld);
#endinitclip
Symbol 124 MovieClip [handheld] Frame 5
stop();
Symbol 124 MovieClip [handheld] Frame 10
function visitURL(e) {
var _local1 = "http://jayisgames.com/";
getURL (ur, "_blank");
}
stop();
Symbol 124 MovieClip [handheld] Frame 15
gotoAndStop ("on");
Symbol 129 MovieClip [selector] Frame 1
#initclip 16
Object.registerClass("selector", Selector);
#endinitclip
Symbol 134 MovieClip [__Packages.LoadManager] Frame 0
class LoadManager
{
static var inst;
var loader, loadedClips, numLoading, clipsWaitingToLoad, currTotalBytes, xPos, yPos, cbo;
function LoadManager () {
loader = new SwfLoader(this);
loadedClips = new Array();
numLoading = 0;
clipsWaitingToLoad = new Array();
currTotalBytes = 0;
}
static function getInstance() {
if (inst == null) {
inst = new LoadManager();
}
return(inst);
}
function callBack(theClip) {
theClip._x = xPos;
theClip._y = yPos;
loadedClips.push(theClip);
var _local4 = cbo;
numLoading--;
if (clipsWaitingToLoad.length > 0) {
var _local2 = clipsWaitingToLoad.shift();
xPos = _local2.x;
yPos = _local2.y;
cbo = _local2.cbo;
loader.load(_local2.url, _local2.loadingClip);
numLoading++;
}
if (_local4) {
_local4(theClip);
}
}
function loadSWF(theOwner, theURL, theInstance, theDepth, theX, theY, theCallBack, theLockRoot) {
var _local3 = loader.preload(theOwner, theInstance, theDepth, theLockRoot);
if (numLoading == 0) {
xPos = theX;
yPos = theY;
cbo = theCallBack;
loader.load(theURL, _local3);
numLoading++;
} else {
var _local2 = new Object();
_local2.url = theURL;
_local2.loadingClip = _local3;
_local2.x = theX;
_local2.y = theY;
_local2.cbo = theCallBack;
clipsWaitingToLoad.push(_local2);
}
return(_local3);
}
function getLoadingClips() {
return(numLoading);
}
function isClipLoaded(theClip) {
var _local2 = loadedClips.length - 1;
while (_local2 >= 0) {
if (loadedClips[_local2] == theClip) {
return(true);
}
_local2--;
}
return(false);
}
function unloadClip(theClip) {
var _local2 = loadedClips.length - 1;
while (_local2 >= 0) {
if (loadedClips[_local2] == theClip) {
loadedClips.splice(_local2, 1);
theClip.removeMovieClip();
return(true);
}
_local2--;
}
return(false);
}
}
Symbol 135 MovieClip [__Packages.SwfLoader] Frame 0
class SwfLoader extends MovieClipLoader
{
var cbo, listener, addListener, loadClip;
function SwfLoader (theCallBackObject) {
super();
cbo = theCallBackObject;
listener = new Object();
listener._parent = this;
listener.onLoadComplete = function (target_mc) {
};
listener.onLoadProgress = function (target_mc, loadedBytes, totalBytes) {
this._parent.cbo.currTotalBytes = totalBytes;
};
listener.onLoadInit = function (target_mc) {
this._parent.cbo.callBack(target_mc);
};
listener.onLoadError = function (target_mc, errorCode) {
};
addListener(listener);
}
function debug(theString) {
_root._global.debug(theString);
}
function preload(parentClip, theInstance, theDepth, theLockRoot) {
var _local1 = parentClip.createEmptyMovieClip(theInstance, theDepth);
_local1._x = 10000;
_local1._y = 10000;
if (theLockRoot != undefined) {
_local1._lockroot = theLockRoot;
} else {
_local1._lockroot = true;
}
return(_local1);
}
function load(theURL, theClip) {
loadClip(theURL, theClip);
}
}
Symbol 136 MovieClip [__Packages.GameManager] Frame 0
class GameManager extends MovieClip
{
var loadMgr, sndMgr, numGames, titleTexts, authorTexts, infoTexts, linkTexts, versions, dimensions, versionVars, actionMenu, currGameID, asV, lb, handheld, selectorUI, bkgnd, introMovie, preloader, getURL, removeMovieClip, actionEnabled, currGame;
function GameManager () {
super();
loadMgr = LoadManager.getInstance();
sndMgr = SoundManager.getInstance();
numGames = NUM_GAMES;
titleTexts = new Array();
authorTexts = new Array();
infoTexts = new Array();
linkTexts = new Array();
versions = new Array();
var _local3 = 0;
while (_local3 <= numGames) {
if (_local3 == 0) {
titleTexts.push("");
authorTexts.push("");
infoTexts.push("");
linkTexts.push("");
} else {
titleTexts.push(GameManager[("P_" + _local3) + "_T"]);
authorTexts.push(GameManager[("P_" + _local3) + "_A"]);
infoTexts.push(GameManager[("P_" + _local3) + "_I"]);
linkTexts.push(GameManager[("P_" + _local3) + "_L"]);
}
_local3++;
}
dimensions = ["", {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}, {w:640, h:480}];
}
static function getInstance() {
if (inst == null) {
inst = new GameManager();
}
return(inst);
}
function init(currGameID, asV, lb) {
versionVars = new GameVars("versions.txt");
_root.attachMovie("mask", "mask_left", MASK_DEPTH, {_x:MASK_L_X, _y:MASK_L_Y});
_root.attachMovie("mask", "mask_right", MASK_DEPTH + 1, {_x:MASK_R_X, _y:MASK_R_Y});
actionMenu = ActionMenu(_root.attachMovie("actionmenu", "actionMenu", ACTIONMENU_DEPTH));
this.currGameID = reverseLookup(currGameID);
this.asV = asV;
this.lb = lb;
handheld = Handheld(_root.attachMovie("handheld", "handheld", HANDHELD_DEPTH));
handheld._visible = true;
selectorUI = Selector(_root.attachMovie("selector", "selector", SELECTOR_DEPTH));
selectorUI.init(numGames, handheld, this.currGameID, asV);
bkgnd = Background(_root.attachMovie("background", "background", BACKGROUND_DEPTH));
bkgnd._visible = true;
var _local3 = ((this.asV == 2) ? "intro_.swf" : "intro.swf");
introMovie = loadMgr.loadSWF(_root, _local3, "introMovie", GAME_DEPTH, 0, 0, null, true);
preloader = _root.attachMovie("preloader", "preloader_mc", PRELOADER_DEPTH, {_x:PRELOADER_X, _y:PRELOADER_Y, loaded_mc:introMovie});
}
function reverseLookup(gameID) {
var _local2 = 1;
while (_local2 < remapArray.length) {
if (remapArray[_local2] == gameID) {
return(_local2);
}
_local2++;
}
return(0);
}
function setVersions() {
versions.push(0);
var _local2 = 1;
while (_local2 <= NUM_GAMES) {
var _local3 = versionVars["game" + remapArray[_local2]];
versions.push(((_local3 > 0) ? (_local3) : 1));
_local2++;
}
}
function sndToggle() {
sndMgr.mute();
}
function bgSndToggle() {
_root.toggleBgSnd();
}
function selectorClick(who) {
selectorUI.arrowClick(who);
}
function gameClick(who) {
handheld.gameSelected(who);
}
function handheldReady() {
selectorUI._visible = true;
selectorUI.showGames();
}
function handheldAway() {
loadGame();
}
function launchGame(gameID) {
if (gameID != ANTFACTOR_PROMO) {
_root.stopBgSound();
selectorUI.hide();
currGameID = gameID;
} else {
getURL(linkTexts[ANTFACTOR_PROMO], "_blank");
}
}
function clearStage() {
handheld.hide();
bkgnd.hide();
}
function gameDone() {
if (introMovie != null) {
removeMovieClip();
preloader = null;
introMovie = null;
if (asV > 0) {
_global.setTimeout(this, "loadGame", 1000);
} else {
bkgnd.show();
handheld.show();
}
} else if (actionEnabled) {
Stage.displayState = "normal";
actionMenu.hideMenu();
bkgnd.show();
handheld.show();
_global.setTimeout(this, "cleanUp", 1000);
}
}
function enableConsole() {
actionMenu._visible = true;
}
function disableConsole() {
actionMenu._visible = false;
}
function cleanUp() {
Mouse.show();
_root._quality = "high";
loadMgr.unloadClip(currGame);
currGame = null;
_root.startBgSound();
}
function resetGame() {
if (currGameID != 0) {
currGame.reset();
}
}
function getGameInfo(gameID) {
return(infoTexts[gameID]);
}
function getGameLink(gameID) {
return(linkTexts[gameID]);
}
function gameLoaded() {
_global.setTimeout(mx.utils.Delegate.create(this, delayedStart), 1500);
}
function delayedStart() {
preloader = null;
actionEnabled = true;
currGame.start();
}
function callSetGameLink(gameID) {
if (flash.external.ExternalInterface.available) {
try {
flash.external.ExternalInterface.call("setGameLink", remapArray[gameID]);
} catch(error:Error) {
}
}
}
function loadGame() {
if ((((currGameID > 10) && (currGameID < 16)) || (currGameID == 18)) || (currGameID == 28)) {
var _local3 = "?gameID=" + remapArray[currGameID];
_local3 = _local3 + ((lb == 0) ? "&lb=0&as=3" : "&as=3");
getURL(_local3, "_self");
} else {
var _local7 = dimensions[currGameID].w;
var _local6 = dimensions[currGameID].h;
var _local5 = Math.floor((STAGE_WIDTH - _local7) / 2);
var _local4 = Math.floor((STAGE_HEIGHT - _local6) / 2);
currGame = loadMgr.loadSWF(_root, (("game" + remapArray[currGameID]) + ".swf?") + versions[currGameID], "game" + currGameID, GAME_DEPTH, _local5, _local4, mx.utils.Delegate.create(this, gameLoaded));
preloader = _root.attachMovie("preloader", "preloader_mc", PRELOADER_DEPTH, {_x:PRELOADER_X, _y:PRELOADER_Y, loaded_mc:currGame});
if (currGameID != 99) {
actionMenu.showTitle(titleTexts[currGameID], authorTexts[currGameID], linkTexts[currGameID]);
actionMenu._visible = true;
actionEnabled = false;
}
}
}
static var STAGE_WIDTH = 640;
static var STAGE_HEIGHT = 480;
static var STAGE_MID_X = Math.floor(STAGE_WIDTH / 2);
static var STAGE_MID_Y = Math.floor(STAGE_HEIGHT / 2);
static var MASK_DEPTH = 10000;
static var MASK_R_X = 640;
static var MASK_R_Y = 0;
static var MASK_L_X = -640;
static var MASK_L_Y = 0;
static var ACTIONMENU_DEPTH = 5000;
static var SCREENSHOT_DEPTH = 2700;
static var HANDHELD_DEPTH = 2500;
static var SELECTOR_DEPTH = 2400;
static var BACKGROUND_DEPTH = 2300;
static var GAME_DEPTH = 1000;
static var PRELOADER_DEPTH = 500;
static var PRELOADER_X = 252;
static var PRELOADER_Y = 222;
static var inst = null;
static var ANTFACTOR_PROMO = 29;
static var NUM_GAMES = 29;
static var P_1_T = "\"Factory Balls\"";
static var P_1_A = "...by Bart Bonte";
static var P_1_I = "\"Factory Balls\"\n ...by Bart Bonte";
static var P_1_L = "http://home.scarlet.be/~bbonte/";
static var P_2_T = "\"Roll\"";
static var P_2_A = "...by Ben Gillbanks";
static var P_2_I = "\"Roll\"\n ...by Ben Gillbanks";
static var P_2_L = "http://www.binarysun.co.uk/";
static var P_3_T = "\"The Tall Stump\"";
static var P_3_A = "...by Team MAW";
static var P_3_I = "\"The Tall Stump\"\n ...by Team MAW (Adam Wilkinson, Alex May\n and Handre DeJager)";
static var P_3_L = "";
static var P_4_T = "\"Absolute Awesome Ball Game\"";
static var P_4_A = "...by Felix Reidl";
static var P_4_I = "\"Absolute Awesome Ball Game\"\n ...by Felix Reidl";
static var P_4_L = "http://www.moomug.com";
static var P_5_T = "\"Day of the Bobteds\"";
static var P_5_A = "...by Rob Allen";
static var P_5_I = "\"Day of the Bobteds\"\n ...by Rob Allen";
static var P_5_L = "http://foon.co.uk";
static var P_6_T = "\"Mr. MothBall\"";
static var P_6_A = "...by Mateusz Skutnik";
static var P_6_I = "\"Mr. MothBall\"\n ...by Mateusz Skutnik";
static var P_6_L = "http://www.pastelstories.com";
static var P_7_T = "\"Save the Planet\"";
static var P_7_A = "...by Rob Gray";
static var P_7_I = "\"Save the Planet\"\n ...by Rob Gray";
static var P_7_L = "";
static var P_8_T = "\"The Perfect Shot\"";
static var P_8_A = "...by Dan Black";
static var P_8_I = "\"The Perfect Shot\"\n ...by Dan Black";
static var P_8_L = "";
static var P_9_T = "\"Stranded\"";
static var P_9_A = "...by Bart Koning";
static var P_9_I = "\"Stranded\"\n ...by Bart Koning";
static var P_9_L = "http://www.tsuken.nl/";
static var P_10_T = "\"Angular Momentum\"";
static var P_10_A = "...by Robert Berrier and Roland Ariens";
static var P_10_I = "\"Angular Momentum\"\n ...by Robert Berrier and Roland Ariens";
static var P_10_L = "";
static var P_11_T = "\"Kaichou\"";
static var P_11_A = "...by Ali Maunder";
static var P_11_I = "\"Kaichou\"\n ...by Ali Maunder";
static var P_11_L = "http://www.varstudios.com";
static var P_12_T = "\"Koogel\"";
static var P_12_A = "...by Monsterkodi";
static var P_12_I = "\"Koogel\"\n ...by Monsterkodi";
static var P_12_L = "";
static var P_13_T = "\"Osmosis\"";
static var P_13_A = "...by Phillip Reagan";
static var P_13_I = "\"Osmosis\"\n ...by Phillip Reagan";
static var P_13_L = "http://livingwithgames.com/";
static var P_14_T = "\"Space Kitteh\"";
static var P_14_A = "...by Zach Archer and Miles Johnson";
static var P_14_I = "\"Space Kitteh\"\n ...by Zach Archer and Miles Johnson";
static var P_14_L = "http://zacharcher.com/";
static var P_15_T = "\"Rmvblls\"";
static var P_15_A = "...by Eduardo Omine";
static var P_15_I = "\"Rmvblls\"\n ...by Eduardo Omine";
static var P_15_L = "http://www.omine.net/";
static var P_16_T = "\"Contour\"";
static var P_16_A = "...by Sean Hawkes";
static var P_16_I = "\"Contour\"\n ...by Sean Hawkes";
static var P_16_L = "http://www.seansh.com";
static var P_17_T = "\"Skyblocs\"";
static var P_17_A = "...by Tom Methven";
static var P_17_I = "\"Skyblocs\"\n ...by Tom Methven";
static var P_17_L = "http://www.thefirstdoor.co.uk";
static var P_18_T = "\"Ballonius\"";
static var P_18_A = "...by Aaron Cox and Graham Jans";
static var P_18_I = "\"Ballonius\"\n ...by Aaron Cox and Graham Jans";
static var P_18_L = "";
static var P_19_T = "\"Balancing Act\"";
static var P_19_A = "...by Carl Foust";
static var P_19_I = "\"Balancing Act\"\n ...by Carl Foust";
static var P_19_L = "";
static var P_20_T = "\"Jig Easy, Sam\"";
static var P_20_A = "...by Matt Slaybaugh";
static var P_20_I = "\"Jig Easy, Sam\"\n ...by Matt Slaybaugh";
static var P_20_L = "http://skeptictank.net/";
static var P_21_T = "\"Ballrooms\"";
static var P_21_A = "...by Dom Camus";
static var P_21_I = "\"Ballrooms\"\n ...by Dom Camus";
static var P_21_L = "";
static var P_22_T = "\"Ballistic Wars\"";
static var P_22_A = "...by Wan Hazmer";
static var P_22_I = "\"Ballistic Wars\"\n ...by Wan Hazmer";
static var P_22_L = "http://www.easyonlygames.com/";
static var P_23_T = "\"Chap Hai - Way of the Dragon\"";
static var P_23_A = "...by WildSnake Software";
static var P_23_I = "\"Chap Hai - Way of the Dragon\"\n ...by WildSnake Software";
static var P_23_L = "http://www.wildsnake.com";
static var P_24_T = "\"Particle Blaster\"";
static var P_24_A = "...by Gareth Thomas";
static var P_24_I = "\"Particle Blaster\"\n ...by Gareth Thomas";
static var P_24_L = "http://www.thegamehomepage.com/";
static var P_25_T = "\"Fluke Ball\"";
static var P_25_A = "...by Andrew Paradise and Georg Pedersen";
static var P_25_I = "\"Fluke Ball\"\n ...by Andrew Paradise and Georg Pedersen";
static var P_25_L = "http://andrewparadise.com";
static var P_26_T = "\"Bug Bug in Sky Tower\"";
static var P_26_A = "...by Aqui Griffin";
static var P_26_I = "\"Bug Bug in Sky Tower\"\n ...by Aqui Griffin";
static var P_26_L = "http://aquigriffin.com/";
static var P_27_T = "\"Bisection Dominion\"";
static var P_27_A = "...by Guilherme S. T\u00F6ws";
static var P_27_I = "\"Bisection Dominion\"\n ...by Guilherme S. T\u00F6ws";
static var P_27_L = "http://www.breadbros.com/";
static var P_28_T = "\"Entropic Space\"";
static var P_28_A = "...by Will Emigh, Ian Pottmeyer & Rory Starks";
static var P_28_I = "\"Entropic Space\"\n ...by W. Emigh, I. Pottmeyer & R. Starks";
static var P_28_L = "http://studiocypher.com";
static var P_29_T = "\"Antfactor\"";
static var P_29_A = "...by Antfactor";
static var P_29_I = "Background music, loops and sound effects\n ...by Antfactor";
static var P_29_L = "http://antfactor.com";
var remapArray = [0, 2, 3, 4, 7, 8, 9, 10, 14, 15, 16, 18, 19, 21, 24, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 39, 41, 42, 48, 50];
}
Symbol 137 MovieClip [__Packages.SoundManager] Frame 0
class SoundManager
{
static var inst;
var currSoundID, sounds, sound_mcs, soundsVolume, soundsFadingIn, soundsFadingOut, global_sound, global_volume, soundLibrary;
function SoundManager () {
currSoundID = 0;
sounds = new Array();
sound_mcs = new Array();
soundsVolume = new Array();
soundsFadingIn = new Array();
soundsFadingOut = new Array();
global_sound = new Sound();
global_volume = 100;
soundLibrary = _root.createEmptyMovieClip("soundLib", _root.getNextHighestDepth());
}
function fader() {
getInstance().sFader();
}
function sFader() {
if (soundsFadingIn.length > 0) {
var _local2 = soundsFadingIn.length;
while (_local2 >= 0) {
increaseVolume(soundsFadingIn[_local2]);
if (getSoundVolume(soundsFadingIn[_local2]) == 100) {
soundsFadingIn.splice(_local2, 1);
}
_local2--;
}
}
if (soundsFadingOut.length > 0) {
var _local2 = soundsFadingOut.length;
while (_local2 >= 0) {
decreaseVolume(soundsFadingOut[_local2]);
if (getSoundVolume(soundsFadingOut[_local2]) == 0) {
stop(soundsFadingOut[_local2]);
soundsFadingOut.splice(_local2, 1);
}
_local2--;
}
}
}
function fadeOutSound(theSoundID) {
soundsFadingOut.push(theSoundID);
}
function fadeInSound(theSoundID, loop) {
play(theSoundID, loop, false);
soundsFadingIn.push(theSoundID);
}
static function getInstance() {
if (inst == null) {
inst = new SoundManager();
}
return(inst);
}
function load(theURL, isStreaming, theCallBack) {
var _local3 = soundLibrary.createEmptyMovieClip("sndHolder" + currSoundID, soundLibrary.getNextHighestDepth());
var _local2 = new Sound(_local3);
if (theCallBack) {
_local2.onLoad = theCallBack;
}
_local2.loadSound(theURL, isStreaming);
sounds[currSoundID] = _local2;
sound_mcs[currSoundID] = _local3;
soundsVolume[currSoundID] = 100;
return(currSoundID++);
}
function play(theSoundID, loop, multi) {
var _local2 = ((loop != null) ? (loop) : 0);
var _local3 = ((multi != null) ? (multi) : true);
if (!_local3) {
sounds[theSoundID].stop();
}
sounds[theSoundID].start(0, _local2);
}
function stop(theSoundID) {
sounds[theSoundID].stop();
}
function changeVolume(theDelta, theSoundID) {
var _local4;
var _local2;
if (theSoundID != null) {
_local4 = sounds[theSoundID];
_local2 = soundsVolume[theSoundID];
} else {
_local4 = global_sound;
_local2 = global_volume;
}
_local2 = Math.min(100, _local2 + theDelta);
_local2 = Math.max(0, _local2);
_local4.setVolume(_local2);
if (theSoundID != null) {
soundsVolume[theSoundID] = _local2;
} else {
global_volume = _local2;
}
return(_local2);
}
function increaseVolume(theSoundID) {
return(changeVolume(VOLUME_DELTA, theSoundID));
}
function decreaseVolume(theSoundID) {
return(changeVolume(-VOLUME_DELTA, theSoundID));
}
function mute(theSoundID) {
var _local2;
var _local3;
if (theSoundID != null) {
_local2 = sounds[theSoundID];
_local3 = soundsVolume[theSoundID];
} else {
_local2 = global_sound;
_local3 = global_volume;
}
if (_local2.getVolume() > 0) {
_local2.setVolume(0);
return(0);
}
_local2.setVolume(_local3);
return(_local3);
}
function isMuted(theSoundID) {
var _local2;
if (theSoundID != null) {
_local2 = sounds[theSoundID];
} else {
_local2 = global_sound;
}
if (_local2.getVolume() > 0) {
return(false);
}
return(true);
}
function getSoundVolume(theSoundID) {
if ((theSoundID != null) && (soundsVolume[theSoundID] != null)) {
return(soundsVolume[theSoundID]);
}
return(global_volume);
}
static var VOLUME_DELTA = 5;
}
Symbol 138 MovieClip [__Packages.GameVars] Frame 0
class GameVars extends LoadVars
{
var varFile, load;
function GameVars (aFile) {
super();
varFile = aFile;
load(varFile);
}
function onLoad(aSuccess) {
if (aSuccess) {
GameManager.getInstance().setVersions();
}
}
}
Symbol 139 MovieClip [__Packages.ActionMenu] Frame 0
class ActionMenu extends MovieClip
{
var _visible, menu_mc, _x, _y, _parent, onEnterFrame, restPosition, enterFrameHandler, onRollOver;
function ActionMenu () {
super();
_visible = false;
var _local3 = new TextField.StyleSheet();
_local3.setStyle("a:hover", {color:"#ffffff"});
_local3.setStyle("a", {color:"#cccccc"});
_local3.setStyle("a:link", {color:"#cccccc"});
_local3.setStyle("a:active", {color:"#cccccc"});
_local3.setStyle("a:visited", {color:"#cccccc"});
menu_mc.puzzleAuthor_txt.styleSheet = _local3;
_x = 0;
_y = ACTION_MENU_HIDE;
setSound();
}
function setSound() {
if (SoundManager.getInstance().isMuted()) {
menu_mc.soundOn_btn._visible = false;
menu_mc.soundOff_btn._visible = true;
} else {
menu_mc.soundOff_btn._visible = false;
menu_mc.soundOn_btn._visible = true;
}
}
function soundon() {
_visible = false;
_parent.soundOff_btn._visible = true;
SoundManager.getInstance().mute();
}
function soundoff() {
_visible = false;
_parent.soundOn_btn._visible = true;
SoundManager.getInstance().mute();
}
function addEventListeners() {
menu_mc.onRollOver = showMenu;
menu_mc.reset_btn.onRelease = resetClickListener;
menu_mc.menu_btn.onRelease = quitClickListener;
onEnterFrame = onEveryFrame;
setSound();
menu_mc.soundOn_btn.onRelease = soundon;
menu_mc.soundOff_btn.onRelease = soundoff;
}
function removeEventListeners() {
delete menu_mc.reset_btn.onRelease;
delete menu_mc.menu_btn.onRelease;
delete menu_mc.soundOn_btn.onRelease;
delete menu_mc.soundOff_btn.onRelease;
}
function resetClickListener() {
GameManager.getInstance().resetGame();
}
function quitClickListener() {
GameManager.getInstance().gameDone();
}
function showTitle(titleText, authorText, linkText) {
showDelay = true;
menu_mc.puzzleTitle_txt.text = titleText;
if (linkText != "") {
menu_mc.puzzleAuthor_txt.text = ((("<a href=\"" + linkText) + "\" target=\"_blank\">") + authorText) + "</a>";
} else {
menu_mc.puzzleAuthor_txt.text = authorText;
}
restPosition = ACTION_MENU_SHOW;
enterFrameHandler = rollDown;
_global.setTimeout(this, "hideTitle", 3500);
addEventListeners();
}
function onEveryFrame() {
if (enterFrameHandler != null) {
enterFrameHandler();
}
}
function hideTitle() {
showDelay = false;
enterFrameHandler = idle;
}
function rollDown() {
if (showDelay || (testWithin())) {
var _local2 = Math.abs(_y);
if (_local2 == 0) {
enterFrameHandler = idle;
} else if (_local2 > 10) {
_y = _y + 8;
} else if (_local2 < 5) {
_y = _y + 1;
} else {
_y = _y + 5;
}
} else if (!showDelay) {
enterFrameHandler = rollUp;
}
}
function rollUp() {
if ((!testWithin()) || (restPosition == ACTION_MENU_HIDE)) {
var _local2 = _y - restPosition;
if (_local2 == 0) {
delete onEnterFrame;
menu_mc.onRollOver = showMenu;
} else if (_local2 > 10) {
_y = _y - 8;
} else if (_local2 < 5) {
_y = _y - 1;
} else {
_y = _y - 5;
}
} else {
enterFrameHandler = rollDown;
}
}
function idle() {
if ((!testWithin()) && (!showDelay)) {
enterFrameHandler = rollUp;
}
}
function testWithin() {
if (menu_mc.hitTest(_root._xmouse, _root._ymouse, false)) {
return(true);
}
return(false);
}
function showMenu() {
enterFrameHandler = rollDown;
delete onRollOver;
_parent.onEnterFrame = _parent.onEveryFrame;
}
function hideMenu() {
removeEventListeners();
showDelay = false;
restPosition = ACTION_MENU_HIDE;
enterFrameHandler = rollUp;
onEnterFrame = onEveryFrame;
}
static var ACTION_MENU_HIDE = -100;
static var ACTION_MENU_SHOW = -61;
var showDelay = false;
var mouseWithin = false;
}
Symbol 140 MovieClip [__Packages.Handheld] Frame 0
class Handheld extends MovieClip
{
static var ROBOT_J, ROBOT_I, ROBOT_G, HANDHELD_IN, HANDHELD_OUT;
var _visible, _x, _y, numGames, infoText, attachMovie, gameInfoCSS, musicIcon_mc, screensArray, currentScreen, analogstick_btn, getURL, _name, cg_btn, nitrome_btn, sierra_btn, switchball_btn, at_btn, fwg_btn, ag_btn, j_btn, i_btn, g_btn, sndToggle_btn, bgSndToggle_btn, aniBeginTime, onEnterFrame, speakerIcon_mc, gotoAndPlay, _currentframe;
function Handheld () {
super();
_visible = false;
_x = 1;
_y = ANI_INITIAL_POS;
numGames = GameManager.NUM_GAMES;
ROBOT_J = new Sound(this);
ROBOT_J.attachSound("robot_j");
ROBOT_J.setVolume(50);
ROBOT_I = new Sound(this);
ROBOT_I.attachSound("robot_i");
ROBOT_I.setVolume(50);
ROBOT_G = new Sound(this);
ROBOT_G.attachSound("robot_g");
ROBOT_G.setVolume(50);
HANDHELD_IN = new Sound(this);
HANDHELD_IN.attachSound("handheld_in");
HANDHELD_IN.setVolume(50);
HANDHELD_OUT = new Sound(this);
HANDHELD_OUT.attachSound("handheld_out");
HANDHELD_OUT.setVolume(50);
initScreens();
infoText = attachMovie("infoText", "infoText", SCREEN_DEPTH, {_x:SCREEN_HIDE_X, _y:INFO_TEXT_Y});
gameInfoCSS = new TextField.StyleSheet();
gameInfoCSS.setStyle("a:hover", {color:"#D6FF74"});
gameInfoCSS.setStyle("a", {color:"#67B442"});
gameInfoCSS.setStyle("a:link", {color:"#67B442"});
gameInfoCSS.setStyle("a:active", {color:"#67B442"});
gameInfoCSS.setStyle("a:visited", {color:"#67B442"});
infoText.gameinfo.styleSheet = gameInfoCSS;
if (!_root.isBgSnd) {
musicIcon_mc.gotoAndPlay("off");
}
}
function initScreens() {
screensArray = new Array();
screensArray.push("dummyval");
currentScreen = 0;
var _local3;
var _local2 = 1;
while (_local2 <= numGames) {
_local3 = LoadManager.getInstance().loadSWF(this, ("images/game" + GameManager.getInstance().remapArray[_local2]) + "_lg.png", "screen" + _local2, SCREEN_DEPTH++, SCREEN_HIDE_X, SCREEN_Y, null);
screensArray.push(_local3);
_local2++;
}
screensArray[0] = LoadManager.getInstance().loadSWF(this, "images/replay.png", "screen0", SCREEN_DEPTH++, SCREEN_HIDE_X, SCREEN_Y, null);
}
function showScreen(gameID) {
if (currentScreen != 0) {
delete screensArray[currentScreen].onRelease;
screensArray[currentScreen]._x = SCREEN_HIDE_X;
}
currentScreen = gameID;
screensArray[currentScreen].onRelease = handleClick;
screensArray[currentScreen]._x = SCREEN_SHOW_X;
var _local2 = GameManager.getInstance().getGameLink(gameID);
infoText.gameinfo.text = GameManager.getInstance().getGameInfo(gameID);
if (_local2 != "") {
infoText.gameinfo.text = infoText.gameinfo.text + (((("\n<a href=\"" + _local2) + "\" target=\"_blank\">") + _local2) + "</a>");
}
infoText._x = SCREEN_SHOW_X;
analogstick_btn.onRelease = handleClick;
}
function handleURL(theURL) {
getURL(theURL, "_blank");
}
function handleClick() {
GameManager.getInstance().gameClick(_name);
}
function gameSelected(name) {
if (currentScreen != 0) {
delete screensArray[currentScreen].onRelease;
GameManager.getInstance().launchGame(currentScreen);
}
}
function addEvents() {
cg_btn.onRelease = function () {
this._parent.handleURL("http://jayisgames.com/");
};
nitrome_btn.onRelease = function () {
this._parent.handleURL("http://www.nitrome.com/");
};
sierra_btn.onRelease = function () {
this._parent.handleURL("http://www.switchball.com/");
};
switchball_btn.onRelease = function () {
this._parent.handleURL("http://www.switchball.com/");
};
at_btn.onRelease = function () {
this._parent.handleURL("http://www.arcadetown.com/?aid=1129599");
};
fwg_btn.onRelease = function () {
this._parent.handleURL("http://www.freeworldgroup.com/");
};
ag_btn.onRelease = function () {
this._parent.handleURL("http://www.armorgames.com/");
};
j_btn.onRelease = function () {
Handheld.ROBOT_J.start();
};
i_btn.onRelease = function () {
Handheld.ROBOT_I.start();
};
g_btn.onRelease = function () {
Handheld.ROBOT_G.start();
};
sndToggle_btn.onRelease = function () {
GameManager.getInstance().sndToggle();
this._parent.speakerIcon_mc.gotoAndPlay(this._parent.speakerIcon_mc._currentFrame + 1);
};
bgSndToggle_btn.onRelease = function () {
GameManager.getInstance().bgSndToggle();
this._parent.musicIcon_mc.gotoAndPlay(this._parent.musicIcon_mc._currentFrame + 1);
};
}
function deleteEvents() {
delete cg_btn.onRelease;
delete nitrome_btn.onRelease;
delete sierra_btn.onRelease;
delete switchball_btn.onRelease;
delete at_btn.onRelease;
delete fwg_btn.onRelease;
delete ag_btn.onRelease;
delete j_btn.onRelease;
delete i_btn.onRelease;
delete g_btn.onRelease;
delete sndToggle_btn.onRelease;
}
function show() {
HANDHELD_IN.start();
aniBeginTime = new Date().valueOf();
onEnterFrame = easeIn;
addEvents();
updateSpeakerIcon();
}
function updateSpeakerIcon() {
if (SoundManager.getInstance().isMuted()) {
speakerIcon_mc.gotoAndStop("off");
} else {
speakerIcon_mc.gotoAndStop("on");
}
}
function hide() {
aniBeginTime = new Date().valueOf();
onEnterFrame = easeOut;
deleteEvents();
HANDHELD_OUT.start();
}
function easeIn(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeOut(_local3, ANI_INITIAL_POS, -ANI_DELTA_POS, ANI_IN_DURATION);
if (_local2 < ANI_FINAL_POS) {
delete onEnterFrame;
_y = ANI_FINAL_POS;
gotoAndPlay(_currentframe + 1);
GameManager.getInstance().handheldReady();
} else {
_y = _local2;
}
}
function easeOut(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeIn(_local3, ANI_FINAL_POS, ANI_DELTA_POS, ANI_OUT_DURATION);
if (_local2 > ANI_INITIAL_POS) {
delete onEnterFrame;
_y = ANI_INITIAL_POS;
GameManager.getInstance().handheldAway();
screensArray[currentScreen]._x = SCREEN_HIDE_X;
infoText._x = SCREEN_HIDE_X;
currentScreen = 0;
} else {
_y = _local2;
}
}
static var HANDHELD_READY = "ready";
static var HANDHELD_AWAY = "away";
static var ANI_IN_DURATION = 1350;
static var ANI_OUT_DURATION = 1000;
static var ANI_INITIAL_POS = 481;
static var ANI_FINAL_POS = 117;
static var ANI_DELTA_POS = Math.abs(ANI_INITIAL_POS - ANI_FINAL_POS);
static var SCREEN_DEPTH = 1;
static var SCREEN_HIDE_X = -1000;
static var SCREEN_SHOW_X = 176;
static var SCREEN_Y = 35;
static var INFO_TEXT_Y = 221;
}
Symbol 141 MovieClip [__Packages.com.robertpenner.easing.Cubic] Frame 0
class com.robertpenner.easing.Cubic
{
function Cubic () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return((((c * t) * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return((c * (((t * t) * t) + 1)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return(((((c / 2) * t) * t) * t) + b);
}
t = t - 2;
return(((c / 2) * (((t * t) * t) + 2)) + b);
}
}
Symbol 142 MovieClip [__Packages.Background] Frame 0
class Background extends MovieClip
{
var _visible, gotoAndPlay;
function Background () {
super();
_visible = false;
}
function show() {
gotoAndPlay("show");
}
function hide() {
gotoAndPlay("hide");
}
}
Symbol 143 MovieClip [__Packages.Cart] Frame 0
class Cart extends MovieClip
{
static var filter, myFilters, CART_FALL;
var myParent, gameID, useHandCursor, clip, _y, filters, aniBeginTime, soundPlay, onEnterFrame;
function Cart () {
super();
}
function init(myParent, gameID) {
this.myParent = myParent;
this.gameID = gameID;
useHandCursor = true;
var _local2 = ("images/game" + GameManager.getInstance().remapArray[gameID]) + ".png";
clip = LoadManager.getInstance().loadSWF(this, _local2, "cart" + gameID, DEPTH, 15, 13, null);
filter = getBitmapFilter();
myFilters = new Array();
myFilters.push(filter);
CART_FALL = new Sound(this);
CART_FALL.attachSound("cart_fall");
CART_FALL.setVolume(40);
}
function getGameID() {
return(gameID);
}
function setAniPosition() {
_y = ANI_INITIAL_POS;
}
function select() {
filters = myFilters;
}
function deselect() {
filters = null;
}
function show(timeDelay) {
_global.setTimeout(this, "doShow", timeDelay);
}
function hide(timeDelay) {
_global.setTimeout(this, "doHide", timeDelay);
}
function doShow() {
aniBeginTime = new Date().valueOf();
soundPlay = false;
onEnterFrame = easeIn;
}
function doHide() {
aniBeginTime = new Date().valueOf();
onEnterFrame = easeOut;
}
function easeIn(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeOut(_local3, ANI_INITIAL_POS, ANI_DELTA_POS, ANI_IN_DURATION);
if (_local2 > ANI_FINAL_POS) {
delete onEnterFrame;
_y = ANI_FINAL_POS;
} else {
if ((Math.abs(_local2 - ANI_FINAL_POS) < 10) && (!soundPlay)) {
CART_FALL.start();
soundPlay = true;
}
_y = _local2;
}
}
function easeOut(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeIn(_local3, ANI_FINAL_POS, -ANI_DELTA_POS, ANI_OUT_DURATION);
if (_local2 < ANI_INITIAL_POS) {
delete onEnterFrame;
_y = ANI_INITIAL_POS;
} else {
_y = _local2;
}
}
static function getBitmapFilter() {
var _local2 = 14090100 /* 0xD6FF74 */;
var _local8 = 1;
var _local5 = 5;
var _local4 = 5;
var _local6 = 10;
var _local3 = false;
var _local7 = false;
var _local1 = 3;
return(new flash.filters.GlowFilter(_local2, _local8, _local5, _local4, _local6, _local1, _local3, _local7));
}
static var DEPTH = 0;
static var WIDTH = 99;
static var HEIGHT = 99;
static var ANI_IN_DURATION = 500;
static var ANI_OUT_DURATION = 250;
static var ANI_INITIAL_POS = -123;
static var ANI_FINAL_POS = 0;
static var ANI_DELTA_POS = Math.abs(ANI_INITIAL_POS - ANI_FINAL_POS);
}
Symbol 144 MovieClip [__Packages.Selector] Frame 0
class Selector extends MovieClip
{
var _visible, _x, _y, numGames, handheld, asV, selectedGameID, arrowButtons, attachMovie, getNextHighestDepth, aniIndex, selectedGameIndex, cartsArray, cartContainer, createEmptyMovieClip, centerIndex, cartContainerPos, cartContainerInitalPos, cartContainerFinalPos, _name, onEnterFrame, aniBeginTime;
function Selector () {
super();
_visible = false;
_x = POS_X;
_y = POS_Y;
}
function init(numGames, handheld, currGameID, asv) {
this.numGames = numGames;
this.handheld = handheld;
asV = asv;
selectedGameID = currGameID;
initCarts();
arrowButtons = attachMovie("arrows", "arrowButtons", getNextHighestDepth());
arrowButtons.arrow_l.buttonMode = true;
arrowButtons.arrow_r.buttonMode = true;
}
function initCarts() {
var _local9;
if (numGames > 8) {
_local9 = 1;
} else if (numGames > 4) {
_local9 = 2;
} else if (numGames > 2) {
_local9 = 3;
} else if (numGames > 1) {
_local9 = 5;
} else {
_local9 = 9;
}
aniIndex = Math.floor(((numGames * _local9) - NUM_SHOW) / 2);
var _local4 = new Array();
if (selectedGameID > 0) {
selectedGameIndex = (aniIndex + 2) % numGames;
_local4[selectedGameIndex] = selectedGameID;
} else {
selectedGameIndex = -1;
}
var _local6 = 0;
while (_local6 < numGames) {
while (_local4[_local6] == undefined) {
var _local7 = Math.floor((Math.random() * numGames) + 1);
var _local8 = false;
var _local2 = 0;
while (_local2 < numGames) {
if ((_local4[_local2] != undefined) && (_local4[_local2] == _local7)) {
_local8 = true;
break;
}
_local2++;
}
if ((!_local8) && (_local7 <= numGames)) {
_local4[_local6] = _local7;
}
}
_local6++;
}
cartsArray = new Array();
cartContainer = createEmptyMovieClip("cartContainer", getNextHighestDepth());
var _local3;
var _local2 = 0;
while (_local2 < _local9) {
var _local5 = 0;
while (_local5 < numGames) {
cartsArray.push(Cart(cartContainer.attachMovie("cart", ("cart" + _local2) + _local5, cartContainer.getNextHighestDepth())));
_local3 = cartsArray.length - 1;
cartsArray[_local3].init(this, _local4[_local5]);
cartsArray[_local3]._x = (_local3 * Cart.WIDTH) + (_local3 * PADDING);
if ((_local3 >= aniIndex) && (_local3 < (aniIndex + NUM_SHOW))) {
cartsArray[_local3].setAniPosition();
}
if (_local3 == (aniIndex + 2)) {
centerIndex = _local3;
}
cartsArray[_local3].onRelease = handleClick;
_local5++;
}
_local2++;
}
cartContainerPos = -((aniIndex * Cart.WIDTH) + (aniIndex * PADDING));
cartContainerInitalPos = cartContainerPos;
cartContainer._x = cartContainerPos;
cartContainerFinalPos = cartContainerPos;
}
function showGames() {
var _local3 = 0;
while (_local3 < NUM_SHOW) {
cartsArray[aniIndex + _local3].show((OFFSET_DELAY * _local3) + SHOW_DELAY);
_local3++;
}
showArrows();
enableDpad();
if ((selectedGameID > 0) && (asV == 0)) {
delaySelectID = _global.setTimeout(this, "selectInitialGame", 3500);
}
}
function selectInitialGame() {
cartsArray[selectedGameIndex].select();
arrowClick(cartsArray[aniIndex + 2]._name);
selectedGameIndex = -1;
selectedGameID = 0;
}
function enableDpad() {
if (!handheld.dpad_l) {
_global.setTimeout(this, "enableDpad", 100);
} else {
handheld.dpad_l.onRelease = handleClick;
handheld.dpad_r.onRelease = handleClick;
}
}
function handleClick() {
_global.clearTimeout(delaySelectID);
GameManager.getInstance().selectorClick(_name);
}
function hide() {
if (isAni) {
_global.setTimeout(this, "hide", 100);
} else {
var _local3 = 0;
while (_local3 < NUM_SHOW) {
cartsArray[(centerIndex + _local3) - 2].hide(OFFSET_DELAY * _local3);
_local3++;
}
hideArrows();
GameManager.getInstance().clearStage();
}
}
function doShowArrows() {
arrowButtons._visible = true;
}
function showArrows() {
_global.setTimeout(this, "doShowArrows", ARROW_DELAY);
arrowButtons.arrow_l.onRelease = handleClick;
arrowButtons.arrow_r.onRelease = handleClick;
}
function hideArrows() {
arrowButtons._visible = false;
delete arrowButtons.arrow_l.onRelease;
delete arrowButtons.arrow_r.onRelease;
}
function doMove() {
isAni = true;
if (moveCounter < 0) {
moveLeft(moveCounter);
} else if (moveCounter > 0) {
moveRight(moveCounter);
}
}
function moveLeft(numSpaces) {
cartContainerInitalPos = cartContainerPos;
onEnterFrame = easeInOut_left;
cartContainerFinalPos = cartContainerFinalPos + (numSpaces * ANI_DELTA_POS);
aniBeginTime = new Date().valueOf();
}
function moveRight(numSpaces) {
cartContainerInitalPos = cartContainerPos;
onEnterFrame = easeInOut_right;
cartContainerFinalPos = cartContainerFinalPos + (numSpaces * ANI_DELTA_POS);
aniBeginTime = new Date().valueOf();
}
function arrowClick(name) {
if (!isAni) {
_global.clearTimeout(intervalID);
switch (name) {
case "arrow_r" :
case "dpad_r" :
if (moveCounter > -2) {
moveCounter--;
selectCart(centerIndex - moveCounter);
} else {
selectCart((centerIndex - moveCounter) + 1);
cartContainer._x = (cartContainerPos = (cartContainerFinalPos = cartContainer._x - ANI_DELTA_POS));
rollQueueRight(1);
}
intervalID = _global.setTimeout(this, "doMove", SELECT_DELAY);
break;
case "arrow_l" :
case "dpad_l" :
if (moveCounter < 2) {
moveCounter++;
selectCart(centerIndex - moveCounter);
} else {
selectCart(centerIndex - (moveCounter + 1));
cartContainer._x = (cartContainerPos = (cartContainerFinalPos = cartContainer._x + ANI_DELTA_POS));
rollQueueLeft(1);
}
intervalID = _global.setTimeout(this, "doMove", SELECT_DELAY);
break;
default :
var _local4 = -1;
var _local3 = cartsArray.length - 1;
while (_local3 >= 0) {
if (cartsArray[_local3]._name == name) {
_local4 = _local3;
break;
}
_local3--;
}
if (_local4 == -1) {
break;
}
var _local6 = centerIndex - _local4;
selectCart(_local4);
if (_local6 == 0) {
break;
}
var _local7 = _local6 * ANI_DELTA_POS;
moveCounter = _local6;
doMove();
}
}
}
function selectCart(cartIndex) {
var _local2 = cartsArray.length - 1;
while (_local2 >= 0) {
cartsArray[_local2].deselect();
_local2--;
}
cartsArray[cartIndex].select();
handheld.showScreen(cartsArray[cartIndex].getGameID());
GameManager.getInstance().callSetGameLink(cartsArray[cartIndex].getGameID());
}
function rollQueueLeft(numCarts) {
var _local2 = 0;
while (_local2 < numCarts) {
cartsArray[cartsArray.length - 1]._x = cartsArray[0]._x - (Cart.WIDTH + PADDING);
cartsArray.unshift(cartsArray.pop());
_local2++;
}
}
function rollQueueRight(numCarts) {
var _local2 = 0;
while (_local2 < numCarts) {
cartsArray[0]._x = (cartsArray[cartsArray.length - 1]._x + Cart.WIDTH) + PADDING;
cartsArray.push(cartsArray.shift());
_local2++;
}
}
function easeInOut_left(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeInOut(_local3, cartContainerInitalPos, moveCounter * ANI_DELTA_POS, ANI_DURATION);
if (_local2 < cartContainerFinalPos) {
delete onEnterFrame;
cartContainer._x = (cartContainerPos = cartContainerFinalPos);
rollQueueRight(Math.abs(moveCounter));
moveCounter = 0;
isAni = false;
} else {
cartContainer._x = _local2;
}
}
function easeInOut_right(e) {
var _local3 = new Date().valueOf() - aniBeginTime;
var _local2 = com.robertpenner.easing.Cubic.easeInOut(_local3, cartContainerInitalPos, moveCounter * ANI_DELTA_POS, ANI_DURATION);
if (_local2 > cartContainerFinalPos) {
delete onEnterFrame;
cartContainer._x = (cartContainerPos = cartContainerFinalPos);
rollQueueLeft(Math.abs(moveCounter));
moveCounter = 0;
isAni = false;
} else {
cartContainer._x = _local2;
}
}
function getGlobalX(obj) {
var _local1 = new flash.geom.Point(0, 0);
obj.localToGlobal(_local1);
return(_local1.x);
}
function traceCartsArray() {
var _local3 = "";
var _local2 = 0;
while (_local2 < cartsArray.length) {
if (_local2 == centerIndex) {
_local3 = _local3 + ("[" + cartsArray[_local2].getGameID());
} else if (_local2 == (centerIndex + 1)) {
_local3 = _local3 + ("]" + cartsArray[_local2].getGameID());
} else {
_local3 = _local3 + ("_" + cartsArray[_local2].getGameID());
}
_local2++;
}
}
static var PADDING = 25;
static var NUM_SHOW = 5;
static var SHOW_DELAY = 500;
static var SELECT_DELAY = 250;
static var OFFSET_DELAY = 100;
static var ARROW_DELAY = 1500;
static var POS_X = 23;
static var POS_Y = 10;
static var ANI_DURATION = 1000;
static var ANI_DELTA_POS = Cart.WIDTH + PADDING;
var moveCounter = 0;
var intervalID = 0;
var delaySelectID = 0;
var isAni = false;
}
Symbol 145 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}