Frame 1
function startup() {
if (a) {
return(undefined);
}
a = true;
b = new c("CubeChaos");
b.d();
}
function g() {
var _local2 = this;
var h = createEmptyMovieClip("sprite_root", 0);
var i = 500;
var j = new Array(i);
var _local1 = 0;
while (_local1 < i) {
j[_local1] = i - _local1;
_local1++;
}
var l = new Object();
_local2.m = function () {
return(j.length);
};
_local2.n = function (o) {
var _local1 = o;
var _local3 = this;
var p = (j.pop() + i);
var q = ("sprite" + p);
var _local2;
if ((typeof(_local1.s) == "string") && (l[_local1.s])) {
l[_local1.s].createEmptyMovieClip(q, p);
_local2 = l[_local1.s][q];
} else {
h.createEmptyMovieClip(q, p);
_local2 = h[q];
}
if (typeof(_local1.t) == "string") {
_local2.attachMovie(_local1.t, "member_mc", p);
}
_local2._x = ((typeof(_local1.u) == "number") ? (_local1.u) : (Stage.width / 2));
_local2._y = ((typeof(_local1.v) == "number") ? (_local1.v) : (Stage.height / 2));
if (typeof(_local1.width) == "number") {
_local2._width = _local1.width;
}
if (typeof(_local1.height) == "number") {
_local2._height = _local1.height;
}
if (typeof(_local1.w) == "number") {
_local2._xscale = _local1.w;
}
if (typeof(_local1.x) == "number") {
_local2._yscale = _local1.x;
}
_local2._visible = ((typeof(_local1.y) == "boolean") ? (_local1.y) : true);
_local2._alpha = ((typeof(_local1.z) == "number") ? (_local1.z) : 100);
_local2.ac = p;
_local2.ad = function () {
var _local1 = this;
var ae = _local1.ac;
var _local2 = _local1.ac % i;
_local1.swapDepths(_local2);
_local1.member_mc.swapDepths(_local2);
_local1.ac = _local2;
};
_local2.ag = function () {
var _local2 = this;
var _local1 = (_local2.ac % i) + (i * 2);
_local2.swapDepths(_local1);
_local2.member_mc.swapDepths(_local1);
_local2.ac = _local1;
};
return(_local2);
};
_local2.ah = function (o) {
var _local2 = o;
if (typeof(_local2.s) == "string") {
var _local1 = _local2.s;
_local2.s = null;
if (l[_local1]) {
aj("Alert! generating an already existing group: ", _local1);
} else {
l[_local1] = this.n(_local2);
l[_local1].ak = _local1;
}
}
return(l[_local1]);
};
_local2.al = function (am) {
var _local1 = am;
if (typeof(_local1) == "string") {
ai = _local1;
} else {
ai = _local1.ak;
}
if (l[ai]) {
f.an(l[ai]);
l[ai] = null;
}
};
_local2.setMember = function (ao, t) {
ao.attachMovie(t, "member_mc", ao.getDepth());
};
_local2.ap = function (o) {
var _local1 = o;
var aq = this.n({u:_local1.u, v:_local1.v});
aq.createTextField("member_mc", aq.ac, 0, 0, 1, 1);
var _local2 = aq.member_mc;
_local2.autosize = ((typeof(_local1.align) == "string") ? (_local1.align) : "left");
_local2.multiline = false;
_local2.wordWrap = false;
_local2.border = false;
_local2.selectable = false;
_local2.type = "dynamic";
_local2.embedFonts = true;
var _local3 = new TextFormat();
_local3.color = ((typeof(_local1.color) == "string") ? (_local1.color) : "0xffffff");
_local3.size = _local1.size || 9;
_local3.font = ((typeof(_local1.font) == "string") ? (_local1.font) : "Arial");
_local3.align = ((typeof(_local1.align) == "string") ? (_local1.align) : "left");
_local3.bold = ((typeof(_local1.bold) == "boolean") ? (_local1.bold) : false);
_local2.setNewTextFormat(_local3);
_local2.text = ((typeof(_local1.text) == "string") ? (_local1.text) : "");
return(aq);
};
_local2.an = function (ao) {
var _local2 = ao;
if (!_local2.ac) {
} else {
var _local1 = _local2.ac % i;
_local2.removeMovieClip();
j.push(_local1);
return(_local1);
}
return(undefined);
};
}
function au() {
var _local3 = this;
var av = new Array();
var aw = 0;
_local3.ax = function (object) {
var _local2 = object;
if (typeof(_local2.ay) == "function") {
var _local1 = 0;
while (_local1 < av.length) {
if (av[_local1] == _local2) {
return;
}
_local1++;
}
av.push(_local2);
} else {
aj("tried to run bad object!");
az(_local2);
}
};
_local3.bc = function (object) {
var _local2 = object;
var _local1 = 0;
while (_local1 < av.length) {
if (av[_local1] == _local2) {
aw++;
av[_local1].bd = true;
return;
}
_local1++;
}
};
onEnterFrame = function () {
var _local2 = av;
var _local1 = 0;
while (_local1 < _local2.length) {
if (!_local2[_local1].bd) {
_local2[_local1].ay();
}
_local1++;
}
if (aw > 0) {
_local1 = 0;
while (_local1 < av.length) {
if (av[_local1].bd) {
av[_local1].bd = false;
av.splice(_local1, 1);
_local1--;
aw--;
}
_local1++;
}
}
};
_local3.bf = function () {
aj("Running Object list:");
var _local1 = 0;
while (_local1 < av.length) {
aj(av[_local1]);
_local1++;
}
};
_local3.bg = function () {
var _local2 = av;
var _local1 = 0;
while (_local1 < _local2.length) {
if (typeof(_local2[_local1]) != "object") {
aj("invalid object in event: ", _local1);
}
_local1++;
}
};
}
function bi() {
var _local3 = ["errorclick.aif", "xplode.aif", "gameover.aif", "levelup.aif", "midascoin.aif", "blockdrop.aif"];
createEmptyMovieClip("sound_fx", -1);
var bk = 0;
var bl = new Object();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = new Sound(bn.createEmptyMovieClip("sound_" + (_local1 + 1), (-_local1) - 2));
_local2.attachSound(_local3[_local1]);
_local2.onSoundComplete = function () {
this.bo = false;
};
bl[_local3[_local1]] = _local2;
bl[_local3[_local1]].bo = false;
_local1++;
}
this.play = function (sound, bp) {
var _local1 = sound;
if (bl[_local1].bo) {
if (bp) {
return;
}
this.stop(_local1);
}
bl[_local1].bo = true;
bl[_local1].start();
};
this.stop = function (sound) {
bl[sound].stop();
bl[sound].bo = false;
};
}
function c() {
var _local1 = this;
function start() {
var _local1 = new XML();
_local1.ignoreWhite = true;
_local1.parseXML(gameData);
random.dd(_local1.firstChild.attributes.randomseed);
cb = ((typeof(_local1.firstChild.attributes.skilllevel) == "string") ? (parseInt(_local1.firstChild.attributes.skilllevel)) : 1);
cw = ((typeof(_local1.firstChild.attributes.timelimit) == "string") ? (parseInt(_local1.firstChild.attributes.timelimit)) : 180);
ch = ((typeof(_local1.firstChild.attributes.postdelay) == "string") ? (parseInt(_local1.firstChild.attributes.postdelay) * 25) : 75);
ce = ((typeof(_local1.final.firstChild.nodeValue) == "string") ? (_local1.final.firstChild.nodeValue) : "You Got");
cf = ((typeof(_local1.timeup.firstChild.nodeValue) == "string") ? (_local1.timeup.firstChild.nodeValue) : "TIME UP!");
cg = ((typeof(_local1.gameover.firstChild.nodeValue) == "string") ? (_local1.gameover.firstChild.nodeValue) : "GAME OVER!");
var _local2 = new Object();
_local2.de = _local1.score.firstChild.nodeValue;
_local2.df = _local1.time.firstChild.nodeValue;
_local2.dg = _local1.instruction.firstChild.nodeValue;
_local2.dh = _local1.level.firstChild.nodeValue;
_local2.di = _local1.next_level.firstChild.nodeValue;
_local2.end = _local1.end.firstChild.nodeValue;
_local2.dj = _local1.levelup.firstChild.nodeValue;
b.cn.dk(_local2);
self.dl();
cy = new Object();
cy.dm = getTimer();
cy.bz = 0;
at.ax(self);
fscommand ("gameStart");
b.dn({action:"version", value:br});
}
function dy(u, color, fa) {
var _local2 = fa;
var _local3 = u;
if (cc[_local3][b.bx - 1]) {
b.et();
return(false);
}
if (typeof(_local2) != "number") {
_local2 = 0;
}
var v = (cc[_local3].length - 1);
while (v > _local2) {
cc[_local3][v] = cc[_local3][v - 1];
cc[_local3][v].fb = v;
cc[_local3][v]._y = b.bv + (((b.bx - v) - 1) * b.bs);
v--;
}
var v = _local2;
var fc = b.bt[color];
var s = cc[_local3].s.ak;
var o = {t:fc, s:s, u:0, v:b.bv + (((b.bx - v) - 1) * b.bs)};
var _local1 = f.n(o);
_local1.useHandCursor = false;
_local1.dv = _local3;
_local1.fb = v;
_local1.fd = false;
_local1.fe = false;
_local1.selected = false;
_local1.color = color;
_local1.onPress = function () {
b.ff(this);
};
_local1.onRollOver = function () {
b.fg(this);
};
_local1.onRollOut = function () {
b.fh(this);
};
cc[_local3][v] = _local1;
cc[_local3].du++;
if ((cc[_local3].du == cj) && (!cc[_local3].s.dq)) {
new fi({ao:cc[_local3].s});
}
return(true);
}
function fv(u, v, color) {
var _local3 = u;
var _local1 = cc[_local3][v];
if ((((_local1.color != color) || (cc[_local3].s.fd)) || (_local1.fd)) || (_local1.fe)) {
return(0);
}
var _local2 = 1;
_local1.fe = true;
cd.push(_local1);
_local2 = _local2 + fv(_local3 - 1, v, color);
_local2 = _local2 + fv(_local3 + 1, v, color);
_local2 = _local2 + fv(_local3, v - 1, color);
_local2 = _local2 + fv(_local3, v + 1, color);
return(_local2);
}
function er() {
if (b.cr > 0) {
cs = true;
} else {
cs = false;
var gi = Math.round(b.bw / 2);
var _local3 = gi;
var _local1 = gi;
while (_local1 < b.bw) {
if (cc[_local1].du > 0) {
if (_local3 < _local1) {
var dp = cc[_local1].s;
dp.fd = true;
var gk = (dp.dv - _local3);
var ee = function () {
this.ef.fd = false;
b.cr--;
if (typeof(b.cx.dv) == "number") {
var _local1 = b.cx;
b.ft();
b.fg(_local1);
}
};
var o = {ao:dp, u:b.bu + (_local3 * b.bs), ei:ee, gl:3};
b.cr++;
new gm(o);
cc[_local1].s.dv = _local3;
var gc = cc[_local3].s;
cc[_local3].s = cc[_local1].s;
cc[_local1].s = gc;
cc[_local1].s._x = b.bu + (_local1 * b.bs);
cc[_local1].s.dv = _local1;
gc = cc[_local3].du;
cc[_local3].du = cc[_local1].du;
cc[_local1].du = gc;
var _local2 = 0;
while (_local2 < cc[_local1].length) {
cc[_local1][_local2].dv = _local3;
cc[_local3][_local2] = cc[_local1][_local2];
cc[_local1][_local2] = false;
_local2++;
}
}
_local3++;
}
_local1++;
}
_local3 = gi - 1;
_local1 = gi - 1;
while (_local1 >= 0) {
if (cc[_local1].du > 0) {
if (_local3 > _local1) {
var dp = cc[_local1].s;
dp.fd = true;
var gk = (dp.dv - _local3);
var ee = function () {
this.ef.fd = false;
b.cr--;
if (typeof(b.cx.dv) == "number") {
var _local1 = b.cx;
b.ft();
b.fg(_local1);
}
};
var o = {ao:dp, u:b.bu + (_local3 * b.bs), ei:ee, gl:3};
b.cr++;
new gm(o);
dp.dv = _local3;
cc[_local1].s.dv = _local3;
var gc = cc[_local3].s;
cc[_local3].s = cc[_local1].s;
cc[_local1].s = gc;
cc[_local1].s._x = b.bu + (_local1 * b.bs);
cc[_local1].s.dv = _local1;
gc = cc[_local3].du;
cc[_local3].du = cc[_local1].du;
cc[_local1].du = gc;
var _local2 = 0;
while (_local2 < cc[_local1].length) {
cc[_local1][_local2].dv = _local3;
cc[_local3][_local2] = cc[_local1][_local2];
cc[_local1][_local2] = false;
_local2++;
}
}
_local3--;
}
_local1--;
}
}
}
function fm() {
var _local3 = 0;
while (_local3 < cc.length) {
var _local2 = 0;
var v = 0;
while (v < cc[1].length) {
if (cc[_local3][v]) {
if (_local2 < v) {
var _local1 = cc[_local3][v];
var gp = (_local1.fb - _local2);
if (_local1.fd) {
_local1.gq = _local1.gq + (gp * b.bs);
} else {
var ee = function () {
b.cr--;
};
var o = {ao:_local1, v:_local1._y + (gp * b.bs), ei:ee};
b.ca.gr(o);
b.cr++;
_local1.fd = true;
}
_local1.fb = _local2;
cc[_local3][_local2] = _local1;
cc[_local3][v] = false;
_local2++;
} else {
_local2++;
}
}
v++;
}
_local3++;
}
}
function gg() {
var _local2 = cd.length;
var _local1 = 0;
while (_local1 < _local2) {
f.setMember(cd[_local1], b.bt[cd[_local1].color] + "1");
cd[_local1].selected = true;
_local1++;
}
}
function fr() {
var _local2 = cd.length;
var _local1 = 0;
while (_local1 < _local2) {
f.setMember(cd[_local1], b.bt[cd[_local1].color]);
cd[_local1].fe = false;
cd[_local1].selected = false;
_local1++;
}
cd = new Array();
}
function gu(gf) {
var _local2 = gf;
_local2.fd = true;
_local2.fe = false;
var o = {t:"gold", u:_local2._parent._x, v:_local2._y};
var dp = f.n(o);
dp.ad();
var ed = ["gold1", "gold2", "gold3", "gold4", "gold5"];
var ee = function () {
f.an(this.ef);
};
new eh({ao:dp, ed:ed, ei:ee});
u = _local2.dv;
v = _local2.fb;
cc[u][v] = false;
cc[u].du--;
if (cc[u].du == (cj - 1)) {
cc[u].s.dq.dr();
}
f.an(_local2);
}
function fz() {
var fu = cd.length;
var u;
var _local2;
var gv = 0;
var _local1 = 0;
while (_local1 < fu) {
_local2 = cd[_local1].fb + 1;
while (_local2 < b.bx) {
var _local3 = cc[cd[_local1].dv][_local2];
if ((_local3.color == 4) && (!_local3.fd)) {
gu(_local3);
gv++;
} else {
break;
}
_local2++;
}
var _local3 = cd[_local1];
gu(_local3);
_local1++;
}
cd = new Array();
if (gv > 0) {
b.dn({action:"midas", value:gv});
}
}
var self = _local1;
_local1.bs = 24;
_local1.bt = ["blue", "red", "green", "white", "coin"];
_local1.bu = 288;
_local1.bv = 23;
_local1.bw = 13;
_local1.bx = 15;
_local1.by = 5;
_local1.bz = 0;
_local1.ca = new ca();
_local1.ca.start();
var cb;
var cc;
var cd = new Array();
var ce;
var cf;
var cg;
var ch;
_local1.ci = false;
var cj = (_local1.bx - 2);
var ck = new cl();
var log = new cm();
_local1.cn = new co();
_local1.cp = new cq();
at.ax(_local1.cp);
_local1.cr = 0;
var cs = false;
var ct = getTimer();
var cu;
var cv = getTimer();
var cw;
_local1.cx = false;
var cy;
_local1.cz = 0;
_local1.d = function () {
var _local1 = new Object();
_local1.ay = function () {
if (gameData != undefined) {
at.bc(this);
b.db();
}
};
at.ax(_local1);
};
_local1.db = function () {
start();
};
_local1.dl = function () {
if (cc) {
var dp;
var _local2 = 0;
while (_local2 < b.bw) {
dp = cc[_local2].s;
if (dp.dq) {
dp.dq.dr();
}
if (dp) {
f.al(dp);
}
_local2++;
}
cc = null;
}
this.cr = 0;
cs = false;
ct = getTimer();
cc = new Array();
var ds = 2;
if (ck.dt() > 3) {
ds = 3;
}
var _local2 = 0;
while (_local2 < b.bw) {
cc.push(new Array());
var _local1 = 0;
while (_local1 < b.bx) {
cc[_local2].push(false);
_local1++;
}
cc[_local2].du = 0;
cc[_local2].s = f.ah({u:b.bu + (_local2 * b.bs), v:0, s:"column_" + _local2});
cc[_local2].s.dv = _local2;
_local1 = 0;
while (_local1 < b.by) {
var _local3 = random.dx(0, ds);
dy(_local2, _local3);
_local1++;
}
_local2++;
}
this.cp.dz();
ck.ea();
};
_local1.eb = function () {
var ec = this.cp.dr();
this.ca.clear();
var ed = ["gold2", "gold5"];
var ee = function () {
f.an(this.ef);
};
var _local3 = 0;
var _local2 = 0;
while (_local2 < b.bw) {
var _local1 = 0;
while (_local1 < b.bx) {
dp = cc[_local2][_local1];
if (dp) {
dp.onPress = null;
dp.onRollOver = null;
dp.onRollOut = null;
_local3 = _local2 * 2;
new eh({ao:dp, ed:ed, ei:ee, ej:_local3});
ec = Math.max(ec, _local3);
dp = dp;
}
_local1++;
}
_local2++;
}
var ek = function () {
if (b.ci) {
return(undefined);
}
b.cn.el(b.dt());
b.dl();
};
var em = new en(ek, ec + 5);
cd = new Array();
};
_local1.eo = function () {
this.eb();
};
_local1.ay = function () {
var _local3 = this;
_local3.bz++;
var ep = getTimer();
if (_local3.ci) {
} else {
if ((ep - ct) >= 3000) {
ct = getTimer();
}
if (cs && (b.cr == 0)) {
er();
}
var _local1 = Math.round(cw - ((ep - cv) / 1000));
_local1 = Math.max(0, _local1);
if (_local1 == 0) {
b.et(cf);
}
_local3.cz++;
_local3.cz = _local3.cz % 10;
var _local2 = String(Math.floor(_local1 / 60) + ":");
_local1 = _local1 % 60;
_local2 = _local2 + ((_local1 < 10) ? ("0" + _local1) : (_local1));
if (cu != _local2) {
_local3.cn.setTime(_local2);
cu = _local2;
}
}
};
_local1.et = function (ev) {
var _local3 = this;
if (_local3.ci) {
} else {
_local3.ci = true;
b.cp.dr();
var _local2 = 0;
while (_local2 < b.bw) {
var _local1 = 0;
while (_local1 < b.bx) {
dp = cc[_local2][_local1];
if (dp) {
dp.onPress = null;
dp.onRollOver = null;
dp.onRollOut = null;
}
_local1++;
}
_local2++;
}
var ew = ((typeof(ev) == "string") ? (ev) : (cg));
_local3.cn.alert(ew, (ce + ": ") + b.ex());
_local3.cn.ey();
bh.play("gameover.aif");
fscommand ("gameEnd", String(b.ez()));
new en(function () {
fscommand ("gameQuit");
}, ch);
}
};
_local1.dt = function () {
return(ck.dt());
};
_local1.fj = function () {
var _local3 = this;
var fk = random.fl(0, _local3.bw - 1);
var _local2;
var _local1 = 0;
while (_local1 < _local3.bw) {
_local2 = (fk + _local1) % _local3.bw;
if ((cc[_local2].du < _local3.bx) && (cc[_local2].du > 0)) {
dy(_local2, 4, _local3.bx - 1);
bh.play("midascoin.aif");
fm();
return;
}
_local1++;
}
};
_local1.fn = function (fo) {
var _local2 = fo;
if (b.cr > 0) {
return(false);
}
var _local3 = false;
var _local1 = 0;
while (_local1 < b.bw) {
if (cc[_local1][b.bx - 1]) {
b.et();
if (cc[_local1].s.dq) {
cc[_local1].s.dq.dr();
}
new fq(cc[_local1].s);
_local3 = true;
}
_local1++;
}
if (_local3) {
return(false);
}
fr();
_local1 = 0;
while (_local1 < _local2.length) {
dy(_local1, _local2[(_local2.length - _local1) - 1].color);
_local1++;
}
return(true);
};
_local1.ff = function (fs) {
var _local1 = fs;
if (cd.length > 0) {
this.ft();
}
ct = getTimer();
var _local2 = fv(_local1.dv, _local1.fb, _local1.color);
if ((_local2 >= 3) && (_local1.color != 4)) {
var fw = _local1._parent._x;
var _local3 = _local1._y;
var fy = b.dn({action:"clear cubes", value:_local2});
fz();
cx = false;
var gc = new gd(fw + 13, _local3, fy);
fm();
er();
bh.play("xplode.aif");
} else {
var fy = b.dn({action:"error click"});
this.ft();
bh.play("errorclick.aif");
}
};
_local1.fg = function (gf) {
var _local1 = gf;
this.cx = _local1;
var _local2 = fv(_local1.dv, _local1.fb, _local1.color);
if (_local2 >= 3) {
gg();
return(true);
}
return(false);
};
_local1.fh = function (gf) {
this.cx = false;
fr();
};
_local1.gs = function (u, v, color) {
var _local1 = v;
var _local2 = u;
var _local3 = color;
if (cc[_local2 + 1][_local1].color == _local3) {
return(true);
}
if (cc[_local2 - 1][_local1].color == _local3) {
return(true);
}
if (cc[_local2][_local1 + 1].color == _local3) {
return(true);
}
if (cc[_local2][_local1 - 1].color == _local3) {
return(true);
}
return(false);
};
_local1.ft = function () {
var _local2 = cd.length;
var _local1 = 0;
while (_local1 < _local2) {
cd[_local1].fe = false;
_local1++;
}
cd = new Array();
};
_local1.ex = function () {
return(ck.ex());
};
_local1.dt = function () {
return(ck.dt());
};
_local1.gw = function () {
return(cb);
};
_local1.dn = function (o) {
log.gx(o);
return(ck.dn(o));
};
_local1.ez = function () {
var _local3 = new cl();
var _local2 = log.gz();
var _local1 = 0;
while (_local1 < _local2.length) {
_local3.dn(_local2[_local1]);
_local1++;
}
var ha = _local3.ex();
return(ha);
};
_local1.hb = function () {
var _local2 = 0;
while (_local2 < b.bw) {
aj("Group:");
az(cc[_local2].s);
var _local1 = 0;
while (_local1 < b.bx) {
dp = cc[_local2][_local1];
if (dp) {
aj("gridX", dp.dv, "gridY", dp.fb, "x", dp._x, "y", dp._y);
}
_local1++;
}
_local2++;
}
aj("---------------------------------------------------");
az(cc, true);
};
_local1.hc = function (hd) {
var _local2 = this;
var _local1 = cc[hd[0]][hd[1]];
if (!_local1) {
return(false);
}
if (_local1.fe || (!_local1.onPress)) {
return(false);
}
aj("block x:", _local1.dv, " y: ", _local1.fb);
if (_local2.fg(_local1)) {
_local2.ff(_local1);
_local2.fh(_local1);
return(true);
}
_local2.fh(_local1);
return(false);
};
}
function aj() {
var _local2 = arguments;
var _local3 = "> ";
var _local1 = 0;
while (_local1 < _local2.length) {
_local3 = _local3 + _local2[_local1];
_local1++;
if (_local2.length != _local1) {
_local3 = _local3 + " ";
}
}
trace(_local3);
}
function az(hg, hh) {
var _local1 = hg;
var _local3 = hh;
function hi(hg, hh, hj) {
var _local1 = hg;
var _local2 = hj;
var _local3 = hh;
_local2 = ((typeof(_local2) == "string") ? (_local2 + ".") : "");
for (hk in _local1) {
trace(((_local2 + hk) + ": ") + _local1[hk]);
if (_local3) {
if (typeof(_local1[hk]) == "object") {
hi(_local1[hk], _local3, _local2 + hk);
}
}
}
}
trace("--- Obj dump: ---------");
hi(_local1, _local3);
trace("-----------------------");
}
function hl(width, hm) {
var _local2 = "";
var _local3 = ((typeof(hm) != "string") ? " " : (hm));
var _local1 = 0;
while (_local1 < width) {
_local2 = _local2 + _local3;
_local1++;
}
return(_local2);
}
function Random() {
var _local1 = this;
var hp = 0;
var hq = 0;
_local1.ds = function (start, stop) {
var _local2 = stop - start;
var _local1 = Math.random() * (_local2 + 1);
_local1 = Math.floor(start + _local1);
return(Math.min(_local1, stop));
};
_local1.dd = function (bm) {
aj("setSeed:", bm);
hp = bm & 65535;
hq = hp;
};
_local1.dx = function (start, stop) {
var _local2 = stop - start;
var _local1 = this.ht() * (_local2 + 1);
_local1 = Math.floor(start + _local1);
return(Math.min(_local1, stop));
};
_local1.fl = function (start, stop) {
var _local2 = stop - start;
var _local1 = this.hu() * (_local2 + 1);
_local1 = Math.floor(start + _local1);
return(Math.min(_local1, stop));
};
_local1.ht = function () {
hp = ((hp * 732573) + 3545443) & 65535;
hv = hp / 65536;
return(hv);
};
_local1.hu = function () {
hq = ((hq * 732573) + 3545443) & 65535;
hv = hq / 65536;
return(hv);
};
}
function gm(o) {
var _local1 = this;
var _local2 = o;
_local1.ef = _local2.ao;
_local1.hw = _local1.ef._x;
_local1.hx = _local1.ef._y;
_local1.hy = _local1.hw;
_local1.hz = _local1.hx;
_local1.ia = ((typeof(_local2.u) == "number") ? (_local2.u) : (_local1.hw));
_local1.ib = ((typeof(_local2.v) == "number") ? (_local2.v) : (_local1.hx));
_local1.ic = _local1.hw != _local1.ia;
_local1.id = _local1.hx != _local1.ib;
_local1.ei = _local2.ei;
_local1.ej = _local2.ej || 0;
_local1.ie = 0;
_local1.ig = _local2.ig || 10;
_local1.ay = function () {
var _local1 = this;
if (_local1.ej > 0) {
_local1.ej--;
} else {
_local1.ie = Math.min(_local1.ie + (Math.Pi / (_local1.ig * 2)), (Math.PI/2));
if (_local1.ic) {
_local1.hy = _local1.hw + ((Math.sin(_local1.ie + 4.71238898038469) + 1) * (_local1.ia - _local1.hw));
_local1.ef._x = _local1.hy;
}
if (_local1.id) {
_local1.hz = _local1.hx + ((Math.sin(_local1.ie + 4.71238898038469) + 1) * (_local1.ib - _local1.hx));
_local1.ef._y = _local1.hz;
}
if (_local1.ie >= (Math.PI/2)) {
at.bc(_local1);
if (_local1.ei) {
_local1.ei();
}
}
}
};
at.ax(_local1);
}
function ih(o) {
var _local1 = this;
var _local2 = o;
_local1.ef = _local2.ao;
_local1.ii = ((typeof(_local2.ii) == "string") ? (_local2.ii) : "in");
_local1.ig = _local2.frames || 10;
_local1.ij = _local1.ig;
_local1.ik = 100 / _local1.ig;
if (_local1.ii == "in") {
_local1.ik = -_local1.ik;
_local1.il = 0;
} else {
_local1.il = 100;
}
_local1.ei = _local2.ei;
_local1.ay = function () {
var _local1 = this;
_local1.ij--;
_local1.il = _local1.il - _local1.ik;
_local1.ef._alpha = _local1.il;
if (_local1.ij == 0) {
if (_local1.ii == "pulse") {
_local1.ij = _local1.ig;
_local1.ik = -_local1.ik;
} else {
at.bc(_local1);
if (_local1.ei) {
_local1.ei();
}
}
}
};
at.ax(_local1);
}
function eh(o) {
var _local1 = this;
var _local2 = o;
_local1.ef = _local2.ao;
_local1.ei = _local2.ei;
_local1.ej = _local2.ej || 0;
_local1.ed = _local2.ed;
_local1.im = 0;
_local1.io = ((typeof(_local2.io) == "boolean") ? (_local2.io) : false);
_local1.ay = function () {
var _local1 = this;
if (_local1.ej > 0) {
_local1.ej--;
} else if (_local1.im > _local1.ed.length) {
if (_local1.io) {
_local1.im = 0;
// unexpected jump
}
at.bc(_local1);
if (_local1.ei) {
_local1.ei();
}
} else {
f.setMember(_local1.ef, _local1.ed[_local1.im]);
_local1.im++;
}
};
_local1.dr = function () {
at.bc(this);
};
at.ax(_local1);
}
function en(ip, frames) {
var _local1 = this;
_local1.ip = ip;
_local1.ij = 0;
_local1.ig = frames;
_local1.ay = function () {
var _local1 = this;
_local1.ij++;
if (_local1.ij > _local1.ig) {
at.bc(_local1);
_local1.ip();
}
};
at.ax(_local1);
}
function co() {
function ju(eu) {
return(typeof(eu) == "string");
}
var iq = _level0.time_text;
var ir = _level0.points_text;
var is = _level0.level_text;
var it = _level0.info_text;
var iu = _level0.time_tag_text;
var iv = _level0.points_tag_text;
var iw = _level0.level_tag_text;
var ix = _level0.nextlevel_tag_text;
var iy = _level0.end_game_text;
var iz;
this.ja = false;
var jb;
var jc = 446;
var jd = 163;
var je = 269;
var jf = 40;
var jg = new Array();
var jh = new ji(ir);
at.ax(jh);
this.setTime = function (df) {
iq.text = df;
};
this.jj = function (de) {
jh.jk(de);
};
this.jl = function (dh) {
is.text = dh;
var _local1 = new gd(jc, 250, iz, 12);
_local1.ib = 112;
_local1.gl = 15;
};
this.dt = function () {
return(b.dt());
};
this.jm = function (jn) {
it.text = jn;
};
this.jo = function (dh) {
var u = (jd + (jg.length * jf));
if (jb) {
u = u + 20;
if (jg.length < 2) {
jg.push(f.n({t:"coin_b", u:u, v:je}));
}
} else if (jg.length < 3) {
jg.push(f.n({t:"coin_b", u:u, v:je}));
}
};
this.el = function (dh) {
var _local1 = 0;
while (_local1 < jg.length) {
f.an(jg[_local1]);
_local1++;
}
if ((dh >= 4) && (jb)) {
f.an(jb);
jb = null;
}
jg = new Array();
};
this.alert = function (jp, jq) {
if (this.ja) {
} else {
this.ja = true;
var o = {t:"popupbox", u:jc, v:181};
var _local1 = f.n(o);
var jr = _local1.member_mc.body_txt._height;
_local1.member_mc.body_txt.autosize = "center";
_local1.member_mc.header_txt.text = jp;
_local1.member_mc.body_txt.text = jq;
var _local2 = _local1.member_mc.body_txt._height;
var _local3 = (_local2 - jr) / 2;
_local1.member_mc.body_txt._y = _local1.member_mc.body_txt._y - Math.min(40, _local3);
_local1.member_mc.body_txt.autosize = false;
if (_local2 > 116) {
_local1.member_mc.body_txt._height = 116;
}
if (_local1.member_mc.body_txt._width > 214) {
_local1.member_mc.body_txt._width = 214;
}
_local1.swapDepths(3333);
}
};
this.dk = function (o) {
var _local1 = o;
iu.text = (ju(_local1.df) ? (_local1.df) : "00:00");
iv.text = (ju(_local1.de) ? (_local1.de) : "0");
iw.text = (ju(_local1.dh) ? (_local1.dh) : "1");
ix.text = (ju(_local1.di) ? (_local1.di) : "NEXT LEVEL");
it.text = (ju(_local1.dg) ? (_local1.dg) : "");
iy.text = (ju(_local1.end) ? (_local1.end) : "END GAME");
iz = (ju(_local1.dj) ? (_local1.dj) : "LEVEL UP!");
_level0.end_game_button._visible = true;
};
_level0.end_game_button._visible = false;
_level0.end_game_button.useHandCursor = false;
_level0.end_game_button.onRelease = function () {
fscommand ("playData", "7718=0");
b.et();
};
this.ey = function () {
_level0.end_game_button._visible = false;
};
jb = f.n({t:"coinslot2", u:154, v:266});
}
function ji(jv) {
function kb() {
var _local1 = jz - jy;
var _local2 = _local1 * jx;
if (Math.abs(_local1) <= 2) {
jy = jz;
} else {
jy = jy + _local2;
}
jv.text = Math.round(jy);
if (jz == jy) {
ke();
}
}
function ke() {
jw = false;
}
var jw = false;
var jx = 0.2;
var jy = 0;
var jz = 0;
var jv = jv;
this.jk = function (ka) {
jw = true;
if ((jz + ka) < 0) {
jz = 0;
} else {
jz = jz + ka;
}
};
this.ay = function () {
if (jw) {
kb();
}
};
}
function ca() {
var kf = new Array();
var kg = [4, 10, 18];
this.start = function () {
at.ax(this);
};
this.gr = function (o) {
var _local2 = o;
var _local1 = new Object();
_local1.ao = _local2.ao;
_local1.hx = _local1.ao._y;
_local1.hz = _local1.hx;
_local1.ao.gq = ((typeof(_local2.v) == "number") ? (_local2.v) : (_local1.hx));
_local1.id = _local1.hx != _local1.ao.gq;
_local1.ei = _local2.ei;
_local1.ki = 0;
_local1.jx = 0;
kf.push(_local1);
};
this.ay = function () {
var _local2;
var _local3;
var fw;
var fx;
var kk = false;
var _local1 = 0;
while (_local1 < kf.length) {
_local2 = kf[_local1].ao;
_local3 = typeof(_local2.dv) != "number";
if (!_local3) {
kf[_local1].jx = kg[kf[_local1].ki];
kf[_local1].hz = Math.min(kf[_local1].hz + kf[_local1].jx, _local2.gq);
_local2._y = kf[_local1].hz;
kf[_local1].ki = Math.min(kf[_local1].ki + 1, kg.length - 1);
}
if ((kf[_local1].hz == _local2.gq) || (_local3)) {
if (kf[_local1].ei) {
kf[_local1].ei();
}
if (!_local3) {
_local2.fd = false;
}
bh.play("blockdrop.aif", true);
kf.splice(_local1, 1);
_local1--;
if (b.gs(_local2.dv, _local2.fb, _local2.color)) {
kk = true;
}
}
_local1++;
}
if ((kk != false) && (typeof(b.cx.dv) == "number")) {
var gc = b.cx;
b.ft();
b.fg(gc);
}
};
this.clear = function () {
};
}
function cq() {
var _local2 = this;
var kl;
var km;
var kn;
var ko;
var kp;
var jw;
var kq;
var kr;
var ks;
var self = _local2;
_local2.dz = function () {
kl = 275;
km = 390;
kn = new Array();
ko = 0;
jw = false;
kq = 0;
kr = 0;
this.kt();
jw = true;
};
_local2.ku = function () {
var _local3 = 2;
if (b.cn.dt() > 3) {
_local3 = 3;
}
if (ko < b.bw) {
var _local2 = random.dx(0, _local3);
var kv = (b.bu + (ko * b.bs));
var fc = b.bt[_local2];
var o = {t:fc, u:kv, v:km};
var _local1 = f.n(o);
_local1.color = _local2;
kn.unshift(_local1);
var ee = function () {
self.kw();
};
_local1.kx = new ih({ao:_local1, ii:"in", frames:6, ei:ee});
kq++;
ko++;
} else {
self.ky();
}
};
_local2.kw = function () {
kq--;
};
_local2.ky = function () {
if ((kq != 0) || (ko != b.bw)) {
} else if (b.fn(kn)) {
var _local1 = 0;
while (_local1 < kn.length) {
f.an(kn[_local1]);
_local1++;
}
ko = 0;
kn = new Array();
}
};
_local2.ay = function () {
var _local1 = this;
if (!jw) {
} else {
kr = kr + 40;
while (kr >= ks) {
_local1.ku();
kr = kr - ks;
}
}
};
_local2.kt = function () {
kp = 0.6 + (0.2 * (b.dt() + b.gw()));
var _local1 = 700 / kp;
if (_local1 < 30) {
_local1 = 30;
}
ks = Math.round(_local1);
kr = 0;
};
_local2.la = function () {
jw = false;
var _local1 = 0;
while (_local1 < kn.length) {
at.bc(kn[_local1].kx);
_local1++;
}
};
_local2.dr = function () {
jw = false;
var ee = function () {
f.an(this.ef);
};
var ed = ["gold2", "gold5"];
var _local2 = 0;
var _local1 = 0;
while (_local1 < kn.length) {
dp = kn[_local1];
at.bc(dp.kx);
eg = ((kn.length - _local1) - 1) * 2;
_local2 = Math.max(_local2, eg);
new eh({ao:dp, ed:ed, ei:ee, ej:eg});
_local1++;
}
return(_local2);
};
}
function cl() {
var lb = 1;
var lc = 0;
var ld = 0;
var lf = [0, 0, 10, 15, 20, 30, 40, 50, 65, 80, 95, 115, 135, 155, 180];
var lg = false;
var lh = 0;
this.dt = function () {
return(lb);
};
this.ex = function () {
return(lh);
};
var li = {};
li.version = 112;
li["clear cubes"] = 1295;
li.midas = 8982;
li["level up"] = 1441;
li["error click"] = 9031;
li.inactive = 6955;
li["no more moves"] = 8391;
this.dn = function (lj) {
var _local2 = lj;
var lk = (0.8 + (0.2 * lb));
var _local3 = 0;
var ll = true;
_local2.lm = -1;
if (_local2.action == "clear cubes") {
if (_local2.value <= 15) {
_local3 = lf[_local2.value - 1];
_local3 = _local3 * lk;
} else {
_local3 = lf[14] + (30 * (_local2.value - 15));
_local3 = _local3 * lk;
}
ld = ld + _local3;
} else if (_local2.action == "midas") {
_local3 = (100 * _local2.value) * lk;
lc = lc + _local2.value;
var ln = lb;
if (lc < 7) {
lb = 1 + Math.floor(lc / 2);
} else {
lb = 4 + Math.floor((lc - 6) / 3);
}
if (!b.ci) {
if (lb != ln) {
lg = true;
}
var _local1 = 0;
while (_local1 < _local2.value) {
b.cn.jo(lb);
_local1++;
}
}
} else if (_local2.action == "error click") {
_local3 = -10 * lk;
} else if (_local2.action == "no more moves") {
_local3 = -250;
} else if (_local2.action == "inactive") {
_local3 = -1;
} else if (_local2.action == "version") {
_local3 = 0;
} else {
ll = false;
}
if (ld >= 100) {
if (!b.ci) {
b.fj();
}
ld = 0;
}
var lo = lh;
lh = lh + _local3;
lh = Math.max(0, lh);
if (!b.ci) {
b.cn.jj(_local3);
}
_local2.lm = li[_local2.action] || 0;
if (ll) {
_local2.lp = _local3;
this.ll(_local2);
}
if (lg) {
lg = false;
b.cn.jl(lb);
bh.play("levelup.aif");
b.eo();
var lq = {lm:li["level up"], value:lb, lp:0};
this.ll(lq);
}
return(_local3);
};
this.ea = function () {
var _local2;
if (lc < 7) {
_local2 = lc % 2;
} else {
_local2 = (lc - 6) % 3;
}
var _local1 = 0;
while (_local1 < _local2) {
b.cn.jo(lb);
_local1++;
}
};
this.ll = function (o) {
var _local2 = o;
if (b.ci) {
} else {
var _local1 = String(_local2.lm);
if (_local2.value != undefined) {
_local1 = _local1 + ("," + String(_local2.value));
}
_local1 = _local1 + ("=" + String(_local2.lp));
fscommand ("playData", _local1);
}
};
}
function cm() {
var ls = new Array();
this.gx = function (lu) {
ls.push(lu);
};
this.gz = function () {
return(ls);
};
}
function gd(u, v, lp, fontsize) {
var _local1 = this;
var _local3 = {text:lp + "", u:u, v:v, bold:true, size:fontsize || 10, align:"center"};
var _local2 = f.ap(_local3);
_local2.member_mc.background = true;
_local2.member_mc.backgroundColor = "0x404040";
_local2.member_mc.border = true;
_local2.member_mc.borderColor = "0xffffff";
_local2.ag();
_local1.ef = _local2;
_local1.hx = _local1.ef._y;
_local1.hz = _local1.hx;
_local1.lv = _local1.hx - 67;
if (_local1.lv < b.bv) {
_local1.lv = b.bv - 20;
}
_local1.ib = _local1.lv;
_local1.id = _local1.hx != _local1.ib;
_local1.ie = 0;
_local1.gl = 10;
_local1.lw = 1;
_local1.lx = 100;
_local1.ay = function () {
var _local1 = this;
if (_local1.lw == 1) {
_local1.ie = Math.min(_local1.ie + (Math.Pi / (_local1.gl * 2)), (Math.PI/2));
_local1.hz = _local1.hx + (Math.sin(_local1.ie) * (_local1.ib - _local1.hx));
_local1.ef._y = _local1.hz;
if (_local1.ie >= (Math.PI/2)) {
_local1.lw++;
}
} else if (_local1.lw == 2) {
_local1.lx = _local1.lx - 9;
_local1.ef._alpha = _local1.lx;
if (_local1.lx < 10) {
at.bc(_local1);
f.an(_local1.ef);
}
}
};
at.ax(_local1);
}
function fi(o) {
var _local1 = this;
_local1.ef = o.ao;
_local1.ef.dq = _local1;
_local1.ly = new Color(_local1.ef);
_local1.lz = _local1.ly.getTransform();
_local1.ay = function () {
if (b.cz == 5) {
var _local1 = 50;
var _local2 = {ra:"100", rb:_local1, ga:"100", gb:_local1, ba:"100", bb:_local1, aa:"100", ab:"0"};
this.ly.setTransform(_local2);
}
if (b.cz == 0) {
var _local1 = 0;
var _local2 = {ra:"100", rb:_local1, ga:"100", gb:_local1, ba:"100", bb:_local1, aa:"100", ab:"0"};
this.ly.setTransform(_local2);
}
};
_local1.dr = function () {
var _local1 = this;
at.bc(_local1);
_local1.ly.setTransform(_local1.lz);
_local1.ly = null;
_local1.ef.dq = null;
};
at.ax(_local1);
}
function fq(ao) {
var _local1 = this;
_local1.ef = ao;
_local1.mc = 0;
_local1.md = _local1.ef._x;
_local1.me = _local1.ef._y;
_local1.ay = function () {
var _local1 = this;
_local1.ef._x = _local1.md + ((_local1.mf % 2) ? 1 : -1);
_local1.mf++;
if (_local1.mf > 20) {
_local1.dr();
}
};
_local1.dr = function () {
var _local1 = this;
at.bc(_local1);
_local1.ef._x = _local1.md;
_local1.ef._y = _local1.me;
};
at.ax(_local1);
}
function mg() {
var _local3 = this;
function mk() {
if (mh[mi][0] == frame) {
b.hc(mh[mi][1]);
mi++;
}
frame++;
}
function ml() {
frame++;
}
function mo(mp) {
var _local2 = mp;
function mr(mp) {
var _local2 = mp;
var _local3 = "";
var _local1 = 0;
while (_local1 < _local2.length) {
if (typeof(_local2[_local1]) == "object") {
_local3 = _local3 + (("[" + mr(_local2[_local1])) + "]");
} else {
_local3 = _local3 + _local2[_local1];
}
if (_local1 < (_local2.length - 1)) {
_local3 = _local3 + ",";
}
_local1++;
}
return(_local3);
}
var mq = mr(_local2);
return(("[" + mq) + "]");
}
trace("Loaded Vcr Device!");
var mh = new Array();
var mi = 0;
var frame = 0;
var mj;
_local3.start = function () {
if (mh.length != 0) {
mj = mk;
} else {
mj = ml;
}
at.ax(this);
};
_local3.stop = function () {
at.bc(this);
};
_local3.mm = function (lu) {
mh.push([frame, lu]);
};
_local3.mn = function () {
trace("--- tape start ---");
trace(mo(mh));
trace("---- tape end ----");
return(mh);
};
_local3.ay = function () {
mj();
};
}
Stage.showMenu = false;
Stage.scaleMode = "noScale";
f = new g();
at = new au();
bh = new bi();
var bq = false;
var br = "1.1.2";
if (bq) {
var he = new XML();
he.ignoreWhite = true;
he.onData = function (src) {
gameData = src;
};
he.load("gamedata.xml");
}
random = new Random();
stop();
startup();