Frame 1
fscommand ("fullscreen", "false");
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
stop();
Frame 2
fscommand ("fullscreen", "false");
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
current_bytes = this.getBytesLoaded();
tot_bytes = this.getBytesTotal();
percent = int((current_bytes / tot_bytes) * 100) + "% ";
if (current_bytes >= tot_bytes) {
gotoAndStop (24);
}
Frame 3
this.gotoAndPlay("loader");
Frame 24
score = 0;
stop();
Frame 25
timeForLevel = 300000 /* 0x0493E0 */;
checkscore = 1;
_root.realscore.realscore = 0;
cell._visible = false;
game = {};
game.board = _root.gameBoard;
game.board.game = game;
game.width = 8;
game.height = 8;
game.middle = Math.ceil(game.width / 2);
game.pixelwidth = 350;
game.pixelheight = 350;
game.xspacing = game.pixelwidth / game.width;
game.yspacing = game.pixelheight / game.height;
game.types = 5;
game.depth = 100;
game.speed = 8;
game.selected = [];
game.selectItem = function (xm, ym) {
var x = Math.ceil(xm / this.xspacing);
var y = Math.ceil(ym / this.yspacing);
var cellClicked = ((("cell" + x) + "_") + y);
var cell = this[cellClicked];
if (!this.locked) {
if ((this.selected[0].x == x) && (this.selected[0].y == y)) {
this.selected[0].clip.select._visible = false;
this.selected = [];
return(undefined);
}
cell.clip.select._visible = true;
this.selected.push(cell);
if (this.selected.length == 2) {
this.locked = true;
this.swapPlaces();
}
}
};
game.doneSlidingBack = function () {
this.slid++;
if (this.slid == 2) {
this.locked = false;
}
};
game.addNewItems = function () {
delete this.matched;
this.totalMoving = 0;
this.totalDoneMoving = 0;
var tempFunction = function () {
if (!this.game.pause) {
this._x = this._x + this.speed;
this.x = (this.me.x - 0.5) * this.game.xspacing;
if (Math.abs(this._x - this.x) <= Math.abs(this.speed)) {
this._x = this.x;
this.game.doneMoving();
this.onEnterFrame = null;
}
}
};
if (this.left.length > 0) {
this.left.sortOn("x");
var temp = [];
var i = 0;
while (i < this.left.length) {
var keepGoing = true;
var j = 0;
while (keepGoing) {
if ((this.left[i].y == temp[j][0].y) || (temp[j] == undefined)) {
if (temp[j][0] == undefined) {
temp[j] = [];
}
this.totalmoving++;
temp[j].push(this.left[i]);
var keepGoing = false;
}
j++;
}
i++;
}
var i = 0;
while (i < temp.length) {
var xshift = 1;
var stayHere = true;
var rowTotal = temp[i].length;
var tempOb = {};
while ((temp[i].length > 0) && (stayHere)) {
var ob = temp[i].pop();
var nextHole = temp[i][temp[i].length - xshift];
var beginX = (ob.x - 1);
var x = beginX;
var y = ob.y;
var keepGoing = true;
while (keepGoing) {
var tempName = ((("cell" + x) + "_") + y);
if (this[tempName].name != nextHole.name) {
var holename = ob.name;
delete this[holename];
this[holename] = {};
newCell = this[holename];
newCell.x = x + xshift;
newCell.y = y;
newCell.name = holename;
newCell.clip = this[tempName].clip;
newCell.type = this[tempName].type;
newCell.clip.onEnterFrame = tempFunction;
newCell.clip.speed = this.speed;
newCell.clip.game = this;
newCell.clip.me = newCell;
newCell.clip.x = (newCell.x - 0.5) * this.xspacing;
newCell.clip.y = (newCell.y - 0.5) * this.yspacing;
temp[i].unshift(this[tempname]);
if (!tempOb[holename].moving) {
tempOb[holename].moving = true;
}
var xshift = 1;
var keepGoing = false;
} else if (this[tempName].name == nextHole.name) {
if (x > 1) {
x--;
xshift++;
var nextHole = temp[i][temp[i].length - xshift];
} else {
var numToAdd = rowTotal;
var n = 1;
while (n <= numToAdd) {
var stayHere = false;
var keepGoing = false;
var type = (random(this.types) + 1);
var x = n;
var name = ((("cell" + x) + "_") + y);
this[name] = {x:x, y:y, name:name, type:type};
this.addNewLeftClip(this[name], numToAdd);
this[name].clip.onEnterFrame = tempFunction;
this[name].clip.gotoAndStop(type);
n++;
}
}
}
}
}
i++;
}
}
if (this.right.length > 0) {
this.right.sortOn("x");
var temp = [];
var i = 0;
while (i < this.right.length) {
var keepGoing = true;
var j = 0;
while (keepGoing) {
if ((this.right[i].y == temp[j][0].y) || (temp[j] == undefined)) {
if (temp[j][0] == undefined) {
temp[j] = [];
}
temp[j].push(this.right[i]);
this.totalmoving++;
var keepGoing = false;
}
j++;
}
i++;
}
now = getTimer();
var i = 0;
while (i < temp.length) {
if ((getTimer() - now) > 2000) {
trace("break 1");
break;
}
var xshift = 1;
var stayHere = true;
var rowTotal = temp[i].length;
var tempOb = {};
while ((temp[i].length > 0) && (stayHere)) {
if ((getTimer() - now) > 2000) {
trace("break 2");
break;
}
var ob = temp[i].shift();
var nextHole = temp[i][xshift - 1];
var beginX = (ob.x + 1);
var x = beginX;
var y = ob.y;
var keepGoing = true;
while (keepGoing) {
if ((getTimer() - now) > 2000) {
trace("break 3");
break;
}
var tempName = ((("cell" + x) + "_") + y);
if (this[tempName].name != nextHole.name) {
var holename = ob.name;
delete this[holename];
this[holename] = {};
newCell = this[holename];
newCell.x = x - xshift;
newCell.y = y;
newCell.name = holename;
newCell.clip = this[tempName].clip;
newCell.type = this[tempName].type;
newCell.clip.onEnterFrame = tempFunction;
newCell.clip.speed = -this.speed;
newCell.clip.game = this;
newCell.clip.me = newCell;
newCell.clip.x = (newCell.x - 0.5) * this.xspacing;
newCell.clip.y = (newCell.y - 0.5) * this.yspacing;
temp[i].push(this[tempname]);
if (!tempOb[holename].moving) {
tempOb[holename].moving = true;
}
var xshift = 1;
var keepGoing = false;
} else if (this[tempName].name == nextHole.name) {
if (x < this.width) {
x++;
xshift++;
var nextHole = temp[i][xshift - 1];
} else {
var numToAdd = rowTotal;
var n = 1;
while (n <= numToAdd) {
var stayHere = false;
var keepGoing = false;
var type = (random(this.types) + 1);
var x = ((this.width - n) + 1);
var name = ((("cell" + x) + "_") + y);
this[name] = {x:x, y:y, name:name, type:type};
this.addNewRightClip(this[name], (rowTotal - n) + 0.5);
this[name].clip.onEnterFrame = tempFunction;
this[name].clip.gotoAndStop(type);
n++;
}
}
}
}
}
i++;
}
}
delete this.right;
delete this.left;
};
game.doneMoving = function () {
this.totalDoneMoving++;
if (this.totalDoneMoving == this.totalMoving) {
var valid = this.checkForMatches();
if (valid) {
this.playSquish();
this.removeItems();
} else {
this.selected = [];
this.locked = false;
this.displayPatch();
}
}
};
game.displayPatch = function () {
var i = 1;
while (i <= this.width) {
var j = 1;
while (j <= this.height) {
var name = ((("cell" + i) + "_") + j);
var ob = this[name];
ob.clip._x = (ob.x - 0.5) * this.xspacing;
ob.clip._y = (ob.y - 0.5) * this.yspacing;
ob.clip.onEnterFrame = null;
j++;
}
i++;
}
};
game.addNewRightClip = function (who, num) {
var newDepth = (++this.depth);
var clip = ("fruit" + newDepth);
this.board.attachMovie("fruit", clip, newDepth);
var tempx = ((who.x - 0.5) * this.xspacing);
var tempy = ((who.y - 0.5) * this.yspacing);
who.clip = this.board[clip];
var a = (this.width + num);
var placex = (a * this.xspacing);
who.clip.me = who;
who.clip.dir = "right";
who.clip.x = tempx;
who.clip.y = tempy;
who.clip._x = placex;
who.clip._y = tempy;
who.clip.speed = -this.speed;
who.clip.game = this;
who.clip.gotoAndStop(who.type);
};
game.addNewLeftClip = function (who, num) {
var newDepth = (++this.depth);
var clip = ("fruit" + newDepth);
this.board.attachMovie("fruit", clip, newDepth);
var tempx = ((who.x - 0.5) * this.xspacing);
var placex = ((((num + 1) - who.x) - 0.5) * this.xspacing);
var tempy = ((who.y - 0.5) * this.yspacing);
who.clip = this.board[clip];
who.clip.me = who;
who.clip.dir = "left";
who.clip.x = tempx;
who.clip.y = tempy;
who.clip._x = -placex;
who.clip._y = tempy;
who.clip.speed = this.speed;
who.clip.game = this;
who.clip.gotoAndStop(who.type);
};
game.premove = function () {
this.left = [];
this.right = [];
var i = 0;
while (i < this.matched.length) {
if (this.matched[i].x <= this.middle) {
this.left.push(this.matched[i]);
} else {
this.right.push(this.matched[i]);
}
i++;
}
this.addNewItems();
};
game.removed = function (who) {
who.removeMovieClip();
this.removedSoFar++;
if (this.removedSoFar == this.itemsToRemove) {
this.premove();
}
};
game.removeItems = function () {
this.itemsToRemove = this.matched.length;
this.removedSoFar = 0;
var i = 0;
while (i < this.matched.length) {
this.matched[i].clip.fruit.game = this;
this.matched[i].clip.fruit.play();
i++;
}
};
game.playSquish = function () {
_root.squish = new Sound();
_root.squish.attachSound("squish");
_root.squish.setVolume(100);
_root.squish.start();
};
game.playNo = function () {
_root.No = new Sound();
_root.No.attachSound("No");
_root.No.setVolume(100);
_root.No.start();
};
game.doneSliding = function () {
this.slid++;
if (this.slid == 2) {
var valid = this.verifySelections();
if (valid) {
this.playSquish();
this.removeItems();
} else {
this.swapBack();
this.selected = [];
this.playNo();
}
}
};
game.swapBack = function () {
this.slid = 0;
var cell1 = this.selected[0];
var cell2 = this.selected[1];
var tempFunction = function () {
this.xmov = (this.homex - this._x) * this.k;
this.ymov = (this.homey - this._y) * this.k;
this._x = this._x + this.xmov;
this._y = this._y + this.ymov;
if ((Math.abs(this.xmov) < 1) && (Math.abs(this.ymov) < 1)) {
this._x = this.homex;
this._y = this.homey;
this.game.doneSlidingBack();
this.onEnterFrame = null;
}
};
cell1.clip.onEnterFrame = tempFunction;
cell2.clip.onEnterFrame = tempFunction;
};
game.swapPlaces = function () {
this.slid = 0;
var cell1 = this.selected[0];
var cell2 = this.selected[1];
cell1.clip.select._visible = false;
cell2.clip.select._visible = false;
cell1.clip.x = cell2.clip._x;
cell1.clip.homex = cell1.clip._x;
cell2.clip.homex = cell2.clip._x;
cell1.clip.homey = cell1.clip._y;
cell2.clip.homey = cell2.clip._y;
cell1.clip.y = cell2.clip._y;
cell1.clip.k = 0.3;
cell2.clip.k = 0.3;
cell2.clip.x = cell1.clip._x;
cell2.clip.y = cell1.clip._y;
cell1.clip.go = true;
cell2.clip.go = true;
cell1.clip.game = this;
cell2.clip.game = this;
var tempFunction = function () {
if (this.go) {
this.xmov = (this.x - this._x) * this.k;
this.ymov = (this.y - this._y) * this.k;
this._x = this._x + this.xmov;
this._y = this._y + this.ymov;
if ((Math.abs(this.xmov) < 1) && (Math.abs(this.ymov) < 1)) {
this._x = this.x;
this._y = this.y;
this.game.doneSliding();
this.go = false;
}
}
};
cell1.clip.onEnterFrame = tempFunction;
cell2.clip.onEnterFrame = tempFunction;
};
game.addToMatch = function (which) {
var okToInsert = true;
var tempCell = which;
var n = 0;
while (n < this.matched.length) {
if ((this.matched[n].x == tempCell.x) && (this.matched[n].y == tempCell.y)) {
var okToInsert = false;
}
n++;
}
if (okToInsert) {
this.matched.push(which);
}
};
game.checkForMatches = function () {
var returnVal = false;
this.matched = [];
var i = 1;
while (i <= this.width) {
var j = 1;
while (j <= this.height) {
var matchFound = false;
var cell = this[(("cell" + i) + "_") + j];
var rightCell1 = this[(("cell" + (i + 1)) + "_") + j];
var rightCell2 = this[(("cell" + (i + 2)) + "_") + j];
var rightCell3 = this[(("cell" + (i + 3)) + "_") + j];
var rightCell4 = this[(("cell" + (i + 4)) + "_") + j];
var bottomCell1 = this[(("cell" + i) + "_") + (j + 1)];
var bottomCell2 = this[(("cell" + i) + "_") + (j + 2)];
var bottomCell3 = this[(("cell" + i) + "_") + (j + 3)];
var bottomCell4 = this[(("cell" + i) + "_") + (j + 4)];
if ((cell.type == rightCell1.type) && (cell.type == rightCell2.type)) {
var matchFound = true;
this.addToMatch(cell);
this.addToMatch(rightCell1);
this.addToMatch(rightCell2);
if (cell.type == rightCell3.type) {
this.addToMatch(rightCell3);
}
if ((cell.type == rightCell3.type) && (cell.type == rightCell4.type)) {
this.addToMatch(rightCell4);
}
returnVal = true;
}
if ((cell.type == bottomCell1.type) && (cell.type == bottomCell2.type)) {
var matchFound = true;
this.addToMatch(cell);
this.addToMatch(bottomCell1);
this.addToMatch(bottomCell2);
if (cell.type == bottomCell3.type) {
this.addToMatch(bottomCell3);
}
if ((cell.type == bottomCell3.type) && (cell.type == bottomCell4.type)) {
this.addToMatch(bottomCell4);
}
returnVal = true;
}
j++;
}
i++;
}
return(returnVal);
};
game.areThereMatches = function () {
var valid = false;
var b = 0;
while (b < 2) {
var m = 1;
while (m <= this.height) {
var n = 1;
while (n <= this.width) {
if (b == 0) {
var tempx1 = n;
var tempy1 = m;
var tempx2 = (tempx1 + 1);
var tempy2 = tempy1;
} else {
var tempx1 = n;
var tempy1 = m;
var tempx2 = tempx1;
var tempy2 = (tempy1 + 1);
}
var cell1 = this[(("cell" + tempx1) + "_") + tempy1];
var cell2 = this[(("cell" + tempx2) + "_") + tempy2];
var valid = false;
var oldCell1 = cell1;
var oldCell2 = cell2;
var cell1Name = cell1.name;
var cell2Name = cell2.name;
if ((cell1.x == cell2.x) && (((cell1.y - 1) == cell2.y) || ((cell1.y + 1) == cell2.y))) {
this[oldCell1.name] = oldCell2;
this[oldCell2.name] = oldCell1;
var valid = this.checkForMatches();
}
if ((cell1.y == cell2.y) && (((cell1.x - 1) == cell2.x) || ((cell1.x + 1) == cell2.x))) {
this[oldCell1.name] = oldCell2;
this[oldCell2.name] = oldCell1;
var valid = this.checkForMatches();
}
this[oldCell1.name] = oldCell1;
this[oldCell2.name] = oldCell2;
if (valid) {
break;
}
n++;
}
if (valid) {
break;
}
m++;
}
if (valid) {
break;
}
b++;
}
trace(valid);
if (valid) {
trace("x1=" + tempx1);
trace("y1=" + tempy1);
trace("x2=" + tempx2);
trace("y2=" + tempy2);
}
};
game.verifySelections = function () {
var cell1 = this.selected[0];
var cell2 = this.selected[1];
var valid = false;
var oldCell1 = cell1;
var oldCell2 = cell2;
var cell1Name = cell1.name;
var cell2Name = cell2.name;
if ((cell1.x == cell2.x) && (((cell1.y - 1) == cell2.y) || ((cell1.y + 1) == cell2.y))) {
this[oldCell1.name] = oldCell2;
this[oldCell2.name] = oldCell1;
var valid = this.checkForMatches();
}
if ((cell1.y == cell2.y) && (((cell1.x - 1) == cell2.x) || ((cell1.x + 1) == cell2.x))) {
this[oldCell1.name] = oldCell2;
this[oldCell2.name] = oldCell1;
var valid = this.checkForMatches();
}
if (!valid) {
this[oldCell1.name] = oldCell1;
this[oldCell2.name] = oldCell2;
cell1.clip.select._visible = false;
cell2.clip.select._visible = false;
} else {
var x1 = this[cell1Name].x;
var y1 = this[cell1Name].y;
var x2 = this[cell2Name].x;
var y2 = this[cell2Name].y;
this[cell1Name].x = x2;
this[cell1Name].y = y2;
this[cell2Name].x = x1;
this[cell2Name].y = y1;
this[cell1Name].name = cell1Name;
this[cell2Name].name = cell2Name;
}
return(valid);
};
game.board.onMouseDown = function () {
if (this.hitTest(this._parent._xmouse, this._parent._ymouse)) {
this.game.selectItem(this._xmouse, this._ymouse);
}
};
game.addClip = function (who) {
var newDepth = (++this.depth);
var clip = ("fruit" + newDepth);
this.board.attachMovie("fruit", clip, newDepth);
who.clip = this.board[clip];
who.clip._x = (who.x - 0.5) * this.xspacing;
who.clip._y = (who.y - 0.5) * this.yspacing;
who.clip.gotoAndStop(who.type);
};
game.generateBoard = function () {
var i = 1;
while (i <= this.width) {
var j = 1;
while (j <= this.height) {
var name = ((("cell" + i) + "_") + j);
var leftCell = ((("cell" + (i - 1)) + "_") + j);
var farLeftCell = ((("cell" + (i - 2)) + "_") + j);
var topCell = ((("cell" + i) + "_") + (j - 1));
var farTopCell = ((("cell" + i) + "_") + (j - 2));
var keepLooking = true;
while (keepLooking) {
var keepLooking = false;
var type = (random(this.types) + 1);
if (((this[leftCell].type == type) && (this[farLeftCell].type == type)) || ((this[topCell].type == type) && (this[farTopCell].type == type))) {
var keepLooking = true;
}
}
this[name] = {x:i, y:j, name:name, type:type};
this.addClip(this[name]);
j++;
}
i++;
}
};
game.generateBoard();
Instance of Symbol 128 MovieClip "realscore" in Frame 25
onClipEvent (load) {
bonus = new sound();
bonus.attachSound("bonus");
}
onClipEvent (enterFrame) {
if (_root.score != _root.realscore.realscore) {
_root.realscore.realscore = _root.realscore.realscore + 50;
bonus.setVolume(20);
bonus.start();
}
}
Instance of Symbol 134 MovieClip in Frame 25
onClipEvent (load) {
maxTime = _root.timeForLevel;
timeStart = getTimer();
}
onClipEvent (enterFrame) {
timeElapsed = maxTime - (getTimer() - timeStart);
timeRealSeconds = Math.floor(timeElapsed / 1000);
timeMinutes = Math.floor(timeRealSeconds / 60);
trace(timeMinutes);
timeSeconds = timeRealSeconds - (timeMinutes * 60);
if (timeSeconds < 10) {
timeseconds = String("0" + timeseconds);
}
_root.timer = (timeMinutes + ":") + timeSeconds;
_root.timeScore = timeRealSeconds;
if ((timeSeconds <= 0) && (timeMinutes <= 0)) {
_root.gotoAndStop("label_gameover");
}
if ((timeSeconds == 10) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(2);
}
if ((timeSeconds == 9) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(5);
}
if ((timeSeconds == 8) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(10);
}
if ((timeSeconds == 7) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(15);
}
if ((timeSeconds == 6) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(20);
}
if ((timeSeconds == 5) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(25);
}
if ((timeSeconds == 4) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(30);
}
if ((timeSeconds == 3) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(35);
}
if ((timeSeconds == 2) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(40);
}
if ((timeSeconds == 1) && (timeMinutes <= 0)) {
_root.count.gotoAndStop(45);
}
}
Frame 29
for (var x in this.gameBoard) {
if (typeof(this.gameBoard[x]) == "movieclip") {
this.gameBoard[x].removeMovieClip();
}
}
stop();
game.doneMoving = function () {
this.totalDoneMoving++;
if (this.totalDoneMoving == this.totalMoving) {
var valid = this.checkForMatches();
if (valid) {
this.locked = true;
} else {
this.locked = true;
}
}
};
Instance of Symbol 139 MovieClip in Frame 29
onClipEvent (enterFrame) {
_root.checkscore = 2;
}
Symbol 26 MovieClip Frame 112
_root.gotoAndPlay("loader");
Symbol 30 MovieClip Frame 120
stop();
Symbol 60 MovieClip Frame 10
stop();
Symbol 61 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 45
stop();
Symbol 68 MovieClip Frame 9
stop();
Symbol 71 MovieClip Frame 1
stop();
Symbol 71 MovieClip Frame 10
if (_root.checkscore == 1) {
_root.score = _root.score + 100;
}
game.removed(this._parent);
stop();
Symbol 79 MovieClip Frame 1
stop();
Symbol 79 MovieClip Frame 10
if (_root.checkscore == 1) {
_root.score = _root.score + 100;
}
game.removed(this._parent);
stop();
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 10
if (_root.checkscore == 1) {
_root.score = _root.score + 100;
}
game.removed(this._parent);
stop();
Symbol 91 MovieClip Frame 1
stop();
Symbol 91 MovieClip Frame 10
if (_root.checkscore == 1) {
_root.score = _root.score + 100;
}
game.removed(this._parent);
stop();
Symbol 97 MovieClip Frame 1
stop();
Symbol 97 MovieClip Frame 10
if (_root.checkscore == 1) {
_root.score = _root.score + 100;
}
game.removed(this._parent);
stop();
Symbol 98 MovieClip [fruit] Frame 1
stop();
select._visible = false;
Symbol 110 Button
on (release) {
nextFrame();
}
Symbol 115 Button
on (release) {
getURL ("http://www.ultimatearcade.com", "_blank");
}
Symbol 119 Button
on (release) {
getURL ("http://www.ultimatearcade.com/downloads/", "_blank");
}
Symbol 121 Button
on (release) {
game.areThereMatches();
}
Symbol 135 MovieClip Frame 19
stop();
Instance of Symbol 141 MovieClip in Symbol 142 MovieClip Frame 1
onClipEvent (enterFrame) {
this.depth = 125;
}
Symbol 146 Button
on (release) {
_root.gotoAndStop("good");
}
Symbol 149 MovieClip Frame 1
stop();