Frame 1
function startGame() {
if (_root.table_mc != undefined) {
_root.table_mc.removeMovieClip();
}
_root.attachMovie("table", "table_mc", _root.getNextHighestDepth());
_root.table_mc.swapDepths(_root.menu_mc.getDepth());
}
Stage.showMenu = false;
var onSound = true;
var sCh = new SoftChange();
status_mc.onEnterFrame = function () {
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
this.gotoAndStop(_local3);
this._parent.percents_mc.p1_txt.text = (this._parent.percents_mc.p2_txt.text = (this._parent.percents_mc.p3_txt.text = _local3 + "%"));
if (_local3 == 100) {
delete this.onEnterFrame;
_root.sCh.startChange(_root, 4);
}
};
Frame 2
stop();
Frame 4
startGame();
_root.createEmptyMovieClip("sounds_mc", _root.getNextHighestDepth());
var glblSound = new Sound(_root);
var sounds = new Object();
sounds.menuMove = new Sound(_root);
sounds.menuMove.attachSound("menuMove");
sounds.menuClick = new Sound(_root);
sounds.menuClick.attachSound("menuClick");
sounds.undo = new Sound(_root);
sounds.undo.attachSound("undo");
sounds.card_drop = new Sound(_root);
sounds.card_drop.attachSound("card_drop");
sounds.card_found = new Sound(_root);
sounds.card_found.attachSound("card_found");
sounds.card_take = new Sound(_root);
sounds.card_take.attachSound("card_take");
sounds.level_done = new Sound(_root);
sounds.level_done.attachSound("level_done");
_root.table_mc.setSounds(sounds);
_root.table_mc.setWonMC(_root.won_mc);
_root.gameInfo_mc._alpha = 0;
_root.noWay_mc.gotoAndStop(1);
Instance of Symbol 158 MovieClip "won_mc" in Frame 4
on (press) {
this.swapDepths(this.oldDepth);
_root.sCh.startChange(_root, 4);
_root.won_mc.gotoAndStop(1);
}
Instance of Symbol 183 MovieClip in Frame 4
on (release) {
getURL ("http://www.justfreegames.com?WT.mc_id=FlashSpider", "_blank");
}
Instance of Symbol 192 MovieClip in Frame 4
onClipEvent (enterFrame) {
if (!_root.onSound) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.onSound) {
_root.glblSound.setVolume(0);
this.gotoAndStop(2);
} else {
_root.glblSound.setVolume(100);
this.gotoAndStop(1);
}
_root.onSound = !_root.onSound;
}
Instance of Symbol 192 MovieClip in Frame 6
onClipEvent (enterFrame) {
if (!_root.onSound) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.onSound) {
_root.glblSound.setVolume(0);
this.gotoAndStop(2);
} else {
_root.glblSound.setVolume(100);
this.gotoAndStop(1);
}
_root.onSound = !_root.onSound;
}
Frame 7
_root.gameInfo_mc._alpha = 100;
_root.gameInfo_mc.moves_txt.text = 0;
_root.gameInfo_mc.time_txt.text = "00:00:00";
_root.table_mc.makeBase();
_root.table_mc.makeUpperReserve();
_root.table_mc.makeBottomReserve();
_root.table_mc.takeFromBottomReserveFirst(10);
Symbol 5 MovieClip Frame 1
stop();
Symbol 244 MovieClip [__Packages.SoftChange] Frame 0
class SoftChange
{
var Width, Height, color, maxFrame, endFrame;
function SoftChange () {
Width = Stage.width;
Height = Stage.height;
color = 16777215 /* 0xFFFFFF */;
maxFrame = 7;
endFrame = 7;
}
function startChange(mc_mc, changeFrame) {
mc_mc.change_mc.removeMovieClip();
mc_mc.createEmptyMovieClip("change_mc", mc_mc.getNextHighestDepth());
mc_mc.change_mc._alpha = 0;
drawRect(mc_mc.change_mc, Width, Height, color);
mc_mc.change_mc.onRollOver = function () {
this.useHandCursor = false;
};
mc_mc.change_mc.softChange = this;
mc_mc.change_mc.counter = 0;
mc_mc.change_mc.changeFrame = changeFrame;
mc_mc.change_mc.onEnterFrame = function () {
if (this.counter < this.softChange.maxFrame) {
this._alpha = this._alpha + (100 / this.softChange.maxFrame);
} else if (this.counter == this.softChange.maxFrame) {
this._alpha = 100;
this._parent.gotoAndStop(this.changeFrame);
} else if (this.counter < (this.softChange.maxFrame + this.softChange.endFrame)) {
this._alpha = this._alpha - (100 / this.softChange.endFrame);
} else if (this.counter == (this.softChange.maxFrame + this.softChange.endFrame)) {
this._alpha = 0;
this.removeMovieClip();
}
this.counter++;
};
}
function drawRect(mc_mc, W, H, color) {
mc_mc.moveTo(0, 0);
mc_mc.beginFill(color, 100);
mc_mc.lineTo(W, 0);
mc_mc.lineTo(W, H);
mc_mc.lineTo(0, H);
mc_mc.lineTo(0, 0);
mc_mc.endFill();
}
}
Symbol 245 MovieClip [__Packages.Card] Frame 0
class Card extends MovieClip
{
var oldX, oldY, coordsArray, coordsArrayInd, delay, newDepth, invertTime, createEmptyMovieClip, getNextHighestDepth, _width, _height, onEnterFrame, suit, val, isFree, isClosed, isBuisy, isInReserve, afterArray, table, animation;
function Card () {
super();
setSuit("");
setVal(-1);
setIsFree(false);
setIsClosed(true);
setIsInReserve(true);
setIsBuisy(false);
setAfterArray(new Array());
setTable(null);
oldX = (oldY = 0);
coordsArray = new Array();
coordsArrayInd = 0;
delay = 0;
newDepth = null;
invertTime = 10;
}
function showCard() {
var closed_mc = eval (this + ".closed_mc");
var opened_mc = eval (this + ".opened_mc");
if ((closed_mc == undefined) or (opened_mc == undefined)) {
return(undefined);
}
closed_mc._visible = false;
opened_mc._visible = true;
setIsClosed(false);
}
function invertCard(_Delay, _W, _H) {
var _local2 = createEmptyMovieClip("invert_mc", getNextHighestDepth());
var _local3;
if (_Delay == undefined) {
_local3 = 0;
} else {
_local3 = _Delay;
}
_local2._visible = false;
if ((_W == undefined) || (_H == undefined)) {
drawRect(_local2, _width, _height, 16777215);
} else {
drawRect(_local2, _W, _H, 16777215);
}
_local2.blendMode = 10;
_local2.invertTime = invertTime;
_local2.waiting = _local3;
_local2.onEnterFrame = function () {
this.waiting--;
if (this.waiting > 0) {
return(undefined);
}
this._visible = true;
this.invertTime--;
if (this.invertTime == 0) {
this.removeMovieClip();
}
};
}
function hideCard() {
var closed_mc = eval (this + ".closed_mc");
var opened_mc = eval (this + ".opened_mc");
if ((closed_mc == undefined) or (opened_mc == undefined)) {
return(undefined);
}
closed_mc._visible = true;
opened_mc._visible = false;
}
function moveCard(coordsArray, delay, notShow) {
delete onEnterFrame;
this.coordsArray = coordsArray;
coordsArrayInd = 0;
this.delay = delay;
onEnterFrame = function () {
if (this.delay >= 0) {
this.delay--;
return(undefined);
}
if (this.delay == -1) {
this.delay--;
if ((!notShow) || (notShow == undefined)) {
this.showCard();
}
}
if ((this.dropSound.position == 0) || (this.dropSound.position == this.dropSound.duration)) {
this.dropSound.start(0, 1);
}
this._x = this.coordsArray[this.coordsArrayInd];
this._y = this.coordsArray[this.coordsArrayInd + 1];
this._rotation = this.coordsArray[this.coordsArrayInd + 2];
this.coordsArrayInd = this.coordsArrayInd + 3;
if (this.coordsArray[this.coordsArrayInd] == undefined) {
delete this.onEnterFrame;
delete this.coordsArray;
delete this.coordsArrayInd;
delete this.delay;
this.swapDepths(this.newDepth);
this.getTable().numbOfAnimatedCards--;
}
};
}
function getSuit() {
return(suit);
}
function setSuit(_Suit) {
suit = _Suit;
}
function getVal() {
return(val);
}
function setVal(_Val) {
val = _Val;
}
function getIsFree() {
return(isFree);
}
function setIsFree(_IsFree) {
isFree = _IsFree;
}
function getIsClosed() {
return(isClosed);
}
function setIsClosed(_IsClosed) {
isClosed = _IsClosed;
}
function getIsBuisy() {
return(isBuisy);
}
function setIsBuisy(_IsBuisy) {
isBuisy = _IsBuisy;
}
function getIsInReserve() {
return(isInReserve);
}
function setIsInReserve(_IsInReserve) {
isInReserve = _IsInReserve;
}
function getAfterArray() {
return(afterArray);
}
function setAfterArray(_AfterArray) {
afterArray = _AfterArray;
}
function getTable() {
return(table);
}
function setTable(_Table) {
table = _Table;
}
function getAnimation() {
return(animation);
}
function setAnimation(_Animation) {
animation = _Animation;
}
function drawRect(mc_mc, W, H, color) {
mc_mc.moveTo(0, 0);
mc_mc.beginFill(color, 100);
mc_mc.lineTo(W, 0);
mc_mc.lineTo(W, H);
mc_mc.lineTo(0, H);
mc_mc.lineTo(0, 0);
mc_mc.endFill();
}
}
Symbol 246 MovieClip [__Packages.Table] Frame 0
class Table extends MovieClip
{
var fps, moves, isMadeUndo;
function Table (_Options, _Root, _Linkages) {
super();
setOptions(_Options, _Root, _Linkages);
}
function setOptions(_Options, _Root, _Linkages) {
options = new Object();
for (var _local3 in _Options) {
options[_local3] = _Options[_local3];
}
if (options.numbOfColumns == undefined) {
options.numbOfColumns = 10;
}
if (options.numbOfBottomColumns == undefined) {
options.numbOfBottomColumns = 6;
}
if (options.numbOfHomeColumns == undefined) {
options.numbOfHomeColumns = 8;
}
if (options.homePlaces == undefined) {
options.homePlaces = new Array(options.numbOfHomeColumns);
}
if (options.homeColumns == undefined) {
options.homeColumns = new Array(options.numbOfHomeColumns);
}
if (options.columns == undefined) {
options.columns = new Array(options.numbOfColumns);
var _local3 = 0;
while (_local3 < options.columns.length) {
options.columns[_local3] = new Array();
_local3++;
}
}
if (options.upperReserveNumbs == undefined) {
options.upperReserveNumbs = new Array(options.numbOfColumns);
var _local3 = 0;
while (_local3 < options.upperReserveNumbs.length) {
if (_local3 <= 3) {
options.upperReserveNumbs[_local3] = 5;
} else {
options.upperReserveNumbs[_local3] = 4;
}
_local3++;
}
}
if (options.bottomColumns == undefined) {
options.bottomColumns = new Array(options.numbOfBottomColumns);
var _local3 = 0;
while (_local3 < options.bottomColumns.length) {
options.bottomColumns[_local3] = new Array();
_local3++;
}
}
if (options.bottomReserveNumbs == undefined) {
options.bottomReserveNumbs = new Array(options.numbOfBottomColumns);
var _local3 = 0;
while (_local3 < options.bottomReserveNumbs.length) {
options.bottomReserveNumbs[_local3] = 10;
_local3++;
}
}
if (options.curX == undefined) {
options.curX = 17;
}
if (options.curY == undefined) {
options.curY = 15;
}
if (options.cardsScale == undefined) {
options.cardsScale = 42;
}
if (options.upCard == undefined) {
options.upCard = 3;
}
if (options.DXClosed == undefined) {
options.DXClosed = 2;
}
if (options.DXClosedTop == undefined) {
options.DXClosedTop = 3;
}
if (options.DXHome == undefined) {
options.XHome = [69, 61, 53, 47, 39, 31, 23, 15];
}
if (options.DYClosed == undefined) {
options.DYClosed = 3;
}
if (options.DYOpened == undefined) {
options.DYOpened = 11;
}
if (options.animationSpeed == undefined) {
options.animationSpeed = 45;
}
if (options.removeSpeed == undefined) {
options.removeSpeed = 20;
}
if (options.animationDelay == undefined) {
options.animationDelay = 3;
}
if (_Root == undefined) {
root = this;
} else {
root = _Root;
}
if (_Root == undefined) {
root = this;
} else {
root = _Root;
}
linkages = new Object();
for (var _local3 in _Linkages) {
linkages[_local3] = _Linkages[_local3];
}
if (linkages.card == undefined) {
linkages.card = "card";
}
if (linkages.bg == undefined) {
linkages.bg = "bg";
}
if (linkages.back == undefined) {
linkages.back = "back";
}
if (linkages.empty == undefined) {
linkages.empty = "emptyWSuits";
}
if (linkages.emptyBottom == undefined) {
linkages.emptyBottom = "emptyBottom";
}
if (linkages.emptyHome == undefined) {
linkages.emptyHome = "empty";
}
if (linkages.logo == undefined) {
linkages.logo = "logo";
}
if (linkages.diamonds == undefined) {
linkages.diamonds = new Array();
var _local3 = 0;
while (_local3 < 13) {
linkages.diamonds[_local3] = "d" + _local3;
_local3++;
}
}
if (linkages.clubs == undefined) {
linkages.clubs = new Array();
var _local3 = 0;
while (_local3 < 13) {
linkages.clubs[_local3] = "c" + _local3;
_local3++;
}
}
if (linkages.spades == undefined) {
linkages.spades = new Array();
var _local3 = 0;
while (_local3 < 13) {
linkages.spades[_local3] = "s" + _local3;
_local3++;
}
}
if (linkages.hearts == undefined) {
linkages.hearts = new Array();
var _local3 = 0;
while (_local3 < 13) {
linkages.hearts[_local3] = "h" + _local3;
_local3++;
}
}
if (getDificulty() == null) {
setDificulty(2);
}
numbOfAnimatedCards = 0;
animation = new LinearAnimation();
sounds = new Object();
backUp = new Array();
noWayMC = _root.noWay_mc;
noWayMC.mc_mc.info_txt.embedFonts = true;
noWayMC.mc_mc.info_txt.text = "Press mouse button to start playing";
noWayMC.stop();
noWayMC._alpha = 0;
fps = 25;
moves = -1;
gameInfoMC = _root.gameInfo_mc;
isMadeUndo = true;
}
function makeBase() {
var _local8 = null;
var _local13 = null;
var _local9 = options.numbOfColumns;
var _local11 = root.attachMovie(linkages.empty, "startPlace_mc", root.getNextHighestDepth());
var _local12 = _local11._width;
var _local14 = _local11._height;
var _local7 = options.curX;
var _local10 = options.curY;
_local11.removeMovieClip();
_local13 = _local9 * _local12;
_local8 = options.DXClosedTop;
var _local6 = root.createEmptyMovieClip("cards_mc", root.getNextHighestDepth());
var _local2 = null;
var _local4 = 0;
var _local5 = 0;
var _local3 = 0;
while (_local3 < _local9) {
_local2 = _local6.attachMovie(linkages.card, ("startPlace" + _local4) + "_mc", _local5);
_local2.attachMovie(linkages.empty, "place_mc", _local2.getNextHighestDepth());
_local2.startPlace = true;
_local2.isBuisy = false;
_local5 = _local5 + 104;
_local2._x = _local7;
_local2._y = _local10;
_local7 = _local7 + (_local8 + _local2._width);
options.columns[_local4][0] = _local2;
_local4++;
_local3++;
}
_local2 = _local6.attachMovie(linkages.emptyBottom, "startPlaceBottom_mc", _local5);
_local2._x = _local7 - (_local8 + _local2._width);
_local2._y = (Stage.height - (options.curY / 1.5)) - _local2._height;
_local4 = 0;
_local5 = _local5 + 104;
_local3 = 0;
while (_local3 < options.numbOfHomeColumns) {
_local2 = _local6.attachMovie(linkages.emptyHome, ("startPlaceHome" + _local4) + "_mc", _local5);
options.homePlaces[_local3] = _local2;
_local2.isBuisy = false;
_local5 = _local5 + 104;
_local2._x = options.XHome[_local3];
_local2._y = (Stage.height - (options.curY / 1.5)) - _local2._height;
_local4++;
_local3++;
}
}
function makeUpperReserve() {
var _local17 = null;
var _local16 = null;
var _local14 = options.numbOfColumns;
var _local13 = options.upperReserveNumbs;
var _local15 = options.columns;
var _local11 = null;
var _local9 = null;
var _local12 = root.cards_mc;
var _local2 = null;
var _local7 = null;
var _local5 = null;
var _local10 = 0;
var _local8 = null;
var _local6 = getLinkArray();
var _local4 = 0;
while (_local4 < _local14) {
_local11 = _local15[_local4][0]._x;
_local8 = options.columns[_local4][0].getDepth() + 1;
options.columns[_local4][0].isBuisy = true;
var _local3 = 1;
while (_local3 <= _local13[_local4]) {
_local9 = options.curY + (options.DYClosed * (_local3 - 1));
_local2 = _local12.attachMovie(linkages.card, ("card" + _local10) + "_mc", _local8);
_local2.createEmptyMovieClip("shadow_mc", _local2.getNextHighestDepth());
_local5 = _local2.attachMovie(_local6[0], "opened_mc", _local2.getNextHighestDepth());
_local5._xscale = (_local5._yscale = options.cardsScale);
_local5._visible = false;
_local7 = _local2.attachMovie(linkages.back, "closed_mc", _local2.getNextHighestDepth());
drawRect(_local2.shadow_mc, 0, 0, _local7._width, _local7._height, 0, 70);
_local2.shadow_mc._visible = false;
_local2.useHandCursor = false;
_local2.setSuit(_local6[0].substr(0, 1));
_local2.setVal(Number(_local6[0].substring(1)));
_local6.shift();
options.columns[_local4][_local3] = _local2;
_local2._x = _local11;
_local2._y = _local9;
_local10++;
_local8++;
_local2.setTable(this);
_local2.onPress = function () {
this.getTable().pressCard(this);
};
_local3++;
}
_local4++;
}
}
function makeBottomReserve() {
var D = null;
var numbOfBottomColumns = options.numbOfBottomColumns;
var bottomReserveNumbs = options.bottomReserveNumbs;
var tmpArray = new Array();
var cardsArray = options.columns;
var placeW = cardsArray[0][0]._width;
var placeH = cardsArray[0][0]._height;
var cards_mc = root.cards_mc;
var curCard_mc = null;
var closed_mc = null;
var opened_mc = null;
var curX = cards_mc.startPlaceBottom_mc._x;
var curY = cards_mc.startPlaceBottom_mc._y;
var counter = -1;
var depth = (cards_mc.startPlaceBottom_mc.getDepth() + 1);
do {
counter++;
curCard_mc = eval (((cards_mc + ".card") + counter) + "_mc");
} while (curCard_mc != undefined);
var linkArray = getLinkArray();
var pressInReserve = null;
var i = 0;
while (i < numbOfBottomColumns) {
var j = 0;
while (j < bottomReserveNumbs[i]) {
curCard_mc = cards_mc.attachMovie(linkages.card, ("card" + counter) + "_mc", depth);
curCard_mc.createEmptyMovieClip("shadow_mc", curCard_mc.getNextHighestDepth());
tmpArray.push(curCard_mc);
opened_mc = curCard_mc.attachMovie(linkArray[0], "opened_mc", curCard_mc.getNextHighestDepth());
opened_mc._xscale = (opened_mc._yscale = options.cardsScale);
opened_mc._visible = false;
closed_mc = curCard_mc.attachMovie(linkages.back, "closed_mc", curCard_mc.getNextHighestDepth());
curCard_mc.shadow_mc._visible = false;
drawRect(curCard_mc.shadow_mc, 0, 0, closed_mc._width, closed_mc._height, 0, 70);
curCard_mc.useHandCursor = false;
curCard_mc.setSuit(linkArray[0].substr(0, 1));
curCard_mc.setVal(Number(linkArray[0].substring(1)));
linkArray.shift();
options.bottomColumns[i][j] = curCard_mc;
curCard_mc._x = curX;
curCard_mc._y = curY;
counter++;
depth++;
curCard_mc.setTable(this);
curCard_mc.onPress = function () {
this.getTable().pressCard(this);
};
if (i == (numbOfBottomColumns - 1)) {
curCard_mc.setIsFree(true);
}
if (j == Math.round(bottomReserveNumbs[i] / 2)) {
curX = curX - options.DXClosed;
}
j++;
}
curX = curX - options.DXClosed;
i++;
}
}
function takeFromBottomReserveFirst(_Delay) {
var _local3;
var _local6 = options.columns;
var _local5 = new Array();
var _local16 = 0;
var _local21 = 0;
var _local8 = 0;
_local8 = Math.max(_local8, -Infinity);
var _local4 = 0;
while (_local4 < _local6.length) {
_local8 = Math.max(_local8, _local6[_local4].length);
_local4++;
}
var _local7;
_local4 = 1;
while (_local4 < _local8) {
var _local2 = 0;
while (_local2 < _local6.length) {
_local3 = _local6[_local2][_local4];
if (_local3 == undefined) {
if (_local7 == undefined) {
_local7 = _local4 - 1;
}
break;
}
_local5.push(_local3);
_local16++;
_local2++;
}
_local4++;
}
_local5.reverse();
if (_Delay != undefined) {
takeFromBottomReserve(_local7, (_local5.length * options.animationDelay) + _Delay, true);
} else {
takeFromBottomReserve(_local7, _local5.length * options.animationDelay, true);
}
var _local19 = options.bottomColumns[options.bottomColumns.length - 1][0]._x;
var _local18 = options.bottomColumns[options.bottomColumns.length - 1][0]._y;
_local4 = 0;
while (_local4 < _local5.length) {
_local3 = _local5[_local4];
_local3.oldX = _local3._x;
_local3.oldY = _local3._y;
_local3.oldDepth = _local3.getDepth();
_local3._x = _local19 - (options.DXClosed * 2);
_local3._y = _local18;
_local3.swapDepths(_local3._parent.getNextHighestDepth());
_local4++;
}
_local5.reverse();
var _local11;
var _local10;
var _local12;
var _local9;
var _local15 = null;
if (_Delay == undefined) {
var _local13 = 0;
} else {
var _local13 = _Delay;
}
var _local14 = null;
_local4 = 0;
while (_local4 < _local5.length) {
_local3 = _local5[_local4];
_local11 = _local3._x;
_local10 = _local3._y;
_local12 = _local3.oldX;
_local9 = _local3.oldY;
_local14 = Math.ceil(Math.abs(Math.pow(Math.pow(_local12 - _local11, 2) + Math.pow(_local9 - _local10, 2), 0.5)) / options.animationSpeed);
_local3.newDepth = _local3.oldDepth;
delete _local3.oldX;
delete _local3.oldY;
delete _local3.oldDepth;
animation.setAnimationType(2);
_local15 = animation.getPointsArray(_local11, _local10, _local12, _local9, _local14);
if ((_local4 % 2) != 0) {
_local3.dropSound = sounds.card_drop;
}
_local3.moveCard(_local15, _local13, true);
var _local13 = _local13 + options.animationDelay;
numbOfAnimatedCards++;
_local4++;
}
var _local17 = _local3._parent.createEmptyMovieClip("forBreak_mc", _local3._parent.getNextHighestDepth());
drawRect(_local17, 0, 0, Stage.width, Stage.height, 16777215, 0);
_local17.useHandCursor = false;
_local17.cardsArray = options.columns;
_local17.table = this;
_local17.waiting = 2;
_local17.onPress = function () {
var _local3;
var _local4 = 0;
while (_local4 < this.cardsArray.length) {
var _local2 = 0;
while (_local2 < this.cardsArray[_local4].length) {
_local3 = this.cardsArray[_local4][_local2];
_local3.coordsArrayInd = _local3.coordsArray.length - 3;
_local3.delay = 0;
_local2++;
}
_local4++;
}
this.table.numbOfAnimatedCards = 0;
};
_local17.onEnterFrame = function () {
if ((this.table.numbOfAnimatedCards <= 0) && (this.waiting > 0)) {
this.waiting--;
return(undefined);
}
if (this.table.numbOfAnimatedCards <= 0) {
this.table.backUpFunction();
this.table.numbOfAnimatedCards = 0;
this.table.startGameInfo();
this.removeMovieClip();
}
};
gameInfoMC._alpha = 0;
noWayMC._alpha = 100;
noWayMC.play();
}
function takeFromBottomReserve(startPosition, startDelay, isFirst) {
if (numbOfAnimatedCards > 0) {
return(undefined);
}
if (startPosition == undefined) {
startPosition = 0;
}
var _local11 = options.bottomReserveNumbs;
var _local8 = options.bottomColumns[options.bottomColumns.length - 1];
var _local3 = options.columns;
var _local13;
var _local12;
var _local14;
var _local9;
var _local20 = null;
if (startDelay == undefined) {
var _local18 = 0;
} else {
var _local18 = startDelay;
}
var _local2 = startPosition;
var _local19 = null;
var _local10 = _local11[_local11.length - 1] - 1;
while (_local10 >= 0) {
_local13 = _local8[_local10]._x;
_local12 = _local8[_local10]._y;
_local14 = _local3[_local2][_local3[_local2].length - 1]._x;
if (_local3[_local2].length == 1) {
_local9 = _local3[_local2][_local3[_local2].length - 1]._y;
} else if (_local3[_local2][_local3[_local2].length - 1].getIsClosed()) {
_local9 = _local3[_local2][_local3[_local2].length - 1]._y + options.DYClosed;
} else {
_local9 = _local3[_local2][_local3[_local2].length - 1]._y + options.DYOpened;
}
_local8[_local10].newDepth = _local3[_local2][_local3[_local2].length - 1].getDepth() + 1;
var _local6 = _local3[_local2][_local3[_local2].length - 1];
var _local7 = null;
var _local5 = _local8[_local10];
var _local15 = _local6.getVal() - _local5.getVal();
var _local16 = _local6.getSuit() == _local5.getSuit();
var _local17 = _local6.getIsInReserve();
if (((_local15 != 1) || (!_local16)) && (!_local17)) {
_local6.setIsFree(false);
var _local4 = _local3[_local2].length - 1;
while (_local4 >= 0) {
_local7 = _local3[_local2][_local4];
_local7.setIsFree(false);
_local4--;
}
}
_local3[_local2].push(_local5);
_local19 = Math.ceil(Math.abs(Math.pow(Math.pow(_local14 - _local13, 2) + Math.pow(_local9 - _local12, 2), 0.5)) / options.animationSpeed);
animation.setAnimationType(2);
_local20 = animation.getPointsArray(_local13, _local12, _local14, _local9, _local19);
_local5.setIsInReserve(false);
if ((_local10 % 2) != 0) {
_local5.dropSound = sounds.card_drop;
}
_local5.moveCard(_local20, _local18);
var _local18 = _local18 + options.animationDelay;
numbOfAnimatedCards++;
_local2++;
if (_local2 > (_local3.length - 1)) {
_local2 = 0;
}
_local10--;
}
if (!isFirst) {
_local5._parent.waitingForBackUp_mc.removeMovieClip();
var _local21 = _local5._parent.createEmptyMovieClip("waitingForBackUp_mc", _local5._parent.getNextHighestDepth());
_local21.waiting = _local18;
_local21.table = this;
_local21.onEnterFrame = function () {
if (this.waiting > 0) {
this.waiting--;
return(undefined);
}
if (this.table.numbOfAnimatedCards <= 0) {
if (!this.table.checkColumns()) {
this.table.backUpFunction();
}
this.removeMovieClip();
}
};
}
options.numbOfBottomColumns--;
options.bottomColumns.pop();
_local8 = options.bottomColumns[options.bottomColumns.length - 1];
_local10 = _local11[_local11.length - 1] - 1;
while (_local10 >= 0) {
_local8[_local10].setIsFree(true);
_local10--;
}
}
function pressCard(_Card_mc) {
if (numbOfAnimatedCards > 0) {
return(undefined);
}
var card_mc = _Card_mc;
var _local20 = card_mc.getTable();
var _local2 = card_mc.getTable().options.columns;
if (!card_mc.getIsFree()) {
return(undefined);
}
if (card_mc.getIsFree() && (card_mc.getIsInReserve())) {
_local20.takeFromBottomReserve();
} else if (card_mc.getIsFree() && (!card_mc.getIsInReserve())) {
sounds.card_take.start(0, 1);
card_mc.opened_mc._x = card_mc.opened_mc._x - card_mc.getTable().options.upCard;
card_mc.opened_mc._y = card_mc.opened_mc._y - card_mc.getTable().options.upCard;
card_mc.shadow_mc._visible = true;
delete card_mc.onMouseMove;
card_mc.Dx = card_mc._xmouse;
card_mc.Dy = card_mc._ymouse;
card_mc.oldX = card_mc._x;
card_mc.oldY = card_mc._y;
card_mc.oldDepth = card_mc.getDepth();
card_mc.swapDepths(card_mc._parent.getNextHighestDepth());
var afterArray = new Array();
var _local19 = false;
var _local5 = 0;
while (_local5 < _local2.length) {
var _local7 = 0;
while (_local7 < _local2[_local5].length) {
if (_local2[_local5][_local7] == card_mc) {
var _local9 = _local7 + 1;
while (_local9 < _local2[_local5].length) {
afterArray.push(_local2[_local5][_local9]);
_local2[_local5][_local9].opened_mc._x = _local2[_local5][_local9].opened_mc._x - card_mc.getTable().options.upCard;
_local2[_local5][_local9].opened_mc._y = _local2[_local5][_local9].opened_mc._y - card_mc.getTable().options.upCard;
_local2[_local5][_local9].shadow_mc._visible = true;
_local9++;
}
_local19 = true;
break;
}
_local7++;
}
if (_local19) {
break;
}
_local5++;
}
if (afterArray.length > 0) {
var _local15 = null;
var _local17 = 0;
while (_local17 < afterArray.length) {
_local15 = afterArray[_local17];
_local15.Dx = _local15._xmouse;
_local15.Dy = _local15._ymouse;
_local15.oldX = _local15._x;
_local15.oldY = _local15._y;
_local15.oldDepth = _local15.getDepth();
_local15.swapDepths(_local15._parent.getNextHighestDepth());
_local17++;
}
card_mc.afterArray = afterArray;
} else {
delete card_mc.afterArray;
}
card_mc.onMouseMove = function () {
this._x = this._parent._xmouse - this.Dx;
this._y = this._parent._ymouse - this.Dy;
var _local2 = null;
var _local3 = 0;
while (_local3 < this.afterArray.length) {
_local2 = this.afterArray[_local3];
_local2._x = _local2._parent._xmouse - _local2.Dx;
_local2._y = _local2._parent._ymouse - _local2.Dy;
_local3++;
}
updateAfterEvent();
};
card_mc.onRelease = (card_mc.onReleaseOutside = function () {
if (!card_mc.getIsFree()) {
return(undefined);
}
this.getTable().sounds.card_drop.start(0, 1);
card_mc.opened_mc._x = card_mc.opened_mc._x + card_mc.getTable().options.upCard;
card_mc.opened_mc._y = card_mc.opened_mc._y + card_mc.getTable().options.upCard;
card_mc.shadow_mc._visible = false;
var _local2 = this.getTable().options.columns;
var _local4 = null;
var _local18 = null;
var _local17 = false;
var _local16 = 0;
while (_local16 < _local2.length) {
var _local15 = 0;
while (_local15 < _local2[_local16].length) {
_local4 = _local2[_local16][_local15];
if (((_local4.getIsInReserve() || (!_local4.getIsFree())) || (_local4 == this)) && (!_local4.startPlace)) {
} else {
_local17 = _local4.hitTest(this);
if (_local17 && (((!_local4.getIsBuisy()) && ((_local4.getVal() - this.getVal()) == 1)) || (_local4.startPlace && (!_local4.isBuisy)))) {
var _local5 = 0;
while (_local5 < _local2.length) {
var _local7 = 0;
while (_local7 < _local2[_local5].length) {
if (_local2[_local5][_local7] == this) {
if (_local2[_local5][_local7 - 1].getIsInReserve()) {
_local2[_local5][_local7 - 1].setIsInReserve(false);
}
if (!_local2[_local5][_local7 - 1].getIsFree()) {
_local2[_local5][_local7 - 1].setIsFree(true);
var _local6 = _local2[_local5][_local7 - 1];
var _local3 = _local2[_local5][_local7 - 2];
var _local10 = _local3.getVal() - _local6.getVal();
var _local11 = _local3.getSuit() == _local6.getSuit();
var _local9 = _local7 - 2;
while (((_local3 != undefined) && (_local10 == 1)) && _local11) {
_local3.setIsFree(true);
_local6 = _local3;
_local9--;
_local3 = _local2[_local5][_local9];
_local10 = _local3.getVal() - _local6.getVal();
_local11 = _local3.getSuit() == _local6.getSuit();
}
}
if ((_local7 - 1) == 0) {
_local2[_local5][_local7 - 1].isBuisy = false;
} else {
if (_local2[_local5][_local7 - 1].getIsClosed()) {
_local2[_local5][_local7 - 1].setIsClosed(false);
_local2[_local5][_local7 - 1].showCard();
}
if (_local2[_local5][_local7 - 1].getIsBuisy()) {
_local2[_local5][_local7 - 1].setIsBuisy(false);
}
}
if (this.afterArray.length > 0) {
_local2[_local5].splice(_local7, 1 + this.afterArray.length);
} else {
_local2[_local5].splice(_local7, 1);
}
}
_local7++;
}
_local5++;
}
_local5 = 0;
while (_local5 < _local2.length) {
var _local7 = 0;
while (_local7 < _local2[_local5].length) {
if (_local2[_local5][_local7] == _local4) {
if ((this.getSuit() != _local4.getSuit()) && (_local7 > 0)) {
var _local8 = _local7;
while (_local8 > 0) {
_local2[_local5][_local8].setIsFree(false);
_local8--;
}
}
_local2[_local5].push(this);
var _local14 = null;
var _local13 = 0;
while (_local13 < this.afterArray.length) {
_local14 = this.afterArray[_local13];
_local2[_local5].push(_local14);
_local14.opened_mc._x = _local14.opened_mc._x + _local14.getTable().options.upCard;
_local14.opened_mc._y = _local14.opened_mc._y + _local14.getTable().options.upCard;
_local14.shadow_mc._visible = false;
_local13++;
}
}
_local7++;
}
_local5++;
}
_local4.setIsBuisy(true);
this._x = _local4._x;
if (!_local4.startPlace) {
this._y = _local4._y + this.getTable().options.DYOpened;
} else {
this._y = _local4._y;
_local4.isBuisy = true;
}
this.swapDepths(_local4.getDepth() + 1);
var _local14 = null;
var _local12 = this;
var _local13 = 0;
while (_local13 < this.afterArray.length) {
_local14 = this.afterArray[_local13];
_local14._x = _local12._x;
_local14._y = _local12._y + _local14.getTable().options.DYOpened;
_local14.swapDepths(_local12.getDepth() + 1);
_local12 = _local14;
_local13++;
}
delete this.onMouseMove;
this.afterArray = [];
if (!this.getTable().checkColumns()) {
this.getTable().checkCards();
this.getTable().backUpFunction();
}
return(undefined);
}
}
_local15++;
}
_local16++;
}
this.swapDepths(this.oldDepth);
this._x = this.oldX;
this._y = this.oldY;
this.getTable().checkCards();
delete this.onMouseMove;
var _local14 = null;
_local16 = 0;
while (_local16 < this.afterArray.length) {
_local14 = this.afterArray[_local16];
_local14.swapDepths(_local14.oldDepth);
_local14._x = _local14.oldX;
_local14._y = _local14.oldY;
_local14.opened_mc._x = _local14.opened_mc._x + _local14.getTable().options.upCard;
_local14.opened_mc._y = _local14.opened_mc._y + _local14.getTable().options.upCard;
_local14.shadow_mc._visible = false;
_local14.getTable().checkCards();
_local16++;
}
});
}
}
function checkColumns() {
var _local8 = null;
var _local11 = null;
var _local5 = new Array();
var _local22 = 0;
var _local23 = false;
var _local13 = 0;
while (_local13 < options.columns.length) {
_local5 = [options.columns[_local13][options.columns[_local13].length - 1]];
var _local12 = options.columns[_local13].length - 1;
while (_local12 > 1) {
_local8 = options.columns[_local13][_local12];
_local11 = options.columns[_local13][_local12 - 1];
if (_local11.getIsInReserve() || (_local11.getIsClosed())) {
break;
}
if (((_local11.getVal() - _local8.getVal()) == 1) && (_local11.getSuit() == _local8.getSuit())) {
_local5.push(_local11);
if (_local5.length == 13) {
sounds.card_found.start(0, 1);
var _local17;
var _local15;
var _local18;
var _local14;
var _local7 = -1;
var _local20 = new Array();
do {
_local7++;
} while (options.homePlaces[_local7].isBuisy);
options.homeColumns[_local7] = new Array();
options.homeColumns[_local7] = _local5;
var _local19 = options.homePlaces[_local7].getDepth() + 1;
var _local10 = null;
var _local6 = 0;
while (_local6 < _local5.length) {
_local17 = _local5[_local6]._x;
_local15 = _local5[_local6]._y;
_local18 = options.homePlaces[_local7]._x;
_local14 = options.homePlaces[_local7]._y;
options.homePlaces[_local7].isBuisy = true;
animation.setAnimationType(1);
if (_local10 == null) {
_local10 = Math.ceil(Math.abs(Math.pow(Math.pow(_local18 - _local17, 2) + Math.pow(_local14 - _local15, 2), 0.5)) / options.removeSpeed);
}
_local20 = animation.getPointsArray(_local17, _local15, _local18, _local14, _local10);
_local5[_local6].newDepth = _local19;
_local5[_local6].swapDepths(_local5[_local6]._parent.getNextHighestDepth());
_local19++;
_local5[_local6].setIsFree(false);
delete _local5[_local6].dropSound;
_local5[_local6].moveCard(_local20, _local22);
_local22 = _local22 + options.animationDelay;
numbOfAnimatedCards++;
_local6++;
}
if (_local7 == (options.homePlaces.length - 1)) {
UWon();
}
var _local16 = false;
var _local2 = 0;
while (_local2 < options.columns.length) {
var _local4 = 0;
while (_local4 < options.columns[_local2].length) {
_local8 = options.columns[_local2][_local4];
if (_local8 == _local5[_local5.length - 1]) {
options.columns[_local2].splice(_local4, 13);
_local16 = true;
if ((_local4 - 1) == 0) {
options.columns[_local2][_local4 - 1].isBuisy = false;
} else {
var _local9 = options.columns[_local2][_local4 - 1].getSuit();
options.columns[_local2][_local4 - 1].setIsClosed(false);
options.columns[_local2][_local4 - 1].showCard();
options.columns[_local2][_local4 - 1].setIsBuisy(false);
options.columns[_local2][_local4 - 1].setIsFree(true);
options.columns[_local2][_local4 - 1].setIsInReserve(false);
var _local3 = _local4 - 1;
while (_local3 > 2) {
if (options.columns[_local2][_local3].getIsInReserve() || (options.columns[_local2][_local3].getSuit() != _local9)) {
break;
}
options.columns[_local2][_local3].setIsClosed(false);
options.columns[_local2][_local3].showCard();
options.columns[_local2][_local3].setIsBuisy(false);
options.columns[_local2][_local3].setIsFree(true);
options.columns[_local2][_local3].setIsInReserve(false);
if (((!options.columns[_local2][_local3 - 1].getIsInReserve()) && (options.columns[_local2][_local3 - 1].getSuit() == _local9)) && ((options.columns[_local2][_local3 - 1].getVal() - options.columns[_local2][_local3].getVal()) == 1)) {
options.columns[_local2][_local3 - 1].setIsBuisy(true);
options.columns[_local2][_local3 - 1].setIsFree(true);
options.columns[_local2][_local3 - 1].setIsInReserve(false);
} else {
break;
}
_local3 = _local3 - 2;
}
}
break;
}
_local4++;
}
if (_local16) {
break;
}
_local2++;
}
_local8._parent.waitingForBackUp_mc.removeMovieClip();
var _local21 = _local8._parent.createEmptyMovieClip("waitingForBackUp_mc", _local8._parent.getNextHighestDepth());
_local21.waiting = _local10 + options.animationDelay;
_local21.table = this;
_local21.onEnterFrame = function () {
if ((this.table.numbOfAnimatedCards <= 0) && (this.waiting > 0)) {
this.waiting--;
return(undefined);
}
if (this.table.numbOfAnimatedCards <= 0) {
this.table.checkCards();
this.table.numbOfAnimatedCards = 0;
this.table.backUpFunction();
this.removeMovieClip();
}
};
_local23 = true;
}
} else {
break;
}
_local12--;
}
_local13++;
}
return(_local23);
}
function UWon() {
root.wonList_mc.removeMovieClip();
var _local2 = root.createEmptyMovieClip("wonList_mc", root.getNextHighestDepth());
_local2.table = this;
_local2.noWayMC = noWayMC;
_local2.gameInfoMC = gameInfoMC;
_local2.onEnterFrame = function () {
if (this.table.numbOfAnimatedCards == 0) {
this.table.sounds.level_done.start(0, 1);
this.table.won_mc._visible = true;
this.table.won_mc._alpha = 100;
this.table.won_mc.oldDepth = this.table.won_mc.getDepth();
this.table.won_mc.swapDepths(this.table.won_mc._parent.getNextHighestDepth());
this.noWayMC._alpha = 0;
delete this.gameInfoMC.onEnterFrame;
this.removeMovieClip();
}
};
}
function getDificulty() {
return(dificulty);
}
function setDificulty(_Dificulty) {
dificulty = _Dificulty;
}
function getSounds() {
return(sounds);
}
function setSounds(_Sounds) {
sounds = _Sounds;
}
function getWonMC() {
return(won_mc);
}
function setWonMC(_WonMC) {
won_mc = _WonMC;
won_mc._visible = false;
}
function makeLinkArray() {
var _local2 = new Array();
switch (getDificulty()) {
case 1 :
_local2 = _local2.concat(linkages.spades, linkages.spades, linkages.spades, linkages.spades, linkages.spades, linkages.spades, linkages.spades, linkages.spades);
break;
case 2 :
_local2 = _local2.concat(linkages.spades, linkages.hearts, linkages.spades, linkages.hearts, linkages.spades, linkages.hearts, linkages.spades, linkages.hearts);
break;
case 3 :
_local2 = _local2.concat(linkages.spades, linkages.hearts, linkages.diamonds, linkages.clubs, linkages.spades, linkages.hearts, linkages.diamonds, linkages.clubs);
}
_local2 = shuffleArray(_local2);
_local2 = shuffleArray(_local2);
setLinkArray(shuffleArray(_local2));
}
function getLinkArray() {
return(linkArray);
}
function setLinkArray(_LinkArray) {
linkArray = _LinkArray;
}
function shuffleArray(_Array) {
if ((_Array == undefined) or (_Array.length == 0)) {
return(undefined);
}
var _local2 = _Array;
var _local3 = new Array(_local2.length);
var _local4 = _local2.length;
var _local6 = _local3.length;
var _local5 = null;
var _local1 = null;
do {
do {
_local1 = Math.round((_local6 - 1) * Math.random());
} while (_local3[_local1] != undefined);
_local5 = Math.round((_local4 - 1) * Math.random());
_local3[_local1] = _local2[_local5];
_local2.splice(_local5, 1);
_local4 = _local2.length;
} while (_local4 > 0);
return(_local3);
}
function drawRect(mc_mc, x0, y0, W, H, color, alpha) {
mc_mc.moveTo(x0, y0);
mc_mc.beginFill(color, alpha);
mc_mc.lineTo(x0 + W, y0);
mc_mc.lineTo(x0 + W, y0 + H);
mc_mc.lineTo(x0, y0 + H);
mc_mc.lineTo(x0, x0);
mc_mc.endFill();
}
function backUpFunction() {
var _local7 = new Object();
var _local3 = new Array();
var _local6 = new Array();
var _local10 = options.columns;
var _local9 = options.bottomColumns;
var _local8 = options.homeColumns;
for (var _local2 in options) {
if (typeof(options[_local2]) == "object") {
_local7[_local2] = new Array();
switch (typeof(options[_local2][0])) {
case "object" :
var _local5 = 0;
while (_local5 < options[_local2].length) {
_local7[_local2][_local5] = new Array();
var _local4 = 0;
while (_local4 < options[_local2][_local5].length) {
_local7[_local2][_local5][_local4] = options[_local2][_local5][_local4];
_local4++;
}
_local5++;
}
break;
case "undefined" :
continue;//outer level
default :
_local5 = 0;
for(;;){
if (_local5 >= options[_local2].length) {
break;
}
_local7[_local2][_local5] = options[_local2][_local5];
_local5++;
};
}
} else {
_local7[_local2] = options[_local2];
}
}
var _local2 = 0;
while (_local2 < _local10.length) {
var _local5 = 1;
while (_local5 < _local10[_local2].length) {
_local3.push(_local10[_local2][_local5]);
_local5++;
}
_local2++;
}
_local2 = 0;
while (_local2 < _local9.length) {
var _local5 = 0;
while (_local5 < _local9[_local2].length) {
_local3.push(_local9[_local2][_local5]);
_local5++;
}
_local2++;
}
_local2 = 0;
while (_local2 < _local8.length) {
var _local5 = 0;
while (_local5 < _local8[_local2].length) {
_local3.push(_local8[_local2][_local5]);
_local5++;
}
_local2++;
}
_local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2] == undefined) {
_local3.splice(Number(_local2));
}
_local2++;
}
_local2 = 0;
while (_local2 < _local3.length) {
_local6[_local2] = new Array();
_local6[_local2][0] = _local3[_local2]._name;
_local6[_local2][1] = _local3[_local2]._x;
_local6[_local2][2] = _local3[_local2]._y;
_local6[_local2][3] = _local3[_local2].getDepth();
_local6[_local2][4] = _local3[_local2].getIsFree();
_local6[_local2][5] = _local3[_local2].getIsClosed();
_local6[_local2][6] = _local3[_local2].getIsInReserve();
_local6[_local2][7] = _local3[_local2].getIsBuisy();
_local2++;
}
backUp[backUp.length] = new Array();
backUp[backUp.length - 1][0] = _local7;
backUp[backUp.length - 1][1] = _local6;
checkMoves();
moves++;
gameInfoMC.moves_txt.text = moves;
}
function undo(_CardsMC) {
if (((backUp.length < 2) || (numbOfAnimatedCards > 0)) || (!isMadeUndo)) {
return(undefined);
}
isMadeUndo = false;
backUp.pop();
var optionsBU = backUp[backUp.length - 1][0];
var cardsInfo = backUp[backUp.length - 1][1];
var cardsArray = new Array();
for (var i in optionsBU) {
if (typeof(optionsBU[i]) == "object") {
options[i] = new Array();
switch (typeof(optionsBU[i][0])) {
case "object" :
var j = 0;
while (j < optionsBU[i].length) {
options[i][j] = new Array();
var k = 0;
while (k < optionsBU[i][j].length) {
options[i][j][k] = optionsBU[i][j][k];
k++;
}
j++;
}
break;
case "undefined" :
continue;//outer level
default :
var j = 0;
for(;;){
if (j >= optionsBU[i].length) {
break;
}
options[i][j] = optionsBU[i][j];
j++;
};
}
} else {
options[i] = optionsBU[i];
}
}
var columns = options.columns;
var bottomColumns = options.bottomColumns;
var homeColumns = options.homeColumns;
var homePlaces = options.homePlaces;
var i = 0;
while (i < columns.length) {
var j = 1;
while (j < columns[i].length) {
cardsArray.push(columns[i][j]);
j++;
}
if (columns[i].length == 1) {
columns[i][0].isBuisy = false;
} else {
columns[i][0].isBuisy = true;
}
i++;
}
var i = 0;
while (i < bottomColumns.length) {
var j = 0;
while (j < bottomColumns[i].length) {
cardsArray.push(bottomColumns[i][j]);
j++;
}
i++;
}
var i = 0;
while (i < homeColumns.length) {
cardsArray.push(homeColumns[i]);
i++;
}
var i = 0;
while (i < homePlaces.length) {
if (homePlaces[i].isBuisy && (homeColumns[i].length == undefined)) {
homePlaces[i].isBuisy = false;
}
i++;
}
var i = 0;
while (i < cardsArray.length) {
if (cardsArray[i] == undefined) {
cardsArray.splice(Number(i));
}
i++;
}
var curCard_mc;
var i = 0;
while (i < cardsArray.length) {
curCard_mc = eval ((_CardsMC + ".") + cardsInfo[i][0]);
curCard_mc._x = cardsInfo[i][1];
curCard_mc._y = cardsInfo[i][2];
curCard_mc.opened_mc._x = (curCard_mc.opened_mc._y = 0);
curCard_mc.swapDepths(cardsInfo[i][3]);
curCard_mc.setIsFree(cardsInfo[i][4]);
curCard_mc.setIsClosed(cardsInfo[i][5]);
curCard_mc.setIsInReserve(cardsInfo[i][6]);
curCard_mc.setIsBuisy(cardsInfo[i][7]);
curCard_mc.oldX = (curCard_mc.oldY = (curCard_mc.coordsArrayInd = (curCard_mc.delay = 0)));
curCard_mc.coordsArray = [];
if (curCard_mc.getIsInReserve()) {
curCard_mc.hideCard();
}
i++;
}
checkMoves();
checkCards();
numbOfAnimatedCards = 0;
isMadeUndo = true;
}
function checkMoves() {
var _local3 = options.columns;
var _local5;
var _local8;
var _local4;
var _local9;
var _local11;
var _local10;
var _local14 = new Array();
var _local13 = new Array();
var _local6 = false;
var _local7 = 0;
while (_local7 < _local3.length) {
if (_local3[_local7].length == 1) {
} else {
_local5 = _local3[_local7].length - 1;
_local4 = _local3[_local7][_local5];
while ((_local4.getIsFree() && (!_local4.getIsInReserve())) && (!_local4.getIsClosed())) {
_local5--;
_local4 = _local3[_local7][_local5];
}
_local5++;
_local4 = _local3[_local7][_local5];
_local11 = _local4.getVal();
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local2 == _local7) {
} else {
if ((_local3[_local2].length == 1) || (_local2 == _local7)) {
_local6 = true;
break;
}
_local8 = _local3[_local2].length - 1;
_local9 = _local3[_local2][_local8];
_local10 = _local9.getVal();
if ((_local10 - _local11) == 1) {
_local6 = true;
break;
}
}
_local2++;
}
if (_local6) {
break;
}
}
_local7++;
}
var _local12 = true;
_local7 = 0;
while (_local7 < options.homePlaces.length) {
_local12 = options.homePlaces[_local7].isBuisy;
if (!_local12) {
break;
}
_local7++;
}
if (((!_local6) && (options.bottomColumns.length == 0)) && (!_local12)) {
gameInfoMC._alpha = 0;
noWayMC.mc_mc.info_txt.text = "No More Moves";
noWayMC._alpha = 100;
noWayMC.play();
} else {
gameInfoMC._alpha = 100;
noWayMC.gotoAndStop(1);
noWayMC._alpha = 0;
}
}
function hint() {
if (numbOfAnimatedCards > 0) {
return(undefined);
}
var _local2 = options.columns;
var _local7;
var _local11;
var _local4;
var _local8;
var _local15;
var _local14;
var _local9 = new Array();
var _local12 = new Array();
var _local13 = false;
var _local5 = 0;
while (_local5 < _local2.length) {
if (_local2[_local5].length == 1) {
} else {
_local7 = _local2[_local5].length - 1;
_local4 = _local2[_local5][_local7];
while ((_local4.getIsFree() && (!_local4.getIsInReserve())) && (!_local4.getIsClosed())) {
_local7--;
_local4 = _local2[_local5][_local7];
}
_local7++;
_local4 = _local2[_local5][_local7];
_local15 = _local4.getVal();
var _local3 = 0;
while (_local3 < _local2.length) {
if (_local3 == _local5) {
} else {
if ((_local2[_local3].length == 1) || (_local3 == _local5)) {
_local2[_local3][0].invertCard(0, _local2[_local3][0]._width - 2.5, _local2[_local3][0]._height - 2.5);
_local13 = true;
break;
}
_local11 = _local2[_local3].length - 1;
_local8 = _local2[_local3][_local11];
_local14 = _local8.getVal();
if ((_local14 - _local15) == 1) {
_local13 = true;
while (_local4 != undefined) {
_local9.push(_local4);
_local7++;
_local4 = _local2[_local5][_local7];
}
while (_local8 != undefined) {
_local12.push(_local8);
_local11++;
_local8 = _local2[_local3][_local11];
}
var _local10;
var _local6 = 0;
while (_local6 < _local9.length) {
_local9[_local6].invertCard();
if (_local10 == undefined) {
_local10 = _local9[_local6].invertTime;
}
_local6++;
}
_local6 = 0;
while (_local6 < _local12.length) {
_local12[_local6].invertCard(_local10);
_local6++;
}
break;
}
}
_local3++;
}
if (_local13) {
break;
}
}
_local5++;
}
if ((!_local13) && (options.bottomColumns.length > 0)) {
options.bottomColumns[options.bottomColumns.length - 1][options.bottomColumns[options.bottomColumns.length - 1].length - 1].invertCard();
}
}
function startGameInfo() {
var _local2 = gameInfoMC;
_local2.FPS = fps;
_local2.counter = 0;
_local2.sec = 0;
_local2.mins = 0;
_local2.hrs = 0;
delete _local2.onEnterFrame;
_local2.onEnterFrame = function () {
this.counter++;
if (this.counter == this.FPS) {
this.counter = 0;
this.sec++;
if (this.sec == 60) {
this.sec = 0;
this.mins++;
}
if (this.mins == 60) {
this.mins = 0;
this.hrs++;
}
this.time_txt.text = "";
if (String(this.hrs).length == 1) {
this.time_txt.text = ("0" + this.hrs) + ":";
} else {
this.time_txt.text = this.hrs + ":";
}
if (String(this.mins).length == 1) {
this.time_txt.text = this.time_txt.text + (("0" + this.mins) + ":");
} else {
this.time_txt.text = this.time_txt.text + (this.mins + ":");
}
if (String(this.sec).length == 1) {
this.time_txt.text = this.time_txt.text + ("0" + this.sec);
} else {
this.time_txt.text = this.time_txt.text + this.sec;
}
}
};
}
function checkCards() {
var _local7 = options.columns;
var _local2;
var _local3;
var _local8;
var _local9;
var _local6;
var _local5 = 0;
while (_local5 < _local7.length) {
var _local4 = 0;
while (_local4 < _local7[_local5].length) {
_local2 = _local7[_local5][_local4];
_local3 = _local7[_local5][_local4 + 1];
if (_local7[_local5].length == 1) {
_local2.isBuisy = false;
} else if (_local4 == 0) {
_local2.isBuisy = true;
_local9 = _local2._x;
_local6 = _local2._y;
_local8 = _local2.getDepth() + 1;
} else {
_local2.swapDepths(_local8);
_local8++;
_local2._x = _local9;
_local2._y = _local6;
_local2.opened_mc._x = _local2.shadow_mc._x;
_local2.opened_mc._y = _local2.shadow_mc._y;
_local2.shadow_mc._visible = false;
if ((_local3.getIsInReserve() && (_local3 != undefined)) && (_local2.getIsInReserve())) {
_local6 = _local6 + options.DYClosed;
} else if (((!_local3.getIsInReserve()) && (_local3 != undefined)) && (_local2.getIsInReserve())) {
_local6 = _local6 + options.DYClosed;
} else if (((!_local3.getIsInReserve()) && (_local3 != undefined)) && (!_local2.getIsInReserve())) {
_local6 = _local6 + options.DYOpened;
}
}
_local4++;
}
_local5++;
}
}
var options = null;
var root = null;
var linkages = null;
var linkArray = null;
var dificulty = null;
var numbOfAnimatedCards = null;
var animation = null;
var sounds = null;
var won_mc = null;
var backUp = null;
var noWayMC = null;
var gameInfoMC = null;
}
Symbol 247 MovieClip [__Packages.LinearAnimation] Frame 0
class LinearAnimation
{
function LinearAnimation (_ID) {
animationType = _ID;
}
function getPointsArray(x0, y0, xE, yE, numbOfFrames) {
var _local22 = xE - x0;
var _local21 = yE - y0;
var _local6 = null;
var _local5 = null;
var _local8;
var _local17;
var _local15;
var _local13;
var _local7;
var _local16;
var _local14;
var _local12;
var _local9;
var _local20;
var _local19;
var _local18;
var _local11 = x0;
var _local10 = y0;
var _local3 = new Array();
switch (getAnimationType()) {
case 1 :
_local6 = _local22 / numbOfFrames;
_local5 = _local21 / numbOfFrames;
var _local2 = 0;
while (_local2 < ((numbOfFrames * 3) - 3)) {
_local3[_local2] = _local11 + _local6;
_local3[_local2 + 1] = _local10 + _local5;
_local11 = _local11 + _local6;
_local10 = _local10 + _local5;
_local2 = _local2 + 3;
}
_local3[_local2] = xE;
_local3[_local2 + 1] = yE;
_local3[_local2 + 2] = 0;
break;
case 2 :
_local8 = 0;
_local17 = x0;
_local15 = _local22;
_local13 = numbOfFrames;
_local7 = 0;
_local16 = y0;
_local14 = _local21;
_local12 = numbOfFrames;
_local9 = 0;
_local20 = 0;
_local19 = -720;
_local18 = numbOfFrames;
_local2 = 0;
for(;;){
if (_local2 > (numbOfFrames * 3)) {
break;
}
_local3[_local2] = easeOutQuart(_local8, _local17, _local15, _local13);
_local3[_local2 + 1] = easeOutQuart(_local7, _local16, _local14, _local12);
_local3[_local2 + 2] = easeOutQuart(_local9, _local20, _local19, _local18);
_local8++;
_local7++;
_local9++;
_local2 = _local2 + 3;
};
}
return(_local3);
}
function animateMovie(mc_mc, coordsArray) {
mc_mc.ind = 0;
mc_mc.coordsArray = coordsArray;
delete mc_mc.onEnterFrame;
mc_mc.onEnterFrame = function () {
if (this.coordsArray[this.ind] == undefined) {
delete this.onEnterFrame;
delete this.coordsArray;
delete this.ind;
}
this._x = this.coordsArray[this.ind];
this._y = this.coordsArray[this.ind + 1];
this.ind = this.ind + 2;
};
}
function setAnimationType(_ID) {
animationType = _ID;
}
function getAnimationType() {
return(animationType);
}
function easeOutQuart(t, b, c, d) {
t = (t / d) - 1;
return(((-c) * ((((t * t) * t) * t) - 1)) + b);
}
var animationType = null;
var animatedMovies = null;
}
Symbol 17 Button
on (release) {
getURL ("http://www.justfreegames.com", "_blank");
}
Symbol 152 MovieClip Frame 1
stop();
Symbol 153 MovieClip [table] Frame 1
#initclip 6
Object.registerClass("table", Table);
#endinitclip
Symbol 154 MovieClip [card] Frame 1
#initclip 5
Object.registerClass("card", Card);
#endinitclip
Symbol 170 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.sCh.startChange(_root, 5);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 175 Button
on (release) {
_root.sounds.menuClick.start(0, 1);
getURL ("http://www.justfreegames.com/justfreegames_game_index_card.php?WT.mc_id=FlashSpider", "_blank");
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 180 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.sCh.startChange(_root, 6);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 192 MovieClip Frame 1
stop();
Symbol 204 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.sCh.startChange(_root, 4);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 212 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.table_mc.setDificulty(1);
_root.table_mc.makeLinkArray();
_root.sCh.startChange(_root, 7);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 219 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.table_mc.setDificulty(3);
_root.table_mc.makeLinkArray();
_root.sCh.startChange(_root, 7);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 225 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.table_mc.setDificulty(2);
_root.table_mc.makeLinkArray();
_root.sCh.startChange(_root, 7);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 233 Button
on (press) {
_root.sounds.menuClick.start(0, 1);
_root.sCh.startChange(_root, 4);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 238 Button
on (press) {
_root.table_mc.undo(_root.table_mc.cards_mc);
_root.sounds.undo.start(0, 1);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}
Symbol 243 Button
on (press) {
_root.table_mc.hint();
_root.sounds.undo.start(0, 1);
}
on (rollOver) {
_root.sounds.menuMove.start(0, 1);
}