Frame 1
startSplash._visible = false;
var wordLink = new WordLink();
wordLink.waitForData();
Symbol 31 MovieClip Frame 1
#initclip 1
var RELAX_END_SEC = 60;
var relax = false;
var relaxTimer;
Movable = function () {
this.doAnimate = false;
this.onMoveEndListener = null;
};
Movable.prototype = new MovieClip();
Movable.prototype.onFrameEntered = function () {
if (this.doAnimate) {
if ((this.delayStart == null) && (this.delay > 0)) {
this.delayStart = getTimer();
return(undefined);
}
if ((this.delayStart + this.delay) > getTimer()) {
return(undefined);
}
if (this.startTime == null) {
this.startTime = getTimer();
}
var _local5 = this.targetX;
var _local4 = this.targetY;
var _local3 = _local5 - this.startX;
var _local2 = _local4 - this.startY;
if (this.algorithm == "cubic_out") {
var _local7 = Math.round(this.easeOutCubic(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutCubic(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "bounce_out") {
var _local7 = Math.round(this.easeOutBounce(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutBounce(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "easeInQuad") {
var _local7 = Math.round(this.easeInQuad(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeInQuad(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "easeOutElastic") {
var _local7 = Math.round(this.easeOutElastic(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutElastic(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "linear") {
var _local7 = Math.round(this.linear(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.linear(getTimer() - this.startTime, this.startY, _local2, this.duration));
}
this._x = _local7;
this._y = _local6;
if ((Math.abs(this._x - _local5) < 2) && (Math.abs(this._y - _local4) < 2)) {
this.startTime = null;
this._x = _local5;
this._y = _local4;
this.doAnimate = false;
if (this.onMoveEndListener != null) {
this.onMoveEndListener.moved(this);
}
}
}
};
Movable.prototype.setMoveEndListener = function (list) {
this.onMoveEndListener = list;
};
Movable.prototype.animate = function (targetX, targetY, duration) {
this.animate(targetX, targetY, duration, 0, "easeOutElastic");
};
Movable.prototype.animate = function (targetX, targetY, duration, delay) {
this.animate(targetX, targetY, duration, delay, "easeOutElastic");
};
Movable.prototype.animate = function (targetX, targetY, duration, delay, algo) {
if ((algo == null) || (algo == "")) {
algo = "easeOutElastic";
}
this.targetX = targetX;
this.targetY = targetY;
this.startX = this._x;
this.startY = this._y;
this.startTime = null;
this.algorithm = algo;
this.delay = delay;
this.duration = duration;
this.doAnimate = true;
};
Movable.prototype.linear = function (t, b, c, d) {
if (t > d) {
t = d;
}
return(((c * t) / d) + b);
};
Movable.prototype.quintEaseIn = function (t, b, c, d) {
if (t > d) {
t = d;
}
t = t / d;
return((((((c * t) * t) * t) * t) * t) + b);
};
Movable.prototype.easeInQuad = function (t, b, c, d) {
if (t > d) {
t = d;
}
return((((c * t) * t) / (d * d)) + b);
};
Movable.prototype.easeOutQuad = function (t, b, c, d) {
if (t > d) {
t = d;
}
return((((((-c) * t) * t) / (d * d)) + (((2 * c) * t) / d)) + b);
};
Movable.prototype.easeOutCubic = function (t, b, c, d) {
if (t > d) {
t = d;
}
t = (t / d) - 1;
return((c * (((t * t) * t) + 1)) + b);
};
Movable.prototype.easeOutQuart = function (t, b, c, d) {
if (t > d) {
t = d;
}
t = (t / d) - 1;
return(((-c) * ((((t * t) * t) * t) - 1)) + b);
};
Movable.prototype.easeOutElastic = function (t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
return((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) + c) + b);
};
AnimatedTile = function () {
this.speed = 5;
this.acceleration = 1.2;
this.onEnterFrame = function () {
if (this.doAnimate) {
if ((this.startTime == null) || (this.startTime == undefined)) {
this.startTime = getTimer();
}
if ((this.startTime + this.delay) < getTimer()) {
this.speed = this.speed * this.acceleration;
this._y = this._y + this.speed;
if (this._y > 490) {
this.onEnd();
}
}
}
};
this.onEnd = function () {
removeMovieClip(this);
};
};
AnimatedTile.prototype = new Movable();
Object.registerClass("AnimatedTile", AnimatedTile);
AnimatedChainMask = function () {
this.onEnterFrame = function () {
this.onFrameEntered();
};
};
AnimatedChainMask.prototype = new Movable();
Object.registerClass("chainMask", AnimatedChainMask);
Ruta = function () {
this.rowId = 0;
this.colId = 0;
this.isSelected = false;
this.tileManager = null;
this.width = 60;
this.height = 60;
this.links = new Array();
this.onEnterFrame = function () {
this.onFrameEntered();
};
this.linkSouthEast = function () {
this.tileManager.level++;
var name = ("link_" + (this.tileManager.level++));
attachMovie("UpRight", name, this.tileManager.level++);
var e = eval (name);
e._x = this._x + (e._width / 2);
e._y = this._y + this.tileManager.gc.tileHeight;
e.dirName = "se";
this.links.push(e);
};
this.linkSouthWest = function () {
this.tileManager.level++;
var name = ("link_" + this.tileManager.level);
attachMovie("UpLeft", name, this.tileManager.level++);
var e = eval (name);
e._x = (this._x + this.tileManager.gc.tileWidth) - (e._width / 2);
e._y = this._y + this.tileManager.gc.tileHeight;
e.dirName = "sw";
this.links.push(e);
};
this.linkNorthEast = function () {
this.tileManager.level++;
var name = ("link_" + this.tileManager.level);
attachMovie("upLeft", name, this.tileManager.level++);
var e = eval (name);
e._x = this._x + (e._width / 2);
e._y = this._y;
e.dirName = "ne";
this.links.push(e);
};
this.linkNorthWest = function () {
this.tileManager.level++;
var name = ("link_" + this.tileManager.level);
attachMovie("upRight", name, this.tileManager.level++);
var e = eval (name);
e._x = (this._x + this.tileManager.gc.tileWidth) - (e._width / 2);
e._y = this._y;
e.dirName = "nw";
this.links.push(e);
};
this.linkWest = function () {
this.tileManager.level++;
var name = ("link_" + this.tileManager.level);
attachMovie("Horizontal", name, this.tileManager.level++);
var e = eval (name);
e._x = (this._x + (this.tileManager.gc.tileWidth / 2)) + (e._width / 2);
e._y = (this._y + (this.tileManager.gc.tileHeight / 2)) - (e._height / 2);
e.dirName = "w";
this.links.push(e);
};
this.linkEast = function () {
this.tileManager.level++;
var name = ("link_" + this.tileManager.level);
attachMovie("Horizontal", name, this.tileManager.level++);
var e = eval (name);
e._x = this._x - (e._width / 2);
e._y = (this._y + (this.tileManager.gc.tileHeight / 2)) - (e._height / 2);
e.dirName = "e";
this.links.push(e);
};
this.removeLinks = function () {
var _local2 = 0;
while (_local2 < this.links.length) {
var _local3 = this.links[_local2];
if (_local3 != null) {
removeMovieClip(_local3);
}
_local2++;
}
this.links = new Array();
};
this.unlinkDirection = function (direction) {
var _local3 = 0;
while (_local3 < this.links.length) {
var _local2 = this.links[_local3];
if (_local2.dirName == direction) {
if (_local2 != null) {
removeMovieClip(_local2);
}
}
_local3++;
}
};
this.setType = function (type) {
this.type = type;
if (this.type == "n") {
this.gotoAndStop("frmNormal");
} else if (this.type == "g") {
this.gotoAndStop("frmGold");
} else if (this.type == "r") {
this.gotoAndStop("frmRedBonus");
}
};
this.lookNormal = function () {
this.isSelected = false;
if (this.type == "g") {
this.gotoAndStop("frmGold");
} else if (this.type == "n") {
this.gotoAndStop("frmNormal");
} else if (this.type == "r") {
this.gotoAndStop("frmRedBonus");
}
};
this.lookSelected = function () {
this.isSelected = true;
if (this.type == "g") {
this.gotoAndStop("frmGoldSelected");
} else if (this.type == "n") {
this.gotoAndStop("frmSelected");
} else if (this.type == "r") {
this.gotoAndStop("frmRedBonusSelected");
}
};
this.onPress = function () {
if (this.tileManager.locked || (this.doAnimate)) {
return(undefined);
}
if ((!this.tileManager.isValid(this)) && (this.tileManager.lastSelected._name != this._name)) {
if (this.isSelected) {
this.tileManager.unSelectLink(this);
return(undefined);
}
this.tileManager.unSelectAll();
} else {
if (((this.tileManager.lastSelected._name == this._name) && (this.tileManager.selectedTiles.length >= this.tileManager.gc.minWordLinkLength)) && (this.tileManager.selectedTiles.length <= this.tileManager.gc.maxWordLinkLength)) {
this.tileManager.resetSelectedTiles();
return(undefined);
}
if ((this.tileManager.lastSelected._name == this._name) && (this.tileManager.selectedTiles.length < this.tileManager.gc.minWordLinkLength)) {
this.tileManager.unSelectLink(this);
return(undefined);
}
}
if (this.tileManager.selectedTiles.length >= this.tileManager.gc.maxWordLinkLength) {
return(undefined);
}
if (this.isSelected) {
this.lookNormal();
this.tileManager.tileUnselected(this);
} else {
this.lookSelected();
this.tileManager.tileSelectedSound.start(0);
this.tileManager.tileSelected(this);
}
};
this.bounceScore = function () {
var o = new Object();
this.bounceObj = o;
var n = (("star_" + this._name) + this.tileManager.level);
attachMovie("WordStar", n, this.tileManager.level++);
var ref = eval (n);
this.star = ref;
ref._x = ((this._x + this._width) - (ref._width / 2)) + 3;
ref._y = ((this._y + this._height) - (ref._height / 2)) + 3;
ref.gotoAndStop(1);
ref.num = this.theScore.text;
o.ref = ref;
o.obj = this.theScore;
o.state = 0;
o.self = this;
o.count = 0;
o.onEvent = function () {
if (o.state == 0) {
o.state = 1;
} else if (o.state == 1) {
if (this.count == 0) {
this.ref.gotoAndStop(2);
this.count++;
} else if (this.count < 7) {
this.count = this.count + 1;
} else {
o.state = 2;
}
} else if (o.state == 2) {
this.ref.gotoAndStop(1);
o.state = 3;
} else if (o.state == 3) {
clearInterval(this.intervallet);
if (this.ref != null) {
this.self.star = null;
removeMovieClip(this.ref);
}
if (this.self.doDelete) {
removeMovieClip(this.self);
}
}
};
o.intervallet = setInterval(o, "onEvent", 40);
};
};
Ruta.prototype = new Movable();
Object.registerClass("ruta", Ruta);
I18n = function () {
this.labels = new Array();
this.addLabel = function (lbl) {
this.labels.push(lbl);
};
this.getLabel = function (lbl) {
var _local2 = 0;
while (_local2 < this.labels.length) {
if (this.labels[_local2][0].toLowerCase() == lbl.toLowerCase()) {
return(this.labels[_local2][1]);
}
_local2++;
}
return("M: " + lbl.toUpperCase());
};
};
LetterData = function () {
this.letter = "";
this.score = 0;
};
GameDataObj = function () {
this.charArray = new Array();
this.scoreArray = new Array();
this.letterArray = new Array();
this.usedLetters = new Array();
this.index = 0;
this.timelimitSecs = 300;
this.lettersforbonus = 20;
this.superbonuslength = 5;
this.levelletters = 100;
this.parseGameData = function (gameData) {
var _local10 = new XML();
_local10.ignoreWhite = true;
_local10.parseXml(gameData);
var _local9 = _local10.firstChild;
if (_local9.nodeName == "gamedata") {
var _local11 = _local9.attributes.characters;
var _local12 = _local9.attributes.scores;
this.timelimit = _local9.attributes.timelimit;
this.lettersforbonus = _local9.attributes.lettersforbonus;
this.superbonuslength = _local9.attributes.superbonuslength;
this.levelletters = _local9.attributes.levelletters;
this.minletters = _local9.attributes.minletters;
this.maxletters = _local9.attributes.maxletters;
var _local13 = new String(_local9.attributes.relaxMode);
if (_local13 == "true") {
relax = true;
} else {
relax = false;
}
this.charArray = _local11.split(" ");
this.scoreArray = _local12.split(" ");
var _local2 = 0;
while (_local2 < this.charArray.length) {
if (this.charArray[_local2] != "") {
var _local8 = this.charArray[_local2];
var _local4 = new LetterData();
_local4.letter = _local8;
if (this.scoreArray[_local2] != "") {
_local4.score = this.scoreArray[_local2];
}
this.letterArray.push(_local4);
}
_local2++;
}
var _local3 = _local9.firstChild;
while (_local3 != null) {
if (_local3.nodeName == "text") {
var _local7 = _local3.attributes.id;
var _local6 = _local3.firstChild;
var _local5 = new Array();
_local5.push(_local7);
_local5.push(_local6);
_level0.theI18n.addLabel(_local5);
}
_local3 = _local3.nextSibling;
}
}
};
this.getNextLetterData = function () {
if (this.letterArray.length > 0) {
var _local2 = this.letterArray.shift();
this.usedLetters.push(_local2);
return(_local2);
}
this.letterArray = this.usedLetters;
return(this.getNextLetterData());
};
};
GameConstants = function () {
this.margin_top = 35;
this.margin_left = 194;
this.movieWidth = 700;
this.tileDisplacement = 27;
this.tileHeight = 55;
this.tileWidth = 55;
this.tilePileLong = 8;
this.tilePileShort = 7;
this.tileColumns = 9;
this.tileRefillSpeed = 450;
this.tileShrinkSpeed = 200;
this.minWordLinkLength = 3;
this.maxWordLinkLength = 10;
this.animSpeed = 300;
this.gameHeight = 455;
this.bonusWordLength = 5;
this.bonusFrequency = 6;
this.levelletters = 100;
this.initialize = function (gameDataObj) {
this.minWordLinkLength = gameDataObj.minletters;
this.maxWordLinkLength = gameDataObj.maxletters;
this.bonusWordLength = gameDataObj.superbonuslength;
this.bonusFrequency = gameDataObj.lettersforbonus;
this.levelletters = gameDataObj.levelletters;
};
this.getRandomLetter = function () {
return(this.letters[this.rnd(0, this.letters.length - 1)]);
};
this.rnd = function (lowNumber, highNumber) {
var _local3 = highNumber - lowNumber;
var _local2 = Math.random() * _local3;
var _local1 = Math.round(_local2);
_local1 = _local1 + lowNumber;
return(_local1);
};
};
TileManager = function () {
this.tiles = new Array();
this.selectedTiles = new Array();
this.locked = true;
this.lock();
this.tileSelectedSound = new Sound();
this.tileSelectedSound.setVolume(50);
this.tileSelectedSound.attachSound("tileSelect");
this.wordlinkSubmit = new Sound();
this.wordlinkSubmit.setVolume(30);
this.wordlinkSubmit.attachSound("wordlink");
this.bonusBrickSound = new Sound();
this.bonusBrickSound.attachSound("bonusBrick");
this.levelUpSound = new Sound();
this.levelUpSound.attachSound("levelup");
this.gameoverSound = new Sound();
this.gameoverSound.attachSound("gameover");
this.introSound = new Sound();
this.introSound.attachSound("introSound");
this.sendAwayTiles = new Sound();
this.sendAwayTiles.attachSound("sendAway");
this.bonusCount = 0;
this.tileId = 100;
this.level = 100;
this.lastSelected = null;
this.submittedWords = new Array();
this.AABB = "";
this.firstRedBonusDisplayed = false;
this.firstSuperBonusDisplayed = false;
this.levelTileCount = 0;
this.levelNumber = 1;
this.initialize = function (gameDataObj) {
this.gameData = gameDataObj;
this.gc = new GameConstants();
this.gc.initialize(gameDataObj);
};
this.doubleTheseLetters = new Array();
this.unSelectAll = function () {
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
this.unselectTile(this.selectedTiles[_local2]);
_local2++;
}
this.selectedTiles = new Array();
this.lastSelected = null;
this.displayWordLink();
};
this.lock = function () {
this.locked = true;
_level0.txtLock.text = "locked";
};
this.unlock = function () {
this.locked = false;
_level0.txtLock.text = "unlocked";
};
this.doubleLetterScores = function () {
if (this.doubleTheseLetters.length > 0) {
var _local8 = 0;
while (_local8 < this.doubleTheseLetters.length) {
var _local4 = this.doubleTheseLetters[_local8].letter;
var _local6 = 0;
var _local9 = false;
var _local7 = 0;
while (_local7 < this.gameData.usedLetters.length) {
if (this.gameData.usedLetters[_local7].letter == _local4) {
_local6 = this.gameData.usedLetters[_local7].score * 2;
_local9 = true;
break;
}
_local7++;
}
if (!_local9) {
_local7 = 0;
while (_local7 < this.gameData.letterArray.length) {
if (this.gameData.letterArray[_local7].letter == _local4) {
_local6 = this.gameData.letterArray[_local7].score * 2;
break;
}
_local7++;
}
}
_local7 = 0;
while (_local7 < this.gameData.usedLetters.length) {
if (this.gameData.usedLetters[_local7].letter == _local4) {
this.gameData.usedLetters[_local7].score = _local6;
}
_local7++;
}
_local7 = 0;
while (_local7 < this.gameData.letterArray.length) {
if (this.gameData.letterArray[_local7].letter == _local4) {
this.gameData.letterArray[_local7].score = _local6;
}
_local7++;
}
var _local5 = 0;
while (_local5 < this.tiles.length) {
var _local3 = 0;
while (_local3 < this.tiles[_local5].length) {
var _local2 = this.tiles[_local5][_local3];
if (_local2.letterData.letter == _local4) {
_local2.letterData.score = _local6;
_local2.theScore.text = _local2.letterData.score;
_local2.bounceScore();
}
_local3++;
}
_local5++;
}
_local8++;
}
this.doubleTheseLetters = new Array();
}
};
this.unSelectLink = function (tile) {
tileFound = false;
var _local5 = new Array();
var _local4 = 0;
while (_local4 < this.selectedTiles.length) {
var _local3 = this.selectedTiles[_local4];
if (tileFound) {
this.unselectTile(_local3);
_local5.push(_local3);
} else if (_local3._name == tile._name) {
this.unselectTile(_local3);
_local5.push(_local3);
tileFound = true;
}
_local4++;
}
_local4 = 0;
while (_local4 < _local5.length) {
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
if (_local5[_local4]._name == this.selectedTiles[_local2]._name) {
this.selectedTiles.splice(_local2, 1);
break;
}
_local2++;
}
_local4++;
}
if (this.selectedTiles.length > 0) {
this.lastSelected = this.selectedTiles[this.selectedTiles.length - 1];
this.lastSelected.unlinkDirection(this.relativeDirection(this.lastSelected, tile));
} else {
this.lastSelected = null;
}
this.displayWordLink();
};
this.tileUnselected = function (tile) {
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
if (this.selectedTiles[_local2]._name == tile._name) {
this.unselectTile(this.selectedTiles[_local2]);
this.selectedTiles.splice(_local2, 1);
if (this.selectedTiles.length > 0) {
this.lastSelected = this.selectedTiles[this.selectedTiles.length - 1];
}
this.displayWordLink();
return(undefined);
}
_local2++;
}
};
this.unselectTile = function (tile) {
if ((this.lastSelected != null) && (tile._name == this.lastSelected._name)) {
this.lastSelected = null;
}
tile.removeLinks();
tile.lookNormal();
};
this.isValid = function (tile) {
if (this.lastSelected == null) {
return(true);
}
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
if (this.selectedTiles[_local2]._name == tile._name) {
return(false);
}
_local2++;
}
if (tile.rowId == this.lastSelected.rowId) {
if ((tile.colId == (this.lastSelected.colId + 1)) || (tile.colId == (this.lastSelected.colId - 1))) {
return(true);
}
}
if ((this.lastSelected.rowId == 0) || ((this.lastSelected.rowId % 2) == 0)) {
if ((tile.rowId == (this.lastSelected.rowId + 1)) || (tile.rowId == (this.lastSelected.rowId - 1))) {
if ((tile.colId == this.lastSelected.colId) || (tile.colId == (this.lastSelected.colId - 1))) {
return(true);
}
}
} else if ((tile.rowId == (this.lastSelected.rowId + 1)) || (tile.rowId == (this.lastSelected.rowId - 1))) {
if ((tile.colId == this.lastSelected.colId) || (tile.colId == (this.lastSelected.colId + 1))) {
return(true);
}
}
};
this.relativeDirection = function (fromTile, toTile) {
if (fromTile.rowId == toTile.rowId) {
if (fromTile.colId > toTile.colId) {
return("e");
}
return("w");
}
if ((fromTile.rowId == 0) || ((fromTile.rowId % 2) == 0)) {
if (fromTile.rowId > toTile.rowId) {
if (fromTile.colId == toTile.colId) {
return("nw");
}
return("ne");
}
if (fromTile.colId == toTile.colId) {
return("sw");
}
return("se");
}
if (fromTile.rowId < toTile.rowId) {
if (fromTile.colId == toTile.colId) {
return("se");
}
return("sw");
}
if (fromTile.colId == toTile.colId) {
return("ne");
}
return("nw");
};
this.tileSelected = function (tile) {
this.selectedTiles.push(tile);
var _local2 = this.relativeDirection(this.lastSelected, tile);
if (_local2 == "e") {
this.lastSelected.linkEast();
} else if (_local2 == "w") {
this.lastSelected.linkWest();
} else if (_local2 == "se") {
this.lastSelected.linkSouthEast();
} else if (_local2 == "ne") {
this.lastSelected.linkNorthEast();
} else if (_local2 == "nw") {
this.lastSelected.linkNorthWest();
} else if (_local2 == "sw") {
this.lastSelected.linkSouthWest();
}
this.displayWordLink();
this.lastSelected = tile;
};
this.displayWordLink = function () {
_level0.txtWordLink.text = "";
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
_level0.txtWordLink.text = _level0.txtWordLink.text + this.selectedTiles[_local2].theLetter.text;
_local2++;
}
};
this.removeTile = function (tile, delay) {
if ((delay == null) || (delay == undefined)) {
delay = 0;
}
var x = 0;
while (x < this.tiles.length) {
var row = this.tiles[x];
var y = 0;
while (y < row.length) {
var t = row[y];
if (t._name == tile._name) {
if (t._name == this.lastSelected._name) {
this.lastSelected = null;
}
var item = row[y];
row.splice(y, 1);
item.removeLinks();
var name = ("animated_" + (this.tileId++));
attachMovie("AnimatedTile", name, this.level++);
var e = eval (name);
e._x = tile._x;
e._y = tile._y;
e.delay = delay;
e.doAnimate = true;
if (item != null) {
if (item.star != null) {
item.doDelete = true;
item._visible = false;
} else {
removeMovieClip(item);
}
}
return(undefined);
}
y++;
}
x++;
}
};
this.scramble = function () {
if (relax) {
relaxTimer = getTimer();
}
var o = new Object();
o.tileManager = this;
o.row = 0;
o.col = 0;
o.count = 0;
if (this.locked) {
return(undefined);
}
this.unSelectAll();
this.submittedWords.push("<");
this.AABB = this.AABB + "scramble ,";
if (relax == false) {
fscommand ("playData", "12=0");
}
this.lock();
var x = 0;
while (x < this.tiles.length) {
var y = 0;
while (y < this.tiles[x].length) {
var tilen = this.tiles[x][y];
var ld = this.gameData.getNextLetterData();
tilen.letterData = ld;
tilen.setType("n");
y++;
}
x++;
}
o.onEventet = function () {
if (this.row < this.tileManager.tiles.length) {
if (this.col < this.tileManager.tiles[this.row].length) {
var tile = this.tileManager.tiles[this.row][this.col];
var n = ("anim" + (this.tileManager.level++));
attachMovie("AnimatedTile", n, this.tileManager.level++);
var ref = eval (n);
ref._x = tile._x;
ref._y = tile._y;
ref.tileManager = this.tileManager;
ref.count = this.count++;
tile._visible = false;
ref.tile = tile;
ref.doAnimate = true;
ref.onEnd = function () {
this.tile.theLetter.text = this.tile.letterData.letter;
this.tile.theScore.text = this.tile.letterData.score;
this.tile.setType("n");
this.tile._visible = true;
if (this.tile.letterData.letter.length > 1) {
var _local2 = new TextFormat();
_local2.size = 25;
this.tile.theLetter.setTextFormat(_local2);
} else {
var _local2 = new TextFormat();
_local2.size = 32;
this.tile.theLetter.setTextFormat(_local2);
}
if (this.count == 59) {
this.tileManager.unlock();
}
removeMovieClip(this);
};
this.col++;
} else {
this.col = 0;
this.row++;
}
} else {
clearInterval(this.tileManager.scrambleInterval);
}
};
this.scrambleInterval = setInterval(o, "onEventet", 1);
};
this.resetSelectedTiles = function () {
if (relax) {
relaxTimer = getTimer();
}
if (this.resultStringFixed == true) {
return(undefined);
}
if (this.selectedTiles.length < this.gc.minWordLinkLength) {
return(undefined);
}
if (this.selectedTiles.length > this.gc.maxWordLinkLength) {
return(undefined);
}
this.lock();
var _local10 = false;
var _local5 = 0;
while (_local5 < this.selectedTiles.length) {
if (this.selectedTiles[_local5].type == "g") {
_local10 = true;
break;
}
_local5++;
}
var _local2 = null;
var _local8 = new Array();
var _local6 = "";
var _local9 = false;
var _local7 = "";
_local5 = 0;
while (_local5 < this.selectedTiles.length) {
_local2 = this.selectedTiles[_local5];
_local8.push(_local2.letterData);
if (_local2.type == "g") {
this.doubleTheseLetters.push(_local2.letterData);
}
var _local3 = "";
var _local4 = "";
if (_local2.type == "g") {
_local3 = ((_local2.rowId + ";") + _local2.colId) + ";super ";
_local4 = "super ";
} else if (_local2.type == "r") {
_local3 = ((_local2.rowId + ";") + _local2.colId) + ";bonus ";
_local4 = "bonus ";
}
if (_local3 != "") {
_local9 = true;
}
_local7 = ((_local7 + _local2.letterData.letter) + " ") + _local4;
_local6 = ((((((_local6 + _local3) + _local2.rowId) + ";") + _local2.colId) + ";") + _local2.letterData.letter) + " ";
_local5++;
}
this.AABB = (this.AABB + _local7.substring(0, _local7.length - 1)) + ",";
if (_local9) {
this.bonusBrickSound.start();
} else {
this.sendAwayTiles.start();
}
if (relax == false) {
fscommand ("playData", (("647," + _local6) + "=") + getTimer());
}
this.submittedWords.push(_local8);
if (_local8.length >= this.gc.bonusWordLength) {
this.doSuperBonus = true;
}
this.levelTileCount = this.levelTileCount + _local8.length;
if (this.levelTileCount >= this.gc.levelletters) {
this.levelTileCount = this.levelTileCount - this.gc.levelletters;
_level0.wordchainDisplay.chainmask._x = -180;
this.levelUpSound.start();
this.levelNumber++;
if (relax == false) {
fscommand ("playData", ("169," + this.levelNumber) + "=0");
}
_level0.showLevel = true;
_level0.logoDisplay.gotoAndPlay("frmFadeIn");
var _local11 = new Object();
_local11.onEvent = function () {
_level0.logoDisplay.gotoAndPlay("frmFadeOut");
clearInterval(this.inte);
};
_local11.inte = setInterval(_local11, "onEvent", 3000);
this.submittedWords.push(">");
this.AABB = this.AABB + "level ,";
}
var _local14 = this.levelTileCount / this.gc.levelletters;
var _local13 = 180 * _local14;
_level0.wordchainDisplay.chainmask.animate(_local13 - 180, _level0.wordchainDisplay.chainmask._y, 1500, 0, "cubic_out");
var _local12 = 0;
if (_local10) {
this.doubleLetterScores();
_local12 = 1200;
}
this.onTileWaitInterval = setInterval(this, "onTileWait", _local12);
};
this.onTileWait = function () {
clearInterval(this.onTileWaitInterval);
var _local2 = 0;
while (_local2 < this.selectedTiles.length) {
t = this.selectedTiles[_local2];
this.removeTile(t, 50 * _local2);
_local2++;
}
this.selectedTiles = new Array();
this.repaintBoard();
this.displayWordLink();
this.lastSelected = null;
this.unlock();
};
this.gameOver = function () {
if (_level0.showGameOver) {
return(undefined);
}
this.lock();
_level0.gameTimer.stop();
_level0.showGameOver = true;
_level0.logoDisplay.gotoAndPlay("frmFadeIn");
this.gameoverSound.start();
var resultString = "";
var _local5 = 0;
while (_local5 < this.submittedWords.length) {
var _local4 = this.submittedWords[_local5];
if (_local4 == ">") {
resultString = resultString + "level ";
} else if (_local4 == "<") {
resultString = resultString + "scramble ";
} else {
var _local3 = 0;
while (_local3 < _local4.length) {
var _local2 = _local4[_local3];
resultString = resultString + _local2.letter;
if (_local2.type == "r") {
resultString = resultString + " bonus";
} else if (_local2.type == "g") {
resultString = resultString + " super";
}
if (_local3 < (_local4.length - 1)) {
resultString = resultString + " ";
}
_local3++;
}
}
if (_local5 < (this.submittedWords.length - 1)) {
resultString = resultString + ",";
}
_local5++;
}
var poster = new Object();
poster.tileMan = this;
if (this.AABB.substring(this.AABB.length - 1) == ",") {
this.AABB = this.AABB.substring(0, this.AABB.length - 1);
}
this.resultStringFixed = true;
poster.resultString = this.AABB;
this.resetSelectedTiles();
poster.onEvent = function () {
fscommand ("gameOver", this.resultString);
clearInterval(poster.ref);
};
poster.ref = setInterval(poster, "onEvent", 3000);
};
this.repaintBoard = function () {
xPos = this.gc.margin_left;
var x = 0;
while (x < this.tiles.length) {
var row = this.tiles[x];
var evenRow = true;
var colCount = 8;
if ((x % 2) == 0) {
evenRow = false;
colCount = 9;
}
var col = 0;
while (col < row.length) {
var tile = row[col];
if (row.length != colCount) {
if (tile.colId != col) {
var newXpos = (((evenRow ? (this.gc.tileDisplacement) : 0) + (col * this.gc.tileWidth)) + this.gc.margin_left);
tile.animate(newXPos, tile._y, this.gc.tileShrinkSpeed, row.length - colCount);
tile.colId = col;
}
}
col++;
}
if (row.length != colCount) {
var diff = Math.abs(colCount - row.length);
var placementCount = 0;
var z = row.length;
while (z < colCount) {
var name = ("tile_" + (this.tileId++));
attachMovie("Ruta", name, this.level++);
var e = eval (name);
var targetY = ((x * this.gc.tileHeight) + this.gc.margin_top);
var targetX = (((evenRow ? (this.gc.tileDisplacement) : 0) + (z * this.gc.tileWidth)) + this.gc.margin_left);
e._y = targetY;
e._x = (this.gc.movieWidth - this.gc.tileWidth) + (placementCount * this.gc.tileWidth);
placementCount++;
e.colId = z;
e.rowId = x;
this.bonusCount++;
if (this.bonusCount == this.gc.bonusFrequency) {
if (this.doSuperBonus) {
e.setType("g");
} else {
e.setType("r");
}
if ((!this.firstRedBonusDisplayed) && (!this.doSuperBonus)) {
this.bonusBrickSound.start();
_level0.showRedBonus = true;
_level0.logoDisplay.gotoAndPlay("frmFadeIn");
this.firstRedBonusDisplayed = true;
var hideDisplay = new Object();
hideDisplay.onEvent = function () {
_level0.logoDisplay.gotoAndPlay("frmFadeOut");
clearInterval(this.inte);
};
hideDisplay.inte = setInterval(hideDisplay, "onEvent", 15000);
} else if ((!this.firstSuperBonusDisplayed) && (this.doSuperBonus)) {
this.bonusBrickSound.start();
_level0.showGoldBonus = true;
_level0.logoDisplay.gotoAndPlay("frmFadeIn");
this.firstSuperBonusDisplayed = true;
var hideDisplay = new Object();
hideDisplay.onEvent = function () {
_level0.logoDisplay.gotoAndPlay("frmFadeOut");
clearInterval(this.inte);
};
hideDisplay.inte = setInterval(hideDisplay, "onEvent", 15000);
}
this.bonusCount = 0;
this.doSuperBonus = false;
} else {
e.setType("n");
}
var ld = this.gameData.getNextLetterData();
e.theLetter.text = ld.letter;
e.theScore.text = ld.score;
e.letterData = ld;
e.letterData.type = e.type;
if (ld.letter.length > 1) {
var tf = new TextFormat();
tf.size = 25;
e.theLetter.setTextFormat(tf);
} else {
var tf = new TextFormat();
tf.size = 32;
e.theLetter.setTextFormat(tf);
}
e.tileManager = this;
this.tiles[x].push(e);
e.animate(targetX, targetY, this.gc.tileRefillSpeed, 300);
z++;
}
}
x++;
}
var mySound = new Object();
mySound.tileMan = this;
mySound.onEvent = function () {
this.tileMan.wordlinkSubmit.start();
clearInterval(this.inte);
};
mySound.inte = setInterval(mySound, "onEvent", 200);
};
this.createTiles = function () {
var row = 0;
while (row < 7) {
var newRow = new Array();
this.tiles.push(newRow);
var evenRow = true;
var rowCount = 8;
if ((row % 2) == 0) {
evenRow = false;
rowCount = 9;
}
var col = 0;
while (col < rowCount) {
var name = ("tile_" + (this.tileId++));
attachMovie("Ruta", name, this.level++);
var e = eval (name);
e._x = this.gc.margin_left + (col * this.gc.tileWidth);
e._y = this.gc.margin_top + (row * this.gc.tileHeight);
if (evenRow) {
e._x = (this.gc.margin_left + this.gc.tileDisplacement) + (col * this.gc.tileWidth);
}
e.rowId = row;
e.colId = col;
var letterData = this.gameData.getNextLetterData();
e.theLetter.text = letterData.letter;
if (letterData.letter.length > 1) {
var tf = new TextFormat();
tf.size = 25;
e.theLetter.setTextFormat(tf);
} else {
var tf = new TextFormat();
tf.size = 32;
e.theLetter.setTextFormat(tf);
}
newRow.push(e);
e.letterData = letterData;
e.theScore.text = letterData.score;
e.setType("n");
e.letterData.type = e.type;
e.tileManager = this;
col++;
}
row++;
}
fscommand ("gameStart");
this.introSound.start();
this.unlock();
};
};
WordLink = function () {
this.loadData = true;
this.waitForData = function () {
var o = new Object();
o.myParent = this;
o.onEvent = function () {
if (((_level0.gameData != undefined) && (_level0.gameData != null)) && (_level0.gameData != "")) {
_level0.theI18n = new I18n();
_level0.gameDataObj = new GameDataObj();
_level0.gameDataObj.parseGameData(_level0.gameData);
_level0.tileMan = new TileManager();
_level0.tileMan.initialize(_level0.gameDataObj);
this.myParent.setTexts();
_level0.startSplash._visible = true;
_level0.startSplash.startTimer = new Object();
_level0.startSplash.startTimer.secs = 15;
_level0.startSplash.startTimer.onEvent2 = function () {
if (this.secs == 0) {
_level0.startSplash._visible = false;
clearInterval(_level0.startTimerController);
_level0.wordlink.startUpGame();
} else {
_level0.startSplash.lblTimeCount.text = this.secs;
this.secs--;
}
};
_level0.startTimerController = setInterval(_level0.startSplash.startTimer, "onEvent2", 1000);
clearInterval(o.myParent.tmrWaitData);
}
};
this.tmrWaitData = setInterval(o, "onEvent", 5);
};
this.setTexts = function () {
_level0.txtSubmitButton.text = _level0.theI18n.getLabel("submit");
_level0.txtTimeLeftLabel.text = _level0.theI18n.getLabel("time_left");
_level0.txtTimeLeftLabelShadow.text = _level0.theI18n.getLabel("time_left");
_level0.txtScramble.text = _level0.theI18n.getLabel("scramble");
_level0.txtEndGame.text = _level0.theI18n.getLabel("end_game");
if (relax) {
_level0.txtTimeLeft._visible = false;
_level0.txtTimeLeftShadow._visible = false;
_level0.txtTimeLeftLabel._visible = false;
_level0.txtTimeLeftLabelShadow._visible = false;
}
_level0.startSplash.lblTitle.text = _level0.theI18n.getLabel("i_title");
_level0.startSplash.lblLanguage.text = _level0.theI18n.getLabel("i_language");
_level0.startSplash.lblText1.text = _level0.theI18n.getLabel("i_text1");
_level0.startSplash.lblText2.text = _level0.theI18n.getLabel("i_text2");
_level0.startSplash.lblText3.text = _level0.theI18n.getLabel("i_text3");
_level0.startSplash.lblText4.text = _level0.theI18n.getLabel("i_text4");
_level0.startSplash.lblTime.text = _level0.theI18n.getLabel("i_time");
_level0.startSplash.lblButton.text = _level0.theI18n.getLabel("i_button");
};
this.startUpGame = function () {
clearInterval(_level0.startTimerController);
_level0.startSplash._visible = false;
_level0.gameTimer = new GameTimer();
_level0.gameTimer.initialize(_level0.gameDataObj.timelimit);
_level0.gameTimer.start();
_level0.tileMan.createTiles();
var _local1 = new EnterListener();
Key.addListener(_local1);
};
};
EnterListener = function () {
this.onKeyUp = function () {
if (Key.getCode() == 13) {
if (_level0.tileMan.locked) {
return(undefined);
}
_level0.tileMan.resetSelectedTiles();
}
};
};
GameTimer = function () {
this.seconds = 300;
this.secondSound = new Sound();
this.secondSound.attachSound("second");
this.initialize = function (s) {
this.seconds = s;
this.limit = s;
};
this.displayTime = function () {
var _local4 = Math.floor((getTimer() - this.startTime) / 1000);
this.seconds = this.limit - _local4;
var _local2 = this.seconds / 60;
_local2 = Math.floor(_local2);
var _local3 = this.seconds - (_local2 * 60);
if (this.seconds < 10) {
this.secondSound.start();
}
if (_local3 < 10) {
_local3 = "0" + _local3;
}
if (relax) {
var _local5 = Math.floor((getTimer() - relaxTimer) / 1000);
if (_local5 >= RELAX_END_SEC) {
_level0.tileMan.gameOver();
if (!_level0.tileMan.locked) {
_level0.tileMan.gameOver();
this.stop();
}
}
} else {
_level0.txtTimeLeft.text = (_local2 + ":") + _local3;
_level0.txtTimeLeftShadow.text = (_local2 + ":") + _local3;
}
};
this.start = function () {
this.startTime = getTimer();
this.tmr = setInterval(this, "updateEvent", 1000);
};
this.stop = function () {
clearInterval(this.tmr);
};
this.updateEvent = function () {
var _local2 = Math.floor((getTimer() - this.startTime) / 1000);
if (_local2 > this.limit) {
if (relax == false) {
_level0.tileMan.gameOver();
this.stop();
}
} else {
this.displayTime();
}
};
};
#endinitclip
Symbol 42 MovieClip [Ruta] Frame 1
stop();
Symbol 42 MovieClip [Ruta] Frame 2
stop();
Symbol 42 MovieClip [Ruta] Frame 3
stop();
Symbol 42 MovieClip [Ruta] Frame 4
stop();
Symbol 42 MovieClip [Ruta] Frame 5
stop();
Symbol 42 MovieClip [Ruta] Frame 6
stop();
Symbol 42 MovieClip [Ruta] Frame 7
stop();
Symbol 80 MovieClip Frame 10
stop();
Symbol 81 MovieClip [LogoDisplayer] Frame 1
redBonusInfo._visible = false;
stop();
Symbol 81 MovieClip [LogoDisplayer] Frame 19
this.redBonusInfo._visible = false;
this.goldBonusInfo._visible = false;
this.levelInfo._visible = false;
this.gameoverInfo._visible = false;
if (_level0.showRedBonus) {
this.redBonusInfo.lblRedBonusTitle.text = _level0.theI18n.getLabel("bonus_title");
this.redBonusInfo.lblRedBonusDetails.text = _level0.theI18n.getLabel("bonus_detail");
this.redBonusInfo._visible = true;
_level0.showRedBonus = false;
} else if (_level0.showGoldBonus) {
this.goldBonusInfo.lblGoldBonusTitle.text = _level0.theI18n.getLabel("super_bonus_title");
this.goldBonusInfo.lblGoldBonusDetails.text = _level0.theI18n.getLabel("super_bonus_detail");
this.goldBonusInfo._visible = true;
_level0.showGoldBonus = false;
} else if (_level0.showLevel) {
this.levelInfo._visible = true;
this.levelInfo.txtLevelText.text = _level0.theI18n.getLabel("new_level");
this.levelInfo.txtLevel.text = _level0.tileMan.levelNumber;
_level0.showLevel = false;
} else if (_level0.showGameOver) {
this.gameoverInfo._visible = true;
this.gameoverInfo.lblTitle.text = _level0.theI18n.getLabel("game_over");
this.gameoverInfo.lblDetails.text = _level0.theI18n.getLabel("please_wait");
this.gameoverInfo.gotoAndPlay(1);
}
stop();
Symbol 81 MovieClip [LogoDisplayer] Frame 25
if (_level0.showGameOver) {
stop();
}
this.redBonusInfo._visible = false;
this.goldBonusInfo._visible = false;
this.levelInfo._visible = false;
this.gameoverInfo._visible = false;
Symbol 92 Button
on (release) {
if (!tileMan.locked) {
fscommand ("playData", "119=0");
tileMan.gameOver();
}
}
Symbol 100 Button
on (release) {
if (!tileMan.locked) {
tileMan.scramble();
}
}
Symbol 102 Button
on (release) {
if (!tileMan.locked) {
tileMan.resetSelectedTiles();
}
}
Symbol 107 Button
on (release) {
_level0.wordlink.startUpGame();
}