Frame 1
function showMochiAd() {
trace("showing mochi ad");
MochiAd.showPreGameAd({id:"4a1f206dea8a928b", res:"600x400"});
}
stop();
Instance of Symbol 107 MovieClip "background" in Frame 1
on (release) {
getURL ("http://www.doof.com/?ref=gemswap", "_blank");
}
Instance of Symbol 149 MovieClip in Frame 1
on (release) {
getURL ("http://www.doof.com/?ref=gemswap", "_blank");
}
Frame 2
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;
var pv;
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);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
__com_mochibot__("74c55c5d", this, 10301, true);
com.novelgames.flashgames.common.MainDevelopment.initialize(this);
Instance of Symbol 157 MovieClip in Frame 2
on (release) {
getURL ("http://www.doof.com/?ref=gemswap", "_blank");
}
Frame 24
stop();
Symbol 5 MovieClip [GIGYA] Frame 1
System.security.allowDomain("cdn.gigya.com");
System.security.allowInsecureDomain("cdn.gigya.com");
var mcWF = _root.createEmptyMovieClip("Wildfire", _root.getNextHighestDepth());
mcWF._lockroot = true;
mcWF._x = 0;
mcWF._y = 0;
mcWF.ModuleID = "PostModule1";
var cfg = ((_root[mcWF.ModuleID] = {}));
cfg.width = "600";
cfg.height = "400";
cfg.bookmarkURL = "http://www.doof.com/#/games/GemSwap";
cfg.widgetTitle = "Gem Swap";
cfg.advancedTracking = "true";
cfg.partner = "177341";
cfg.UIConfig = "<config><display showDesktop=\"true\" showEmail=\"true\" useTransitions=\"true\" showBookmark=\"true\" codeBoxHeight=\"auto\" showCodeBox=\"true\" showCloseButton=\"true\" bulletinChecked=\"false\" networksWithCodeBox=\"\"></display><body corner-roundness=\"8;8;8;8\"><background frame-color=\"Transparent\" gradient-color-begin=\"#353535\" gradient-color-end=\"#606060\" corner-roundness=\"8;8;8;8\"></background><controls size=\"11\" bold=\"true\"><snbuttons iconsOnly=\"false\" type=\"textUnder\" frame-color=\"#6D0000\" background-color=\"#FFFFFF\" over-background-color=\"#FFFFFF\" color=\"#CACACA\" corner-roundness=\"0;8;8;8\" gradient-color-begin=\"#8A8A8A\" gradient-color-end=\"#000000\" font=\"Arial\" size=\"11\" bold=\"false\" over-gradient-color-begin=\"#AAAAAA\" over-gradient-color-end=\"#000000\" over-color=\"#F4F4F4\" down-color=\"#000000\"><more frame-color=\"Transparent\"></more></snbuttons><textboxes frame-color=\"#000000\" color=\"#AAAAAA\" corner-roundness=\"0;0;0;0\" gradient-color-begin=\"#202020\" gradient-color-end=\"#0B0B0B\" font=\"Arial\" bold=\"false\"><codeboxes color=\"#EAEAEA\" frame-color=\"#8A8A8A\" gradient-color-begin=\"#000000\" font=\"Arial\" bold=\"false\"></codeboxes><inputs frame-color=\"#6D0000\"></inputs><dropdowns frame-color=\"#6D0000\" handle-gradient-color-begin=\"#B60000\" handle-gradient-color-end=\"#6D0000\" handle-over-gradient-color-begin=\"#FF0000\" handle-over-gradient-color-end=\"#DA0000\" handle-down-gradient-color-begin=\"#FF0000\" handle-down-gradient-color-end=\"#6D0000\" background-color=\"#6D0000\" gradient-color-begin=\"#000000\" font=\"Arial\" bold=\"false\"></dropdowns></textboxes><buttons frame-color=\"#FF0000\" gradient-color-begin=\"#FF2424\" gradient-color-end=\"#6D0000\" color=\"#F4F4F4\" corner-roundness=\"0;8;8;8\" font=\"Arial\" size=\"10\" bold=\"false\" down-frame-color=\"#000000\" over-gradient-color-begin=\"#DA0000\" down-gradient-color-begin=\"#910000\" over-gradient-color-end=\"#DA0000\" down-gradient-color-end=\"#FF0000\" over-color=\"#F4F4F4\"><post-buttons gradient-color-begin=\"#FF4949\" gradient-color-end=\"#6D0000\"></post-buttons></buttons><listboxes corner-roundness=\"5;5;5;5\"></listboxes><servicemarker gradient-color-begin=\"#DA0000\" gradient-color-end=\"#DA0000\"></servicemarker></controls><texts color=\"#FFFFFF\" font=\"Arial\" size=\"10\"><privacy color=\"#959595\" size=\"11\"></privacy><headers size=\"11\" bold=\"true\"></headers><labels size=\"11\" bold=\"true\"></labels><messages color=\"#D5D5D5\" frame-thickness=\"0\" corner-roundness=\"0;0;0;0\" gradient-color-begin=\"#B60000\" gradient-color-end=\"#000000\" size=\"11\" bold=\"true\"></messages><links color=\"#DFDFDF\" underline=\"false\" size=\"11\" bold=\"true\" over-color=\"#FFFFFF\"></links></texts></body></config>";
cfg.defaultContent = function () {
return("<object width=\"600\" height=\"400\">\u00A0<param name=\"movie\" value=\"http://static.doof.com/content/static/games/GemSwap/GemSwapWidget.swf\"></param>\u00A0<param name=\"wmode\" value=\"transparent\"></param>\u00A0<embed src=\"http://static.doof.com/content/static/games/GemSwap/GemSwapWidget.swf\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"600\"\u00A0height=\"400\"></embed></object>");
};
cfg.onPostProfile = function (eventObj) {
trace((((("event fired eventObj.type=" + eventObj.type) + " eventObj.network=") + eventObj.network) + " eventObj.partnerData=") + eventObj.partnerData);
};
cfg.onLoad = function (eventObj) {
trace((("event fired eventObj.type=" + eventObj.type) + "eventObj.ModuleID=") + eventObj.ModuleID);
};
cfg.onClose = function (eventObj) {
mcWF._visible = false;
};
mcWF.loadMovie("http://cdn.gigya.com/WildFire/swf/wildfire.swf", "get");
Instance of Symbol 27 MovieClip "doofClick" in Symbol 38 MovieClip [endScreen] Frame 1
on (release) {
getURL ("http://www.doof.com/?ref=gemswap", "_blank");
}
Instance of Symbol 35 MovieClip "playAgain" in Symbol 38 MovieClip [endScreen] Frame 1
on (release) {
this._visible = false;
_root.gotoAndStop("splashScreen");
_parent.removeMovieClip(this);
}
Instance of Symbol 37 MovieClip "shareBTN" in Symbol 38 MovieClip [endScreen] Frame 1
on (release) {
this.attachMovie("GIGYA", "GIGYA", this.getNextHighestDepth());
}
Symbol 53 MovieClip [gem] Frame 1
#initclip 19
Object.registerClass("gem", com.novelgames.flashgames.gems.Gem);
#endinitclip
Symbol 56 MovieClip [scorePopup] Frame 1
#initclip 14
Object.registerClass("scorePopup", com.novelgames.flashgames.gems.ScorePopup);
#endinitclip
Symbol 74 MovieClip [message] Frame 1
#initclip 15
Object.registerClass("message", com.novelgames.flashgames.gems.Message);
#endinitclip
Symbol 74 MovieClip [message] Frame 40
showGameOverFinished();
var startGO = getTimer();
this.onEnterFrame = function () {
if ((getTimer() - startGO) > 3000) {
if (_root.inContainer) {
trace("api exists");
_root.sendApiScore(_parent.score);
trace("sendApiScore ");
} else {
trace("goto gameover");
_root.displayScore = _parent.score;
_root.gotoAndPlay("GameOverScreen");
}
delete this.onEnterFrame;
}
};
Symbol 78 MovieClip [lifeBar] Frame 1
#initclip 16
Object.registerClass("lifeBar", com.novelgames.flashgames.gems.LifeBar);
#endinitclip
Symbol 99 MovieClip [game] Frame 1
#initclip 17
Object.registerClass("game", com.novelgames.flashgames.gems.Game);
#endinitclip
Symbol 103 MovieClip [muteButton] Frame 1
#initclip 18
Object.registerClass("muteButton", com.novelgames.flashgames.common.MuteButton);
#endinitclip
Symbol 105 MovieClip [GameConnectorAS2] Frame 1
#initclip 13
Object.registerClass("GameConnectorAS2", com.tmgc.gameconnector.GameConnectorAS2);
#endinitclip
Symbol 146 MovieClip Frame 360
stop();
Symbol 149 MovieClip Frame 128
_parent.showMochiAd();
Symbol 149 MovieClip Frame 179
stop();
Symbol 162 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.5");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 163 MovieClip [__Packages.com.novelgames.flashgames.gems.ScorePopup] Frame 0
class com.novelgames.flashgames.gems.ScorePopup extends MovieClip
{
var _x, _y, score, intervalID, removeMovieClip;
function ScorePopup () {
super();
}
function initialize(x, y, score) {
_x = x;
_y = y;
this.score = com.novelgames.flashgames.gems.Config.SCOREPOPUP_PREFIX + score;
intervalID = setInterval(this, "destroy", com.novelgames.flashgames.gems.Config.SCOREPOPUP_SHOWTIME);
}
function destroy() {
clearInterval(intervalID);
removeMovieClip();
}
}
Symbol 164 MovieClip [__Packages.com.novelgames.flashgames.gems.Config] Frame 0
class com.novelgames.flashgames.gems.Config
{
function Config () {
}
static var LINEGEMS = 3;
static var BLOCK_NOOFTYPES = 7;
static var BLOCK_DIMENSIONX = 8;
static var BLOCK_DIMENSIONY = 8;
static var BLOCK_SPACING = 45;
static var CREATEDROP_SPEED = 300;
static var CREATEDROP_SPACING = 30;
static var SWAP_SPEED = 300;
static var DESTROY_SCALESPEED = 800;
static var DESTROY_ROTATESPEED = 1800;
static var DROP_SPEED = 500;
static var NOMOREMOVES_SCALESPEED = 300;
static var NOMOREMVOES_SCALEROWDIFFERENCE = 50;
static var SCOREPOPUP_PREFIX = "+";
static var SCOREPOPUP_SHOWTIME = 500;
static var SCORE_LINE = 10;
static var SCORE_LINEEXTRAGEM = 7;
static var SCORE_EXTRALINE = 8;
static var SCORE_COMBO = 9;
static var SCORE_LEVELUP = 500;
static var LIFEBAR_EMPTYCOLOUR = 669771;
static var LIFEBAR_FULLCOLOUR = 8173519;
static var LIFE_INITIAL = 250;
static var LIFE_MAX = 360;
static var LIFE_INCREASEPERLINE = 20;
static var LIFE_INITIALDECREASERATE = 5;
static var LIFE_DECREASERATEINCREMENT = 0.1;
static var LEVELUP_SCALESPEED = 500;
static var LEVELUP_LIFERESUMESPEED = 50;
}
Symbol 165 MovieClip [__Packages.com.novelgames.flashgames.gems.Message] Frame 0
class com.novelgames.flashgames.gems.Message extends MovieClip
{
var stop, gotoAndStop, score, blocker, playAgainButton, _parent;
function Message () {
super();
stop();
}
function showLevelUp(score) {
gotoAndStop("levelUp");
this.score = com.novelgames.flashgames.gems.Config.SCOREPOPUP_PREFIX + score;
}
function showNoMoreMoves() {
gotoAndStop("noMoreMoves");
}
function showGameOver() {
blocker.onPress = function () {
};
blocker.useHandCursor = false;
}
function hide() {
gotoAndStop("hide");
}
function showGameOverFinished() {
stop();
playAgainButton.onRelease = function () {
this._parent._parent._parent.gotoTitlePage();
};
_parent.showEnterHighScore();
}
}
Symbol 166 MovieClip [__Packages.com.novelgames.flashgames.gems.LifeBar] Frame 0
class com.novelgames.flashgames.gems.LifeBar extends MovieClip
{
var fullRed, fullGreen, fullBlue, emptyRed, emptyGreen, emptyBlue, _width, colour;
function LifeBar () {
super();
initialize();
}
function initialize() {
fullRed = (com.novelgames.flashgames.gems.Config.LIFEBAR_FULLCOLOUR >> 16) & 255;
fullGreen = (com.novelgames.flashgames.gems.Config.LIFEBAR_FULLCOLOUR >> 8) & 255;
fullBlue = com.novelgames.flashgames.gems.Config.LIFEBAR_FULLCOLOUR & 255;
emptyRed = (com.novelgames.flashgames.gems.Config.LIFEBAR_EMPTYCOLOUR >> 16) & 255;
emptyGreen = (com.novelgames.flashgames.gems.Config.LIFEBAR_EMPTYCOLOUR >> 8) & 255;
emptyBlue = com.novelgames.flashgames.gems.Config.LIFEBAR_EMPTYCOLOUR & 255;
}
function updateLife(life) {
var _local3 = ((life * fullRed) + ((com.novelgames.flashgames.gems.Config.LIFE_MAX - life) * emptyRed)) / com.novelgames.flashgames.gems.Config.LIFE_MAX;
var _local5 = ((life * fullGreen) + ((com.novelgames.flashgames.gems.Config.LIFE_MAX - life) * emptyGreen)) / com.novelgames.flashgames.gems.Config.LIFE_MAX;
var _local4 = ((life * fullBlue) + ((com.novelgames.flashgames.gems.Config.LIFE_MAX - life) * emptyBlue)) / com.novelgames.flashgames.gems.Config.LIFE_MAX;
_width = life;
new Color(colour).setRGB(((_local3 << 16) | (_local5 << 8)) | _local4);
}
}
Symbol 167 MovieClip [__Packages.com.novelgames.flashgames.gems.Game] Frame 0
class com.novelgames.flashgames.gems.Game extends MovieClip
{
var chosenGem1, chosenGem2, movingGems, showingNoMoreMoves, currentCombo, level, score, life, lifeDecreaseRate, lifeBar, levelStarted, shouldLevelUp, gameOver, soundSwap, soundGroup, soundLevelUp, soundGameOver, _parent, gemsHolder, _xmouse, _ymouse, gems, lastLifeDecreaseTime, moveGemsTime, intervalID, highlight, destroyingGems, scoresHolder, droppingGems, message;
function Game () {
super();
chosenGem1 = null;
chosenGem2 = null;
movingGems = false;
showingNoMoreMoves = false;
currentCombo = 0;
level = 1;
score = 0;
life = com.novelgames.flashgames.gems.Config.LIFE_INITIAL;
lifeDecreaseRate = com.novelgames.flashgames.gems.Config.LIFE_INITIALDECREASERATE;
lifeBar.__proto__ = com.novelgames.flashgames.gems.LifeBar.prototype;
lifeBar.initialize();
lifeBar.updateLife(life);
levelStarted = false;
shouldLevelUp = false;
gameOver = false;
soundSwap = new com.novelgames.flashgames.common.NewSound(this, "soundSwap");
soundGroup = new com.novelgames.flashgames.common.NewSound(this, "soundGroup");
soundLevelUp = new com.novelgames.flashgames.common.NewSound(this, "soundLevelUp");
soundGameOver = new com.novelgames.flashgames.common.NewSound(this, "soundGameOver");
_parent.connector.gameStarted(0);
createGems();
}
function gemPressed(gem) {
if (gameOver) {
return(undefined);
}
if (!levelStarted) {
return(undefined);
}
if (movingGems) {
return(undefined);
}
currentCombo = 0;
if (chosenGem1 == null) {
chosenGem1 = gem;
showHighlight(gem._x, gem._y);
} else if (chosenGem1 == gem) {
chosenGem1 = null;
hideHighlight();
} else if (!getGemsAreAdjacent(gem, chosenGem1)) {
chosenGem1 = gem;
showHighlight(gem._x, gem._y);
} else {
chosenGem2 = gem;
startSwapGems();
}
}
function gemReleasedOutside() {
var _local3;
var _local2;
if (gameOver) {
return(undefined);
}
if (!levelStarted) {
return(undefined);
}
if (movingGems) {
return(undefined);
}
if (chosenGem1 == null) {
return(undefined);
}
_local3 = Math.floor((_xmouse - gemsHolder._x) / com.novelgames.flashgames.gems.Config.BLOCK_SPACING);
_local2 = Math.floor((_ymouse - gemsHolder._y) / com.novelgames.flashgames.gems.Config.BLOCK_SPACING);
if (!getGemsAreAdjacent(chosenGem1, gems[(_local2 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3])) {
return(undefined);
}
chosenGem2 = gems[(_local2 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3];
startSwapGems();
}
function showEnterHighScore() {
_parent.showEnterHighScore(score);
}
function onEnterFrame() {
var _local2 = getTimer();
if (gameOver) {
return(undefined);
}
if (!levelStarted) {
return(undefined);
}
if (shouldLevelUp) {
return(undefined);
}
if (showingNoMoreMoves) {
return(undefined);
}
life = life - (((_local2 - lastLifeDecreaseTime) * lifeDecreaseRate) / 1000);
if (life < 0) {
life = 0;
}
lifeBar.updateLife(life);
lastLifeDecreaseTime = _local2;
if (life == 0) {
showGameOver();
}
}
function createGems() {
var _local7 = generateTypes();
var _local5;
var _local6;
var _local4;
var _local3;
var _local2;
gems = new Array();
_local3 = 0;
while (_local3 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY) {
_local2 = 0;
while (_local2 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
_local5 = (_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2;
_local6 = gemsHolder.attachMovie("gem", "gem" + _local5, _local5);
_local4 = _local6;
_local4.initialize(_local2, _local3 - com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY, _local7[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2]);
_local4.targetY = _local3;
gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2] = _local4;
_local2++;
}
_local3++;
}
startCreateDropGems();
}
function generateTypes() {
var _local3 = new Array(com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY);
var _local2;
do {
_local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2] = Math.floor(Math.random() * com.novelgames.flashgames.gems.Config.BLOCK_NOOFTYPES);
_local2++;
}
} while (!getTypesAreValid(_local3));
return(_local3);
}
function getTypesAreValid(types) {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY) {
_local2 = 0;
while (_local2 <= (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX - com.novelgames.flashgames.gems.Config.LINEGEMS)) {
if (getIsGroup(types, _local2, _local3, 1, 0)) {
return(false);
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
_local2 = 0;
while (_local2 <= (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - com.novelgames.flashgames.gems.Config.LINEGEMS)) {
if (getIsGroup(types, _local3, _local2, 0, 1)) {
return(false);
}
_local2++;
}
_local3++;
}
return(getMovesAreAvailable(types));
}
function getMovesAreAvailable(types) {
var _local5;
var _local3;
var _local2;
_local3 = 0;
while (_local3 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX - 1)) {
com.novelgames.flashgames.gems.Util.swap(types, (_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2, ((_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2) + 1);
if (getGroupsExist(types, _local2, _local3) || (getGroupsExist(types, _local2 + 1, _local3))) {
com.novelgames.flashgames.gems.Util.swap(types, (_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2, ((_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2) + 1);
return(true);
}
com.novelgames.flashgames.gems.Util.swap(types, (_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2, ((_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2) + 1);
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - 1)) {
com.novelgames.flashgames.gems.Util.swap(types, (_local2 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3, ((_local2 + 1) * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3);
if (getGroupsExist(types, _local3, _local2) || (getGroupsExist(types, _local3, _local2 + 1))) {
com.novelgames.flashgames.gems.Util.swap(types, (_local2 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3, ((_local2 + 1) * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3);
return(true);
}
com.novelgames.flashgames.gems.Util.swap(types, (_local2 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3, ((_local2 + 1) * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local3);
_local2++;
}
_local3++;
}
return(false);
}
function getGroupsExist(types, x, y) {
var _local4;
var _local3;
var _local9;
var _local2;
var _local8;
_local4 = Math.max(0, (x - com.novelgames.flashgames.gems.Config.LINEGEMS) - 1);
_local3 = Math.min(com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX - com.novelgames.flashgames.gems.Config.LINEGEMS, x);
_local2 = _local4;
while (_local2 <= _local3) {
if (getIsGroup(types, _local2, y, 1, 0)) {
return(true);
}
_local2++;
}
_local4 = Math.max(0, (y - com.novelgames.flashgames.gems.Config.LINEGEMS) - 1);
_local3 = Math.min(com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - com.novelgames.flashgames.gems.Config.LINEGEMS, y);
_local2 = _local4;
while (_local2 <= _local3) {
if (getIsGroup(types, x, _local2, 0, 1)) {
return(true);
}
_local2++;
}
return(false);
}
function getIsGroup(types, x, y, stepX, stepY) {
return(getGroupSize(types, x, y, stepX, stepY) >= com.novelgames.flashgames.gems.Config.LINEGEMS);
}
function getGroupSize(types, x, y, stepX, stepY) {
var _local4 = types[(y * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + x];
var _local1;
_local1 = 1;
while (true) {
x = x + stepX;
y = y + stepY;
if ((x >= com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) || (y >= com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY)) {
return(_local1);
}
if (types[(y * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + x] != _local4) {
return(_local1);
}
_local1++;
}
}
function startCreateDropGems() {
movingGems = true;
moveGemsTime = getTimer();
intervalID = setInterval(this, "createDropGems", 1);
}
function createDropGems() {
var _local4 = getTimer() - moveGemsTime;
var _local3 = true;
var _local2;
_local2 = 0;
while (_local2 < gems.length) {
if (!gems[_local2].doCreateDropMove(_local4)) {
_local3 = false;
}
_local2++;
}
if (_local3) {
_local2 = 0;
while (_local2 < gems.length) {
gems[_local2].y = gems[_local2].targetY;
_local2++;
}
movingGems = false;
clearInterval(intervalID);
if (!levelStarted) {
levelStarted = true;
lastLifeDecreaseTime = getTimer();
}
if (showingNoMoreMoves) {
showingNoMoreMoves = false;
lastLifeDecreaseTime = getTimer();
}
}
updateAfterEvent();
}
function getGemsAreAdjacent(gem1, gem2) {
if ((gem1.x == gem2.x) && (Math.abs(gem1.y - gem2.y) == 1)) {
return(true);
}
if ((gem1.y == gem2.y) && (Math.abs(gem1.x - gem2.x) == 1)) {
return(true);
}
return(false);
}
function showHighlight(x, y) {
highlight._x = gemsHolder._x + x;
highlight._y = gemsHolder._y + y;
highlight._visible = true;
}
function hideHighlight() {
highlight._visible = false;
}
function startSwapGems() {
chosenGem1.targetX = chosenGem2.x;
chosenGem1.targetY = chosenGem2.y;
chosenGem2.targetX = chosenGem1.x;
chosenGem2.targetY = chosenGem1.y;
soundSwap.start();
movingGems = true;
moveGemsTime = getTimer();
intervalID = setInterval(this, "swapGems", 1);
}
function startUnswapGems() {
chosenGem1.targetX = chosenGem2.x;
chosenGem1.targetY = chosenGem2.y;
chosenGem2.targetX = chosenGem1.x;
chosenGem2.targetY = chosenGem1.y;
soundSwap.start();
movingGems = true;
moveGemsTime = getTimer();
intervalID = setInterval(this, "unswapGems", 1);
}
function swapGems() {
var _local2 = getTimer() - moveGemsTime;
if (_local2 < ((com.novelgames.flashgames.gems.Config.BLOCK_SPACING / com.novelgames.flashgames.gems.Config.SWAP_SPEED) * 1000)) {
chosenGem1.doSwapMove(_local2);
chosenGem2.doSwapMove(_local2);
} else {
finishGemsSwap();
if (checkDestroyingGems()) {
chosenGem1 = null;
chosenGem2 = null;
hideHighlight();
movingGems = false;
clearInterval(intervalID);
startDestroyGems();
} else {
clearInterval(intervalID);
startUnswapGems();
}
}
updateAfterEvent();
}
function unswapGems() {
var _local2 = getTimer() - moveGemsTime;
if (_local2 < ((com.novelgames.flashgames.gems.Config.BLOCK_SPACING / com.novelgames.flashgames.gems.Config.SWAP_SPEED) * 1000)) {
chosenGem1.doSwapMove(_local2);
chosenGem2.doSwapMove(_local2);
} else {
finishGemsSwap();
chosenGem1 = null;
chosenGem2 = null;
hideHighlight();
movingGems = false;
clearInterval(intervalID);
}
updateAfterEvent();
}
function finishGemsSwap() {
gems[(chosenGem1.targetY * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + chosenGem1.targetX] = chosenGem1;
gems[(chosenGem2.targetY * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + chosenGem2.targetX] = chosenGem2;
chosenGem1.x = chosenGem1.targetX;
chosenGem1.y = chosenGem1.targetY;
chosenGem2.x = chosenGem2.targetX;
chosenGem2.y = chosenGem2.targetY;
chosenGem1._x = (chosenGem1.x * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
chosenGem1._y = (chosenGem1.y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
chosenGem2._x = (chosenGem2.x * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
chosenGem2._y = (chosenGem2.y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
}
function checkDestroyingGems() {
var _local12 = new Array(gems.length);
var _local3;
var _local13 = 0;
var _local11 = 0;
var _local14 = 0;
var _local2;
var _local10 = Number.POSITIVE_INFINITY;
var _local8 = Number.NEGATIVE_INFINITY;
var _local9 = Number.POSITIVE_INFINITY;
var _local7 = Number.NEGATIVE_INFINITY;
var _local6;
var _local5;
var _local4;
_local6 = 0;
while (_local6 < _local12.length) {
_local12[_local6] = gems[_local6].type;
_local6++;
}
destroyingGems = new Array();
_local6 = 0;
while (_local6 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY) {
_local5 = 0;
while (_local5 <= (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX - com.novelgames.flashgames.gems.Config.LINEGEMS)) {
_local3 = getGroupSize(_local12, _local5, _local6, 1, 0);
if (_local3 >= com.novelgames.flashgames.gems.Config.LINEGEMS) {
_local4 = 0;
while (_local4 < _local3) {
_local2 = gems[(_local6 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + (_local5 + _local4)];
if (_local2._x < _local10) {
_local10 = _local2._x;
}
if (_local2._x > _local8) {
_local8 = _local2._x;
}
if (_local2._y < _local9) {
_local9 = _local2._y;
}
if (_local2._y > _local7) {
_local7 = _local2._y;
}
destroyingGems.push(_local2);
_local4++;
}
_local11 = _local11 + com.novelgames.flashgames.gems.Config.SCORE_LINE;
if (_local3 > com.novelgames.flashgames.gems.Config.LINEGEMS) {
_local11 = _local11 + ((_local3 - com.novelgames.flashgames.gems.Config.LINEGEMS) * com.novelgames.flashgames.gems.Config.SCORE_LINEEXTRAGEM);
}
_local13++;
_local14 = _local14 + com.novelgames.flashgames.gems.Config.LIFE_INCREASEPERLINE;
}
_local5 = _local5 + _local3;
}
_local6++;
}
_local6 = 0;
while (_local6 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
_local5 = 0;
while (_local5 <= (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - com.novelgames.flashgames.gems.Config.LINEGEMS)) {
_local3 = getGroupSize(_local12, _local6, _local5, 0, 1);
if (_local3 >= com.novelgames.flashgames.gems.Config.LINEGEMS) {
_local4 = 0;
while (_local4 < _local3) {
_local2 = gems[((_local5 + _local4) * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local6];
if (_local2._x < _local10) {
_local10 = _local2._x;
}
if (_local2._x > _local8) {
_local8 = _local2._x;
}
if (_local2._y < _local9) {
_local9 = _local2._y;
}
if (_local2._y > _local7) {
_local7 = _local2._y;
}
destroyingGems.push(_local2);
_local4++;
}
_local11 = _local11 + com.novelgames.flashgames.gems.Config.SCORE_LINE;
if (_local3 > com.novelgames.flashgames.gems.Config.LINEGEMS) {
_local11 = _local11 + ((_local3 - com.novelgames.flashgames.gems.Config.LINEGEMS) * com.novelgames.flashgames.gems.Config.SCORE_LINEEXTRAGEM);
}
_local13++;
_local14 = _local14 + com.novelgames.flashgames.gems.Config.LIFE_INCREASEPERLINE;
}
_local5 = _local5 + _local3;
}
_local6++;
}
if (destroyingGems.length > 0) {
_local11 = _local11 + ((_local13 - 1) * com.novelgames.flashgames.gems.Config.SCORE_EXTRALINE);
_local11 = _local11 + (currentCombo * com.novelgames.flashgames.gems.Config.SCORE_COMBO);
showScorePopup((_local10 + _local8) / 2, (_local9 + _local7) / 2, _local11);
score = score + _local11;
life = life + _local14;
if (life > com.novelgames.flashgames.gems.Config.LIFE_MAX) {
life = com.novelgames.flashgames.gems.Config.LIFE_MAX;
}
lifeBar.updateLife(life);
if (life >= com.novelgames.flashgames.gems.Config.LIFE_MAX) {
shouldLevelUp = true;
}
currentCombo++;
soundGroup.start();
return(true);
}
return(false);
}
function showScorePopup(x, y, score) {
var _local2 = scoresHolder.getNextHighestDepth();
var _local3;
var _local4;
_local3 = scoresHolder.attachMovie("scorePopup", "scorePopup" + _local2, _local2);
_local4 = _local3;
_local4.initialize(x, y, score);
}
function startDestroyGems() {
movingGems = true;
moveGemsTime = getTimer();
intervalID = setInterval(this, "destroyGems", 1);
}
function destroyGems() {
var _local8 = (getTimer() - moveGemsTime) / 1000;
var _local6 = 100 - (com.novelgames.flashgames.gems.Config.DESTROY_SCALESPEED * _local8);
var _local7 = com.novelgames.flashgames.gems.Config.DESTROY_ROTATESPEED * _local8;
var _local4;
var _local5;
var _local2;
var _local3;
if (_local6 < 0) {
_local6 = 0;
}
_local2 = 0;
while (_local2 < destroyingGems.length) {
destroyingGems[_local2]._xscale = _local6;
destroyingGems[_local2]._yscale = _local6;
destroyingGems[_local2]._rotation = _local7;
_local2++;
}
if (_local6 <= 0) {
clearInterval(intervalID);
_local2 = 0;
while (_local2 < destroyingGems.length) {
gems[(destroyingGems[_local2].y * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + destroyingGems[_local2].x] = null;
destroyingGems[_local2].removeMovieClip();
_local2++;
}
droppingGems = new Array();
_local2 = 0;
while (_local2 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
_local4 = 0;
_local3 = com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - 1;
while (_local3 >= 0) {
if (gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2] == null) {
_local4++;
} else if (_local4 > 0) {
gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2].targetY = gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2].y + _local4;
droppingGems.push(gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2]);
}
_local3--;
}
_local3 = 0;
while (_local3 < _local4) {
_local5 = generateNewGem(_local2, (-_local3) - 1, _local4);
_local5.targetY = _local5.y + _local4;
droppingGems.push(_local5);
_local3++;
}
_local2++;
}
startDropGems();
}
updateAfterEvent();
}
function generateNewGem(x, y) {
var _local2 = gemsHolder.getNextHighestDepth();
var _local4 = gemsHolder.attachMovie("gem", "gem" + _local2, _local2);
var _local3 = _local4;
var _local5 = Math.floor(Math.random() * com.novelgames.flashgames.gems.Config.BLOCK_NOOFTYPES);
_local3.initialize(x, y, _local5);
return(_local3);
}
function startDropGems() {
movingGems = true;
moveGemsTime = getTimer();
intervalID = setInterval(this, "dropGems", 1);
}
function dropGems() {
var _local4 = getTimer() - moveGemsTime;
var _local3;
var _local2;
_local2 = 0;
while (_local2 < droppingGems.length) {
if (!droppingGems[_local2].doDropMove(_local4)) {
} else {
droppingGems[_local2].y = droppingGems[_local2].targetY;
gems[(droppingGems[_local2].y * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + droppingGems[_local2].x] = droppingGems[_local2];
droppingGems.splice(_local2, 1);
_local2--;
}
_local2++;
}
if (droppingGems.length == 0) {
clearInterval(intervalID);
if (checkDestroyingGems()) {
startDestroyGems();
} else if (shouldLevelUp) {
levelUp();
} else {
_local3 = new Array(gems.length);
_local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2] = gems[_local2].type;
_local2++;
}
if (!getMovesAreAvailable(_local3)) {
startNoMoreMoves();
} else {
movingGems = false;
}
}
}
updateAfterEvent();
}
function startNoMoreMoves() {
showingNoMoreMoves = true;
movingGems = true;
moveGemsTime = getTimer();
message.showNoMoreMoves();
intervalID = setInterval(this, "destroyNoMoreMoveGems", 1);
}
function destroyNoMoreMoveGems() {
var _local5 = 100 - (((getTimer() - moveGemsTime) * com.novelgames.flashgames.gems.Config.NOMOREMOVES_SCALESPEED) / 1000);
var _local4;
var _local3;
var _local2;
_local3 = com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY;
while (_local3 >= 0) {
_local4 = _local5 + (com.novelgames.flashgames.gems.Config.NOMOREMVOES_SCALEROWDIFFERENCE * (com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY - _local3));
_local2 = 0;
while (_local2 < com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) {
if (_local4 < 0) {
gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2].removeMovieClip();
} else if (_local4 < 100) {
gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2]._xscale = _local4;
gems[(_local3 * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONX) + _local2]._yscale = _local4;
}
_local2++;
}
_local3--;
}
if ((_local5 + (com.novelgames.flashgames.gems.Config.NOMOREMVOES_SCALEROWDIFFERENCE * com.novelgames.flashgames.gems.Config.BLOCK_DIMENSIONY)) <= 0) {
clearInterval(intervalID);
message.hide();
createGems();
}
updateAfterEvent();
}
function levelUp() {
score = score + com.novelgames.flashgames.gems.Config.SCORE_LEVELUP;
message.showLevelUp(com.novelgames.flashgames.gems.Config.SCORE_LEVELUP);
soundLevelUp.start();
movingGems = true;
moveGemsTime = getTimer();
clearInterval(intervalID);
intervalID = setInterval(this, "destroyLevelUpGems", 1);
}
function destroyLevelUpGems() {
var _local4 = (getTimer() - moveGemsTime) / 1000;
var _local3 = 100 - (com.novelgames.flashgames.gems.Config.LEVELUP_SCALESPEED * _local4);
var _local2;
_local2 = 0;
while (_local2 < gems.length) {
if (_local3 < 0) {
gems[_local2].removeMovieClip();
} else {
gems[_local2]._xscale = _local3;
gems[_local2]._yscale = _local3;
}
_local2++;
}
life = com.novelgames.flashgames.gems.Config.LIFE_MAX - (com.novelgames.flashgames.gems.Config.LEVELUP_LIFERESUMESPEED * _local4);
if (life < com.novelgames.flashgames.gems.Config.LIFE_INITIAL) {
life = com.novelgames.flashgames.gems.Config.LIFE_INITIAL;
}
lifeBar.updateLife(life);
if (life <= com.novelgames.flashgames.gems.Config.LIFE_INITIAL) {
clearInterval(intervalID);
level++;
lifeDecreaseRate = lifeDecreaseRate + com.novelgames.flashgames.gems.Config.LIFE_DECREASERATEINCREMENT;
levelStarted = false;
shouldLevelUp = false;
message.hide();
createGems();
}
}
function showGameOver() {
gameOver = true;
clearInterval(intervalID);
var _local3 = _root.attachMovie("endScreen", "endScreen", _root.getNextHighestDepth());
trace(score);
trace(_local3.playAgain.score);
_local3.playAgain.score.text = score;
trace(_local3.playAgain.score.text);
}
}
Symbol 168 MovieClip [__Packages.com.novelgames.flashgames.gems.Gem] Frame 0
class com.novelgames.flashgames.gems.Gem extends MovieClip
{
var stop, x, y, type, _x, _y, gotoAndStop, button, cacheAsBitmap, targetY, targetX;
function Gem () {
super();
stop();
}
function initialize(x, y, type) {
this.x = x;
this.y = y;
this.type = type;
_x = (x * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
_y = (y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
gotoAndStop(type + 1);
button.onPress = function () {
this._parent._parent._parent.gemPressed(this._parent);
};
button.onReleaseOutside = function () {
this._parent._parent._parent.gemReleasedOutside();
};
cacheAsBitmap = true;
}
function doCreateDropMove(time) {
_y = ((y * (com.novelgames.flashgames.gems.Config.BLOCK_SPACING + com.novelgames.flashgames.gems.Config.CREATEDROP_SPACING)) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) + ((com.novelgames.flashgames.gems.Config.DROP_SPEED * time) / 1000);
if (_y >= ((targetY * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2))) {
_y = (targetY * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
return(true);
}
return(false);
}
function doSwapMove(time) {
if (targetX > x) {
_x = ((x * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) + ((com.novelgames.flashgames.gems.Config.SWAP_SPEED * time) / 1000);
} else if (targetX < x) {
_x = ((x * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) - ((com.novelgames.flashgames.gems.Config.SWAP_SPEED * time) / 1000);
} else if (targetY > y) {
_y = ((y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) + ((com.novelgames.flashgames.gems.Config.SWAP_SPEED * time) / 1000);
} else {
_y = ((y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) - ((com.novelgames.flashgames.gems.Config.SWAP_SPEED * time) / 1000);
}
}
function doDropMove(time) {
_y = ((y * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2)) + ((com.novelgames.flashgames.gems.Config.DROP_SPEED * time) / 1000);
if (_y >= ((targetY * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2))) {
_y = (targetY * com.novelgames.flashgames.gems.Config.BLOCK_SPACING) + (com.novelgames.flashgames.gems.Config.BLOCK_SPACING / 2);
return(true);
}
return(false);
}
}
Symbol 169 MovieClip [__Packages.com.novelgames.flashgames.common.NewSound] Frame 0
class com.novelgames.flashgames.common.NewSound extends Sound
{
var attachSound, setVolume, target, symbolName;
function NewSound (target, symbolName) {
super(target);
var _local3;
attachSound(symbolName);
setVolume(volumeAll);
this.target = target;
this.symbolName = symbolName;
sounds.push(this);
_local3 = 0;
while (_local3 < sounds.length) {
if (sounds[_local3] == this) {
} else if ((sounds[_local3].target == target) && (sounds[_local3].symbolName == symbolName)) {
sounds.splice(_local3, 1);
_local3--;
}
_local3++;
}
}
static function setVolumeAll(volume) {
var _local1;
volumeAll = volume;
_local1 = 0;
while (_local1 < sounds.length) {
sounds[_local1].setVolume(volume);
_local1++;
}
}
static function muteAll() {
setVolumeAll(0);
}
static function unmuteAll() {
setVolumeAll(100);
}
static function getIsMuteAll() {
return(volumeAll == 0);
}
static var sounds = new Array();
static var volumeAll = 100;
}
Symbol 170 MovieClip [__Packages.com.novelgames.flashgames.gems.Util] Frame 0
class com.novelgames.flashgames.gems.Util
{
function Util () {
}
static function swap(theArray, index1, index2) {
var _local2 = theArray[index1];
theArray[index1] = theArray[index2];
theArray[index2] = _local2;
}
}
Symbol 171 MovieClip [__Packages.com.novelgames.flashgames.common.MuteButton] Frame 0
class com.novelgames.flashgames.common.MuteButton extends MovieClip
{
var gotoAndStop;
function MuteButton () {
super();
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
showOff();
} else {
showOn();
}
}
function onPress() {
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
com.novelgames.flashgames.common.NewSound.unmuteAll();
showOn();
} else {
com.novelgames.flashgames.common.NewSound.muteAll();
showOff();
}
}
function showOff() {
gotoAndStop("off");
}
function showOn() {
gotoAndStop("on");
}
}
Symbol 172 MovieClip [__Packages.com.novelgames.flashgames.common.MainDevelopment] Frame 0
class com.novelgames.flashgames.common.MainDevelopment extends MovieClip
{
var gotoAndStop, startButton, highScoresButton, moreGamesButton;
function MainDevelopment () {
super();
}
static function initialize(movieClip) {
movieClip.__proto__ = com.novelgames.flashgames.common.MainDevelopment.prototype;
movieClip.gotoTitlePage();
}
function gotoTitlePage() {
gotoAndStop("title");
startButton.onRelease = function () {
this._parent.gotoInstructionsPage();
};
highScoresButton.onRelease = function () {
this._parent.showHighScores();
};
moreGamesButton.onRelease = function () {
this._parent.getURL("http://www.novelgames.com", "_blank");
};
}
function gotoInstructionsPage() {
gotoAndStop("instructions");
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
}
function gotoGamePage() {
gotoAndStop("game");
}
function showHighScores() {
trace("showHighScores()");
}
function showEnterHighScore(score) {
trace(("showEnterHighScore(" + score) + ")");
}
}
Symbol 104 MovieClip [__Packages.com.tmgc.gameconnector.GameConnectorAS2] Frame 0
class com.tmgc.gameconnector.GameConnectorAS2 extends MovieClip
{
var _url, _localConnection;
function GameConnectorAS2 () {
super();
var _local7 = unescape(_url);
var _local9 = _local7.lastIndexOf("?");
var _local8 = _local7.substr(_local9 + 1, _local7.length);
var _local6 = _local8.split("&");
var _local3 = 0;
while (_local3 < _local6.length) {
var _local5 = _local6[_local3].split("=")[0];
var _local4 = _local6[_local3].split("=")[1];
if (_local5 == "doofConnectionName") {
_doofConnectionName = _local4;
}
if (_local5 == "gameConnectionName") {
_gameConnectionName = _local4;
}
_local3++;
}
_localConnection = new LocalConnection();
try {
_localConnection.connect(gameConnectionName);
} catch(error:Error) {
trace(error);
}
}
function get doofConnectionName() {
return(_doofConnectionName);
}
function get gameConnectionName() {
return(_gameConnectionName);
}
function gameStarted(initialScore) {
trace("GameConnectorAS2.gameStarted() initialScore=" + String(initialScore));
_localConnection.send(doofConnectionName, "gameStarted", initialScore);
}
function gameEnded(finalScore) {
trace("GameConnectorAS2.gameEnded() finalScore=" + String(finalScore));
_localConnection.send(doofConnectionName, "gameEnded", finalScore);
}
function gameScore(score) {
trace("GameConnectorAS2.gameScore() score=" + String(score));
_localConnection.send(doofConnectionName, "gameScore", score);
}
function gameStat(statName, statValue) {
trace((("GameConnectorAS2.gameStat() statName=" + statName) + ", statValue=") + statValue);
_localConnection.send(doofConnectionName, "gameStat", statName, statValue);
}
function gameStatList(stats) {
trace("GameConnectorAS2.gameStatList() stats=" + stats);
_localConnection.send(doofConnectionName, "gameStatList", stats);
}
function stopGame() {
trace("GameConnectorAS2.stopGame()");
}
var _doofConnectionName = "doof";
var _gameConnectionName = "game";
}