Frame 1
function debug(msg, code, func, vars) {
switch (D_MODE) {
case D_SILENT :
return(undefined);
case D_ERROR :
if (code > D_ERROR) {
return(undefined);
}
case D_NOTIFY :
if (code > D_NOTIFY) {
return(undefined);
}
break;
case D_MOVE :
if ((code > D_NOTIFY) && (code != D_MOVE)) {
return(undefined);
}
break;
case D_GHOST :
if ((code > D_NOTIFY) && (code != D_GHOST)) {
return(undefined);
}
break;
case D_MATCH :
if ((code > D_NOTIFY) && (code != D_MATCH)) {
return(undefined);
}
break;
case D_DRAW :
if ((code > D_NOTIFY) && (code != D_DRAW)) {
return(undefined);
}
break;
case D_SCORE :
if ((code > D_NOTIFY) && (code != D_SCORE)) {
return(undefined);
}
break;
}
var varsString = "";
if (vars != null) {
for (prop in vars) {
var value = vars[prop];
if (value == undefined) {
value = "undefined";
}
varsString = (((varsString + prop) + ":") + value) + ", ";
}
varsString = (" [" + varsString) + "]";
}
var printOut = (((((func + " (") + code) + ") :: ") + msg) + varsString);
_root.tDebug = (_root.tDebug + printOut) + newline;
}
function assertNotNull(vars, location) {
for (prop in vars) {
var obj = vars[prop];
if ((obj == null) || (obj == undefined)) {
debug("null value assertion failed", D_ERROR, location, vars);
return(true);
}
}
return(false);
}
function columnAdd(value, amt) {
assertNotNull({value:value, amt:amt}, "columnAdd");
value = value + amt;
while (value < 0) {
value = value + NUM_COLUMNS;
}
while (value > (NUM_COLUMNS - 1)) {
value = value - NUM_COLUMNS;
}
return(value);
}
function ringAdd(value, amt) {
assertNotNull({value:value, amt:amt}, "ringAdd");
value = value + amt;
while (value < 0) {
value = value + NUM_RINGS;
}
while (value > (NUM_RINGS - 1)) {
value = value - NUM_RINGS;
}
return(value);
}
function ringRadius(ring) {
assertNotNull({ring:ring}, "ringRadius");
switch (ring) {
case 0 :
return(50);
case 1 :
return(75);
case 2 :
return(106);
case 3 :
return(145);
case 4 :
return(200);
case 5 :
return(253);
case -1 :
return(27);
case -2 :
return(18);
}
debug("unkown ring, returning 0", D_ERROR, "radiusForRing()", {ring:ring});
return(0);
}
function columnAngle(column) {
assertNotNull({column:column}, "columnAngle");
return((column * (2 / NUM_COLUMNS)) * Math.PI);
}
function angleDelta(angA, angB) {
assertNotNull({angA:angA, angB:angB}, "angleDelta");
while (angA < 0) {
angA = angA + (Math.PI*2);
}
while (angA > (Math.PI*2)) {
angA = angA - (Math.PI*2);
}
while (angB < 0) {
angB = angB + (Math.PI*2);
}
while (angB > (Math.PI*2)) {
angB = angB - (Math.PI*2);
}
var delta = (angA - angB);
if (Math.abs(delta) > Math.PI) {
delta = ((Math.PI*2) - delta) * -1;
}
while (delta < -3.14159265358979) {
delta = delta + (Math.PI*2);
}
while (delta > Math.PI) {
delta = delta - (Math.PI*2);
}
return(delta);
}
function radiusFromRatio(ratio_delta, ring) {
assertNotNull({ratio_delta:ratio_delta, ring:ring}, "radiusFromRatio");
var rest_radius = ringRadius(ring);
if (ratio_delta < 0) {
var one_click = (rest_radius - ringRadius(ring - 1));
var delta = (ratio_delta * one_click);
} else {
var one_click = (ringRadius(ring + 1) - rest_radius);
var delta = (ratio_delta * one_click);
}
return(rest_radius + delta);
}
function padString(number, padding) {
var strValue = String(number);
var i = (padding - strValue.length);
while (i > 0) {
strValue = "0" + strValue;
i--;
}
return(strValue);
}
function BitMap() {
this.bitArray = new Array();
}
NUM_RINGS = 4;
NUM_COLUMNS = 18;
COLUMN_RATE = 20;
IN_GAME_RELEASE_DELAY = 2;
IN_GAME_RELEASE_DELAY_INITIAL = 20;
MATCH_DELAY = 10;
MATCH_SCALE_RATE = 5;
INIT_RELEASE_DELAY = 1;
PEARL_DOWN_RATE = 2500;
PEARL_DELAY = 4000;
PEARL_BLINK_RATE = 250;
PEARL_BLINK_POINT = 5;
PEARL_POINTS = 5;
GEM_POINTS_NEEDED_INITIAL = 50;
GEM_POINTS_NEEDED_INCREMENT = 25;
GEM_TOTAL_STEPS = 17;
RESERVE_DELAY = 10;
RESERVE_COST = 3;
SNAPBACK_RATE_RING = 0.20943951023932;
SNAPBACK_RATE_COLUMN = 0.4;
COUNTOFF_RATE_PEARLS = 5;
SAVESEND_URL = "/cgi/games/queen/savesend.cgi";
COLOR_ARRAY = [10027212, 16711680, 16750848, 65535, 39168, 16711935];
LEVEL_COLORS = ["purple", "green", "blue", "red", "brown"];
ACCOLADES = ["", "the Good", "the Great", "the Magnificent", "the Stupendous", "the Supreme"];
JewelMC = _root.iCenter;
SCORE_SPACING = 13;
USE_DEBUG_JEWELS = false;
DEBUG_JEWEL_ARRAY = new Array(5, 0, 1, 4, 4, 0, 2, 1, 2, 3, 1, 2, 0, 1, 2, 3, 4, 3, 3, 5, 0, 1, 0, 1, 4, 1, 0, 3, 4, 5, 1, 2, 3, 0, 1, 2, 5, 4, 4, 0, 1, 2, 3, 4, 5, 1, 0, 3, 4, 5, 1, 3, 5, 2, 2, 5, 3, 2, 0, 2, 3, 3, 1, 5, 0, 2, 4, 0, 1, 3, 1, 5, 3, 1, 1, 1, 2, 4, 4, 5, 1, 0, 3, 4, 5, 2, 1, 1, 2, 1, 3, 0, 5);
D_SILENT = 0;
D_ERROR = 1;
D_NOTIFY = 2;
D_MOVE = 3;
D_GHOST = 4;
D_MATCH = 5;
D_DRAW = 6;
D_SCORE = 7;
D_MODE = D_SILENT;
M_OFF = 0;
M_SELECT = 1;
M_CALCULATE = 2;
M_COLUMN = 3;
M_RING = 4;
J_INIT = 0;
J_NONE = 0;
J_RESTING = 1;
J_MOVING = 2;
J_MATCHED = 3;
J_GHOST = 4;
E_ComboEnd = 0;
E_MatchMade = 1;
E_LevelUp = 2;
E_GameOver = 3;
_global.debug = debug;
BitMap.prototype.setBit = function (index, bool) {
var i = Math.floor(index / 32);
var sub_index = (index % 32);
var bitstring = this.bitArray[i];
if (bitstring == undefined) {
bitstring = 0;
}
if (bool) {
bitstring = (1 << sub_index) | bitString;
} else if (this.getBit(index)) {
bitstring = bitString ^ (1 << sub_index);
}
this.bitArray[i] = bitstring;
};
BitMap.prototype.getBit = function (index) {
var i = Math.floor(index / 32);
var index = (index % 32);
if (this.bitArray[i] == undefined) {
this.bitArray[i] = 0;
}
var val = ((1 << index) & this.bitArray[i]);
if (val) {
return(true);
}
return(false);
};
BitMap.prototype.isZero = function () {
var total = 0;
var i = 0;
while (i < this.bitArray.length) {
if (this.bitArray[i] != 0) {
return(false);
}
i++;
}
return(true);
};
BitMap.prototype.clear = function () {
var i = 0;
while (i < this.bitArray.length) {
this.bitArray[i] = 0;
i++;
}
};
Instance of Symbol 76 MovieClip "iCode" in Frame 1
onClipEvent (enterFrame) {
if (EventManager.isOn) {
EventManager.onEnterFrame();
}
}
Frame 2
_global.SoundMgr = new Object();
SoundMgr.init = function () {
this.globalsound = new Sound();
this.woodRollSnd = new Sound();
this.woodClickSnd = new Sound();
this.woodRollSnd.attachSound("sWoodRoll");
this.woodClickSnd.attachSound("sWoodClick");
this.isOff = false;
};
SoundMgr.turnOff = function () {
this.isOff = true;
_root.iButtonControls.gotoAndStop(2);
this.globalsound.setVolume(0);
};
SoundMgr.turnOn = function () {
this.isOff = false;
_root.iButtonControls.gotoAndStop(1);
this.globalsound.setVolume(100);
};
SoundMgr.playWoodRoll = function () {
this.woodRollSnd.start();
};
SoundMgr.playWoodClick = function () {
this.woodClickSnd.start();
};
SoundMgr.isSoundOff = function () {
return(this.isOff);
};
Frame 3
function DistanceTween(obj, property, rate, finish, callback) {
this.object = obj;
this.property = property;
this.rate = rate;
this.finish = finish;
this.callbackFunction = callback;
this.isFinished = false;
var curProp = obj[property];
if ((((finish - curProp) < 0) && (rate > 0)) || (((finish - curprop) > 0) && (rate < 0))) {
this.rate = this.rate * -1;
}
}
function TimedTween(obj, property, time, finish, callback) {
this.base = DistanceTween;
var rate = ((finish - obj[property]) / time);
this.base(obj, property, rate, finish, callback);
delete this.base;
}
_global.AnimationManager = new Object();
AnimationManager.init = function () {
this.tweenObjects = new Array();
};
AnimationManager.tween = function () {
var temp = new Array();
var old = this.tweenObjects;
while (old.length > 0) {
var tween = old.shift();
if (tween.delay > 0) {
tween.delay--;
} else if (tween.increment()) {
tween.callback();
delete tween;
continue;
}
temp.push(tween);
}
this.tweenObjects = temp;
};
AnimationManager.addTween = function (tween, delay) {
if (delay == undefined) {
tween.delay = 0;
} else {
tween.delay = delay;
}
this.tweenObjects.push(tween);
};
DistanceTween.prototype.increment = function () {
var obj = this.object;
var prop = this.property;
var rate = this.rate;
var finish = this.finish;
if (obj == null) {
debug("tween object is null");
this.isFinished = true;
return(true);
}
obj[prop] = obj[prop] + rate;
if (rate > 0) {
if (obj[prop] >= finish) {
obj[prop] = finish;
this.isFinished = true;
return(true);
}
} else if (obj[prop] <= finish) {
obj[prop] = finish;
this.isFinished = true;
return(true);
}
return(false);
};
DistanceTween.prototype.callback = function () {
this.callbackFunction(this.object);
};
DistanceTween.prototype.setFinish = function (value) {
debug("setting finish", D_MATCH, "DistanceTween.setFinish", {value:value, ring:this.object.ring, column:this.object.column});
if (this.finish > value) {
debug("***setting finish to a lower value***", D_ERROR, "DistanceTween.setFinish", {value:value, finish:this.finish, ring:this.object.ring, column:this.object.column});
}
this.finish = value;
};
TimedTween.prototype.__proto__ = DistanceTween.prototype;
Frame 4
function Jewel() {
this.mode = J_INIT;
this.color_id = undefined;
this.ring = 0;
this.column = 0;
this.j_angle = 0;
this.j_radius = 0;
this.j_scale = 100;
this.color_obj = new Color(this.iColor);
this.iSelected._visible = false;
this.stop();
this.iColor._visible = false;
}
_global.JewelManager = new Object();
JewelManager.init = function () {
this.curDepth = 1;
this.jewelArray = new Array();
this.taintedJewels = new Array();
};
JewelManager.restart = function () {
while (this.taintedJewels.length > 0) {
this.taintedJewels.pop();
}
while (this.jewelArray.length > 0) {
var jewel = this.jewelArray.pop();
jewel.removeMovieClip();
}
this.curDepth = 1;
};
JewelManager.createJewel = function (color_id) {
var jewelName = ("iJewel_" + this.curDepth);
JewelMC.attachMovie("Jewel", jewelName, this.curDepth);
var jewel = JewelMC[jewelName];
jewel.id = this.curDepth;
this.curDepth++;
this.jewelArray.push(jewel);
jewel.setColor(color_id);
return(jewel);
};
JewelManager.createGhost = function () {
var ghost = this.createJewel(0);
ghost.mode = J_GHOST;
return(ghost);
};
JewelManager.deleteJewel = function (jewel) {
var ar = this.jewelArray;
var i = 0;
while (i < ar.length) {
if (jewel == ar[i]) {
ar.splice(i, 1);
break;
}
i++;
}
jewel.removeMovieClip();
};
JewelManager.draw = function () {
while (this.taintedJewels.length > 0) {
var j = this.taintedJewels.pop();
if (j != undefined) {
j.draw();
}
}
};
JewelManager.rollSnd = new Sound();
JewelManager.rollSnd.attachSound("sGemServe");
JewelManager.clickSnd = new Sound();
JewelManager.clickSnd.attachSound("sGemClick");
Jewel.prototype = new MovieClip();
Jewel.prototype.setColor = function (color_id) {
assertNotNull({color_id:color_id}, "Jewel.setColor");
this.color_id = color_id;
this.gotoAndStop(color_id + 2);
};
Jewel.prototype.getColor = function () {
assertNotNull({color_id:this.color_id}, "Jewel.getColor");
return(this.color_id);
};
Jewel.prototype.setSelected = function (bool) {
this.iSelected._visible = bool;
};
Jewel.prototype.reset = function () {
this.angle = columnAngle(this.column);
this.radius = ringRadius(this.ring);
};
Jewel.prototype.taint = function () {
JewelManager.taintedJewels[this.id] = this;
};
Jewel.prototype.getAngle = function () {
return(this.j_angle);
};
Jewel.prototype.setAngle = function (value) {
this.j_angle = value;
this.taint();
};
Jewel.prototype.addProperty("angle", Jewel.prototype.getAngle, Jewel.prototype.setAngle);
Jewel.prototype.getRadius = function () {
return(this.j_radius);
};
Jewel.prototype.setRadius = function (value) {
this.j_radius = value;
this.taint();
};
Jewel.prototype.addProperty("radius", Jewel.prototype.getRadius, Jewel.prototype.setRadius);
Jewel.prototype.getScale = function () {
return(this.j_scale);
};
Jewel.prototype.setScale = function (value) {
this.j_scale = value;
this.taint();
};
Jewel.prototype.addProperty("scale", Jewel.prototype.getScale, Jewel.prototype.setScale);
Jewel.prototype.draw = function () {
var a = this.angle;
var r = this.radius;
debug("", D_DRAW, "draw", {angle:a, radius:r});
this._x = Math.cos(a) * r;
this._y = Math.sin(a) * r;
this._rotation = ((a * 180) / Math.PI) + 90;
var scale = (this.scale / 100);
this._xscale = (this._yscale = ((r / 150) * 100) * scale);
};
Jewel.prototype.explode = function () {
this.gotoAndPlay("disappear");
};
Jewel.prototype.playClick = function () {
JewelManager.clickSnd.start();
};
Jewel.prototype.playRoll = function () {
if ((JewelManager.rollSnd.position <= 0) || (JewelManager.rollSnd.position >= JewelManager.rollSnd.duration)) {
JewelManager.rollSnd.start();
}
};
Object.registerClass("Jewel", Jewel);
Frame 5
_global.BoardManager = new Object();
BoardManager.init = function () {
this.jewelArray = new Array(NUM_RINGS);
this.tainted = new Array();
this.columnsToMove = new Array();
this.movingFlags = new BitMap();
this.restingFlags = new BitMap();
this.matchedFlags = new BitMap();
this.isButtonDisabled = false;
var i = 0;
while (i < NUM_RINGS) {
this.jewelArray[i] = new Array(NUM_COLUMNS);
i++;
}
};
BoardManager.reserveJewels = function () {
if (this.isButtonDisabled) {
return(undefined);
}
var soundDelay = new TimedTween(null, null, 0, 0, this.boomTinkleCallback);
AnimationManager.addTween(soundDelay, 1);
this.explodeRing(0);
this.explodeRing(1);
this.explodeRing(2);
this.explodeRing(3);
this.restart();
this.fillBoard();
this.replaceMatches();
this.animateBoardIn();
};
BoardManager.boomTinkleCallback = function () {
GemManager.sndBoomTinkle.start();
};
BoardManager.restart = function () {
var ring = (NUM_RINGS - 1);
while (ring >= 0) {
var col = 0;
while (col < NUM_COLUMNS) {
this.jewelArray[ring][col] = null;
col++;
}
ring--;
}
while (this.tainted.length > 0) {
this.tainted.pop();
}
while (this.columnsToMove.length > 0) {
this.columnsToMove.pop();
}
this.isButtonDisabled = false;
this.movingFlags.clear();
this.restingFlags.clear();
this.matchedFlags.clear();
this.innerGhost.removeMovieClip();
this.outerGhost.removeMovieClip();
this.innerGhost = null;
this.outerGhost = null;
};
BoardManager.fillBoard = function () {
var ring = (NUM_RINGS - 1);
while (ring >= 0) {
var col = 0;
while (col < NUM_COLUMNS) {
var jewel = this.addJewel(ring, col);
jewel._visible = false;
col++;
}
ring--;
}
};
BoardManager.sndGemServeAll = new Sound();
BoardManager.sndGemServeAll.attachSound("sGemServeAll");
BoardManager.sndGemServeAll.onSoundComplete = function () {
this.start();
};
BoardManager.onPauseGame = function () {
if (this.isServeSoundPlaying) {
this.sndGemServeAll.stop("sGemServeAll");
} else {
BoardManager.disableButtons();
}
};
BoardManager.onResumeGame = function () {
if (this.isServeSoundPlaying) {
this.sndGemServeAll.start();
} else {
this.enableButtons();
}
};
BoardManager.animateBoardIn = function () {
debug("animateBoardIn");
var delay = 0;
var soundDelay = new TimedTween(null, null, 0, 0, this.serveSoundCallback);
AnimationManager.addTween(soundDelay, 1);
var ring = (NUM_RINGS - 1);
while (ring >= 0) {
var col = 0;
while (col < NUM_COLUMNS) {
var jewel = this.getJewel(ring, col);
jewel._visible = true;
this.animateIn(jewel, delay, false);
delay = delay + INIT_RELEASE_DELAY;
col++;
}
ring--;
}
this.disableButtons();
};
BoardManager.serveSoundCallback = function () {
BoardManager.sndGemServeAll.start();
BoardManager.isServeSoundPlaying = true;
};
BoardManager.replaceMatches = function () {
do {
var matchCount = this.replaceMatchesHelper();
} while (matchCount > 0);
};
BoardManager.replaceMatchesHelper = function () {
var jewelCount = 0;
var lastColorId = -1;
var matchCount = 0;
var ring = 0;
while (ring < NUM_RINGS) {
jewelCount = 0;
colorTwoIn = this.getJewel(ring, NUM_COLUMNS - 2).getColor();
lastColorId = this.getJewel(ring, NUM_COLUMNS - 1).getColor();
if (colorTwoIn == lastColorId) {
jewelCount = 2;
} else {
jewelCount = 1;
}
var col = 0;
while (col < NUM_COLUMNS) {
var column = (col % NUM_COLUMNS);
var jewel = this.getJewel(ring, column);
var colorId = jewel.getColor();
if (colorId == lastColorId) {
jewelCount++;
} else {
jewelCount = 1;
lastColorId = colorId;
}
if (jewelCount >= 3) {
var newColorId = colorId;
while (newColorId == colorId) {
newColorId = Math.floor(Math.random() * COLOR_ARRAY.length);
}
jewel.setColor(newColorId);
matchCount++;
lastColorId = newColorId;
jewelCount = 1;
}
col++;
}
ring++;
}
var col = 0;
while (col < NUM_COLUMNS) {
var ring = 0;
while (ring < NUM_RINGS) {
var jewel = this.getJewel(ring, col);
var colorId = jewel.getColor();
if (colorId == lastColorId) {
jewelCount++;
} else {
jewelCount = 1;
lastColorId = colorId;
}
if (jewelCount >= 3) {
var newColorId = colorId;
while (newColorId == colorId) {
newColorId = Math.floor(Math.random() * COLOR_ARRAY.length);
}
jewel.setColor(newColorId);
matchCount++;
lastColorId = newColorId;
jewelCount = 1;
}
ring++;
}
jewelCount = 0;
lastColorId = -1;
col++;
}
return(matchCount);
};
BoardManager.getJewel = function (ring, column) {
return(this.jewelArray[ring][column]);
};
BoardManager.setJewel = function (jewel) {
if (assertNotNull({jewel:jewel}, "BoardManager.setJewel")) {
debug("setting jewel to null.", D_ERROR);
}
this.jewelArray[jewel.ring][jewel.column] = jewel;
this.changeJewelMode(jewel, jewel.mode);
};
BoardManager.explodeRing = function (ring) {
var i = 0;
while (i < NUM_COLUMNS) {
var jewel = this.getJewel(ring, i);
jewel.explode();
this.removeJewel(jewel);
i++;
}
};
BoardManager.removeJewel = function (jewel) {
assertNotNull({jewel:jewel}, "BoardManager.removeJewel");
this.jewelArray[jewel.ring][jewel.column] = null;
};
BoardManager.addJewel = function (ring, column) {
assertNotNull({ring:ring, column:column}, "BoardManager.addJewel");
if (USE_DEBUG_JEWELS && (DEBUG_JEWEL_ARRAY.length > 0)) {
var color_id = DEBUG_JEWEL_ARRAY.shift();
} else {
var color_id = Math.floor(Math.random() * COLOR_ARRAY.length);
}
var jewel = JewelManager.createJewel(color_id);
jewel.ring = ring;
jewel.column = column;
this.setJewel(jewel);
return(jewel);
};
BoardManager.changeJewelMode = function (jewel, mode) {
var index = ((jewel.ring * NUM_COLUMNS) + jewel.column);
jewel.mode = mode;
switch (mode) {
case J_RESTING :
this.movingFlags.setBit(index, false);
this.matchedFlags.setBit(index, false);
this.restingFlags.setBit(index, true);
return;
case J_MATCHED :
this.movingFlags.setBit(index, false);
this.matchedFlags.setBit(index, true);
this.restingFlags.setBit(index, false);
return;
case J_MOVING :
this.movingFlags.setBit(index, true);
this.matchedFlags.setBit(index, false);
this.restingFlags.setBit(index, false);
return;
case J_NONE :
this.movingFlags.setBit(index, false);
this.matchedFlags.setBit(index, false);
this.restingFlags.setBit(index, false);
return;
default :
debug("unknown mode");
}
};
BoardManager.reset = function () {
var ring = 0;
while (ring < NUM_RINGS) {
var col = 0;
while (col < NUM_COLUMNS) {
var jewel = this.getJewel(ring, col);
jewel.reset();
col++;
}
ring++;
}
this.clearGhosts();
};
BoardManager.disableButtons = function () {
this.isButtonDisabled = true;
var ring = 0;
while (ring < NUM_RINGS) {
var col = 0;
while (col < NUM_COLUMNS) {
var jewel = this.getJewel(ring, col);
jewel.iButton.enabled = false;
col++;
}
ring++;
}
};
BoardManager.enableButtons = function () {
if (this.isServeSoundPlaying) {
this.sndGemServeAll.stop("sGemServeAll");
this.isServeSoundPlaying = false;
}
this.isButtonDisabled = false;
var ring = 0;
while (ring < NUM_RINGS) {
var col = 0;
while (col < NUM_COLUMNS) {
var jewel = this.getJewel(ring, col);
jewel.iButton.enabled = true;
col++;
}
ring++;
}
};
BoardManager.animateMatch = function (jewel) {
var tween = new TimedTween(jewel, "scale", MATCH_SCALE_RATE, 0, this.deleteJewelCallback);
AnimationManager.addTween(tween, MATCH_DELAY);
};
BoardManager.deleteJewelCallback = function () {
JewelManager.deleteJewel(this.object);
};
BoardManager.sndGemServeOne = new Sound();
BoardManager.sndGemServeOne.attachSound("sGemServe");
BoardManager.animateIn = function (jewel, delay, sndFlag) {
this.changeJewelMode(jewel, J_MOVING);
jewel.angle = columnAngle(jewel.column);
var finish = ringRadius(jewel.ring);
jewel.tween = new DistanceTween(jewel, "radius", COLUMN_RATE, finish, this.onJewelLandCallback);
AnimationManager.addTween(jewel.tween, delay);
if (sndFlag == undefined) {
var sndPlay = new TimedTween(jewel, null, 0, 0, this.onJewelServeCallback);
AnimationManager.addTween(sndPlay, delay);
}
};
BoardManager.sndGemServeOne = new Sound();
BoardManager.sndGemServeOne.attachSound("sGemServe");
BoardManager.onJewelServeCallback = function () {
BoardManager.sndGemServeOne.start();
};
BoardManager.onJewelLandCallback = function () {
BoardManager.onJewelLand(this.object);
};
BoardManager.onJewelLand = function (jewel) {
this.changeJewelMode(jewel, J_RESTING);
this.matchTaint(jewel);
};
BoardManager.matchTaint = function (jewel) {
this.tainted.push(jewel);
};
BoardManager.findMatches = function () {
var jewelsTainted = 0;
while (this.tainted.length > 0) {
jewelsTainted++;
var jewel = this.tainted.pop();
this.markIfMatch(jewel);
}
var colsMoved = 0;
while (this.columnsToMove.length > 0) {
var col = this.columnsToMove.pop();
this.fillColumn(col);
colsMoved++;
}
if ((colsMoved > 0) || (jewelsTainted > 0)) {
if (this.movingFlags.isZero() && (this.matchedFlags.isZero())) {
EventManager.sendEvent(E_ComboEnd);
this.enableButtons();
}
}
};
BoardManager.fillColumn = function (column) {
var lookingFor = (NUM_RINGS - 1);
var found = 0;
var delay = IN_GAME_RELEASE_DELAY_INITIAL;
var i = lookingFor;
while (i >= 0) {
var jewel = this.getJewel(i, column);
if ((jewel.mode == J_RESTING) && (lookingFor == i)) {
found++;
lookingFor--;
} else if ((jewel.mode == J_MOVING) && (lookingFor == i)) {
delay = Math.max(delay, jewel.tween.delay);
found++;
lookingFor--;
} else if ((jewel.mode == J_RESTING) && (lookingFor > i)) {
debug("strarting tween", D_MATCH, "fillColumn", {lookingFor:lookingFor});
this.removeJewel(jewel);
jewel.ring = lookingFor;
this.setJewel(jewel);
delay = delay + IN_GAME_RELEASE_DELAY;
this.animateIn(jewel, delay);
found++;
lookingFor--;
} else if ((jewel.mode == J_MOVING) && (lookingFor > i)) {
debug("updating tween", D_MATCH, "fillColumn", {lookingFor:lookingFor});
this.removeJewel(jewel);
jewel.ring = lookingFor;
this.setJewel(jewel);
jewel.tween.setFinish(ringRadius(jewel.ring));
delay = Math.max(delay, jewel.tween.delay);
found++;
lookingFor--;
} else if ((jewel.mode == J_MATCHED) || (jewel == null)) {
debug("jewel matched needs to be replaced", D_MATCH, "fillColumn", {lookingFor:lookingFor});
} else {
debug("this should not be reached", D_ERROR, "BoardManager.fillColumn", {jewel:jewel, mode:jewel.mode});
}
i--;
}
var need_to_make = (NUM_RINGS - found);
delay = delay + IN_GAME_RELEASE_DELAY;
while (lookingFor >= 0) {
debug("creating jewel", D_MATCH, "fillColumn");
var jewel = this.addJewel(lookingFor, column);
this.animateIn(jewel, delay);
delay = delay + IN_GAME_RELEASE_DELAY;
lookingFor--;
}
if (found < 4) {
debug("", D_MATCH, "fillColumn", {found:found, lookingFor:lookingFor, need_to_make:need_to_make});
}
};
BoardManager.markIfMatch = function (jewel) {
var matches = this.getMatches(jewel);
var isMatch = false;
var num_matches = matches.length;
var middleJewel = matches[0];
while (matches.length > 0) {
var m = matches.pop();
if (m.mode == J_RESTING) {
isMatch = true;
this.markAsMatched(m);
this.columnsToMove.push(m.column);
} else if (m.mode != J_MATCHED) {
debug("wait! why is this jewel contained in a match", D_ERROR, "markIfMatch", {mode:m.mode});
}
}
if (isMatch) {
this.sndJewelMatch.start();
var score = ScoreManager.getNextScoreValue(num_matches);
middleJewel.draw();
ScoreManager.createScoreBit(score, middleJewel._x, middleJewel._y);
}
return(isMatch);
};
BoardManager.sndJewelMatch = new Sound();
BoardManager.sndJewelMatch.attachSound("sJewelMatch");
BoardManager.markAsMatched = function (jewel) {
debug("jewel matched", D_MATCH, "markAsMatched", {jewel:jewel, color:jewel.color_id});
this.changeJewelMode(jewel, J_MATCHED);
this.animateMatch(jewel);
};
BoardManager.isMatch = function (jewel, ring, column) {
if (jewel.mode != J_RESTING) {
return(false);
}
if (ring == undefined) {
var ring = jewel.ring;
} else if (ring == NUM_RINGS) {
ring = 0;
} else if (ring == -1) {
ring = NUM_RINGS - 1;
}
if (column == undefined) {
var column = jewel.column;
} else if (column == -1) {
column = NUM_COLUMNS - 1;
} else if (column == NUM_COLUMNS) {
column = 0;
}
var color_id = jewel.getColor();
if (jewel.column != column) {
var color1 = this.getJewel(ring + 1, column).getColor();
var color2 = this.getJewel(ring + 2, column).getColor();
var color3 = this.getJewel(ring - 1, column).getColor();
var color4 = this.getJewel(ring - 2, column).getColor();
if ((((color_id == color1) && (color_id == color2)) || ((color_id == color1) && (color_id == color3))) || ((color_id == color4) && (color_id == color3))) {
return(true);
}
} else if (jewel.ring != ring) {
if ((jewel.ring == (NUM_RINGS - 1)) && ((ring == NUM_RINGS) || (ring == 0))) {
var color1 = this.getJewel(0, jewel.column).getColor();
var color2 = this.getJewel(1, jewel.column).getColor();
if ((color_id == color1) && (color_id == color2)) {
return(true);
}
} else if ((jewel.ring == 0) && ((ring == (NUM_RINGS - 1)) || (ring == -1))) {
var color1 = this.getJewel(NUM_RINGS - 1, jewel.column).getColor();
var color2 = this.getJewel(NUM_RINGS - 2, jewel.column).getColor();
if ((color_id == color1) && (color_id == color2)) {
return(true);
}
} else if ((jewel.ring == (NUM_RINGS - 2)) && (ring == (NUM_RINGS - 3))) {
var color1 = this.getJewel(NUM_RINGS - 1, jewel.column).getColor();
var color2 = this.getJewel(0, jewel.column).getColor();
if ((color_id == color1) && (color_id == color2)) {
return(true);
}
} else if ((jewel.ring == 1) && (ring == 2)) {
var color1 = this.getJewel(NUM_RINGS - 1, jewel.column).getColor();
var color2 = this.getJewel(0, jewel.column).getColor();
if ((color_id == color1) && (color_id == color2)) {
return(true);
}
}
var color1 = this.getJewel(ring, columnAdd(jewel.column, 1)).getColor();
var color2 = this.getJewel(ring, columnAdd(jewel.column, 2)).getColor();
var color3 = this.getJewel(ring, columnAdd(jewel.column, -1)).getColor();
var color4 = this.getJewel(ring, columnAdd(jewel.column, -2)).getColor();
if ((((color_id == color1) && (color_id == color2)) || ((color_id == color1) && (color_id == color3))) || ((color_id == color4) && (color_id == color3))) {
return(true);
}
}
return(false);
};
BoardManager.getMatches = function (jewel) {
assertNotNull(jewel, "BoardManager.isMatch");
if (jewel.mode != J_RESTING) {
return(false);
}
var ring = jewel.ring;
var column = jewel.column;
var tJewel = false;
var matchArray = new Array();
var colMatches = this.getColumnMatches(jewel);
var len = colMatches.length;
var i = 0;
while (i < len) {
var cMatch = colMatches[i];
if (cMatch != jewel) {
var tMatches = this.getRingMatches(cMatch);
if (tMatches.length > 0) {
tJewel = cMatch;
colMatches = colMatches.concat(tMatches);
}
}
i++;
}
var ringMatches = this.getRingMatches(jewel);
var len = ringMatches.length;
var i = 0;
while (i < len) {
var rMatch = ringMatches[i];
if (rMatch != jewel) {
var tMatches = this.getColumnMatches(rMatch);
if (tMatches.length > 0) {
tJewel = rMatch;
ringMatches = ringMatches.concat(tMatches);
}
}
i++;
}
if (tjewel) {
matchArray.unshift(tJewel);
matchArray.push(jewel);
while (colMatches.length > 0) {
var match = colMatches.pop();
if (match != tJewel) {
matchArray.push(match);
}
}
while (ringMatches.length > 0) {
var match = ringMatches.pop();
if (match != tJewel) {
matchArray.push(match);
}
}
} else if ((ringMatches.length > 1) && (colMatches.length > 1)) {
matchArray.unshift(jewel);
matchArray = matchArray.concat(ringMatches);
matchArray = matchArray.concat(colMatches);
} else if (ringMatches.length > 1) {
ringMatches.push(jewel);
ringMatches.sort(this.columnSortHelper);
var middle = Math.floor(ringMatches.length / 2);
var midJewel = ringMatches[middle];
ringMatches.splice(middle, 1);
ringMatches.unshift(midJewel);
matchArray = ringMatches;
} else if (colMatches.length > 1) {
colMatches.push(jewel);
colMatches.sort(this.ringSortHelper);
var middle = Math.floor(colMatches.length / 2);
var midJewel = colMatches[middle];
colMatches.splice(middle, 1);
colMatches.unshift(midJewel);
matchArray = colMatches;
}
return(matchArray);
};
BoardManager.ringSortHelper = function (a, b) {
if (a.ring < b.ring) {
return(-1);
}
if (a.ring > b.ring) {
return(1);
}
return(0);
};
BoardManager.columnSortHelper = function (a, b) {
if ((a.column > 15) && (b.column < 5)) {
return(-1);
}
if ((a.column < 5) && (b.column > 15)) {
return(1);
}
if (a.column < b.column) {
return(-1);
}
if (a.column > b.column) {
return(1);
}
return(0);
};
BoardManager.getRingMatches = function (jewel) {
var color_id = jewel.getColor();
var matchArray = new Array();
var ring = jewel.ring;
var column = jewel.column;
while (true) {
column = columnAdd(column, 1);
var match = this.getJewel(ring, column);
if (match.mode != J_RESTING) {
break;
}
if (match.getColor() == jewel.getColor()) {
matchArray.push(match);
} else {
break;
}
}
var ring = jewel.ring;
var column = jewel.column;
while (true) {
column = columnAdd(column, -1);
var match = this.getJewel(ring, column);
if (match.mode != J_RESTING) {
break;
}
if (match.getColor() == jewel.getColor()) {
matchArray.push(match);
} else {
break;
}
}
if (matchArray.length < 2) {
return(new Array());
}
return(matchArray);
};
BoardManager.getColumnMatches = function (jewel) {
var color_id = jewel.getColor();
var matchArray = new Array();
var ring = jewel.ring;
var column = jewel.column;
while (true) {
ring++;
if (ring >= NUM_RINGS) {
break;
}
var match = this.getJewel(ring, column);
if (match.mode != J_RESTING) {
break;
}
if (match.getColor() == jewel.getColor()) {
matchArray.push(match);
} else {
break;
}
}
var ring = jewel.ring;
var column = jewel.column;
while (true) {
ring--;
if (ring < 0) {
break;
}
var match = this.getJewel(ring, column);
if (match.mode != J_RESTING) {
break;
}
if (match.getColor() == jewel.getColor()) {
matchArray.push(match);
} else {
break;
}
}
if (matchArray.length < 2) {
return(new Array());
}
return(matchArray);
};
BoardManager.move = function (jewel, ring, column) {
var temp = new Array();
if ((jewel.ring != ring) && (jewel.column == column)) {
var inc = (ring - jewel.ring);
var i = 0;
while (i < NUM_RINGS) {
var jewelInCol = this.getJewel(i, column);
jewelInCol.ring = ringAdd(i, inc);
temp.push(jewelInCol);
i++;
}
} else if ((jewel.column != column) && (jewel.ring == ring)) {
var inc = (column - jewel.column);
var i = 0;
while (i < NUM_COLUMNS) {
var jewelInRing = this.getJewel(ring, i);
jewelInRing.column = columnAdd(i, inc);
temp.push(jewelInRing);
i++;
}
} else {
debug("illegal move", D_ERROR, "BoardManager.move()", {jewel:jewel, ring:ring, column:column});
}
while (temp.length > 0) {
var t = temp.pop();
this.matchTaint(t);
this.setJewel(t);
}
this.reset();
this.markIfMatch(jewel);
this.disableButtons();
};
BoardManager.shiftRing = function (ring, delta) {
var col = 0;
while (col < 18) {
var jewel = this.getJewel(ring, col);
var rest_angle = columnAngle(jewel.column);
jewel.angle = rest_angle + delta;
col++;
}
};
BoardManager.shiftColumn = function (col, ratio_delta) {
var ring = 0;
while (ring < NUM_RINGS) {
var jewel = this.getJewel(ring, col);
jewel.radius = radiusFromRatio(ratio_delta, jewel.ring);
ring++;
}
var outer = this.getOuterGhost(col);
outer.radius = radiusFromRatio(ratio_delta, outer.ring);
var inner = this.getInnerGhost(col);
inner.radius = radiusFromRatio(ratio_delta, inner.ring);
};
BoardManager.getOuterGhost = function (col) {
if (this.outerGhost == null) {
this.outerGhost = JewelManager.createGhost();
}
this.outerGhost._visible = true;
this.outerGhost.column = col;
this.outerGhost.ring = NUM_RINGS;
var ghostOf = this.getJewel(0, col);
var color_id = ghostOf.getColor();
this.outerGhost.setColor(color_id);
this.outerGhost.reset();
return(this.outerGhost);
};
BoardManager.getInnerGhost = function (col) {
if (this.innerGhost == null) {
this.innerGhost = JewelManager.createGhost();
}
this.innerGhost._visible = true;
this.innerGhost.column = col;
this.innerGhost.ring = -1;
var ghostOf = this.getJewel(NUM_RINGS - 1, col);
var color_id = ghostOf.getColor();
this.innerGhost.setColor(color_id);
this.innerGhost.reset();
return(this.innerGhost);
};
BoardManager.clearGhosts = function () {
debug("clearing ghosts", D_GHOST, "BoardManager.clearGhosts");
this.innerGhost.reset();
this.outerGhost.reset();
};
Frame 6
_global.MoveManager = new Object();
MoveManager.init = function () {
this.mode = M_OFF;
this.jewel = null;
this.x_mouse_offset = 0;
this.y_mouse_offset = 0;
};
MoveManager.switchMode = function (mode, jewel) {
switch (mode) {
case M_OFF :
break;
case M_SELECT :
this.jewel.setSelected(true);
break;
case M_CALCULATE :
if (jewel == null) {
jewel = this.jewel;
} else {
this.setJewel(jewel);
}
assertNotNull({jewel:jewel}, "MoveManager.switchMode");
break;
case M_COLUMN :
break;
case M_RING :
break;
default :
debug("unknown mode", D_ERROR, "MoveManager.switchMode", {mode:mode});
return(undefined);
}
this.mode = mode;
};
MoveManager.setJewel = function (jewel) {
if (this.jewel) {
this.jewel.setSelected(false);
}
this.jewel = jewel;
};
MoveManager.doClick = function (jewel) {
assertNotNull({jewel:jewel}, "MoveManager.doClick");
jewel.playClick();
this.x_mouse_offset = jewel._x - JewelMC._xmouse;
this.y_mouse_offset = jewel._y - JewelMC._ymouse;
switch (this.mode) {
case M_OFF :
this.switchMode(M_CALCULATE, jewel);
return;
case M_SELECT :
if (this.isAdjacent(jewel.ring, jewel.column)) {
this.doMove(jewel.ring, jewel.column);
this.switchMode(M_OFF);
} else if (this.jewel == jewel) {
this.switchMode(M_OFF);
} else {
this.switchMode(M_CALCULATE, jewel);
}
return;
case M_CALCULATE :
debug("doClick during M_CALCULATE", D_ERROR);
return;
case M_RING :
debug("doClick during M_RING", D_ERROR);
return;
case M_COLUMN :
debug("doClick during M_COLUMN", D_ERROR);
return;
default :
debug("unkown mode", D_ERROR, "MoveManager.doClick", {mode:this.mode});
}
};
MoveManager.doMouseMove = function () {
switch (this.mode) {
case M_OFF :
return;
case M_SELECT :
return;
case M_CALCULATE :
this.calculate();
return;
case M_COLUMN :
this.shiftColumn();
return;
case M_RING :
this.shiftRing();
return;
default :
debug("unkown mode", D_ERROR, "MoveManager.doMouseMove", {mode:this.mode});
}
};
MoveManager.doMouseUp = function () {
switch (this.mode) {
case M_OFF :
return;
case M_SELECT :
return;
case M_CALCULATE :
this.switchMode(M_OFF);
return;
case M_COLUMN :
if (!this.moveTest()) {
AnimationManager.addTween(new DistanceTween(this, "columnRatio", SNAPBACK_RATE_COLUMN, 0));
}
this.switchMode(M_OFF);
return;
case M_RING :
if (!this.moveTest()) {
AnimationManager.addTween(new DistanceTween(this, "ringDelta", SNAPBACK_RATE_RING, 0));
}
this.switchMode(M_OFF);
return;
default :
debug("unkown mode", D_ERROR, "MoveManager.doMouseUp", {mode:this.mode});
}
};
MoveManager.sndIllegalMove = new Sound();
MoveManager.sndIllegalMove.attachSound("sIllegalMove");
MoveManager.doMove = function (ring, column) {
assertNotNull({jewel:this.jewel, ring:ring, column:column}, "MoveManager.doMove");
if (BoardManager.isMatch(this.jewel, ring, column)) {
BoardManager.move(this.jewel, ring, column);
return(true);
}
this.sndIllegalMove.start();
debug("not a valid move", D_NOTIFY, "MoveManager.doMove");
return(false);
};
MoveManager.isAdjacent = function (ring, column) {
var jewel = this.jewel;
var c_up = columnAdd(jewel.column, 1);
var c_down = columnAdd(jewel.column, -1);
var r_up = (jewel.ring + 1);
var r_down = (jewel.ring - 1);
if (((((ring == r_up) && (column == jewel.column)) || ((ring == r_down) && (column == jewel.column))) || ((ring == jewel.ring) && (column == c_up))) || ((ring == jewel.ring) && (column == c_down))) {
return(true);
}
return(false);
};
MoveManager.getXMouse = function () {
return(JewelMC._xmouse + this.x_mouse_offset);
};
MoveManager.getYMouse = function () {
return(JewelMC._ymouse + this.y_mouse_offset);
};
MoveManager.shiftRing = function () {
var jewel = this.jewel;
var x = this.getXMouse();
var y = this.getYMouse();
var angle = Math.atan2(y, x);
var rest_angle = columnAngle(jewel.column);
var angle_delta = angleDelta(angle, rest_angle);
var threshold = columnAngle(1);
if (angle_delta > threshold) {
BoardManager.shiftRing(jewel.ring, threshold);
} else if (angle_delta < (-1 * threshold)) {
BoardManager.shiftRing(jewel.ring, -1 * threshold);
} else if (Math.abs(angle_delta) < 0.05) {
BoardManager.shiftRing(jewel.ring, 0);
this.switchMode(M_CALCULATE);
} else {
BoardManager.shiftRing(jewel.ring, angle_delta);
}
};
MoveManager.setRingDelta = function (delta) {
BoardManager.shiftRing(this.jewel.ring, delta);
};
MoveManager.getRingDelta = function () {
var angle = this.jewel.angle;
var rest_angle = columnAngle(this.jewel.column);
return(angleDelta(angle, rest_angle));
};
MoveManager.addProperty("ringDelta", MoveManager.getRingDelta, MoveManager.setRingDelta);
MoveManager.shiftColumn = function () {
var jewel = this.jewel;
var x1 = this.getXMouse();
var y1 = this.getYMouse();
var x2 = this.jewel._x;
var y2 = this.jewel._y;
var angle = (Math.atan2(y1, x1) - Math.atan2(y2, x2));
var hypotenuse = Math.sqrt((x1 * x1) + (y1 * y1));
var radius = (hypotenuse * Math.cos(angle));
var radius_delta = (radius - ringRadius(jewel.ring));
var next_up = ringRadius(jewel.ring + 1);
var next_down = ringRadius(jewel.ring - 1);
if ((radius >= next_up) && (next_up != 0)) {
BoardManager.shiftColumn(jewel.column, 1);
} else if ((radius <= next_down) && (next_down != 0)) {
BoardManager.shiftColumn(jewel.column, -1);
} else if (Math.abs(radius_delta) < 2) {
BoardManager.shiftColumn(jewel.column, 0);
this.switchMode(M_CALCULATE);
} else if (radius_delta > 0) {
var up = (ringRadius(jewel.ring + 1) - ringRadius(jewel.ring));
var delta_ratio = (radius_delta / up);
BoardManager.shiftColumn(jewel.column, delta_ratio);
} else if (radius_delta < 0) {
var down = (ringRadius(jewel.ring) - ringRadius(jewel.ring - 1));
var delta_ratio = (radius_delta / down);
BoardManager.shiftColumn(jewel.column, delta_ratio);
}
};
MoveManager.setColumnRatio = function (ratio) {
BoardManager.shiftColumn(this.jewel.column, ratio);
};
MoveManager.getColumnRatio = function () {
var jewel = this.jewel;
var radius_delta = (jewel.radius - ringRadius(jewel.ring));
if (radius_delta > 0) {
var up = (ringRadius(jewel.ring + 1) - ringRadius(jewel.ring));
var delta_ratio = (radius_delta / up);
return(delta_ratio);
}
if (radius_delta < 0) {
var down = (ringRadius(jewel.ring) - ringRadius(jewel.ring - 1));
var delta_ratio = (radius_delta / down);
return(delta_ratio);
}
return(0);
};
MoveManager.addProperty("columnRatio", MoveManager.getColumnRatio, MoveManager.setColumnRatio);
MoveManager.moveTest = function () {
var jewel = this.jewel;
var pos_angle = columnAngle(jewel.column + 1);
var neg_angle = columnAngle(jewel.column - 1);
var pos_test = angleDelta(jewel.angle, pos_angle);
var neg_test = angleDelta(jewel.angle, neg_angle);
var up_radius = ringRadius(jewel.ring + 1);
var down_radius = ringRadius(jewel.ring - 1);
var up_test = Math.abs(jewel.radius - up_radius);
var down_test = Math.abs(jewel.radius - down_radius);
if (Math.abs(pos_test) < 0.1) {
return(this.doMove(jewel.ring, jewel.column + 1));
}
if (Math.abs(neg_test) < 0.05) {
return(this.doMove(jewel.ring, jewel.column - 1));
}
if (up_test < 4) {
return(this.doMove(jewel.ring + 1, jewel.column));
}
if (down_test < 4) {
return(this.doMove(jewel.ring - 1, jewel.column));
}
return(false);
};
MoveManager.calculate = function () {
var jewel = this.jewel;
var x_m = this.getXMouse();
var y_m = this.getYMouse();
var x_j = jewel._x;
var y_j = jewel._y;
var c_sqr = ((x_m * x_m) + (y_m * y_m));
var a_sqr = ((x_j * x_j) + (y_j * y_j));
var b_sqr = (Math.pow(x_m - x_j, 2) + Math.pow(y_m - y_j, 2));
var a = Math.sqrt(a_sqr);
var b = Math.sqrt(b_sqr);
if (b < (jewel._width / 5)) {
return(false);
}
var cosine_c = (((c_sqr - a_sqr) - b_sqr) / ((2 * a) * b));
var angle_c = Math.acos(cosine_c);
var threshold_degrees = (Math.PI/4);
var upper_threshold = 2.35619449019234;
if ((angle_c < threshold_degrees) || (angle_c > upper_threshold)) {
this.switchMode(M_COLUMN);
} else {
this.switchMode(M_RING);
}
return(true);
};
Frame 7
_global.EventManager = new Object();
EventManager.init = function () {
this.isOn = true;
this.isInGameTransition = false;
Mouse.addListener(this);
Stage.addListener(this);
};
EventManager.turnOn = function () {
this.isOn = true;
};
EventManager.turnOff = function () {
this.isOn = false;
};
EventManager.sendEvent = function (event) {
switch (event) {
case E_ComboEnd :
debug("E_ComboEnd", D_NOTIFY, "EventMangager");
ScoreManager.onEndCombo();
GameManager.onEndCombo();
return;
case E_GameOver :
GameManager.onGameOver();
return;
case E_LevelUp :
GameManager.onLevelUp();
return;
default :
debug("unknown event", D_ERROR, "EventManager.sendEvent", {event:event});
}
};
EventManager.onEnterFrame = function () {
if (!this.isInGameTransition) {
PearlManager.onEnterFrame();
}
BoardManager.findMatches();
AnimationManager.tween();
JewelManager.draw();
};
EventManager.onMouseUp = function () {
MoveManager.doMouseUp();
};
EventManager.onMouseMove = function () {
MoveManager.doMouseMove();
};
Frame 8
function ScoreBit(mc) {
this.mc = mc;
}
_global.ScoreManager = new Object();
ScoreManager.init = function () {
this.totalScore = 0;
this.restart();
this.resetStageClips();
};
ScoreManager.getTotalScore = function () {
return(this.totalScore);
};
ScoreManager.resetStageClips = function () {
this.comboScoreField = _root.tComboScore;
this.stage = _root.iScoreLayer;
_root.iLeft.tScore = padString(this.totalScore, 9);
};
ScoreManager.restart = function () {
this.currentComboId = 1;
this.currentComboScore = 0;
this.currentMultiplier = 1;
this.curDepth = 0;
};
ScoreManager.onEndCombo = function () {
this.currentComboId++;
this.currentComboScore = 0;
this.currentMultiplier = 1;
};
ScoreManager.getComboId = function () {
return(this.currentComboId);
};
ScoreManager.getNextScoreValue = function (matchSize) {
var score;
var multi = this.currentMultiplier;
if (matchSize > 4) {
score = 100 * multi;
} else if (matchSize > 3) {
score = 50 * multi;
} else {
score = 25 * multi;
}
if (this.currentMultiplier < 5) {
this.currentMultiplier++;
}
return(score);
};
ScoreManager.addToScore = function (value) {
this.addPoints(value);
this.currentComboScore = this.currentComboScore + value;
this.comboScoreField.text = this.currentComboScore;
GemManager.onAddPoints(value);
};
ScoreManager.addPoints = function (value) {
this.totalScore = this.totalScore + value;
_root.iLeft.tScore = padString(this.totalScore, 9);
var best = Player.getBestScore();
if (this.totalScore > best) {
Player.setBestScore(this.totalScore);
_root.iLeft.tBestScore = padString(this.totalScore, 9);
}
};
ScoreManager.createScoreBit = function (value, x, y) {
var scoreBitName = ("iScoreBit_" + this.curDepth);
this.stage.createEmptyMovieClip(scoreBitName, this.curDepth);
var mc = this.stage[scoreBitName];
var scoreBit = new ScoreBit(mc);
scoreBit.id = this.curDepth;
scoreBit.init(value, x, y);
this.curDepth++;
};
ScoreManager.isOutstandingBits = function () {
if (this.outstandingBits) {
return(true);
}
return(false);
};
ScoreBit.prototype.setScore = function (value) {
this.score = value;
var valueStr = String(value);
var i = 0;
while (i < valueStr.length) {
var c = valueStr.charAt(i);
var lib_name = ("l_score_" + c);
var mc_name = ("digit_" + i);
this.mc.attachMovie(lib_name, mc_name, i);
var digit = this.mc[mc_name];
digit._x = (i * SCORE_SPACING) - (((valueStr.length - 1) * SCORE_SPACING) / 2);
i++;
}
ScoreManager.outstandingBits++;
};
ScoreBit.prototype.init = function (value, x, y) {
this.mc._x = x;
this.mc._y = y;
this.setScore(value);
this.hack = 100;
var tween0 = new TimedTween(this, "hack", 15, 0, this.callback);
var tween1 = new TimedTween(this.mc, "_x", 15, 0);
var tween2 = new TimedTween(this.mc, "_y", 15, 0);
var tween3 = new TimedTween(this.mc, "_xscale", 15, 0);
var tween4 = new TimedTween(this.mc, "_yscale", 15, 0);
AnimationManager.addTween(tween0, 25);
AnimationManager.addTween(tween1, 25);
AnimationManager.addTween(tween2, 25);
AnimationManager.addTween(tween3, 25);
AnimationManager.addTween(tween4, 25);
};
ScoreBit.prototype.callback = function () {
ScoreManager.addToScore(this.object.score);
this.object.mc.removeMovieClip();
ScoreManager.outstandingBits--;
};
Frame 9
_global.PearlManager = new Object();
PearlManager.init = function () {
this.resetStageClips();
this.reset();
};
PearlManager.reset = function () {
this.isDisabled = true;
this.pointsTillAdvance = 0;
this.timeTillRetreat = PEARL_DOWN_RATE + PEARL_DELAY;
this.mc.gotoAndStop(this.mc._totalframes);
this.isBlinkOn = false;
this.timeSinceBlink = PEARL_BLINK_RATE;
};
PearlManager.restart = function () {
this.reset();
this.isDisabled = false;
this.lastTime = getTimer();
this.isAlertSoundPlaying = false;
this.isCountOff = false;
};
PearlManager.onResumeGame = function () {
this.lastTime = getTimer();
};
PearlManager.onPauseGame = function () {
this.sndTimerAlert.stop("sTimerAlert");
this.isAlertSoundPlaying = false;
};
PearlManager.resetStageClips = function () {
this.mc = _root.iGameBoard.iPearls;
};
PearlManager.retreat = function () {
var next_frame = (this.mc._currentframe - 1);
if (next_frame <= 1) {
if ((BoardManager.movingFlags.isZero() && (BoardManager.matchedFlags.isZero())) && (!ScoreManager.isOutstandingBits())) {
this.sndTimerAlert.stop("sTimerAlert");
this.isAlertSoundPlaying = false;
EventManager.sendEvent(E_GameOver);
} else {
return(undefined);
}
}
this.mc.gotoAndStop(next_frame);
if (this.isBlinkOn) {
this.blinkOn();
} else if (this.mc._currentframe <= (PEARL_BLINK_POINT + 1)) {
this.blinkOff();
}
};
PearlManager.advance = function () {
var next_frame = (this.mc._currentframe + 1);
if (next_frame >= this.mc._totalframes) {
EventManager.sendEvent(E_LevelUp);
}
this.mc.gotoAndStop(next_frame);
};
PearlManager.onAddPoints = function (pointValue) {
this.pointsTillAdvance = this.pointsTillAdvance + pointValue;
while (this.pointsTillAdvance >= PEARL_POINTS_NEEDED) {
this.advance();
this.pointsTillAdvance = this.pointsTillAdvance - PEARL_POINTS_NEEDED;
}
};
PearlManager.onEnterFrame = function () {
if (this.isDisabled) {
return(undefined);
}
var thisTime = getTimer();
var elapsed = (thisTime - this.lastTime);
this.lastTime = thisTime;
this.timeTillRetreat = this.timeTillRetreat - elapsed;
if (this.timeTillRetreat <= 0) {
this.timeTillRetreat = this.timeTillRetreat + PEARL_DOWN_RATE;
this.retreat();
}
if (this.mc._currentframe <= (PEARL_BLINK_POINT + 1)) {
this.doBlink(elapsed);
if ((!this.isAlertSoundPlaying) && (!GameManager.isGameOver)) {
this.isAlertSoundPlaying = true;
this.sndTimerAlert.start();
}
}
};
PearlManager.sndTimerAlert = new Sound();
PearlManager.sndTimerAlert.attachSound("sTimerAlert");
PearlManager.sndTimerAlert.onSoundComplete = function () {
this.start();
};
PearlManager.doBlink = function (elapsed) {
this.timeSinceBlink = this.timeSinceBlink + elapsed;
if (this.timeSinceBlink > PEARL_BLINK_RATE) {
if (this.isBlinkOn) {
this.blinkOff();
this.isBlinkOn = false;
} else {
this.blinkOn();
this.isBlinkOn = true;
}
this.timeSinceBlink = this.timeSinceBlink % PEARL_BLINK_RATE;
}
};
PearlManager.blinkOn = function () {
var trans = {ra:"100", rb:"255", ga:"62", gb:"0", ba:"64", bb:"0", aa:"100", ab:"0"};
for (var prop in this.mc) {
var pearl = this.mc[prop];
if (typeof(pearl) == "movieclip") {
if (!pearl.color) {
pearl.trans = new Color(pearl);
}
pearl.trans.setTransform(trans);
}
}
};
PearlManager.blinkOff = function () {
var trans = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
for (var prop in this.mc) {
var pearl = this.mc[prop];
var what_ypeof = typeof(pearl);
if (typeof(pearl) == "movieclip") {
if (!pearl.color) {
pearl.trans = new Color(pearl);
}
pearl.trans.setTransform(trans);
}
}
};
PearlManager.disable = function () {
this.sndTimerAlert.stop("sTimerAlert");
this.isDisabled = true;
};
PearlManager.getPearlsLeft = function () {
var this_frame = this.mc._currentframe;
var next_frame = (this_frame - 1);
if (((this.pearlsLeftFraction == undefined) || (this.pearlsLeftFraction > this_frame)) || (this.pearlsLeftFraction < next_frame)) {
this.pearlsLeftFraction = this_frame;
}
return(this.pearlsLeftFraction);
};
PearlManager.registerBonusField = function (mc) {
this.bonusFieldMc = mc;
this.totalBonus = 0;
};
PearlManager.sndCountOff = new Sound();
PearlManager.sndCountOff.attachSound("sPearlExplode");
PearlManager.setPearlsLeft = function (fraction) {
if (fraction < 1) {
this.isCountOff = false;
} else {
this.isCountOff = true;
}
var this_frame = this.mc._currentframe;
var next_frame = (this_frame - 1);
if (fraction <= next_frame) {
PearlManager.doCountOff();
PearlManager.sndCountOff.start();
ScoreManager.addPoints(PEARL_POINTS);
this.totalBonus = this.totalBonus + PEARL_POINTS;
this.bonusFieldMc.tBonus = padString(this.totalBonus, 3);
this.mc.gotoAndStop(next_frame);
}
this.pearlsLeftFraction = fraction;
};
PearlManager.addProperty("pearlsLeft", PearlManager.getPearlsLeft, PearlManager.setPearlsLeft);
Frame 10
_global.GemManager = new Object();
GemManager.init = function () {
this.resetStageClips();
this.reset();
};
GemManager.reset = function () {
this.pointsTillAdvance = 0;
this.mc.gotoAndStop(1);
this.resetStageClips();
};
GemManager.restart = function () {
this.reset();
};
GemManager.resetStageClips = function () {
this.mc = _root.iCenterGem;
this.rollover = this.mc.iRollover;
this.mc._visible = true;
this.rollover._visible = false;
debug("resetStageClips");
};
GemManager.onRollOver = function () {
this.rollover._visible = true;
};
GemManager.onRollOut = function () {
this.mc._xscale = 100;
this.mc._yscale = 100;
this.rollover._visible = false;
};
GemManager.sndBoomTinkle = new Sound();
GemManager.sndBoomTinkle.attachSound("sBoomTinkle");
GemManager.onPress = function () {
debug("onPress");
this.mc._xscale = 90;
this.mc._yscale = 90;
};
GemManager.onDragOut = function () {
this.mc._xscale = 100;
this.mc._yscale = 100;
};
GemManager.onRelease = function () {
debug("onRelease");
this.mc._xscale = 100;
this.mc._yscale = 100;
this.rollover._visible = false;
this.hack = 0;
var delay = RESERVE_DELAY;
var cost = RESERVE_COST;
while (cost > 0) {
AnimationManager.addTween(new TimedTween(this, "hack", 0, 0, this.retreatCallback), delay * cost);
cost--;
}
AnimationManager.addTween(new TimedTween(this, "hack", 0, 0, this.reserveCallback), 1);
};
GemManager.retreatCallback = function () {
this.object.retreat();
};
GemManager.reserveCallback = function () {
BoardManager.reserveJewels();
};
GemManager.sndPowerUp = new Sound();
GemManager.sndPowerUp.attachSound("sGemPowerUp");
GemManager.advance = function () {
var next_frame = (this.mc._currentframe + 1);
if (next_frame >= GEM_TOTAL_STEPS) {
EventManager.sendEvent(E_LevelUp);
} else {
this.sndPowerUP.start();
this.mc.gotoAndStop(next_frame);
}
};
GemManager.retreat = function () {
var next_frame = (this.mc._currentframe - 1);
if (next_frame > 0) {
this.mc.gotoAndStop(next_frame);
}
};
GemManager.onAddPoints = function (pointValue) {
this.pointsTillAdvance = this.pointsTillAdvance + pointValue;
var needed = GameManager.getPointsNeeded();
while (this.pointsTillAdvance >= needed) {
this.pointsTillAdvance = this.pointsTillAdvance - needed;
this.advance();
}
};
GemManager.playLevelUp = function () {
this.mc.gotoAndPlay("levelUp");
};
GemManager.playGameOver = function () {
this.mc.gotoAndPlay("timesUp");
};
GemManager.disableButton = function () {
this.mc.rollover.enabled = false;
};
GemManager.enableButton = function () {
this.mc.rollover.enabled = true;
};
Frame 11
_global.Player = new Object();
Player.getBestScore = function () {
if (this.bestScore == undefined) {
this.bestScore = 0;
}
return(this.bestScore);
};
Player.setBestScore = function (value) {
this.bestScore = Math.max(value, this.bestScore);
};
Player.setBestLevel = function (value) {
this.bestLevel = Math.max(value, this.bestLevel);
};
Player.getUsername = function () {
if (this.username == undefined) {
this.usernmae = "UNKOWN";
}
return(this.username);
};
Player.containsIllegal = function (str) {
if (str.indexOf("!") >= 0) {
debug((str + " contains ! -- ") + str.indexOf);
return(true);
}
return(false);
};
Player.setUsername = function (value) {
if (this.containsIllegal(value)) {
debug("illegal characters");
return(false);
}
if (value eq "") {
debug("empty");
return(false);
}
this.username = value;
return(true);
};
Player.getAccolade = function () {
if (this.accolade == undefined) {
this.accolade = 0;
}
return(this.accolade);
};
Player.setAccolade = function (value) {
this.accolade = Math.max(value, this.accolade);
};
Player.isInLineage = function () {
if (this.isInLineage == undefined) {
this.inLineage = false;
}
return(this.inLineage);
};
Player.setInLineage = function (bool) {
this.inLineage = bool;
if (bool && (this.meInLineage == undefined)) {
var me = new Object();
me.name = this.username;
me.accolade = this.getAccolade();
me.topscore = this.getBestScore();
if (this.lineage == undefined) {
this.lineage = new Array();
}
this.lineage.unshift(me);
this.meInLineage = me;
}
};
Player.onLoad = function () {
if (_root.qid) {
this.QueenId = _root.qid;
}
if (_root.lid) {
this.setInLineage(true);
this.LineageId = _root.lid;
}
if (_root.qn != undefined) {
this.setUsername(_root.qn);
} else {
debug("didn't get username: " + _root.qn);
}
if (_root.ac) {
this.setAccolade(_root.ac);
}
if (_root.ts) {
this.setBestScore(_root.ts);
}
if (_root.ldata != undefined) {
this.setLineageData(_root.ldata);
}
};
Player.setLineageData = function (ldata) {
var temp = ldata.split("!");
this.lineage = new Array();
var i = 0;
while (i < temp.length) {
var queen = new Object();
queen.name = temp[i];
if (queen.name == "") {
} else {
queen.accolade = temp[i + 1];
queen.topscore = temp[i + 2];
this.lineage.push(queen);
}
i = i + 3;
}
var me = new Object();
me.name = this.username;
me.accolade = this.getAccolade();
me.topscore = this.getBestScore();
this.lineage.unshift(me);
this.meInLineage = me;
};
Player.getLineageData = function () {
this.meInLineage.name = this.username;
this.meInLineage.accolade = this.getAccolade();
this.meInLineage.topscore = this.getBestScore();
var sameNameCount = 0;
var i = 0;
while (i < this.lineage.length) {
var queen = this.lineage[i];
if (queen != this.meInLineage) {
if (this.isSameName(queen.name)) {
sameNameCount++;
}
}
i++;
}
if (sameNameCount > 0) {
this.meInLineage.name = (this.username + " ") + this.toRoman(sameNameCount + 1);
}
this.lineage.sort(this.lineageSort);
return(this.lineage);
};
Player.toRoman = function (arabic_num) {
switch (arabic_num) {
case 1 :
return("I");
case 2 :
return("II");
case 3 :
return("III");
case 4 :
return("IV");
case 5 :
return("V");
case 6 :
return("VI");
case 7 :
return("VII");
case 8 :
return("VIII");
case 9 :
return("IX");
case 10 :
return("X");
case 11 :
return("XI");
case 12 :
return("XII");
case 13 :
return("XIII");
case 14 :
return("XIV");
case 15 :
return("XV");
case 16 :
return("XVI");
case 17 :
return("XVII");
case 18 :
return("XVIII");
case 19 :
return("XIX");
case 20 :
return("XX");
case 21 :
return("XXI");
case 22 :
return("XXII");
case 23 :
return("XXIII");
case 24 :
return("XXIV");
case 25 :
return("XXV");
case 26 :
return("XXVI");
case 27 :
return("XXVII");
case 28 :
return("XXVIII");
case 29 :
return("XXIX");
case 30 :
return("XXX");
}
return("");
};
Player.isSameName = function (name2) {
var name1 = this.username.toUpperCase();
var name2 = name2.toUpperCase();
var i = 0;
while (i < name1.length) {
if (name1.charAt(i) != name2.charAt(i)) {
return(false);
}
i++;
}
if (name2.length == i) {
return(true);
}
if (name2.charAt(i) != " ") {
return(false);
}
i++;
while (i < name2.length) {
if (((name2.charAt(i) != "I") && (name2.charAt(i) != "V")) && (name2.charAt(i) != "X")) {
return(false);
}
i++;
}
return(true);
};
Player.lineageSort = function (a, b) {
if (int(a.topscore) > int(b.topscore)) {
return(-1);
}
if (int(b.topscore) > int(a.topscore)) {
return(1);
}
return(0);
};
Player.setFullTitleTextField = function (txtField) {
var uname = this.getUsername();
var accolade = this.getAccolade();
var t_text = ("Queen " + uname);
if (accolade > 0) {
t_text = t_text + (" " + ACCOLADES[accolade]);
}
txtField.text = t_text;
var tfWhite = new TextFormat();
var tfYellow = new TextFormat();
tfWhite.color = 16777215 /* 0xFFFFFF */;
tfYellow.color = 268435353 /* 0xFFFFF99 */;
txtField.setTextFormat(0, 5, tfYellow);
var len = uname.length;
var text_total = txtField.length;
txtField.setTextFormat(6, len + 5, tfWhite);
txtField.setTextFormat(len + 6, text_total, tfYellow);
};
Player.validateEmail = function (email) {
if (email.indexOf(" ") >= 0) {
return(false);
}
if (email.indexOf(newline) >= 0) {
return(false);
}
if (email.indexOf("\t") >= 0) {
return(false);
}
if (email.indexOf("\r") >= 0) {
return(false);
}
if (email.indexOf("@") < 0) {
return(false);
}
if (email.indexOf(".") < 0) {
return(false);
}
if (email.indexOf(",") >= 0) {
return(false);
}
if (email.indexOf(";") >= 0) {
return(false);
}
return(true);
};
Player.submitEmail = function (callingMc, friendEmail, senderEmail, type) {
var isEmailFail = false;
if (!this.validateEmail(senderEmail)) {
callingMc.iSenderDialog.gotoAndStop(2);
isEmailFail = true;
} else {
callingMc.iSenderDialog.gotoAndStop(1);
}
if ((type != 2) && (!this.validateEmail(friendEmail))) {
callingMc.iRecieverDialog.gotoAndStop(2);
isEmailFail = true;
} else {
callingMc.iRecieverDialog.gotoAndStop(1);
}
if (isEmailFail) {
return(undefined);
}
this.iboard = callingMc;
this.iboard.gotoAndStop("sending");
this.netSender.s_email = senderEmail;
this.netSender.r_email = friendEmail;
this.netSender.q_id = this.QueenId;
this.netSender.l_id = this.LineageId;
this.netSender.q_name = this.username;
this.netSender.accolade = this.accolade;
this.netSender.t_score = this.bestScore;
this.netSender.t_level = this.bestLevel;
this.netsender.s_type = type;
debug("sent...");
this.netSender.sendAndLoad(SAVESEND_URL, this.netReciever, "GET");
};
Player.onNetCallback = function () {
if ((this.netReciever.success == undefined) || (this.netReciever.success == 0)) {
this.iboard.gotoAndPlay("error");
} else if ((this.netReciever.suffix != "") && (this.netReciever.suffix != "I")) {
this.username = (this.username + " ") + this.netReciever.suffix;
this.iboard.tUsername = this.username;
this.iboard.gotoAndPlay("end2B");
_root.iLeft.iScrollBox.gotoAndPlay("reset");
} else if (this.netSender.s_type == 2) {
this.iboard.gotoAndPlay("thanks");
} else {
this.iboard.gotoAndPlay("end2A");
}
this.QueenId = this.netReciever.qid;
this.LineageId = this.netReciever.lid;
this.setInLineage(true);
};
Player.netSender = new LoadVars();
Player.netReciever = new LoadVars();
Player.netReciever.onLoad = function (successCode) {
debug("netObj.onLoad: " + successCode);
debug(this.toString());
Player.onNetCallback();
};
Frame 12
_global.GameManager = new Object();
GameManager.init = function () {
this.level = 1;
AnimationManager.init();
JewelManager.init();
BoardManager.init();
MoveManager.init();
EventManager.init();
ScoreManager.init();
PearlManager.init();
EventManager.turnOff();
this.isGameOn = false;
this.isGameOver = false;
this.isGameRestart = false;
};
GameManager.soundOff = function () {
SoundMgr.turnOff();
};
GameManager.soundOn = function () {
SoundMgr.turnOn();
};
GameManager.prepBoard = function () {
BoardManager.fillBoard();
BoardManager.replaceMatches();
};
GameManager.startLevel = function () {
PearlManager.restart();
ScoreManager.restart();
GemManager.restart();
EventManager.turnOn();
var tween = new TimedTween(null, null, 0, 0, this.animateBoardInCallback);
AnimationManager.addTween(tween, 5);
this.isLevelTransition = false;
this.isGameOn = true;
this.isGameOver = false;
};
GameManager.animateBoardInCallback = function () {
debug("animate board callback");
BoardManager.animateBoardIn();
};
GameManager.advanceLevel = function () {
this.level++;
var accolade = GameManager.getLevelAccolade();
Player.setAccolade(accolade);
};
GameManager.clearBoard = function () {
BoardManager.restart();
JewelManager.restart();
ScoreManager.restart();
GemManager.restart();
PearlManager.restart();
};
GameManager.resetStageClips = function () {
_root.iGameBoard.gotoAndStop(this.getLevelColor());
PearlManager.resetStageClips();
ScoreManager.resetStageClips();
GemManager.resetStageClips();
_root.iLeft.gotoAndStop("normal");
_root.iLeft.tBestScore = padString(Player.getBestScore(), 9);
_root.iLeft.tLevel = padString(this.level, 2);
_root.iLeft.tUserName = Player.getUsername();
var accolade = Player.getAccolade();
_root.iLeft.iAccolade.gotoAndStop(accolade + 1);
};
GameManager.onGameOver = function () {
if (this.isGameOn) {
this.isGameOn = false;
this.isGameOver = true;
debug("*******GAME OVER********");
BoardManager.disableButtons();
MoveManager.switchMode(M_OFF);
this.hack = 0;
var tween = new TimedTween(this, "hack", 0, 0, this.gameOverCallback);
AnimationManager.addTween(tween, 100);
var ring0 = new Object();
ring0.ring = 0;
ring0.hack = 0;
var ring0_tween = new TimedTween(ring0, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring0_tween, 32);
var ring1 = new Object();
ring1.ring = 1;
ring1.hack = 0;
var ring1_tween = new TimedTween(ring1, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring1_tween, 34);
var ring2 = new Object();
ring2.ring = 2;
ring2.hack = 0;
var ring2_tween = new TimedTween(ring2, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring2_tween, 36);
var ring3 = new Object();
ring3.ring = 3;
ring3.hack = 0;
var ring3_tween = new TimedTween(ring3, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring3_tween, 38);
BoardManager.reset();
PearlManager.disable();
GemManager.playGameOver();
}
};
GameManager.onLevelUp = function () {
if (this.isGameOn) {
this.isGameOn = false;
this.isGameOver = false;
debug("*******LEVEL UP********");
BoardManager.disableButtons();
MoveManager.switchMode(M_OFF);
BoardManager.reset();
Pearlmanager.sndTimerAlert.stop("sTimerAlert");
var pearl_tween = new DistanceTween(PearlManager, "pearlsLeft", 1 / COUNTOFF_RATE_PEARLS, 1);
AnimationManager.addTween(pearl_tween, 24);
this.hack = 0;
var tween = new TimedTween(this, "hack", 0, 0, this.levelUpCallback);
var delay = ((PearlManager.getPearlsLeft() * COUNTOFF_RATE_PEARLS) + 40);
AnimationManager.addTween(tween, delay);
var ring0 = new Object();
ring0.ring = 0;
ring0.hack = 0;
var ring0_tween = new TimedTween(ring0, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring0_tween, 3);
var ring1 = new Object();
ring1.ring = 1;
ring1.hack = 0;
var ring1_tween = new TimedTween(ring1, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring1_tween, 4);
var ring2 = new Object();
ring2.ring = 2;
ring2.hack = 0;
var ring2_tween = new TimedTween(ring2, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring2_tween, 6);
var ring3 = new Object();
ring3.ring = 3;
ring3.hack = 0;
var ring3_tween = new TimedTween(ring3, "hack", 0, 0, this.explodeCallback);
AnimationManager.addTween(ring3_tween, 8);
PearlManager.disable();
GemManager.playLevelUp();
}
};
GameManager.levelUpCallback = function () {
Player.setBestScore(ScoreManager.getTotalScore());
GameManager.isLevelTransition = true;
_root.gotoAndPlay("levelUp");
};
GameManager.gameOverCallback = function () {
Player.setBestScore(ScoreManager.getTotalScore());
GameManager.isGameOver = true;
GameManager.isLevelTransition = true;
_root.gotoAndPlay("levelUp");
};
GameManager.explodeCallback = function () {
BoardManager.explodeRing(this.object.ring);
};
GameManager.onEndCombo = function () {
if (!this.isGameOn) {
BoardManager.disableButtons();
}
};
GameManager.pauseGame = function () {
if (this.isLevelTransition == false) {
EventManager.isOn = false;
BoardManager.onPauseGame();
PearlManager.onPauseGame();
_root.gotoAndPlay("pause");
}
};
GameManager.resumeGame = function () {
EventManager.isOn = true;
BoardManager.onResumeGame();
PearlManager.onResumeGame();
};
GameManager.onLevelDoorClose = function () {
if (this.isGameOver && (!this.isGameRestart)) {
_root.iLevelObject.gotoAndStop(2);
} else {
_root.iLevelObject.tLevelText_1 = "Level " + (this.level + 1);
_root.iLevelObject.tLevelText_2 = "Level " + (this.level + 1);
}
};
GameManager.getLevelAccolade = function () {
var level = this.level;
if (level < 1) {
return(0);
}
if (level <= 3) {
return(1);
}
if (level <= 6) {
return(2);
}
if (level <= 10) {
return(3);
}
if (level <= 14) {
return(4);
}
return(5);
};
GameManager.getLevelColor = function () {
var level_color = 0;
var level = this.level;
if (level == 1) {
level_color = 0;
} else if (level <= 3) {
level_color = 1;
} else if (level <= 6) {
level_color = 2;
} else if (level <= 10) {
level_color = 3;
} else if (level <= 15) {
level_color = 4;
} else {
level_color = (level - 16) % 3;
}
return(LEVEL_COLORS[level_color]);
};
GameManager.getPointsNeeded = function () {
switch (this.level) {
case 1 :
return(75);
case 2 :
return(100);
case 3 :
return(125);
case 4 :
return(135);
case 5 :
return(145);
case 6 :
return(170);
case 7 :
return(175);
case 8 :
return(180);
case 9 :
return(185);
case 10 :
return(200);
case 11 :
return(205);
case 12 :
return(210);
case 13 :
return(220);
case 14 :
return(250);
}
return(250);
};
GameManager.resetLineageStage = function () {
_root.iCenterGem._visible = false;
_root.iGameBoard.tLevel = padString(this.level, 2);
_root.iGameBoard.tScore = padString(ScoreManager.getTotalScore(), 9);
};
GameManager.onPlayAgain = function () {
this.isGameRestart = true;
this.level = 0;
_root.gotoAndPlay("levelUp");
};
GameManager.onLoad = function () {
debug("type = " + _root.type);
if (_root.type) {
this.gameType = _root.type;
} else {
this.gameType = 0;
}
};
GameManager.showHelp = function () {
if ((this.isGameOn == true) && (this.isGameOver == false)) {
this.pauseGame();
JewelMC._visible = false;
GemManager.mc._visible = false;
this.isHelpOn = true;
_root.gotoAndPlay("instructions");
_root.stopAllSounds();
}
};
GameManager.resumeFromHelp = function () {
this.resumeGame();
this.isHelpOn = false;
_root.gotoAndStop("game");
JewelMC._visible = true;
GemManager.mc._visible = true;
};
Frame 13
GameManager.onLoad();
Player.onLoad();
SoundMgr.init();
Frame 15
stop();
iLoadingMovie.gotoAndPlay("transition");
Frame 20
stop();
Frame 21
GameManager.init();
GameManager.prepBoard();
Frame 42
ScoreManager.totalScore = 0;
GameManager.resetStageClips();
Instance of Symbol 327 MovieClip "iCenterGem" in Frame 42
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 364 MovieClip "iInstructions" in Frame 42
onClipEvent (load) {
if ((GameManager.gameType == 2) && (!GameManager.isHelpOn)) {
this._visible = false;
}
}
Frame 81
if ((GameManager.gameType != 2) || (GameManager.isHelpOn)) {
iInstructions.play();
stop();
}
Frame 83
iInstructions._visible = false;
iCenterGem._visible = true;
GameManager.resetStageClips();
GameManager.startLevel();
Instance of Symbol 376 MovieClip "iButtonControls" in Frame 83
onClipEvent (load) {
if (SoundMgr.isSoundOff()) {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Frame 87
stop();
Frame 93
GameManager.onLevelDoorClose();
Frame 148
if (!GameManager.isGameOver) {
GameManager.advanceLevel();
GameManager.resetStageClips();
GameManager.clearBoard();
GameManager.prepBoard();
} else if (GameManager.isGameRestart) {
GameManager.init();
ScoreManager.totalScore = 0;
GameManager.prepBoard();
GameManager.resetStageClips();
_root.iButtonControls._visible = true;
} else {
GameManager.clearBoard();
if (Player.isInLineage()) {
iGameBoard.gotoAndStop("end1B");
iLeft.gotoAndStop("lineage");
} else {
iGameBoard.gotoAndStop("end1A");
iLeft.gotoAndStop("normal");
}
GameManager.resetLineageStage();
_root.iButtonControls._visible = false;
}
Frame 206
if (GameManager.isGameOver) {
stop();
} else {
gotoAndPlay (83);
}
Frame 252
stop();
Frame 291
GameManager.resumeGame();
gotoAndPlay (87);
Symbol 39 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 42 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 45 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 48 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 51 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 54 Button
on (press) {
MoveManager.doClick(this);
}
on (rollOver) {
this.playRoll();
}
Symbol 57 MovieClip Frame 10
stop();
Symbol 58 MovieClip [Jewel] Frame 20
JewelManager.deleteJewel(this);
stop();
Symbol 62 MovieClip [lScoreBit] Frame 3
tScoreValue.text = this.score;
Symbol 62 MovieClip [lScoreBit] Frame 24
stop();
Symbol 67 MovieClip [externalFileHolder] Frame 1
stop();
Instance of Symbol 65 MovieClip "slot" in Symbol 67 MovieClip [externalFileHolder] Frame 1
onClipEvent (data) {
adbgColor = new Color(adbg);
adbgColor.setRGB(_parent._parent._parent.Ad_vars_Object._ad_bgcolor);
_parent.adbg._width = _parent._parent._parent.Ad_vars_Object._ad_width;
_parent.adbg._height = _parent._parent._parent.Ad_vars_Object._ad_height;
_parent.adbg._alpha = 100;
_parent.admask._width = _parent._parent._parent.Ad_vars_Object._ad_width;
_parent.admask._height = _parent._parent._parent.Ad_vars_Object._ad_height;
if (_parent._parent._parent.Ad_vars_Object._ad_params != null) {
ctString = new String(_parent._parent._parent.Ad_vars_Object._ad_params);
ctArray = ctString.split(",");
ctArray.shift();
clickTAG = _parent._parent._parent.Ad_vars_Object._adparam_clickTAG;
shifting_i = 2;
array_i = ctArray.length;
downshift_i = array_i + 2;
assign_i = 2;
while (assign_i < downshift_i) {
this["clickTAG" + assign_i] = eval ("_parent._parent._parent.Ad_vars_Object._adparam_" + ctArray.shift());
assign_i++;
}
}
_parent.referrer.isLoaded = true;
}
onClipEvent (mouseMove) {
if (_parent._parent._parent.Ad_vars_Object._ad_click_url != "") {
_parent.adbg.onRollOver = function () {
_parent.adbg.useHandCursor;
};
}
updateAfterEvent();
}
onClipEvent (mouseUp) {
if ((_parent.referrer.link != "") && (_parent.adbg.hitTest(_root._xmouse, _root._ymouse, false))) {
getURL (_parent.referrer.link, "_blank");
}
}
Instance of Symbol 66 MovieClip "timer" in Symbol 67 MovieClip [externalFileHolder] Frame 1
onClipEvent (enterFrame) {
if (referrer.active) {
referrer.Tick();
}
}
Symbol 75 MovieClip Frame 1
this.lastTime = getTimer();
this.segmentTotal = 0;
this.segmentFrames = 0;
this.tFPS.text = "init";
onEnterFrame = function () {
var thisTime = getTimer();
var elapsed = (thisTime - this.lastTime);
this.lastTime = thisTime;
this.segmentTotal = this.segmentTotal + elapsed;
this.segmentFrames++;
};
printAvg = function () {
var avg = ((this.segmentFrames / this.segmentTotal) * 1000);
this.tFPS.text = avg;
this.segmentTotal = 0;
this.segmentFrames = 0;
};
Symbol 75 MovieClip Frame 15
printAvg();
gotoAndPlay (2);
Symbol 85 MovieClip Frame 1
var percent_loaded = (_root.getBytesLoaded() / _root.getBytesTotal());
iLoadingBar.iMeter._xscale = percent_loaded * 100;
Symbol 85 MovieClip Frame 2
if (percent_loaded < 1) {
gotoAndPlay(_currentframe - 1);
} else {
gotoAndPlay (7);
}
Symbol 85 MovieClip Frame 12
stop();
Symbol 96 MovieClip Frame 1
stop();
Symbol 96 MovieClip Frame 2
stop();
Symbol 105 MovieClip Frame 17
stop();
Symbol 109 Button
on (release) {
if (Player.setUserName(tEnter)) {
_parent.gotoAndPlay("press");
} else {
iDialog.gotoAndStop(2);
}
}
on (keyPress "<Enter>") {
if (Player.setUserName(tEnter)) {
_parent.gotoAndPlay("press");
} else {
iDialog.gotoAndStop(2);
}
}
Symbol 113 Button
on (release) {
_parent.gotoAndPlay("press");
}
Symbol 117 MovieClip Frame 1
if (GameManager.gameType == 2) {
gotoAndStop (9);
}
Symbol 117 MovieClip Frame 8
stop();
Symbol 117 MovieClip Frame 9
tQueenName_1 = "Hello, Queen " + Player.getUsername();
tQueenName_2 = "Hello, Queen " + Player.getUsername();
Symbol 117 MovieClip Frame 14
stop();
Symbol 118 MovieClip Frame 10
stop();
Symbol 118 MovieClip Frame 49
_parent.play();
Symbol 119 MovieClip Frame 1
function aVO_onLoad(success) {
if (success) {
status = "loaded";
parse_ADBG();
} else {
die();
}
}
function die() {
_root.play();
killFAO();
}
function parse_ADBG() {
Ad_Vars_Object._ad_bgtranslate = new String(unescape(Ad_Vars_Object._ad_bgcolor));
Ad_Vars_Object._ad_bgstripped = Ad_Vars_Object._ad_bgtranslate.substr(1, Ad_Vars_Object._ad_bgtranslate.length);
Ad_Vars_Object._ad_bgcolor = "0x" + Ad_Vars_Object._ad_bgstripped;
}
function Flash_Ads_Object() {
this.timedScreenObject = new Object();
this.offScreenOffset = 1000;
this.curScreen = null;
}
function killFAO() {
delete myGameObject;
delete Ad_Vars_Object;
}
function Flash_Ads_Timer(screen, parent, endTime) {
this.screen = screen;
this.mc = screen.mc.timer;
this.parent = parent;
this.mc.referrer = this;
this.endTime = endTime * 1000;
this.active = false;
}
Ad_Vars_Object = new LoadVars();
Ad_Vars_Object.load(_root._ad_info);
Ad_Vars_Object.onLoad = aVO_onLoad;
Flash_Ads_Object.prototype.getBitrate = function () {
bittime1 = int(getTimer() / 1000);
b_loaded = _root.getBytesLoaded();
bittime = (getTimer() / 1000) - bittime1;
bps = b_loaded / bittime;
if (bps >= 2500) {
connectspeed = "fast";
} else {
connectspeed = "slow";
}
};
Flash_Ads_Object.prototype.Continue = function () {
if (this.curScreen != null) {
this.RemoveScreen(this.curScreen);
}
if (Ad_Vars_Object.adshown == true) {
_root.play();
killFAO();
} else {
this.curScreen = this.timedScreenObject;
this.ShowScreen(this.curScreen);
gotoAndStop (9);
}
};
Flash_Ads_Object.prototype.ExternalGraphicsAreLoaded = function () {
Ad_Vars_Object.adLoaded = true;
if (!this.timedScreenObject.isLoaded) {
Ad_Vars_Object.adLoaded = false;
}
return(Ad_Vars_Object.adLoaded);
};
Flash_Ads_Object.prototype.GetExternalParameters = function () {
if (connectspeed == "fast") {
this.timedScreenObject.path = Ad_Vars_Object._ad_url;
this.timedScreenObject.duration = Ad_Vars_Object._ad_duration;
this.timedScreenObject.link = Ad_Vars_Object._ad_click_url;
} else if (connectspeed == "slow") {
this.timedScreenObject.path = Ad_Vars_Object._ad_url;
this.timedScreenObject.duration = Ad_Vars_Object._ad_duration;
this.timedScreenObject.link = Ad_Vars_Object._ad_click_url;
}
};
Flash_Ads_Object.prototype.LoadExternalGraphic = function (screen, depth) {
empty.attachMovie("externalFileHolder", "holder" + depth, depth);
screen.mc = empty["holder" + depth];
screen.mc.referrer = screen;
screen.mc.slot.loadMovie(screen.path);
};
Flash_Ads_Object.prototype.MainMovieIsLoaded = function () {
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
return(true);
}
return(false);
};
Flash_Ads_Object.prototype.PreloadExternalGraphics = function () {
this.LoadExternalGraphic(this.timedScreenObject, 1);
this.timedScreenObject.mc._x = this.offScreenOffset;
};
Flash_Ads_Object.prototype.RemoveScreen = function (screen) {
screen.mc.slot.unloadMovie();
screen.mc.removeMovieClip();
delete screen;
};
Flash_Ads_Object.prototype.ShowScreen = function (screen) {
if (screen.mc._width > Stage.width) {
wscaledown = true;
} else {
wscaledown = false;
}
if (screen.mc._height > Stage.height) {
hscaledown = true;
} else {
hscaledown = false;
}
if ((wscaledown == true) && (hscaledown == false)) {
wscaledownpct = (Stage.width / screen.mc._width) * 100;
screen.mc._xscale = Math.floor(Number(wscaledownpct));
screen.mc._yscale = Math.floor(Number(wscaledownpct));
} else if ((hscaledown == true) && (wscaledown == false)) {
hscaledownpct = (Stage.width / screen.mc._width) * 100;
screen.mc._xscale = Math.floor(Number(hscaledownpct));
screen.mc._yscale = Math.floor(Number(hscaledownpct));
} else if ((wscaledown == true) && (hscaledown == true)) {
wscaledownpct = (Stage.width / screen.mc._width) * 100;
hscaledownpct = (Stage.height / screen.mc._height) * 100;
if (wscaledownpct >= hscaledownpct) {
scaledownpct = wscaledownpct;
} else if (hscaledownpct > wscaledownpct) {
scaledownpct = hscaledownpct;
}
screen.mc._xscale = Math.floor(Number(scaledownpct));
screen.mc._yscale = Math.floor(Number(scaledownpct));
delete wscaledown;
delete hscaledown;
delete wscaledownpct;
delete hscaledownpct;
delete scaledownpct;
}
screen.mc._x = (Stage.width / 2) - (screen.mc._width / 2);
screen.mc._y = (Stage.height / 2) - (screen.mc._height / 2);
screen.timer = new Flash_Ads_Timer(screen, this, screen.duration);
screen.timer.Start();
};
Flash_Ads_Timer.prototype.Start = function () {
this.active = true;
this.startTime = getTimer();
};
Flash_Ads_Timer.prototype.Tick = function () {
if ((getTimer() - this.startTime) >= this.endTime) {
EndTimerAdapter(this.parent);
this.active = false;
}
};
EndTimerAdapter = function (parent) {
Ad_Vars_Object.adshown = true;
parent.Continue();
};
myGameObject = new Flash_Ads_Object();
_root.stop();
Symbol 119 MovieClip Frame 2
ad_loadTimerStart = getTimer();
play();
Symbol 119 MovieClip Frame 3
play();
Symbol 119 MovieClip Frame 4
if (ad_Vars_Object.eof == 1) {
play();
} else if (getTimer() > (ad_loadTimerStart + 5000)) {
die();
} else {
prevFrame();
}
Symbol 119 MovieClip Frame 5
play();
Symbol 119 MovieClip Frame 6
myGameObject.getBitrate();
if (myGameObject.MainMovieIsLoaded() && (ad_Vars_Object.eof == 1)) {
myGameObject.GetExternalParameters();
myGameObject.PreloadExternalGraphics();
play();
} else {
prevFrame();
}
Symbol 119 MovieClip Frame 7
play();
Symbol 119 MovieClip Frame 8
if (myGameObject.ExternalGraphicsAreLoaded()) {
myGameObject.Continue();
} else {
prevFrame();
}
Symbol 145 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 10
stop();
Symbol 162 Button
on (release) {
this.beforeCreditsFrame = this._currentframe;
gotoAndPlay (93);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 168 MovieClip Frame 10
stop();
Symbol 169 Button
on (release) {
GameManager.onPlayAgain();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 173 Button
on (release) {
gotoAndPlay (38);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 176 Button
on (release) {
gotoAndPlay (46);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 182 Button
on (release) {
Player.submitEmail(this, tFriendEmail, tSenderEmail, 0);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 190 MovieClip Frame 1
stop();
Symbol 190 MovieClip Frame 2
stop();
Symbol 191 Button
on (release) {
Player.submitEmail(this, tFriendEmail, tSenderEmail, 2);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 194 Button
on (release) {
getURL ("http://lifetimetv.com");
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 199 Button
on (release) {
gotoAndPlay (73);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 206 Button
on (release) {
Player.submitEmail(this, tFriendEmail, tSenderEmail, 1);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 210 MovieClip Frame 32
gotoAndPlay (1);
Symbol 213 Button
on (release) {
gotoAndPlay(this.beforeCreditsFrame);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 216 Button
on (release) {
getURL ("http://www.brnr.com", "_blank");
}
Symbol 217 MovieClip Frame 5
stop();
Symbol 217 MovieClip Frame 10
stop();
Symbol 217 MovieClip Frame 15
stop();
Symbol 217 MovieClip Frame 20
stop();
Symbol 217 MovieClip Frame 25
stop();
Symbol 217 MovieClip Frame 26
Player.setFullTitleTextField(tQueenTitle);
tFriendEmail = "Enter E-mail Here";
stop();
Symbol 217 MovieClip Frame 31
stop();
Symbol 217 MovieClip Frame 32
Player.setFullTitleTextField(tQueenTitle);
tFriendEmail = "Enter E-mail Here";
stop();
Symbol 217 MovieClip Frame 37
stop();
Symbol 217 MovieClip Frame 45
stop();
Symbol 217 MovieClip Frame 53
stop();
Symbol 217 MovieClip Frame 54
Player.setFullTitleTextField(tQueenTitle);
stop();
Symbol 217 MovieClip Frame 61
Player.setFullTitleTextField(tQueenTitle);
stop();
Symbol 217 MovieClip Frame 66
stop();
Symbol 217 MovieClip Frame 67
Player.setFullTitleTextField(tQueenTitle);
stop();
Symbol 217 MovieClip Frame 72
stop();
Symbol 217 MovieClip Frame 73
Player.setFullTitleTextField(tQueenTitle);
tFriendEmail = "Enter E-mail Here";
stop();
Symbol 217 MovieClip Frame 78
stop();
Symbol 217 MovieClip Frame 85
stop();
Symbol 217 MovieClip Frame 92
stop();
Symbol 217 MovieClip Frame 99
stop();
Symbol 238 MovieClip Frame 1
stop();
Symbol 238 MovieClip Frame 2
stop();
Symbol 238 MovieClip Frame 3
stop();
Symbol 238 MovieClip Frame 4
stop();
Symbol 238 MovieClip Frame 5
stop();
Symbol 238 MovieClip Frame 6
stop();
Symbol 248 Button
on (release) {
_parent.onButtonUp();
}
Symbol 253 Button
on (release) {
_parent.onButtonDown();
}
Symbol 256 Button
on (press) {
_parent._parent.nubPress(this);
}
on (release) {
_parent._parent.nubRelease(this);
}
on (dragOut) {
_parent._parent.nubDragOut(this);
}
Symbol 259 MovieClip Frame 1
var lineage_array = Player.getLineageData();
var y_offset = 0;
var i = 0;
while (i < lineage_array.length) {
var queen = lineage_array[i];
iContent.attachMovie("lLineageCredit", "lc_" + i, i);
var lc = iContent["lc_" + i];
lc.tQueenName = "Queen " + queen.name;
lc._y = y_offset;
var accolade = "";
if (queen.accolade > 0) {
y_offset = y_offset + 49;
accolade = _root.ACCOLADES[queen.accolade] + newline;
} else {
y_offset = y_offset + 34;
}
accolade = accolade + _root.padString(queen.topscore, 9);
lc.tAccolade = accolade;
i++;
}
Symbol 259 MovieClip Frame 2
function nubPress(nub) {
startDrag (nub, false, nub._x, nub_top, nub._x, nub_bottom);
this.onMouseMove = doMove;
}
function nubRelease(nub) {
stopDrag();
this.onMouseMove = null;
}
function nubDragOut(nub) {
}
function doMove() {
if (content_total > (nub_total / 9)) {
iContent._y = content_top - (ratio * (nub._y - nub_top));
}
}
function onButtonUp() {
if (content_total > (nub_total / 9)) {
iContent._y = iContent._y + 50;
iContent._y = Math.min(content_top, iContent._y);
nub._y = ((content_top - iContent._y) / ratio) + nub_top;
}
}
function onButtonDown() {
if (content_total > (nub_total / 9)) {
iContent._y = iContent._y - 50;
iContent._y = Math.max(content_bottom, iContent._y);
nub._y = ((content_top - iContent._y) / ratio) + nub_top;
}
}
topPosition = iScrollBarMain.iNub._y;
totalHeight = iScrollBarMain.iBar._height;
totalDistance = totalHeight - (2 * topPosition);
bottomPosition = topPosition + totalDistance;
content_total = iContent._height - totalDistance;
nub_total = totalDistance;
ratio = content_total / nub_total;
content_top = iContent._y;
content_bottom = content_top - content_total;
nub = iScrollBarMain.iNub;
nub_top = iScrollBarMain.iNub._y;
nub_bottom = nub_top + totalDistance;
Symbol 259 MovieClip Frame 5
stop();
Symbol 260 MovieClip Frame 6
stop();
Symbol 260 MovieClip Frame 12
stop();
Symbol 279 MovieClip Frame 16
gotoAndPlay (1);
Symbol 280 MovieClip Frame 13
stop();
Symbol 281 MovieClip Frame 26
gotoAndPlay (1);
Symbol 283 Button
on (rollOver) {
GemManager.onRollOver();
}
on (rollOut) {
GemManager.onRollOut();
}
on (press) {
GemManager.onPress();
}
on (release) {
GemManager.onRelease();
}
on (dragOut) {
GemManager.onDragOut();
}
Symbol 285 MovieClip Frame 17
stop();
Symbol 316 MovieClip Frame 1
stop();
Symbol 316 MovieClip Frame 2
stop();
Symbol 316 MovieClip Frame 3
stop();
Symbol 316 MovieClip Frame 4
stop();
Symbol 316 MovieClip Frame 5
stop();
Symbol 318 MovieClip Frame 8
gotoAndPlay (1);
Symbol 326 MovieClip Frame 1
stop();
Symbol 326 MovieClip Frame 2
stop();
Symbol 326 MovieClip Frame 3
stop();
Symbol 326 MovieClip Frame 4
stop();
Symbol 326 MovieClip Frame 5
stop();
Symbol 327 MovieClip Frame 1
stop();
Instance of Symbol 316 MovieClip in Symbol 327 MovieClip Frame 29
onClipEvent (load) {
PearlManager.registerBonusField(this);
gotoAndStop(GameManager.getLevelColor());
}
Instance of Symbol 316 MovieClip in Symbol 327 MovieClip Frame 36
onClipEvent (load) {
PearlManager.registerBonusField(this);
gotoAndStop(GameManager.getLevelColor());
}
Symbol 327 MovieClip Frame 41
stop();
Instance of Symbol 326 MovieClip in Symbol 327 MovieClip Frame 67
onClipEvent (enterFrame) {
gotoAndStop(GameManager.getLevelColor());
}
Symbol 327 MovieClip Frame 87
stop();
Symbol 331 Button
on (release) {
_root.play();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 333 Button
on (release) {
GameManager.resumeFromHelp();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 334 MovieClip Frame 1
stop();
Symbol 334 MovieClip Frame 2
stop();
Symbol 342 Button
on (release) {
gotoAndPlay (125);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 346 Button
on (release) {
gotoAndPlay (244);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 349 Button
on (release) {
gotoAndPlay (346);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 351 Button
on (release) {
gotoAndPlay (448);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 353 Button
on (release) {
gotoAndPlay (515);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 354 MovieClip Frame 15
gotoAndPlay (1);
Symbol 357 Button
on (release) {
_root.play();
}
Symbol 362 Button
on (release) {
GameManager.resumeFromHelp();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 363 MovieClip Frame 1
stop();
Symbol 363 MovieClip Frame 2
stop();
Symbol 364 MovieClip Frame 1
stop();
Instance of Symbol 334 MovieClip in Symbol 364 MovieClip Frame 1
onClipEvent (load) {
if (GameManager.isGameOn) {
gotoAndStop (2);
} else {
gotoAndStop (1);
debug("game is not on");
}
}
Symbol 364 MovieClip Frame 124
gotoAndPlay (25);
Symbol 364 MovieClip Frame 243
gotoAndPlay (125);
Symbol 364 MovieClip Frame 345
gotoAndPlay (244);
Symbol 364 MovieClip Frame 447
gotoAndPlay (346);
Symbol 364 MovieClip Frame 514
gotoAndPlay (448);
Instance of Symbol 363 MovieClip in Symbol 364 MovieClip Frame 515
onClipEvent (load) {
if (GameManager.isGameOn) {
gotoAndStop (2);
} else {
gotoAndStop (1);
debug("game is not on");
}
}
Symbol 364 MovieClip Frame 529
gotoAndPlay (515);
Symbol 368 MovieClip Frame 10
stop();
Symbol 369 Button
on (release) {
GameManager.showHelp();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 371 Button
on (release) {
GameManager.pauseGame();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 373 Button
on (release) {
GameManager.soundOff();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 375 Button
on (release) {
GameManager.soundOn();
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}
Symbol 376 MovieClip Frame 1
stop();
Symbol 376 MovieClip Frame 2
stop();
Symbol 381 MovieClip Frame 1
stop();
Symbol 381 MovieClip Frame 2
stop();
Symbol 383 Button
on (release) {
gotoAndPlay (254);
}
on (press) {
_global.SoundMgr.playWoodClick();
}
on (rollOver) {
_global.SoundMgr.playWoodRoll();
}