Frame 3
function load_oEF() {
var gBL = this.getBytesLoaded();
var gBT = this.getBytesTotal();
var p = (gBL / gBT);
blend._y = flame.getBounds(this).yMax - (flame._height * p);
percents = Math.round(100 * p) + " %";
if ((gBL >= gBT) && (gBT > 123)) {
delete this.onEnterFrame;
this.gotoAndStop("library");
}
}
function urlHandler(obj, item) {
getURL ("http://www.pastelgames.com");
}
function commentsHandler(obj, item) {
getURL ("http://www.pastelgames.com/index.php?dzial=comments&co=game&id=49");
}
function qualityHandler(obj, item) {
if (_quality == "HIGH") {
mHQ.customItems[2] = new ContextMenuItem(" Quality: toggle to HIGH", qualityHandler);
mHQ.customItems[2].separatorBefore = true;
_quality = "LOW";
} else {
mHQ.customItems[2] = new ContextMenuItem("Quality: toggle to LOW", qualityHandler);
mHQ.customItems[2].separatorBefore = true;
_quality = "HIGH";
}
}
var percents = "0 %";
this.onEnterFrame = load_oEF;
var mHQ = new ContextMenu();
mHQ.hideBuiltInItems();
mHQ.customItems[0] = new ContextMenuItem("\u00A9 pastelgames.com", urlHandler);
mHQ.customItems[1] = new ContextMenuItem("all rights reserved", urlHandler);
mHQ.customItems[1].enabled = false;
mHQ.customItems[2] = new ContextMenuItem("Quality: toggle to LOW", qualityHandler);
mHQ.customItems[2].separatorBefore = true;
this.menu = mHQ;
Stage.scaleMode = "noScale";
fscommand ("trapallkeys", true);
fscommand ("fullscreen", true);
var u = this._url;
if (u.substr(0, 4) == "file") {
this.createEmptyMovieClip("offlinemask", this.getNextHighestDepth());
var bd = (new flash.display.BitmapData(400, 570, false, 0));
this.offlinemask.attachBitmap(bd, 0);
this.setMask(this.offlinemask);
}
Frame 9
stop();
Frame 10
function EncrpytString(strVal) {
var strKey = "aHfEjcDebChGiAfIjDbEjacD";
var nLenKey = strKey.length;
var strZero = "0";
var strOut = "";
var nTot = strVal.length;
var nCntKey = 0;
var strOut = "";
var nCodeVal;
var nCodeKey;
var nTemp;
var nChecksum = 0;
nCnt = 0;
while (nCnt < nTot) {
nCodeVal = strVal.charCodeAt(nCnt);
if (nCodeVal >= 128) {
nCodeVal = "X";
}
nCodeKey = strKey.charCodeAt(nCntKey);
nCntKey = nCntKey + 1;
if (nCntKey >= nLenKey) {
nCntKey = 0;
}
nTemp = (nCodeVal % 16) + nCodeKey;
strOut = strOut + String.fromCharCode(nTemp);
nChecksum = nChecksum + nTemp;
nCodeKey = strKey.charCodeAt(nCntKey);
nCntKey = nCntKey + 1;
if (nCntKey >= nLenKey) {
nCntKey = 0;
}
nTemp = Math.floor(nCodeVal / 16) + nCodeKey;
strOut = strOut + String.fromCharCode(nTemp);
nChecksum = nChecksum + nTemp;
nCnt++;
}
nChecksum = nChecksum % 256;
nCodeKey = strKey.charCodeAt(nCntKey);
nCntKey = nCntKey + 1;
if (nCntKey >= nLenKey) {
nCntKey = 0;
}
nTemp = (nChecksum % 16) + nCodeKey;
strOut = strOut + String.fromCharCode(nTemp);
nCodeKey = strKey.charCodeAt(nCntKey);
nCntKey = nCntKey + 1;
if (nCntKey >= nLenKey) {
nCntKey = 0;
}
nTemp = Math.floor(nChecksum / 16) + nCodeKey;
strOut = strOut + String.fromCharCode(nTemp);
return(strOut);
}
function GetUrlParam(strUrl, strParam) {
var strUrlLC = strUrl.toLowerCase();
var nPos = strUrlLC.indexOf(strParam);
var nParamLen = strParam.length;
if (nPos > 0) {
var nNumChars;
var nPosEnd = strUrlLC.indexOf("&", nPos + nParamLen);
if (nPosEnd > 0) {
nNumChars = nPosEnd - nPos;
} else {
nNumChars = strUrl.length - nPos;
}
return(strUrl.substr(nPos + nParamLen, nNumChars));
}
return("");
}
function GetBaseUrl(strUrl) {
var strUrlLC = strUrl.toLowerCase();
var nNumChars = strUrlLC.length;
var nPos = strUrlLC.indexOf("?", 0);
if (nPos > 0) {
nNumChars = nPos;
}
var strVal = "download";
if (strUrlLC.substr(0, 4) == "http") {
strVal = strUrl.substr(7, nNumChars - 7);
}
return(strVal);
}
function startGame() {
gameMC._visible = true;
splashMC._visible = false;
events = {};
events.backToMenu = system.Delegate.create(this, showMenu);
events.saveScore = system.Delegate.create(this, saveScore);
events.tryAgain = system.Delegate.create(this, startGame);
events.comments = system.Delegate.create(this, getComments);
var game = new Bababalls_game(gameMC, events);
}
function getComments() {
getURL ("http://www.pastelgames.com/index.php?dzial=comments&co=game&id=52");
}
function downloadIt() {
getURL ((("http://www.arcadetown.com/partner/download.asp?gameid=ironworks&aid=" + _root.GetUrlParam(_url, "aid=")) + "&refer=") + _root.GetBaseUrl(_url), "_blank");
}
function saveScore(player, score) {
if (player == undefined) {
getURL ("http://www.arcadetown.com/ironworks/view_high_scores.asp", "_blank");
return(undefined);
}
var strOut = ((player + "|") + score);
var strOut2 = EncrpytString(strOut);
getURL ("http://www.arcadetown.com/ironworks/hs.asp?" + strOut2, "_blank");
showMenu();
}
function getMore() {
getURL ((("http://www.arcadetown.com/index.asp?gameid=ironworks&aid=" + GetUrlParam(_url, "aid=")) + "&refer=") + GetBaseUrl(_url), "_blank");
}
function enableSound(s) {
if (s) {
soundman.enable();
footer.p_enableSND._visible = false;
} else {
soundman.mute();
footer.p_enableSND._visible = true;
}
footer.p_disableSND._visible = !footer.p_enableSND._visible;
}
function showMenu() {
new extensions.movieclip.SimpleButton(splashMC.p_play, system.Delegate.create(this, startGame));
new extensions.movieclip.SimpleButton(splashMC.p_comment, system.Delegate.create(this, getComments));
new extensions.movieclip.SimpleButton(splashMC.p_score, system.Delegate.create(this, saveScore));
new extensions.movieclip.SimpleButton(splashMC.p_more, system.Delegate.create(this, getMore));
new extensions.movieclip.SimpleButton(splashMC.p_arcade, system.Delegate.create(this, getMore));
new extensions.movieclip.SimpleButton(splashMC.p_downl, system.Delegate.create(this, downloadIt));
new extensions.movieclip.SimpleButton(footer.p_enableSND, system.Delegate.create(this, enableSound, true));
new extensions.movieclip.SimpleButton(footer.p_disableSND, system.Delegate.create(this, enableSound, false));
gameMC._visible = false;
splashMC._visible = true;
}
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);
}
var soundman = SoundManager.getInstance(this);
enableSound(true);
splashMC._visible = false;
gameMC._visible = false;
stop();
Button.prototype.tabEnabled = false;
MovieClip.prototype.tabEnabled = false;
footer.TF.htmlText = "<p align='center'>Iron Works | created by ";
footer.TF.htmlText = footer.TF.htmlText + "<u><a href='http://www.pastelgames.com' target='_blank'>Pastel Games</a></u>";
footer.TF.htmlText = footer.TF.htmlText + " | \u00A9 2008 | ";
footer.TF.htmlText = footer.TF.htmlText + "<u><a href='http://www.pastelgames.com/index.php?dzial=comments&co=game&id=52' target='_blank'>comment this game</a></u></p>";
__com_mochibot__("94baf141", this, 10301, true);
__com_mochibot__("c104f460", this, 10301, true);
Frame 18
gotoAndStop ("game");
Symbol 14 MovieClip Frame 1
stop();
Symbol 31 MovieClip Frame 1
Symbol 31 MovieClip Frame 7
this.pushBall();
Symbol 31 MovieClip Frame 17
gotoAndStop (1);
Symbol 56 MovieClip [missile_shoot] Frame 1
stop();
Symbol 61 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 2
play();
Symbol 61 MovieClip Frame 17
this.moveNewBall();
Symbol 61 MovieClip Frame 25
gotoAndStop (1);
Symbol 64 MovieClip Frame 1
stop();
Symbol 64 MovieClip Frame 15
this.dropdownBalls();
Symbol 64 MovieClip Frame 46
this.pushNextLine();
Symbol 69 MovieClip Frame 1
var score = "0";
score_top.autoSize = "center";
score_shadow.autoSize = "center";
score_shadow2.autoSize = "center";
Symbol 75 MovieClip Frame 10
stop();
Symbol 75 MovieClip Frame 21
stop();
Symbol 75 MovieClip Frame 30
stop();
Symbol 75 MovieClip Frame 39
stop();
Symbol 75 MovieClip Frame 61
stop();
Symbol 78 MovieClip Frame 10
stop();
Symbol 78 MovieClip Frame 21
stop();
Symbol 78 MovieClip Frame 30
stop();
Symbol 78 MovieClip Frame 39
stop();
Symbol 78 MovieClip Frame 61
stop();
Symbol 81 MovieClip Frame 10
stop();
Symbol 81 MovieClip Frame 21
stop();
Symbol 81 MovieClip Frame 30
stop();
Symbol 81 MovieClip Frame 39
stop();
Symbol 81 MovieClip Frame 61
stop();
Symbol 84 MovieClip Frame 10
stop();
Symbol 84 MovieClip Frame 21
stop();
Symbol 84 MovieClip Frame 30
stop();
Symbol 84 MovieClip Frame 39
stop();
Symbol 84 MovieClip Frame 61
stop();
Symbol 87 MovieClip Frame 1
var nickname = "";
Symbol 90 MovieClip Frame 1
var score = "You scored";
Symbol 96 MovieClip Frame 1
var info = "0";
Symbol 101 MovieClip Frame 10
stop();
Symbol 101 MovieClip Frame 21
stop();
Symbol 101 MovieClip Frame 30
stop();
Symbol 101 MovieClip Frame 39
stop();
Symbol 101 MovieClip Frame 61
stop();
Symbol 105 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 53
if (isbutton == true) {
stop();
}
Symbol 135 MovieClip Frame 54
stop();
this._parent.play();
Symbol 138 MovieClip Frame 10
stop();
Symbol 138 MovieClip Frame 21
stop();
Symbol 138 MovieClip Frame 30
stop();
Symbol 138 MovieClip Frame 39
stop();
Symbol 138 MovieClip Frame 61
stop();
Symbol 141 MovieClip Frame 10
stop();
Symbol 141 MovieClip Frame 21
stop();
Symbol 141 MovieClip Frame 30
stop();
Symbol 141 MovieClip Frame 39
stop();
Symbol 141 MovieClip Frame 61
stop();
Symbol 144 MovieClip Frame 10
stop();
Symbol 144 MovieClip Frame 21
stop();
Symbol 144 MovieClip Frame 30
stop();
Symbol 144 MovieClip Frame 39
stop();
Symbol 144 MovieClip Frame 61
stop();
Symbol 147 MovieClip Frame 10
stop();
Symbol 147 MovieClip Frame 21
stop();
Symbol 147 MovieClip Frame 30
stop();
Symbol 147 MovieClip Frame 39
stop();
Symbol 147 MovieClip Frame 61
stop();
Symbol 150 MovieClip Frame 10
stop();
Symbol 150 MovieClip Frame 21
stop();
Symbol 150 MovieClip Frame 30
stop();
Symbol 150 MovieClip Frame 39
stop();
Symbol 150 MovieClip Frame 61
stop();
Symbol 156 MovieClip Frame 10
stop();
Symbol 156 MovieClip Frame 21
stop();
Symbol 156 MovieClip Frame 30
stop();
Symbol 156 MovieClip Frame 39
stop();
Symbol 156 MovieClip Frame 61
stop();
Symbol 159 MovieClip Frame 10
stop();
Symbol 159 MovieClip Frame 21
stop();
Symbol 159 MovieClip Frame 30
stop();
Symbol 159 MovieClip Frame 39
stop();
Symbol 159 MovieClip Frame 61
stop();
Symbol 166 MovieClip Frame 1
gotoAndPlay (2);
Symbol 166 MovieClip Frame 71
bg.onRelease = this._parent.getMore;
stop();
Symbol 166 MovieClip Frame 120
this._parent.showMenu();
Symbol 166 MovieClip Frame 134
this._visible = false;
stop();
Symbol 222 MovieClip [__Packages.extensions.movieclip.SimpleButton] Frame 0
class extensions.movieclip.SimpleButton
{
var MC;
function SimpleButton (tMC, _release, _rollover, _rollout, _press, _releaseoutside) {
MC = tMC;
MC.isbutton = true;
rolloutAction = _rollout;
rolloverAction = _rollover;
releaseoutsideAction = ((_releaseoutside == undefined) ? (_release) : (_releaseoutside));
releaseAction = _release;
MC.onRollOver = system.Delegate.create(this, RollOver);
MC.onRollOut = system.Delegate.create(this, RollOut);
MC.onRelease = system.Delegate.create(this, Release);
MC.onPress = system.Delegate.create(this, Press);
MC.onReleaseOutside = system.Delegate.create(this, ReleaseOutside);
for (var name in MC) {
if (name.indexOf("hit") != -1) {
((MC.hitArea = MC[name]))._visible = false;
}
}
MC.gotoAndPlay("start");
}
function RollOut() {
MC.gotoAndPlay("rollout");
rolloutAction();
}
function RollOver() {
MC.gotoAndPlay("rollover");
rolloverAction();
}
function ReleaseOutside() {
MC.gotoAndPlay("release");
releaseoutsideAction();
}
function Release() {
MC.gotoAndPlay("release");
releaseAction();
}
function Press() {
if (pressAction != undefined) {
MC.gotoAndPlay("onpress");
pressAction();
} else {
MC.gotoAndStop("release");
}
}
var rolloutAction = null;
var rolloverAction = null;
var releaseoutsideAction = null;
var releaseAction = null;
var pressAction = null;
}
Symbol 223 MovieClip [__Packages.system.Delegate] Frame 0
class system.Delegate
{
function Delegate () {
}
static function create(obj, func) {
var extraArgs = arguments.slice(2);
var f = function () {
var target = arguments.callee.target;
var func = arguments.callee.func;
var args = arguments.concat(extraArgs);
return(func.apply(target, args));
};
f.target = obj;
f.func = func;
return(f);
}
}
Symbol 224 MovieClip [__Packages.SoundManager] Frame 0
class SoundManager
{
static var myInstance;
var MC, played, _enabled, _vol;
function SoundManager (_MC) {
MC = _MC;
played = new Array();
_enabled = true;
_vol = 100;
muted_vol = 100;
}
static function getInstance() {
if (myInstance == undefined) {
myInstance = new SoundManager();
}
return(myInstance);
}
function setVolume(v) {
_vol = v;
play();
}
function enable() {
var snd;
_enabled = true;
_vol = muted_vol;
for (var name in played) {
snd = played[name];
snd.setVolume(_vol);
}
}
function get enabled() {
return(_enabled);
}
function isPlaying(soundname) {
var snd = played[soundname];
if (snd != undefined) {
return(snd.isPlaying);
}
}
function mute() {
var snd;
_enabled = false;
muted_vol = _vol;
_vol = 0;
for (var name in played) {
snd = played[name];
snd.setVolume(0);
}
}
function remove(soundname) {
if (played[soundname] != undefined) {
stop(soundname);
delete played[soundname];
}
}
function pause(soundname) {
var snd;
var p;
var d;
if (played[soundname] != undefined) {
p = Math.round(snd.position / 1000);
d = Math.round(snd.duration / 1000);
snd.pause = ((p < d) ? (p) : 0);
snd.isPlaying = false;
snd.stop();
} else {
for (var name in played) {
snd = played[name];
p = Math.round(snd.position / 1000);
d = Math.round(snd.duration / 1000);
snd.pause = ((p < d) ? (p) : 0);
snd.isPlaying = false;
snd.stop(name);
}
}
}
function stop(soundname) {
var snd;
if (soundname != undefined) {
snd = played[soundname];
snd.pause = 0;
snd.isPlaying = false;
snd.stop();
delete snd;
} else {
for (var name in played) {
snd = played[name];
snd.stop();
snd.pause = 0;
snd.isPlaying = false;
delete snd;
}
}
}
function play(soundname, loop, oncomplete) {
loop = loop == true;
var snd;
snd = (played[soundname] = new Sound());
snd.attachSound(soundname);
snd.start();
snd.setVolume(_vol);
if (loop) {
snd.onSoundComplete = function () {
this.start();
};
}
}
function onComplete(soundname) {
var snd = played[soundname];
if (snd == undefined) {
return(undefined);
}
if ((snd.onComplete == undefined) && (snd.loop == false)) {
remove(soundname);
} else if (snd.loop) {
snd.onComplete();
snd.start();
} else {
snd.onComplete();
snd.stop();
}
}
var muted_vol = 100;
}
Symbol 225 MovieClip [__Packages.Bababalls_game] Frame 0
class Bababalls_game
{
var MC, timer, keyboard, sndman, externalevents, gameLevel, scoreValue, pointer, cannon, gridTable, gridW, grid_xMax, grid_yMax, newrow_parity, gridColors, gridH, gridW05, gridH05, gridW75, gridH75, missileBounds, newrow_maxNewBalls, cannonRotation, missile, missile_current, missileVX, missileVY, missile_Xorient, missileX, missileY, newrowMC, lattice, pipe, ironworker, newBallsTable, newrow_offsetX, newrow_ballsVector;
function Bababalls_game (_MC, ev, test) {
MC = _MC;
MC.nextlevel._visible = false;
MC.gameover._visible = false;
MC.pausegame._visible = true;
MC.pausegame.swapDepths(200);
if (MC.ghosts != undefined) {
MC.ghosts.removeMovieClip();
}
MC.createEmptyMovieClip("ghosts", 100);
new extensions.movieclip.SimpleButton(MC.pausegame.p_pause, system.Delegate.create(this, onKeyDown, 80), system.Delegate.create(this, pause_noShooting, true), system.Delegate.create(this, pause_noShooting, false));
timer = system.Timer.getInstance(MC);
keyboard = keyboardPackage.Keyboard.getInstance();
sndman = SoundManager.getInstance();
keyboard.addListener(this);
sndman.play("snd_ambient", true);
externalevents = ev;
setGrid(30, 26, 330, 350);
setCannon(MC.cannon);
gameLevel = 1;
scoreValue = 0;
setValue();
Mouse.addListener(this);
Mouse.hide();
if (test) {
pointer = new Object();
movePointer = onPointerMoving;
Mouse.show();
doTests();
} else {
Mouse.show();
newLevel();
}
}
function onKeyDown(keycode) {
if (keycode == 80) {
if (paused) {
timer.addListener(MC, 0, system.Delegate.create(this, goOn), 0);
MC.pausegame.gotoAndStop("play");
} else {
timer.removeListener(MC);
MC.pausegame.gotoAndStop("play");
MC.pausegame.gotoAndStop("pause");
MC.pausegame.swapDepths(200);
}
paused = !paused;
}
}
function onMouseDown() {
if (endGame || (paused)) {
return(undefined);
}
if (((moveMissile == null) && (missile_canShooting)) && (MouseY < cannon._y)) {
sndman.play("snd_shoot");
shootMissile();
}
}
function get MouseX() {
return(MC._xmouse);
}
function get MouseY() {
return(MC._ymouse);
}
function checkDistance(objXY, hexX, hexY) {
if ((gridTable[hexX][hexY].color != 0) && (gridTable[hexX][hexY] != undefined)) {
var p = getXYPos({_x:hexX, _y:hexY});
var a = (p._x - objXY._x);
var b = (p._y - objXY._y);
return(Math.sqrt((a * a) + (b * b)));
}
return(gridW);
}
function generateTableRows(rows) {
var count = 0;
var thesame = 0;
var prevclr = 0;
gridTable = new Array();
var i = 0;
while (i < grid_xMax) {
gridTable[i] = new Array();
thesame = ((i % 2) ? (int(rows / 4) + 1) : -2);
var j = 0;
while (j < rows) {
switch (rows) {
case 1 :
var c = (((j % (gameLevel % missileColors)) + 1) + ((gameLevel + i) % 2));
break;
case 2 :
var c = ((i % ((gameLevel % missileColors) + (i % 2))) + gameLevel);
break;
case 3 :
var c = (j % ((gameLevel % missileColors) + 1));
break;
case 4 :
var c = ((((j * grid_xMax) + i) % (gameLevel % missileColors)) + 1);
break;
case 5 :
var c = (((j * grid_xMax) + i) % ((gameLevel % missileColors) + 1));
break;
case 6 :
var c = ((i % (gameLevel % missileColors)) + 1);
break;
case 7 :
case 8 :
case 9 :
var c = random((gameLevel % missileColors) + 1);
break;
default :
var c = (random(gameLevel % missileColors) + 1);
}
c = ((thesame < int(rows / 4)) ? (c) : (((thesame > int(rows / 2)) ? (c + (i % 2)) : (j))));
thesame = ((thesame > int(rows / 2)) ? ((-i) % 2) : (thesame));
count = count + ((c == 0) ? 1 : 0);
c = ((count > int(rows / 2)) ? (random(missileColors + 1)) : (c));
count = ((count > int(rows / 2)) ? 1 : (count));
thesame = thesame + ((prevclr == c) ? 1 : (-thesame));
prevclr = c;
c = ((c > missileColors) ? (random(missileColors) + 1) : (c));
gridTable[i][j] = {color:c, checked:false};
j++;
}
var j = rows;
while (j < grid_yMax) {
gridTable[i][j] = {color:0, checked:false};
j++;
}
i++;
}
}
function checkParity() {
var firstFull = 0;
var i = 0;
while (i < grid_xMax) {
firstFull = firstFull + gridTable[i][0].color;
i = i + 2;
}
return(Number(firstFull));
}
function modifyTable(elements) {
var toomuch = false;
var addnewrow = newrow_parity;
if (addnewrow) {
elements.splice(0, 0, 0);
}
var i = 0;
while (i < grid_xMax) {
var c = ((elements[i] == undefined) ? 0 : (elements[i]));
if (addnewrow) {
gridTable[i].splice(0, 0, {color:c, checked:false});
} else if (c != 0) {
gridTable[i].splice(0, 1, {color:c, checked:false});
}
if (gridTable[i][grid_yMax - 1].color == undefined) {
gridTable[i][grid_yMax - 1] = {color:0, checked:false};
}
toomuch = toomuch | (gridTable[i][grid_yMax - 1].color != 0);
i++;
}
endGame = toomuch;
}
function showTable(firerows, deleteZerous, parity) {
firerows = ((firerows == undefined) ? (grid_yMax) : (firerows));
deleteZerous = ((deleteZerous == undefined) ? false : (deleteZerous));
parity = ((parity == undefined) ? 0 : (parity));
gridColors = new Array();
var i = 0;
while (i <= missileColors) {
gridColors.push(0);
i++;
}
var i = 0;
while (i < gridTable.length) {
var j = 0;
while (j < gridTable[i].length) {
var p = gridTable[i][j];
if (((p.color < 0) || (p.color > missileColors)) || (p.checked != false)) {
}
if (p.color != 0) {
addGridColor(p.color);
if (j < firerows) {
if (parity) {
showGhost({_x:i, _y:j}, p.color, (((i % 2) != parity) ? "fireout" : null));
} else {
showGhost({_x:i, _y:j}, p.color, "fireout");
}
} else {
showGhost({_x:i, _y:j}, p.color);
}
} else if (deleteZerous) {
showGhost({_x:i, _y:j}, 0, "delete");
}
j++;
}
i++;
}
var i = 0;
while (i < gridTable.length) {
var row = "";
var j = 0;
while (j < gridTable[i].length) {
row = row + (((gridTable[i][j].color + ".[") + (gridTable[i][j].checked * 1)) + "]\t");
j++;
}
i++;
}
}
function addGridColor(clr) {
if (clr) {
gridColors[clr]++;
gridColors[0] = gridColors[0] + (gridColors[clr] == 1);
}
}
function removeGridColor(clr) {
gridColors[clr]--;
gridColors[0] = gridColors[0] - (gridColors[clr] == 0);
if (gridColors[0] == 0) {
endLevel = true;
}
}
function getNewColor(additional) {
var accessiblecolors = new Array();
var c = 0;
var i = 1;
while (i <= missileColors) {
if (gridColors[i] != 0) {
accessiblecolors.push(i);
}
i++;
}
if (gridColors[0] == 0) {
return(random(missileColors) + 1);
}
c = accessiblecolors[random(gridColors[0])];
return(c + ((c < missileColors) ? (additional) : (-additional)));
}
function setGrid(ball_w, ball_h, stage_w, stage_h) {
gridW = ball_w;
gridH = ball_h;
gridW05 = ball_w / 2;
gridH05 = ball_h / 2;
gridW75 = 0.75 * ball_w;
gridH75 = 0.75 * ball_h;
var hexMaxXY = getHexPos({_x:stage_w, _y:stage_h});
grid_xMax = hexMaxXY._x - (hexMaxXY._x % 2);
grid_yMax = hexMaxXY._y;
var maxXY = getXYPos(hexMaxXY);
stageBounds.xMax = maxXY._x;
stageBounds.yMax = maxXY._y;
missileBounds = {};
missileBounds.xMin = stageBounds.xMin;
missileBounds.xMax = stageBounds.xMax - gridW;
missileBounds.yMin = stageBounds.yMin + gridH05;
missileBounds.yMax = stageBounds.yMax - gridH05;
newrow_maxNewBalls = grid_xMax / 2;
}
function setCannon(tMC) {
cannon = tMC;
var p = getXYPos({_x:grid_xMax / 2, _y:cannon._y / gridH});
cannon._x = p._x - (gridW75 * 0.5);
cannon._y = p._y;
}
function getXYPos(hexpos_obj) {
var px = (hexpos_obj._x * gridW75);
var py = ((hexpos_obj._y * gridH) + ((hexpos_obj._x % 2) * gridH05));
return({_x:px, _y:py});
}
function getHexPos(obj) {
var px = ((obj._x == undefined) ? 0 : (obj._x));
var py = ((obj._y == undefined) ? 0 : (obj._y));
var hex_x = Math.round(px / gridW75);
var hex_y = Math.round((py / gridH) - (0.5 * (hex_x % 2)));
return({_x:hex_x, _y:hex_y});
}
function showGhost(hexpos_obj, stopframe, linkagename, targetClip, notHex) {
notHex = notHex == true;
if (notHex) {
var pos = getHexPos(hexpos_obj);
var d = Math.abs((grid_xMax * pos._y) + pos._x);
var posXY = hexpos_obj;
} else {
var d = Math.abs((grid_xMax * hexpos_obj._y) + hexpos_obj._x);
var posXY = getXYPos(hexpos_obj);
}
var m = "missile_";
var g = ((linkagename == undefined) ? "ghost" : (linkagename));
targetClip = ((targetClip == undefined) ? (MC.ghosts) : (targetClip));
if (linkagename == "delete") {
targetClip["ghost" + d].removeMovieClip();
return(undefined);
}
var gh = targetClip.attachMovie(m + g, "ghost" + d, d, posXY);
gh.gotoAndStop(stopframe);
if (linkagename == undefined) {
gh.ball.gotoAndStop(1 + random(gh.ball._totalframes));
}
}
function showPointer() {
var p = "pointer";
pointer = MC.attachMovie(p, p, MC.getNextHighestDepth());
if (pointer == undefined) {
return(undefined);
}
}
function onPointerMoving() {
var pos = getHexPos({_x:MouseX, _y:MouseY});
pointer._x = pos._x;
pointer._y = pos._y;
}
function rotateCannon() {
cannonRotation = Math.atan2(MouseY - cannon._y, MouseX - cannon._x);
cannonRotation = ((cannonRotation > 0) ? (-cannonRotation) : (cannonRotation)) + PI05;
cannon._rotation = cannonRotation * PI180d;
}
function moveCannon() {
cannon._x = cannon._x + (((cannon._x - 5) < MouseX) ? 2 : -2);
}
function showMissile() {
var m = "missile";
moveMissile = null;
if (missile != undefined) {
missile.removeMovieClip();
}
missile = MC.attachMovie(m + "_start", m, 150, {_x:cannon._x, _y:cannon._y, _rotation:cannon._rotation});
missile_current = getNewColor(Number(missile_addColor));
missile_addColor = false;
missile.gotoAndStop(missile_current);
if (missile == undefined) {
}
}
function shootMissile() {
if (missile == undefined) {
return(undefined);
}
var m = "missile";
missile = MC.attachMovie(m + "_shoot", m, missile.getDepth(), {_x:cannon._x, _y:cannon._y, _rotation:180 + cannon._rotation});
missile.gotoAndStop(missile_current);
missileVX = Math.sin(cannonRotation) * missile_speed;
missileVY = (-Math.cos(cannonRotation)) * missile_speed;
missileVY = ((missileVY > 0) ? (-missileVY) : (missileVY));
missile_Xorient = ((missileVX < 0) ? -1 : 1);
moveMissile = onMissileMoving;
}
function onMissileMoving() {
var x1 = (missile._x + missileVX);
var y1 = (missile._y + missileVY);
var pos = getHexPos(missile);
var targetpos = getHexPos({_x:x1, _y:y1});
if ((pos._x != targetpos._x) || (pos._y != targetpos._y)) {
var dist = checkDistance(missile, targetpos._x, targetpos._y);
if ((dist < gridH) && (dist > 0)) {
placeMissile(getHexPos({_x:missile._x, _y:missile._y}));
return(undefined);
}
}
missile._x = x1;
missile._y = y1;
missileVY = missileVY + gravity;
pos = getHexPos(missile);
if ((((missile._x < missileBounds.xMin) || (missile._x >= missileBounds.xMax)) || (pos._x >= grid_xMax)) || (pos._x < 0)) {
missile._x = missileX;
missileVX = Math.abs(missileVX);
var xx = 0;
var e = false;
do {
if (checkMissileSticking()) {
return(undefined);
}
missile._x = missile._x + (xx * missile_Xorient);
xx++;
pos = getHexPos(missile);
e = xx < missileVX;
e = e & (missile._x < missileBounds.xMin);
e = e & (missile._x >= missileBounds.xMax);
e = e & (pos._x < grid_xMax);
e = e & (pos._x >= 0);
} while (e);
missile_Xorient = -missile_Xorient;
missileVX = missileVX * missile_Xorient;
missile._x = (missileX + missileVX) - (xx * missile_Xorient);
missile._rotation = -missile._rotation;
}
if (missile._y <= missileBounds.yMin) {
var yy = 0;
do {
if (checkMissileSticking()) {
return(undefined);
}
missile._y = missileY + yy;
yy++;
} while ((yy < missileVY) && (missileBounds.yMin > stageBounds.yMin));
placeMissile(getHexPos({_x:missile._x, _y:missile._y}));
return(undefined);
}
checkMissileSticking();
missileX = missile._x;
missileY = missile._y;
}
function placeMissile(pos) {
endGame = pos._y >= grid_yMax;
scoreValue = scoreValue + score_newmissileValue;
if (endGame) {
gameOver();
return(undefined);
}
sndman.play("snd_placeball");
addGridColor(missile_current);
if (!burnGhosts(pos, missile_current)) {
gridTable[pos._x][pos._y] = {color:missile_current, checked:false};
showGhost(pos, missile_current, "fireout");
}
if (!endLevel) {
showMissile();
} else {
newLevel();
}
}
function checkMissileSticking() {
var dist = new Array();
var sticky = false;
var pos = getHexPos(missile);
var k = ((pos._x % 2) ? 1 : -1);
dist.push({_x:pos._x - 1, _y:pos._y, dist:checkDistance(missile, pos._x - 1, pos._y)});
dist.push({_x:pos._x, _y:pos._y - 1, dist:checkDistance(missile, pos._x, pos._y - 1)});
dist.push({_x:pos._x + 1, _y:pos._y, dist:checkDistance(missile, pos._x + 1, pos._y)});
dist.push({_x:pos._x, _y:pos._y + 1, dist:checkDistance(missile, pos._x, pos._y + 1)});
dist.push({_x:pos._x - 1, _y:pos._y + k, dist:checkDistance(missile, pos._x - 1, pos._y + k)});
dist.push({_x:pos._x + 1, _y:pos._y + k, dist:checkDistance(missile, pos._x + 1, pos._y + k)});
dist.sortOn("dist", Array.NUMERIC);
sticky = dist[0].dist < gridH75;
if (sticky) {
placeMissile(pos);
}
return(sticky);
}
function burnGhosts(startpos, clr) {
var stickies = new Array();
var stickedto = new Array();
var k = 0;
var pos = new Object();
var checkPos = function (px, py, clr, arr, stkd, gT) {
var c = gT[px][py].color;
if (!gT[px][py].checked) {
if (c == clr) {
arr.push({_x:px, _y:py});
gT[px][py].checked = true;
} else if (((c != 0) && (c != undefined)) && (py)) {
stkd.push([{_x:px, _y:py}]);
}
}
};
stickies.push({_x:startpos._x, _y:startpos._y});
showGhost(stickies[stickies.length - 1], missile_current, "burnout");
var i = 0;
do {
pos = stickies[i];
k = ((pos._x % 2) ? 1 : -1);
checkPos(pos._x - 1, pos._y, clr, stickies, stickedto, gridTable);
checkPos(pos._x, pos._y - 1, clr, stickies, stickedto, gridTable);
checkPos(pos._x + 1, pos._y, clr, stickies, stickedto, gridTable);
checkPos(pos._x, pos._y + 1, clr, stickies, stickedto, gridTable);
checkPos(pos._x - 1, pos._y + k, clr, stickies, stickedto, gridTable);
checkPos(pos._x + 1, pos._y + k, clr, stickies, stickedto, gridTable);
i++;
} while (i < stickies.length);
if (stickies.length > 2) {
sndman.play("snd_burn");
showLosts(stickedto);
var i = 0;
while (i < stickies.length) {
removeGridColor(clr);
gridTable[stickies[i]._x][stickies[i]._y] = {color:0, checked:false};
showGhost(stickies[i], missile_current, "burnout");
scoreValue = scoreValue + score_burnedValue;
i++;
}
return(true);
}
var i = 0;
while (i < stickies.length) {
gridTable[stickies[i]._x][stickies[i]._y].checked = false;
i++;
}
return(false);
}
function showLosts(bombed) {
var outed = new Array();
var k = 0;
var cell;
var snaptozero = false;
var pos = new Object();
var checkSnapping = function (gT, px, py, addto) {
var c = gT[px][py].color;
var chkd = gT[px][py].checked;
var snap = gT[px][py].snapchkd;
if ((c == 0) || (c == undefined)) {
return(false);
}
if ((snap != true) && (chkd != true)) {
addto.push({_x:px, _y:py});
gT[px][py].snapchkd = true;
return(!py);
}
return(false);
};
var i = 0;
while (i < bombed.length) {
pos = bombed[i][0];
gridTable[pos._x][pos._y].snapchkd = true;
snaptozero = checkSnapping(gridTable, pos._x, pos._y, bombed[i]);
var j = 0;
do {
pos = bombed[i][j];
k = ((pos._x % 2) ? 1 : -1);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x - 1, pos._y, bombed[i]);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x, pos._y - 1, bombed[i]);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x + 1, pos._y, bombed[i]);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x, pos._y + 1, bombed[i]);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x - 1, pos._y + k, bombed[i]);
snaptozero = snaptozero | checkSnapping(gridTable, pos._x + 1, pos._y + k, bombed[i]);
j++;
} while (j < bombed[i].length);
if (snaptozero) {
var j = 0;
while (j < bombed[i].length) {
pos = bombed[i][j];
cell = gridTable[pos._x][pos._y];
cell.snapchkd = false;
j++;
}
} else {
var j = 0;
while (j < bombed[i].length) {
pos = bombed[i][j];
gridTable[pos._x][pos._y].snapchkd = false;
gridTable[pos._x][pos._y].toburn = true;
j++;
}
outed = outed.concat(bombed[i]);
}
i++;
}
var i = 0;
while (i < outed.length) {
pos = outed[i];
cell = gridTable[pos._x][pos._y];
if (cell.toburn == true) {
removeGridColor(cell.color);
gridTable[pos._x][pos._y] = {color:0, checked:false};
showGhost(pos, cell.color, "fadeout");
scoreValue = scoreValue + score_cuttedoffValue;
}
i++;
}
return(outed);
}
function setNewRowObjects() {
if (MC.newballs != undefined) {
MC.newballs.swapDepths(MC.getNextHighestDepth());
MC.newballs.removeMovieClip();
MC.lattice.swapDepths(50);
}
newrowMC = MC.createEmptyMovieClip("newballs", 110);
lattice = MC.lattice;
pipe = MC.pipe;
ironworker = MC.ironworker;
ironworker.pushBall = system.Delegate.create(this, openPipe);
pipe.moveNewBall = system.Delegate.create(this, moveNewBall);
lattice.dropdownBalls = system.Delegate.create(this, dropdownBalls);
moveNewRow = null;
setNewRowStart();
}
function openPipe() {
sndman.play("snd_lever");
pipe.ballMC.gotoAndStop(getNewColor(1));
pipe.gotoAndPlay("start");
pipe.play();
}
function moveNewBall() {
var newball = newBallsTable.length;
newBallsTable.push(pipe.ballMC._currentframe);
showGhost({_x:newball * gridW75, _y:0}, newBallsTable[newball], "rolling", newrowMC, true);
if (newball == 0) {
newrow_offsetX = pipe._x + pipe.ballMC._x;
newrowMC._x = newrow_offsetX;
newrowMC._y = pipe._y + pipe.ballMC._y;
}
pipe.play();
moveNewRow = onNewRowMoving;
}
function onNewRowMoving(moveme) {
if (slowmotion) {
return(undefined);
}
var balls = newBallsTable.length;
var lastball = ((grid_xMax - (balls + newrow_parity)) <= 1);
newrow_parity = checkParity();
newrowMC._x = newrowMC._x - newrow_speed;
var posX = Math.ceil((newrow_offsetX - newrowMC._x) / gridW75);
if (((posX + 1) == grid_xMax) && (newrowMC._x < gridW05)) {
moveNewRow = null;
missile_canShooting = false;
lattice.gotoAndPlay("start");
} else if (posX > balls) {
if (posX % 2) {
moveNewRow = null;
sndman.play("snd_lever2");
ironworker.play();
} else {
newBallsTable.push(0);
}
}
}
function dropdownBalls() {
lattice.stop();
lattice.swapDepths(newrowMC);
moveNewRow = moveDownBalls;
}
function moveDownBalls() {
if (moveMissile != null) {
return(undefined);
}
newrow_parity = checkParity();
moveNewRow = onMovingDownBalls;
newrow_ballsVector = new Object();
newrow_ballsVector.targetX = newrow_parity * gridW75;
newrow_ballsVector.targetY = (-newrow_parity) * gridH05;
newrow_ballsVector._x = (newrowMC._x - newrow_ballsVector.targetX) / 10;
newrow_ballsVector._y = (newrowMC._y - newrow_ballsVector.targetY) / 10;
}
function onMovingDownBalls() {
var y = 0;
newrowMC._x = newrowMC._x - newrow_ballsVector._x;
newrowMC._y = newrowMC._y - newrow_ballsVector._y;
if ((newrowMC._y >= newrow_ballsVector.targetY) && (Math.abs(newrowMC._x) >= Math.abs(newrow_ballsVector.targetY))) {
for (var name in newrowMC) {
if (name.indexOf("ghost") != -1) {
newrowMC[name].removeMovieClip();
}
}
modifyTable(newBallsTable);
showTable(1, true, Number(!newrow_parity));
MC.ghosts._y = newrowMC._y;
moveNewRow = moveTablefromNewRow;
}
}
function moveTablefromNewRow() {
var tMC = MC.ghosts;
tMC._y = tMC._y + (0.1 * gridH);
if (tMC._y >= (-(newrow_parity * gridH05))) {
tMC._y = (-newrow_parity) * gridH05;
moveNewRow = null;
if (endGame) {
gameOver();
return(undefined);
}
lattice.play();
setNewRowStart();
}
}
function setNewRowStart(parity) {
newBallsTable = new Array();
newrow_stopped = true;
missile_canShooting = true;
if (newrowMC.getDepth() > lattice.getDepth()) {
newrowMC.swapDepths(lattice);
}
ironworker.gotoAndPlay("start");
}
function setValue() {
if (scoreValue) {
MC.scorefield.score = scoreValue + score_addString;
} else {
MC.scorefield.score = "0";
}
}
function goOn() {
moveNewRow();
moveMissile();
movePointer();
rotateCannon();
setValue();
}
function newLevel(dogoon) {
dogoon = dogoon == true;
missile_canShooting = dogoon;
MC.nextlevel._visible = !dogoon;
MC.nextlevel.swapDepths(MC.getNextHighestDepth());
if (dogoon) {
MC.ghosts._y = 0;
MC.lattice.gotoAndStop("start");
endLevel = false;
missile_addColor = true;
newBallsTable = new Array();
gameLevel++;
newrow_speed = (int(newrow_speed / 5) * 5) + ((0.2 * gameLevel) % 6);
generateTableRows(Math.ceil(gameLevel / 2));
showTable();
showMissile();
setNewRowObjects();
timer.addListener(MC, 0, system.Delegate.create(this, goOn), 0);
} else {
missile.removeMovieClip();
MC.nextlevel.level.info = "level " + gameLevel;
timer.addListener(MC, 2000, system.Delegate.create(this, newLevel, true), 0);
}
}
function gameOver() {
setValue();
sndman.play("snd_gameover");
timer.removeListener(MC);
keyboard.removeListener(this);
MC.pausegame._visible = false;
var tMC = MC.gameover;
tMC._visible = true;
tMC.swapDepths(200);
tMC.score.score = ("You scored\n" + MC.scorefield.score) + " points";
new extensions.movieclip.SimpleButton(tMC.p_menu, externalevents.backToMenu);
new extensions.movieclip.SimpleButton(tMC.p_save, system.Delegate.create(this, saveScore, MC.gameover.nick));
new extensions.movieclip.SimpleButton(tMC.p_tryagain, externalevents.tryAgain);
new extensions.movieclip.SimpleButton(tMC.p_comments, externalevents.comments);
}
function saveScore(tMC) {
if ((tMC.nickname == "") || (tMC.nickname == player_defaultnick)) {
tMC.nickname = player_defaultnick;
Selection.setFocus(tMC.TF);
Selection.setSelection(0, tMC.TF.text.length);
} else {
externalevents.saveScore(tMC.nickname, scoreValue + score_addString);
}
}
function doTests() {
endLevel = false;
missile_addColor = true;
gameLevel++;
newrow_speed = (int(newrow_speed / 5) * 5) + ((0.2 * gameLevel) % 6);
generateTableRows(Math.ceil(gameLevel / 2));
showTable();
showMissile();
}
function pause_noShooting(v) {
missile_canShooting = !v;
}
var stageBounds = {xMin:0, yMin:0, xMax:0, yMax:0};
var startGame = 0;
var endLevel = false;
var endGame = false;
var missile_speed = 10;
var missileColors = 5;
var missile_canShooting = true;
var missile_addColor = false;
var newrow_speed = 0;
var newrow_stopped = false;
var score_addString = "00";
var score_burnedValue = 10;
var score_cuttedoffValue = 5;
var score_newmissileValue = 1;
var PI180d = 57.2957795130823;
var PI05 = (Math.PI/2);
var gravity = 0;
var paused = false;
var slowmotion = false;
var player_nickname = "Your NickName";
var player_defaultnick = "Your NickName";
var moveMissile = null;
var movePointer = null;
var moveNewRow = null;
}
Symbol 226 MovieClip [__Packages.system.Timer] Frame 0
class system.Timer
{
static var myInstance, _listeners, MC, _enabled;
function Timer (_MC) {
if (myInstance == undefined) {
if (_MC == undefined) {
} else {
myInstance = this;
_listeners = {};
enable();
MC = _MC;
}
}
}
function echo() {
}
static function getInstance(_MC) {
if (myInstance == undefined) {
myInstance = new system.Timer(_MC);
}
return(myInstance);
}
function oEF() {
var isTime = getTimer();
var obj = {};
var count = 0;
for (var name in _listeners) {
count++;
obj = _listeners[name];
if (obj.nextTime < isTime) {
obj.fn();
obj.nextTime = obj.nextTime + obj.stepTime;
if (obj.times > 0) {
if ((--obj.times) == 0) {
removeListener(name);
}
}
}
}
if (count == 0) {
rm_oEF();
}
}
function rm_oEF() {
delete MC.onEnterFrame;
}
function set_oEF() {
MC.onEnterFrame = system.Delegate.create(this, oEF);
}
function enable() {
set_oEF();
_enabled = true;
}
function disable() {
rm_oEF();
_enabled = false;
}
function get enabled() {
return(_enabled);
}
function set enabled(_value) {
if (_value == true) {
enable();
} else {
disable();
}
//return(enabled);
}
function addListener(obj, time, todo, times) {
_listeners[String(obj)] = {stepTime:time, fn:todo, times:times, nextTime:getTimer() + time};
if (_enabled) {
set_oEF();
}
}
function removeListener(obj) {
delete _listeners[String(obj)];
}
}
Symbol 227 MovieClip [__Packages.keyboardPackage.Keyboard] Frame 0
class keyboardPackage.Keyboard extends AsBroadcaster
{
static var myInstance;
var screenKeyboards, pressedKeys, disabledKeys, onKeyUp, onKeyDown, broadcastMessage;
function Keyboard () {
super();
Key.addListener(this);
screenKeyboards = new Array();
pressedKeys = new Array();
disabledKeys = new Array();
setCodeTable();
onKeyUp = onKeyUp_withoutScreenKeyboard;
onKeyDown = onKeyDown_withoutScreenKeyboard;
AsBroadcaster.initialize(this);
}
function getKeyCode(str) {
str = str.toUpperCase();
if (Key[str] != undefined) {
return(Key[str]);
}
if (keyCode[str] != undefined) {
return(keyCode[str]);
}
return(str.charCodeAt(0));
}
function getKeyName(code) {
if (keyCodeName[code] != undefined) {
return(keyCodeName[code]);
}
return("no name");
}
function excludeKey(key, keybMC) {
if (keybMC != undefined) {
if (screenKeyboards[String(keybMC)] != undefined) {
screenKeyboards[String(keybMC)].disableKey(key);
}
} else if (screenKeyboards.length > 0) {
for (var name in screenKeyboards) {
screenKeyboards[name].disableKey(key);
}
}
disabledKeys[key] = true;
}
function sendEvent(keyevent, pressed) {
broadcastMessage(keyevent, pressed);
}
function isAnyKeyPressed() {
for (var code in pressedKeys) {
if (pressedKeys[code]) {
return(true);
}
}
return(false);
}
function onKeyDown_withoutScreenKeyboard() {
var pressedkey = Key.getCode();
pressedKeys[pressedkey] = true;
onKeyUp();
sendEvent("onKeyDown", pressedkey);
}
function onKeyUp_withoutScreenKeyboard() {
var pressedkey = Key.getCode();
var isDown = Key.isDown;
for (pressedkey in pressedKeys) {
if (!isDown(pressedkey)) {
delete pressedKeys[pressedkey];
sendEvent("onKeyUp", pressedkey);
}
}
}
function onKeyDown_withScreenKeyboard(pressedkey) {
var internal = false;
if (pressedkey == undefined) {
pressedkey = Key.getCode();
} else {
internal = true;
}
pressedKeys[pressedkey] = true;
for (pressedkey in pressedKeys) {
if (pressedKeys[pressedkey]) {
for (var name in screenKeyboards) {
screenKeyboards[name].onPress(pressedkey);
}
}
}
if (!internal) {
onKeyUp();
} else {
sendEvent("onScreenKeyDown", pressedkey);
}
sendEvent("onKeyDown", pressedkey);
}
function onKeyUp_withScreenKeyboard(pressedkey) {
var pressedkey = ((pressedkey == undefined) ? (Key.getCode()) : (pressedkey));
var isDown = Key.isDown;
for (pressedkey in pressedKeys) {
if (!isDown(pressedkey)) {
for (var name in screenKeyboards) {
screenKeyboards[name].onRelease(pressedkey);
}
delete pressedKeys[pressedkey];
sendEvent("onKeyUp", pressedkey);
}
}
}
function addScreenKeyboard(keybMC) {
screenKeyboards[String(keybMC)] = new keyboardPackage.ScreenKeyboard(keybMC);
onKeyDown = onKeyDown_withScreenKeyboard;
onKeyUp = onKeyUp_withScreenKeyboard;
}
function removeScreenKeyboard(_MC) {
delete screenKeyboards[String(_MC)];
if (screenKeyboards.length == 0) {
onKeyUp = onKeyUp_withoutScreenKeyboard;
onKeyDown = onKeyDown_withoutScreenKeyboard;
}
}
function setCodeTable() {
keyCode = new Array();
keyCode.ESC = (keyCode.ESCAPE = 27);
keyCode.F1 = 112;
keyCode.F2 = 113;
keyCode.F3 = 114;
keyCode.F4 = 115;
keyCode.F5 = 116;
keyCode.F6 = 117;
keyCode.F7 = 118;
keyCode.F8 = 119;
keyCode.F9 = 120;
keyCode.F10 = 120;
keyCode.F11 = 122;
keyCode.F12 = 123;
keyCode.CAPSLOCK = (keyCode["CAPS LOCK"] = (keyCode.CAPS_LOCK = 20));
keyCode.NUMLOCK = (keyCode["NUM LOCK"] = (keyCode.NUM_LOCK = 144));
keyCode.SCROLLLOCK = (keyCode["SCROLL LOCK"] = (keyCode.SCROLL_LOCK = 145));
keyCode.TAB = 9;
keyCode.ALT = (keyCode["RIGHT ALT"] = (keyCode.RIGHT_ALT = 18));
keyCode.CONTROL = (keyCode.CTRL = 17);
keyCode.SHIFT = (keyCode.SFT = 16);
keyCode.BACKSPACE = (keyCode["BACK SPACE"] = (keyCode.BACK_SPACE = 8));
keyCode.BCKSPC = (keyCode.BSPACE = 8);
keyCode.ENTER = (keyCode.RETURN = 13);
keyCode.SPACE = (keyCode.SPC = 32);
keyCode.PAUSE = (keyCode.BREAK = 19);
keyCode["`"] = (keyCode["~"] = (keyCode.TILDE = 192));
keyCode["1"] = 49;
keyCode["2"] = 50;
keyCode["3"] = 51;
keyCode["4"] = 52;
keyCode["5"] = 53;
keyCode["6"] = 54;
keyCode["7"] = 55;
keyCode["8"] = 56;
keyCode["9"] = 57;
keyCode["0"] = 48;
keyCode["-"] = (keyCode._ = (keyCode.MINUS = 189));
keyCode["="] = (keyCode["+"] = (keyCode.PLUS = 187));
keyCode.Q = 81;
keyCode.W = 87;
keyCode.E = 69;
keyCode.R = 82;
keyCode.T = 84;
keyCode.Y = 89;
keyCode.U = 85;
keyCode.I = 73;
keyCode.O = 79;
keyCode.P = 80;
keyCode.A = 65;
keyCode.S = 83;
keyCode.D = 68;
keyCode.F = 70;
keyCode.G = 71;
keyCode.H = 72;
keyCode.J = 74;
keyCode.K = 75;
keyCode.L = 76;
keyCode.Z = 90;
keyCode.X = 88;
keyCode.C = 67;
keyCode.V = 86;
keyCode.B = 66;
keyCode.N = 78;
keyCode.M = 77;
keyCode["["] = (keyCode["{"] = 219);
keyCode["]"] = (keyCode["}"] = 221);
keyCode["\\"] = (keyCode["|"] = (keyCode.PIPE = (keyCode.BACKSLASH = (keyCode.BACKSLASH = 220))));
keyCode[";"] = (keyCode[":"] = 186);
keyCode["'"] = (keyCode["\""] = 222);
keyCode[","] = (keyCode["<"] = (keyCode.COMMA = 188));
keyCode["."] = (keyCode[">"] = (keyCode.DOT = 190));
keyCode["/"] = (keyCode["?"] = (keyCode.SLASH = 191));
keyCode.MOUSEMENU = (keyCode["RMB MENU"] = (keyCode.RMBMENU = 93));
keyCode.INSERT = (keyCode.INS = 45);
keyCode.DELETE = (keyCode.DEL = (keyCode.DELETEKEY = 46));
keyCode.HOME = 36;
keyCode.END = 35;
keyCode["PAGE UP"] = (keyCode.PAGE_UP = (keyCode.PAGEUP = (keyCode.PGUP = 33)));
keyCode["PAGE DOWN"] = (keyCode.PAGE_DOWN = (keyCode.PAGEDOWN = 34));
keyCode["PAGE DN"] = (keyCode.PAGE_DN = (keyCode.PAGEDN = (keyCode.PGDN = 34)));
keyCode["LEFT ARROW"] = (keyCode.LEFT_ARROW = (keyCode.LEFTARROW = 37));
keyCode["RIGHT ARROW"] = (keyCode.RIGHT_ARROW = (keyCode.RIGHTARROW = 39));
keyCode["UP ARROW"] = (keyCode.UP_ARROW = (keyCode.UPARROW = 38));
keyCode["DOWN ARROW"] = (keyCode.DOWN_ARROW = (keyCode.DOWNARROW = 40));
keyCode["DN ARROW"] = (keyCode.DN_ARROW = (keyCode.DNARROW = 40));
keyCode["NUMERIC SLASH"] = (keyCode.NUMERICSLASH = (keyCode["NUMERIC-SLASH"] = (keyCode.NUMERIC_SLASH = 111)));
keyCode["NUMKEY SLASH"] = (keyCode.NUMKEYSLASH = (keyCode["NUMKEY-SLASH"] = (keyCode.NUMKEY_SLASH = 111)));
keyCode["NUM SLASH"] = (keyCode.NUMSLASH = (keyCode["NUM-SLASH"] = (keyCode.NUM_SLASH = 111)));
keyCode["NUMERIC ASTERIX"] = (keyCode.NUMERICASTERIX = (keyCode["NUMERIC-ASTERIX"] = (keyCode.NUMERIC_ASTERIX = 106)));
keyCode["NUMKEY ASTERIX"] = (keyCode.NUMKEYASTERIX = (keyCode["NUMKEY-ASTERIX"] = (keyCode.NUMKEY_ASTERIX = 106)));
keyCode["NUM ASTERIX"] = (keyCode.NUMASTERIX = (keyCode["NUM-ASTERIX"] = (keyCode.NUM_ASTERIX = 106)));
keyCode["NUMERIC MINUS"] = (keyCode.NUMERICMINUS = (keyCode["NUMERIC-MINUS"] = (keyCode.NUMERIC_MINUS = 109)));
keyCode["NUMKEY MINUS"] = (keyCode.NUMKEYMINUS = (keyCode["NUMKEY-MINUS"] = (keyCode.NUMKEY_MINUS = 109)));
keyCode["NUM MINUS"] = (keyCode.NUMMINUS = (keyCode["NUM-MINUS"] = (keyCode.NUM_MINUS = 109)));
keyCode["NUMERIC PLUS"] = (keyCode.NUMERICPLUS = (keyCode["NUMERIC-PLUS"] = (keyCode.NUMERIC_PLUS = 107)));
keyCode["NUMKEY PLUS"] = (keyCode.NUMKEYPLUS = (keyCode["NUMKEY-PLUS"] = (keyCode.NUMKEY_PLUS = 107)));
keyCode["NUM PLUS"] = (keyCode.NUMPLUS = (keyCode["NUM-PLUS"] = (keyCode.NUM_PLUS = 107)));
keyCode["NUMERIC DOT"] = (keyCode.NUMERICDOT = (keyCode["NUMERIC-DOT"] = (keyCode.NUMERIC_DOT = 110)));
keyCode["NUMKEY DOT"] = (keyCode.NUMKEYDOT = (keyCode["NUMKEY-DOT"] = (keyCode.NUMKEY_DOT = 110)));
keyCode["NUM DOT"] = (keyCode.NUMDOT = (keyCode["NUM-DOT"] = (keyCode.NUM_DOT = 110)));
keyCode["NUM/"] = (keyCode["NUM /"] = (keyCode["NUM-/"] = (keyCode["NUM_/"] = 111)));
keyCode["NUM*"] = (keyCode["NUM *"] = (keyCode["NUM-*"] = (keyCode["NUM_*"] = 106)));
keyCode["NUM-"] = (keyCode["NUM -"] = (keyCode["NUM--"] = (keyCode["NUM_-"] = 109)));
keyCode.NUM7 = (keyCode["NUM 7"] = (keyCode["NUM-7"] = (keyCode.NUM_7 = 103)));
keyCode.NUM8 = (keyCode["NUM 8"] = (keyCode["NUM-8"] = (keyCode.NUM_8 = 104)));
keyCode.NUM9 = (keyCode["NUM 9"] = (keyCode["NUM-9"] = (keyCode.NUM_9 = 105)));
keyCode["NUM+"] = (keyCode["NUM +"] = (keyCode["NUM-+"] = (keyCode["NUM_+"] = 107)));
keyCode.NUM4 = (keyCode["NUM 4"] = (keyCode["NUM-4"] = (keyCode.NUM_4 = 100)));
keyCode.NUM5 = (keyCode["NUM 5"] = (keyCode["NUM-5"] = (keyCode.NUM_5 = 101)));
keyCode.NUM6 = (keyCode["NUM 6"] = (keyCode["NUM-6"] = (keyCode.NUM_6 = 102)));
keyCode.NUM1 = (keyCode["NUM 1"] = (keyCode["NUM-1"] = (keyCode.NUM_1 = 97)));
keyCode.NUM2 = (keyCode["NUM 2"] = (keyCode["NUM-2"] = (keyCode.NUM_2 = 98)));
keyCode.NUM3 = (keyCode["NUM 3"] = (keyCode["NUM-3"] = (keyCode.NUM_3 = 99)));
keyCode.NUM0 = (keyCode["NUM 0"] = (keyCode["NUM-0"] = (keyCode.NUM_0 = 96)));
keyCode["NUM."] = (keyCode["NUM ."] = (keyCode["NUM-."] = (keyCode["NUM_."] = 110)));
keyCode["NUMERIC/"] = (keyCode["NUMERIC /"] = (keyCode["NUMERIC-/"] = (keyCode["NUMERIC_/"] = 111)));
keyCode["NUMERIC*"] = (keyCode["NUMERIC *"] = (keyCode["NUMERIC-*"] = (keyCode["NUMERIC_*"] = 106)));
keyCode["NUMERIC-"] = (keyCode["NUMERIC -"] = (keyCode["NUMERIC--"] = (keyCode["NUMERIC_-"] = 109)));
keyCode.NUMERIC7 = (keyCode["NUMERIC 7"] = (keyCode["NUMERIC-7"] = (keyCode.NUMERIC_7 = 103)));
keyCode.NUMERIC8 = (keyCode["NUMERIC 8"] = (keyCode["NUMERIC-8"] = (keyCode.NUMERIC_8 = 104)));
keyCode.NUMERIC9 = (keyCode["NUMERIC 9"] = (keyCode["NUMERIC-9"] = (keyCode.NUMERIC_9 = 105)));
keyCode["NUMERIC+"] = (keyCode["NUMERIC +"] = (keyCode["NUMERIC-+"] = (keyCode["NUMERIC_+"] = 107)));
keyCode.NUMERIC4 = (keyCode["NUMERIC 4"] = (keyCode["NUMERIC-4"] = (keyCode.NUMERIC_4 = 100)));
keyCode.NUMERIC5 = (keyCode["NUMERIC 5"] = (keyCode["NUMERIC-5"] = (keyCode.NUMERIC_5 = 101)));
keyCode.NUMERIC6 = (keyCode["NUMERIC 6"] = (keyCode["NUMERIC-6"] = (keyCode.NUMERIC_6 = 102)));
keyCode.NUMERIC1 = (keyCode["NUMERIC 1"] = (keyCode["NUMERIC-1"] = (keyCode.NUMERIC_1 = 97)));
keyCode.NUMERIC2 = (keyCode["NUMERIC 2"] = (keyCode["NUMERIC-2"] = (keyCode.NUMERIC_2 = 98)));
keyCode.NUMERIC3 = (keyCode["NUMERIC 3"] = (keyCode["NUMERIC-3"] = (keyCode.NUMERIC_3 = 99)));
keyCode.NUMERIC0 = (keyCode["NUMERIC 0"] = (keyCode["NUMERIC-0"] = (keyCode.NUMERIC_0 = 96)));
keyCode["NUMERIC."] = (keyCode["NUMERIC ."] = (keyCode["NUMERIC-."] = (keyCode["NUMERIC_."] = 110)));
keyCode["NUMKEY/"] = (keyCode["NUMKEY /"] = (keyCode["NUMKEY-/"] = (keyCode["NUMKEY_/"] = 111)));
keyCode["NUMKEY*"] = (keyCode["NUMKEY *"] = (keyCode["NUMKEY-*"] = (keyCode["NUMKEY_*"] = 106)));
keyCode["NUMKEY-"] = (keyCode["NUMKEY -"] = (keyCode["NUMKEY--"] = (keyCode["NUMKEY_-"] = 109)));
keyCode.NUMKEY7 = (keyCode["NUMKEY 7"] = (keyCode["NUMKEY-7"] = (keyCode.NUMKEY_7 = 103)));
keyCode.NUMKEY8 = (keyCode["NUMKEY 8"] = (keyCode["NUMKEY-8"] = (keyCode.NUMKEY_8 = 104)));
keyCode.NUMKEY9 = (keyCode["NUMKEY 9"] = (keyCode["NUMKEY-9"] = (keyCode.NUMKEY_9 = 105)));
keyCode["NUMKEY+"] = (keyCode["NUMKEY +"] = (keyCode["NUMKEY-+"] = (keyCode["NUMKEY_+"] = 107)));
keyCode.NUMKEY4 = (keyCode["NUMKEY 4"] = (keyCode["NUMKEY-4"] = (keyCode.NUMKEY_4 = 100)));
keyCode.NUMKEY5 = (keyCode["NUMKEY 5"] = (keyCode["NUMKEY-5"] = (keyCode.NUMKEY_5 = 101)));
keyCode.NUMKEY6 = (keyCode["NUMKEY 6"] = (keyCode["NUMKEY-6"] = (keyCode.NUMKEY_6 = 102)));
keyCode.NUMKEY1 = (keyCode["NUMKEY 1"] = (keyCode["NUMKEY-1"] = (keyCode.NUMKEY_1 = 97)));
keyCode.NUMKEY2 = (keyCode["NUMKEY 2"] = (keyCode["NUMKEY-2"] = (keyCode.NUMKEY_2 = 98)));
keyCode.NUMKEY3 = (keyCode["NUMKEY 3"] = (keyCode["NUMKEY-3"] = (keyCode.NUMKEY_3 = 99)));
keyCode.NUMKEY0 = (keyCode["NUMKEY 0"] = (keyCode["NUMKEY-0"] = (keyCode.NUMKEY_0 = 96)));
keyCode["NUMKEY."] = (keyCode["NUMKEY ."] = (keyCode["NUMKEY-."] = (keyCode["NUMKEY_."] = 110)));
var code;
for (var name in keyCode) {
code = keyCode[name];
if (keyCodeName[code] == undefined) {
keyCodeName[code] = name;
} else if ((name.indexOf(" ") != -1) || (name.length == 1)) {
if (keyCodeName[code].length == 1) {
keyCodeName[code] = ((name + " (\"") + keyCodeName[code]) + "\")";
} else {
keyCodeName[code] = name;
}
}
}
}
static function getInstance() {
if (myInstance == undefined) {
myInstance = new keyboardPackage.Keyboard();
}
return(myInstance);
}
static var keyCode = new Array();
static var keyCodeName = new Array();
}
Symbol 228 MovieClip [__Packages.keyboardPackage.ScreenKeyboard] Frame 0
class keyboardPackage.ScreenKeyboard
{
var MC, keyboard, usedKeys;
function ScreenKeyboard (_MC) {
MC = _MC;
keyboard = keyboardPackage.Keyboard.getInstance();
usedKeys = new Array();
setKeys();
}
function onPress(key) {
key_onPress(usedKeys[key], key);
}
function onRelease(key) {
key_onRelease(usedKeys[key], key);
}
function key_onPress(tMC, key) {
tMC.gotoAndStop("pressed");
}
function key_onRelease(tMC, key) {
tMC.enabled = true;
tMC.gotoAndStop("released");
}
function mouse_onRollOver(tMC, key) {
usedKeys[key].isMouse = false;
tMC.gotoAndStop("mouseOver");
}
function mouse_onRollOut(tMC, key) {
tMC.gotoAndStop("released");
usedKeys[key].isMouse = false;
}
function mouse_onPress(tMC, key) {
tMC.gotoAndStop("pressed");
usedKeys[key].isMouse = true;
keyboard.onKeyDown(key);
}
function mouse_onRelease(tMC, key) {
keyboard.onKeyUp(key);
}
function setKeys() {
var keyMC;
var keyMCchar;
var keyMCcode;
var tMC;
var letterLabel;
var numpadkey;
for (var name in MC) {
if ((MC[name] instanceof MovieClip) && (name.indexOf("key") != -1)) {
keyMC = MC[name];
keyMCchar = name.substring(name.lastIndexOf("_") + 1).toUpperCase();
numpadkey = keyMCchar.split("NUM")[1];
if (((!isNaN(numpadkey)) && (numpadkey.length == 2)) && (numpadkey != undefined)) {
keyMCchar = "NUM" + String.fromCharCode(Number(numpadkey));
}
if ((!isNaN(Number(keyMCchar))) && (keyMCchar.length > 1)) {
keyMCchar = String.fromCharCode(Number(keyMCchar));
}
keyMCcode = keyboard.getKeyCode(keyMCchar);
usedKeys[keyMCcode] = keyMC;
keyMC.onPress = system.Delegate.create(this, mouse_onPress, keyMC, keyMCcode);
keyMC.onRelease = system.Delegate.create(this, mouse_onRelease, keyMC, keyMCcode);
keyMC.onRollOver = system.Delegate.create(this, mouse_onRollOver, keyMC, keyMCcode);
keyMC.onRollOut = (keyMC.onReleaseOutside = system.Delegate.create(this, mouse_onRollOut, keyMC, keyMCcode));
letterLabel = keyMC.letter.label;
letterLabel.autoSize = "center";
if (keyMCchar.length > 1) {
if (numpadkey) {
keyMCchar = keyMCchar.split("NUM")[1];
} else {
keyMCchar = keyMCchar.substr(0, 1) + keyMCchar.substr(1).toLowerCase();
}
}
letterLabel.text = keyMCchar;
}
}
}
}
Symbol 169 MovieClip Frame 15
stop();
Symbol 170 MovieClip Frame 15
stop();
Symbol 171 MovieClip Frame 15
stop();
Symbol 172 MovieClip Frame 15
stop();
Symbol 173 MovieClip Frame 15
stop();
Symbol 174 MovieClip [missile_start] Frame 1
stop();
Symbol 178 MovieClip Frame 16
Symbol 178 MovieClip Frame 32
gotoAndPlay ("onlyroll");
Symbol 180 MovieClip Frame 16
Symbol 180 MovieClip Frame 32
gotoAndPlay ("onlyroll");
Symbol 181 MovieClip Frame 16
Symbol 181 MovieClip Frame 32
gotoAndPlay ("onlyroll");
Symbol 182 MovieClip Frame 16
Symbol 182 MovieClip Frame 32
gotoAndPlay ("onlyroll");
Symbol 183 MovieClip Frame 16
Symbol 183 MovieClip Frame 32
gotoAndPlay ("onlyroll");
Symbol 184 MovieClip [missile_rolling] Frame 1
stop();
Symbol 191 MovieClip [missile_ghost] Frame 1
stop();
Symbol 192 MovieClip Frame 16
stop();
Symbol 194 MovieClip Frame 16
stop();
Symbol 195 MovieClip Frame 16
stop();
Symbol 196 MovieClip Frame 16
stop();
Symbol 197 MovieClip Frame 16
stop();
Symbol 198 MovieClip [missile_fireout] Frame 1
stop();
Symbol 201 MovieClip Frame 15
this._parent.removeMovieClip();
Symbol 204 MovieClip Frame 15
this._parent.removeMovieClip();
Symbol 207 MovieClip Frame 15
this._parent.removeMovieClip();
Symbol 210 MovieClip Frame 15
this._parent.removeMovieClip();
Symbol 213 MovieClip Frame 15
this._parent.removeMovieClip();
Symbol 214 MovieClip [missile_fadeout] Frame 1
stop();
Symbol 216 MovieClip Frame 32
this._parent.removeMovieClip();
Symbol 217 MovieClip Frame 32
this._parent.removeMovieClip();
Symbol 218 MovieClip Frame 32
this._parent.removeMovieClip();
Symbol 219 MovieClip Frame 32
this._parent.removeMovieClip();
Symbol 220 MovieClip Frame 32
this._parent.removeMovieClip();
Symbol 221 MovieClip [missile_burnout] Frame 1
stop();