Frame 1
stop();
Frame 2
function box(px, py, box_type) {
this.x = px;
this.y = py;
this.type = box_type;
this.isopen = false;
this.isNUM = function () {
return((0 < this.type) && (type < 9));
};
this.isBOMB = function () {
return(this.type == "bomb");
};
}
function name(px, py) {
return((("b_" + px) + "_") + py);
}
function Mname(px, py) {
return((("m_" + px) + "_") + py);
}
function convert(nam) {
return("b" + (substring(nam, 2, nam.length - 1)));
}
function convertM(nam) {
return("m" + (substring(nam, 2, nam.length - 1)));
}
function convert(nam) {
return("b" + (substring(nam, 2, nam.length - 1)));
}
function isbomb(BX) {
return(eval (BX).type == "bomb");
}
function isempty(BX) {
return(eval (BX).type == "empty");
}
function istype(BX) {
return(eval (BX).type);
}
function count_bomb(BX) {
var count = 0;
var x = eval (BX).x;
var y = eval (BX).y;
var i = (y - 1);
while ((y + 1) >= i) {
if (isbomb(name(x - 1, i))) {
count++;
}
if (isbomb(name(x + 1, i))) {
count++;
}
if (isbomb(name(x, i))) {
count++;
}
i++;
}
return(count);
}
var win = ((sizeX * sizeY) - numof_bomb);
var x = 1;
while (sizeX >= x) {
var y = 1;
while (sizeY >= y) {
Set(name(x, y), new box(x, y, "empty"));
y++;
}
x++;
}
var bomb = new Array(numof_bomb);
var i = 0;
while (i < numof_bomb) {
var x = (random(sizeX) + 1);
var y = (random(sizeY) + 1);
if (!isbomb(name(x, y))) {
Set(name(x, y), new box(x, y, "bomb"));
bomb[i] = name(x, y);
} else {
i--;
}
i++;
}
var x = 1;
while (sizeX >= x) {
var y = 1;
while (sizeY >= y) {
if (!isbomb(name(x, y))) {
eval (name(x, y)).type = count_bomb(name(x, y));
if (eval (name(x, y)).type == 0) {
eval (name(x, y)).type = "empty";
}
}
y++;
}
x++;
}
Frame 3
function open(BX) {
var x = eval (BX).x;
var y = eval (BX).y;
var i = (y - 1);
while ((y + 1) >= i) {
var j = (x - 1);
while ((x + 1) >= j) {
eval (Mname(j, i)).gotoAndStop(3);
j++;
}
i++;
}
}
function check(BX) {
if (!eval (BX).isopen) {
win--;
}
eval (BX).isopen = true;
if (win == 0) {
gotoAndStop (4);
}
}
function dead() {
var i = 0;
while (i < numof_bomb) {
eval (convertM(bomb[i])).num = "X";
eval (convertM(bomb[i])).gotoAndStop(3);
i++;
}
gotoAndStop (5);
}
var l = 20;
thebox._width = 480 / sizeX;
thebox._height = 295 / sizeY;
var i = 1;
while (sizeX >= i) {
var j = 1;
while (sizeY >= j) {
l++;
duplicateMovieClip (thebox, Mname(i, j), l);
eval (Mname(i, j))._x = ((i - 1) * thebox._width) + 36;
eval (Mname(i, j))._y = ((j - 1) * thebox._height) + 36;
j++;
}
i++;
}
stop();
Frame 4
getURL ("javascript:alert('You Won!')");
stop();
Frame 5
getURL ("javascript:alert('You Lose!')");
stop();
Symbol 5 Button
on (press) {
play();
}
Symbol 14 Button
on (release) {
gotoAndStop (2);
click++;
tellTarget (timer) {
play();
};
var _root:temp = ("b" + (substring(this._name, 2, this._name.length - 1)));
}
Symbol 15 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 8
if (1 < _parent.click) {
_parent.click = 0;
_parent.gotoAndPlay(3);
} else {
_parent.click = 0;
_parent.gotoAndStop(1);
_parent.symbol.play();
}
Symbol 19 MovieClip Frame 1
stop();
Symbol 19 MovieClip Frame 2
stop();
Symbol 19 MovieClip Frame 3
stop();
Symbol 22 MovieClip Frame 1
click = 0;
stop();
Symbol 22 MovieClip Frame 2
stop();
Symbol 22 MovieClip Frame 3
var curr_box = _root.convert(this._name);
var curr_type = _root.istype(curr_box);
if (curr_type == "bomb") {
if (num != "X") {
_root.dead();
}
} else {
_root.check(curr_box);
if ((0 < curr_type) && (curr_type < 9)) {
num = curr_type;
}
if (curr_type == "empty") {
_root.open(curr_box);
}
}
stop();
Symbol 27 Button
on (release) {
l = 0;
var i = 1;
while (sizeX >= i) {
var j = 1;
while (sizeY >= j) {
unloadMovie (Mname(i, j));
j++;
}
i++;
}
gotoAndStop (1);
}