Frame 1
com.xitex.crgame.CRConfig.__get__instance().fps = 50;
var cookie_rookie_app = (new com.xitex.crgame.CRApplication(this));
Symbol 744 MovieClip Frame 40
stop();
Symbol 854 MovieClip Frame 15
stop();
Symbol 888 MovieClip [__Packages.com.xitex.crgame.CRApplication] Frame 0
class com.xitex.crgame.CRApplication
{
var _container, _game, _gameData;
function CRApplication (prmContainer) {
_container = prmContainer;
_game = new com.xitex.crgame.CRGame(prmContainer);
init();
}
function init() {
createAndInitGameData();
}
function createAndInitGameData() {
_gameData = new com.xitex.crgame.proxy.CRGameData(_root);
_gameData.addEventListener(com.xitex.crgame.events.CREvent.UPDATE, mx.utils.Delegate.create(this, startGame));
_gameData.listen();
}
function startGame() {
_game.setConfig(_gameData.__get__seed(), _gameData.__get__timeLimit(), _gameData.__get__openVersion(), _gameData.relaxMode);
_game.localize(_gameData);
_game.turnLevels(_gameData.__get__source().firstChild.childNodes[1]);
_game.start();
}
}
Symbol 889 MovieClip [__Packages.com.xitex.crgame.CRGame] Frame 0
class com.xitex.crgame.CRGame
{
var _container, _seed, _relaxMode, _openVersion, _prng, _timer, _gameFlow, _introForm, _levelCompleteForm, _lossGameForm, _winGameForm, _mainForm, _openVersionForm, _soundButton, _exitButton, _noMovesAnim, _libraryLevels, _levels, _proxyCommander, _cookies, _cookieFormation, _cookieDeck, _formAnimator, _cookieStack, _score, _traceForm, _logic, _cookieScoreAnimator, _dealAnim, _cookieMovingAnim, _pastryBonus, _spiderAnim, _fallingAnimator, _complete10LevelsAnim;
function CRGame (prmContainer) {
mx.events.EventDispatcher.initialize(this);
_container = prmContainer;
_container._visible = true;
init();
}
function setConfig(prmSeed, prmTimelimit, prmOpenVersion, prmRelaxMode) {
_seed = prmSeed;
_relaxMode = prmRelaxMode;
_openVersion = prmOpenVersion;
trace("seed: " + _seed);
_prng.seed(_seed);
_timer.relaxMode = _relaxMode;
_timer.__set__timeLimit(prmTimelimit);
_gameFlow.__set__openVersion(_openVersion);
}
function localize(prmCRGameData) {
_introForm.localize(prmCRGameData.__get__localeStrings().intro_countdown_text, prmCRGameData.__get__localeStrings().intro_text_1, prmCRGameData.__get__localeStrings().intro_text_2);
_levelCompleteForm.localize(prmCRGameData.__get__localeStrings().level_complete_countdown_text, prmCRGameData.__get__localeStrings().level_complete_title, prmCRGameData.__get__localeStrings().result_cur_score_title, prmCRGameData.__get__localeStrings().result_jar_bonus_title, prmCRGameData.__get__localeStrings().result_pastry_bonus_title, prmCRGameData.__get__localeStrings().result_total_title);
_lossGameForm.localize(prmCRGameData.__get__localeStrings().game_end_countdown_text, prmCRGameData.__get__localeStrings().loss_game_title, prmCRGameData.__get__localeStrings().result_cur_score_title, prmCRGameData.__get__localeStrings().result_jar_bonus_title, prmCRGameData.__get__localeStrings().result_pastry_bonus_title, prmCRGameData.__get__localeStrings().result_total_title);
_winGameForm.localize(prmCRGameData.__get__localeStrings().game_end_countdown_text, prmCRGameData.__get__localeStrings().win_game_title, prmCRGameData.__get__localeStrings().result_cur_score_title, prmCRGameData.__get__localeStrings().result_jar_bonus_title, prmCRGameData.__get__localeStrings().result_pastry_bonus_title, prmCRGameData.__get__localeStrings().result_total_title);
_mainForm.localize(prmCRGameData.__get__localeStrings().main_level_title, prmCRGameData.__get__localeStrings().main_time_title, prmCRGameData.__get__localeStrings().main_score_title);
_openVersionForm.localize(prmCRGameData.__get__localeStrings().register_window_title);
_soundButton.localize(prmCRGameData.__get__localeStrings().sound_btn_title);
_exitButton.localize(prmCRGameData.__get__localeStrings().exit_btn_title);
_noMovesAnim.localize(prmCRGameData.__get__localeStrings().no_more_moves);
}
function turnLevels(prmConfig) {
_libraryLevels = new Array();
var _local18 = prmConfig.childNodes.length;
var _local4;
var _local6;
var _local5;
var _local2 = 0;
while (_local2 < _local18) {
_local6 = Number(prmConfig.childNodes[_local2].attributes.numTypeCookies);
_local5 = Number(prmConfig.childNodes[_local2].attributes.numTypes);
_local4 = prmConfig.childNodes[_local2].attributes.type;
_libraryLevels[_local2] = new com.xitex.crgame.CRLevel(_local2 + 1, _local4, com.xitex.crgame.CRConfig.__get__instance()["level" + Number(_local2 + 1)], _local6, _local5);
_local2++;
}
var _local10 = Number(prmConfig.attributes.numEasyLevels);
var _local12 = Number(prmConfig.attributes.numMediumLevels);
var _local8 = Number(prmConfig.attributes.numHardsLevels);
var _local7 = new Array();
var _local13 = new Array();
var _local11 = new Array();
var _local14 = _prng.getRandomSelection(com.xitex.crgame.CRLevel.__get__numEasyLevels(), _local10);
var _local15 = _prng.getRandomSelection(com.xitex.crgame.CRLevel.__get__numMediumLevels(), _local12);
var _local16 = _prng.getRandomSelection(com.xitex.crgame.CRLevel.__get__numHardLevels(), _local8);
_local2 = 0;
while (_local2 < _local10) {
_local7.push(_libraryLevels[_local14[_local2]]);
_local2++;
}
_local2 = 0;
while (_local2 < _local12) {
_local13.push(_libraryLevels[_local15[_local2] + com.xitex.crgame.CRLevel.__get__numEasyLevels()]);
_local2++;
}
_local2 = 0;
while (_local2 < _local8) {
_local11.push(_libraryLevels[(_local16[_local2] + com.xitex.crgame.CRLevel.__get__numEasyLevels()) + com.xitex.crgame.CRLevel.__get__numMediumLevels()]);
_local2++;
}
var _local9 = _local7.concat(_local13, _local11);
var _local17 = _local9.length;
_local2 = 0;
while (_local2 < _local17) {
_levels.push(_local9[_local2]);
_local2++;
}
}
function start() {
_proxyCommander.execStartGameComm();
_proxyCommander.execVersionComm(_GAME_VERSION);
_container._visible = true;
_gameFlow.startGame();
}
function init() {
com.xitex.crgame.utils.MCPlayer.__get__instance().__set__fps(com.xitex.crgame.CRConfig.__get__instance().fps);
com.xitex.crgame.utils.MCPlayer.__get__instance().__set__fps(com.xitex.crgame.CRConfig.__get__instance().fps);
createIntroForm();
createMainForm();
createLossGameForm();
createWinGameForm();
createLevelCompleteForm();
createOpenVersionForm();
createTraceForm();
createProxyCommander();
createPrng();
createCookies();
createDeck();
createNomovesAnim();
createFormationAnimator();
createSpiderAnimator();
createFallingAnimator();
createCookieFormation();
createCookieStack();
createPastryBonusAnimator();
createScore();
createTimer();
createCookieScoreAnim();
createDealAnim();
createCookieMovingAnimator();
createComplete10LevelsAnim();
createExitButton();
createSoundButton();
createLogic();
createLevels();
createGameFlow();
}
function createPrng() {
_prng = new com.xitex.crgame.prng.Randomizer();
}
function createCookies() {
_cookies = new Array();
var _local3 = 0;
while (_local3 < _NUMBER_OF_TYPES) {
var _local2 = 0;
while (_local2 < _TYPE_LENGTH) {
_cookies.push(new com.xitex.crgame.cookie.CRCookie(_local3, _local2));
_local2++;
}
_local3++;
}
}
function createCookieFormation() {
_cookieFormation = new com.xitex.crgame.cookie.CRCookieFormation(_container.main, _cookieDeck, _formAnimator);
}
function createDeck() {
_cookieDeck = new com.xitex.crgame.cookie.CRDeck(_container.main, _cookies, _prng);
}
function createCookieStack() {
_cookieStack = new com.xitex.crgame.cookie.CRCookieStack(_container.main);
}
function createScore() {
_score = new com.xitex.crgame.ui.CRScore(_container.main);
}
function createTraceForm() {
_traceForm = new com.xitex.crgame.forms.CRTraceForm(_container);
}
function createLogic() {
_logic = new com.xitex.crgame.logic.CRLogic(_container, _cookies, _cookieDeck, _cookieStack, _cookieFormation, _score, _cookieScoreAnimator, _dealAnim, _cookieMovingAnim, _pastryBonus, _noMovesAnim, _proxyCommander);
}
function createLevels() {
_levels = new Array();
}
function createTimer() {
_timer = new com.xitex.crgame.ui.CRTimer(_container.main, 1000);
}
function createCookieScoreAnim() {
_cookieScoreAnimator = new com.xitex.crgame.anims.CRCookieScoreAnim(_container.main);
}
function createDealAnim() {
_dealAnim = new com.xitex.crgame.anims.CRDeckDealAnim(_cookieDeck);
}
function createFormationAnimator() {
_formAnimator = new com.xitex.crgame.anims.CRFormationAnim();
}
function createCookieMovingAnimator() {
_cookieMovingAnim = new com.xitex.crgame.anims.CRCookieMovingAnim(_container.main);
}
function createPastryBonusAnimator() {
_pastryBonus = new com.xitex.crgame.ui.CRPastryBonus(_container.main, _container, _proxyCommander);
}
function createSpiderAnimator() {
_spiderAnim = new com.xitex.crgame.anims.CRSpiderAnim(_container.main);
}
function createFallingAnimator() {
_fallingAnimator = new com.xitex.crgame.anims.CREndFallingAnim(_container.loss_game_form);
}
function createGameFlow() {
_gameFlow = new com.xitex.crgame.CRGameFlow(_container);
_gameFlow.__set__cookieDeck(_cookieDeck);
_gameFlow.__set__cookieFormation(_cookieFormation);
_gameFlow.__set__cookieStack(_cookieStack);
_gameFlow.__set__deckDealAnim(_dealAnim);
_gameFlow.__set__logic(_logic);
_gameFlow.__set__score(_score);
_gameFlow.__set__levels(_levels);
_gameFlow.__set__cookies(_cookies);
_gameFlow.__set__formationAnimator(_formAnimator);
_gameFlow.__set__introForm(_introForm);
_gameFlow.__set__mainForm(_mainForm);
_gameFlow.__set__levelCompleteForm(_levelCompleteForm);
_gameFlow.__set__timer(_timer);
_gameFlow.__set__pastryBonusAnim(_pastryBonus);
_gameFlow.__set__noMovesAnim(_noMovesAnim);
_gameFlow.__set__lossGameForm(_lossGameForm);
_gameFlow.__set__winGameForm(_winGameForm);
_gameFlow.__set__spiderAnimator(_spiderAnim);
_gameFlow.__set__fallingAnimator(_fallingAnimator);
_gameFlow.__set__proxyCommander(_proxyCommander);
_gameFlow.__set__complete10LevelsAnim(_complete10LevelsAnim);
_gameFlow.__set__exitButton(_exitButton);
_gameFlow.__set__soundButton(_soundButton);
_gameFlow.__set__openVersionForm(_openVersionForm);
}
function createIntroForm() {
_introForm = new com.xitex.crgame.forms.CRIntroForm(_container);
}
function createMainForm() {
_mainForm = new com.xitex.crgame.forms.CRMainForm(_container);
}
function createLossGameForm() {
_lossGameForm = new com.xitex.crgame.forms.CRLossGameForm(_container);
}
function createWinGameForm() {
_winGameForm = new com.xitex.crgame.forms.CRWinGameForm(_container);
}
function createLevelCompleteForm() {
_levelCompleteForm = new com.xitex.crgame.forms.CRLevelCompleteForm(_container);
}
function createOpenVersionForm() {
_openVersionForm = new com.xitex.crgame.forms.CROpenVersionForm(_container);
}
function createNomovesAnim() {
_noMovesAnim = new com.xitex.crgame.anims.CRNomovesAnim(_container.main);
}
function createComplete10LevelsAnim() {
_complete10LevelsAnim = new com.xitex.crgame.anims.CRBestBakerAnim(_container.win_game);
}
function createProxyCommander() {
_proxyCommander = new com.xitex.crgame.proxy.CRProxyCommander(_traceForm);
}
function createExitButton() {
_exitButton = new com.xitex.crgame.ui.CRExitButton(_container);
}
function createSoundButton() {
_soundButton = new com.xitex.crgame.ui.CRSoundButton(_container);
}
function get relaxMode() {
return(_relaxMode);
}
var _GAME_VERSION = "1.0";
var _NUMBER_OF_TYPES = 6;
var _TYPE_LENGTH = 10;
}
Symbol 890 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 891 MovieClip [__Packages.com.xitex.crgame.CRLevel] Frame 0
class com.xitex.crgame.CRLevel
{
var _id, _structure, _numTypeCookies, _numTypes, _typeID;
function CRLevel (prmID, prmType, prmStructure, prmNumTypeCookies, prmNumTypes) {
_id = prmID;
_structure = prmStructure;
_numTypeCookies = prmNumTypeCookies;
_numTypes = prmNumTypes;
_typeID = getTypeID(prmType);
}
function toString() {
return(((((((("{ id: " + _id) + ", typeID: ") + _typeID) + ", numTypeCookies: ") + _numTypeCookies) + ", numTypes: ") + _numTypes) + " }");
}
function getTypeID(prmType) {
var _local1;
switch (prmType) {
case EASY_TYPE :
_numEasyLevels = ++_numEasyLevels;
_local1 = 0;
break;
case MEDIUM_TYPE :
_local1 = 1;
_numMediumLevels = ++_numMediumLevels;
break;
case HARD_TYPE :
_numHardLevels = ++_numHardLevels;
_local1 = 2;
}
return(_local1);
}
function get structure() {
return(_structure);
}
function get numTypeCookies() {
return(_numTypeCookies);
}
function get numTypes() {
return(_numTypes);
}
function get typeID() {
return(_typeID);
}
static function get numEasyLevels() {
return(_numEasyLevels);
}
static function get numMediumLevels() {
return(_numMediumLevels);
}
static function get numHardLevels() {
return(_numHardLevels);
}
function get id() {
return(_id);
}
static var EASY_TYPE = "easy";
static var MEDIUM_TYPE = "medium";
static var HARD_TYPE = "hard";
static var _numEasyLevels = 0;
static var _numMediumLevels = 0;
static var _numHardLevels = 0;
}
Symbol 892 MovieClip [__Packages.com.xitex.crgame.CRConfig] Frame 0
class com.xitex.crgame.CRConfig
{
static var _instance;
function CRConfig () {
}
static function get instance() {
if (_instance == undefined) {
_instance = new com.xitex.crgame.CRConfig();
}
return(_instance);
}
var level1 = ["18;12,2;7,11;;0", "17;10,2;6,7,10,11;;0", "16;8,2;5,6,10;;0", "15;6,2;4,5;;0", "14;4,2;3,4,9;;0", "13;2,2;2,3,8,9;;0", "12;0,2;2,8;;0", "11;11,3;;18,17;0", "10;9,3;;17,16;0", "9;3,3;;14,13;0", "8;1,3;;13,12;0", "7;11,1;;18,17;0", "6;9,1;1;17,16;0", "5;7,1;1;16,15;0", "4;5,1;0;15,14;0", "3;3,1;0;14,13;0", "2;1,1;;13,12;0", "1;8,0;;6,5;0", "0;4,0;;4,3;0"];
var level2 = ["17;12,2;8;;0", "16;10,2;7,8,10;;0", "15;8,2;6,7,10;;0", "14;6,2;5,6;;0", "13;4,2;4,5,9;;0", "12;2,2;3,4,9;;0", "11;0,2;3;;0", "10;9,3;;16,15;0", "9;3,3;;13,12;0", "8;11,1;2;17,16;0", "7;9,1;2;16,15;0", "6;7,1;1;15,14;0", "5;5,1;1;14,13;0", "4;3,1;0;13,12;0", "3;1,1;0;12,11;0", "2;10,0;;8,7;0", "1;6,0;;6,5;0", "0;2,0;;4,3;0"];
var level3 = ["19;10,2;9,13,14;;0", "18;8,2;8,9,12,13;;0", "17;6,2;7,8,11,12;;0", "16;4,2;6,7,10,11;;0", "15;2,2;5,6,10;;0", "14;11,3;;19;0", "13;9,3;;19,18;0", "12;7,3;;18,17;0", "11;5,3;;17,16;0", "10;3,3;;16,15;0", "9;9,1;4;19,18;0", "8;7,1;3,4;18,17;0", "7;5,1;2,3;17,16;0", "6;3,1;1,2;16,15;0", "5;1,1;0,1;15;0", "4;8,0;;9,8;0", "3;6,0;;8,7;0", "2;4,0;;7,6;0", "1;2,0;;6,5;0", "0;0,0;;5;0"];
var level4 = ["19;11,3;12,13;;0", "18;9,3;11,12;;0", "17;7,3;10,11;;0", "16;5,3;9,10;;0", "15;3,3;8,9;;0", "14;1,3;7,8;;0", "13;12,2;5;19;0", "12;10,2;4,5;19,18;0", "11;8,2;3,4;18,17;0", "10;6,2;2,3;17,16;0", "9;4,2;1,2;16,15;0", "8;2,2;0,1;15,14;0", "7;0,2;0;14;0", "6;6,0;2,3;;0", "5;11,1;;13,12;0", "4;9,1;;12,11;0", "3;7,1;;11,10,6;0", "2;5,1;;10,9,6;0", "1;3,1;;9,8;0", "0;1,1;;8,7;0"];
var level5 = ["20;5,4;7,8;;0", "19;3,4;6,7;;0", "18;1,4;5,6;;0", "17;9,2;4,9;;0", "16;7,2;3,4,8,9;;0", "15;5,2;2,3,7,8;;0", "14;3,2;1,2,6,7;;0", "13;1,2;0,1,5,6;;0", "12;7,0;3,4;;0", "11;5,0;2,3;;0", "10;3,0;1,2;;0", "9;8,3;;17,16;0", "8;6,3;;20,16,15;0", "7;4,3;;20,19,15,14;0", "6;2,3;;19,18,14,13;0", "5;0,3;;18,13;0", "4;8,1;;17,16,12;0", "3;6,1;;16,15,12,11;0", "2;4,1;;15,14,11,10;0", "1;2,1;;14,13,10;0", "0;0,1;;13;0"];
var level6 = ["21;8,2;12,18;;0", "20;2,2;9,15;;0", "19;10,3;7;;0", "18;8,3;6,7;21;0", "17;6,3;6;;0", "16;4,3;5;;0", "15;2,3;4,5;20;0", "14;0,3;4;;0", "13;10,1;3;;0", "12;8,1;2,3;21;0", "11;6,1;2;;0", "10;4,1;1;;0", "9;2,1;0,1;20;0", "8;0,1;0;;0", "7;9,4;;19,18;0", "6;7,4;;18,17;0", "5;3,4;;16,15;0", "4;1,4;;15,14;0", "3;9,0;;13,12;0", "2;7,0;;12,11;0", "1;3,0;;10,9;0", "0;1,0;;9,8;0"];
var level7 = ["20;7,4;8,9,12;;0", "19;5,4;7,8,11,12;;0", "18;3,4;6,7,10,11;;0", "17;1,4;5,6,10;;0", "16;7,2;4,8,9;;0", "15;5,2;3,4,7,8;;0", "14;3,2;2,3,6,7;;0", "13;1,2;2,5,6;;0", "12;6,5;;20,19;0", "11;4,5;;19,18;0", "10;2,5;;18,17;0", "9;8,3;;20,16;0", "8;6,3;;20,19,16,15;0", "7;4,3;;19,18,15,14;0", "6;2,3;;18,17,14,13;0", "5;0,3;;17,13;0", "4;6,1;1;16,15;0", "3;4,1;0,1;15,14;0", "2;2,1;0;14,13;0", "1;5,0;;4,3;0", "0;3,0;;3,2;0"];
var level8 = ["24;11,3;8,9,12;;0", "23;9,3;7,8,12;;0", "22;7,3;6,7,11;;0", "21;5,3;5,6,11;;0", "20;3,3;4,5,10;;0", "19;1,3;3,4,10;;0", "18;11,1;2,8,9;;0", "17;9,1;2,7,8;;0", "16;7,1;1,6,7;;0", "15;5,1;1,5,6;;0", "14;3,1;0,4,5;;0", "13;1,1;0,3,4;;0", "12;10,4;;24,23;0", "11;6,4;;22,21;0", "10;2,4;;20,19;0", "9;12,2;;24,18;0", "8;10,2;;24,23,18,17;0", "7;8,2;;23,22,17,16;0", "6;6,2;;22,21,16,15;0", "5;4,2;;21,20,15,14;0", "4;2,2;;20,19,14,13;0", "3;0,2;;19,13;0", "2;10,0;;18,17;0", "1;6,0;;16,15;0", "0;2,0;;14,13;0"];
var level9 = ["24;10,2;14,15,20,21;;0", "23;6,2;12,13,18,19;;0", "22;2,2;10,11,16,17;;0", "21;11,3;6,9;24;0", "20;9,3;5,9;24;0", "19;7,3;5,8;23;0", "18;5,3;4,8;23;0", "17;3,3;4,7;22;0", "16;1,3;3,7;22;0", "15;11,1;2,6;24;0", "14;9,1;2,5;24;0", "13;7,1;1,5;23;0", "12;5,1;1,4;23;0", "11;3,1;0,4;22;0", "10;1,1;0,3;22;0", "9;10,4;;21,20;0", "8;6,4;;19,18;0", "7;2,4;;17,16;0", "6;12,2;;21,15;0", "5;8,2;;20,19,14,13;0", "4;4,2;;18,17,12,11;0", "3;0,2;;16,10;0", "2;10,0;;15,14;0", "1;6,0;;13,12;0", "0;2,0;;11,10;0"];
var level10 = ["24;12,4;19;;0", "23;10,4;18,19;;0", "22;8,4;17,18;;0", "21;6,4;16,17;;0", "20;4,4;15,16;;0", "19;11,3;14;24,23;0", "18;9,3;13,14;23,22;0", "17;7,3;12,13;22,21;0", "16;5,3;11,12;21,20;0", "15;3,3;10,11;20;0", "14;10,2;9;19,18;0", "13;8,2;8,9;18,17;0", "12;6,2;7,8;17,16;0", "11;4,2;6,7;16,15;0", "10;2,2;5,6;15;0", "9;9,1;4;14,13;0", "8;7,1;3,4;13,12;0", "7;5,1;2,3;12,11;0", "6;3,1;1,2;11,10;0", "5;1,1;0,1;10;0", "4;8,0;;9,8;0", "3;6,0;;8,7;0", "2;4,0;;7,6;0", "1;2,0;;6,5;0", "0;0,0;;5;0"];
var level11 = ["26;12,2;13,19;;0", "25;10,2;12,13,18,19;;0", "24;8,2;11,12,17,18;;0", "23;6,2;10,11,16,17;;0", "22;4,2;9,10,15,16;;0", "21;2,2;8,9,14,15;;0", "20;0,2;8,14;;0", "19;11,3;7;26,25;0", "18;9,3;6,7;25,24;0", "17;7,3;6;24,23;0", "16;5,3;5;23,22;0", "15;3,3;4,5;22,21;0", "14;1,3;4;21,20;0", "13;11,1;3;26,25;0", "12;9,1;2,3;25,24;0", "11;7,1;2;24,23;0", "10;5,1;1;23,22;0", "9;3,1;0,1;22,21;0", "8;1,1;0;21,20;0", "7;10,4;;19,18;0", "6;8,4;;18,17;0", "5;4,4;;16,15;0", "4;2,4;;15,14;0", "3;10,0;;13,12;0", "2;8,0;;12,11;0", "1;4,0;;10,9;0", "0;2,0;;9,8;0"];
var level12 = ["20;11,4;18;;0", "19;14,3;3,4;;0", "18;11,3;11;20;0", "17;7,3;10,13;;0", "16;5,3;10;;0", "15;3,3;9;;0", "14;1,3;9,12;;0", "13;8,4;;17;0", "12;0,4;;14;0", "11;11,2;7;18;0", "10;6,2;6;17,16;0", "9;2,2;5;15,14;0", "8;14,1;2,3;;0", "7;11,1;1;11;0", "6;5,1;0;10;0", "5;3,1;0;9;0", "4;13,4;;19;0", "3;13,2;;19,8;0", "2;13,0;;8;0", "1;11,0;;7;0", "0;4,0;;6,5;0"];
var level13 = ["29;9,6;20,21;;0", "28;7,6;19,20;;0", "27;5,6;18,19;;0", "26;3,6;17,18;;0", "25;9,0;13,14;;0", "24;7,0;12,13;;0", "23;5,0;11,12;;0", "22;3,0;10,11;;0", "21;10,5;9;29;0", "20;8,5;8;29,28;0", "19;6,5;7,8;28,27;0", "18;4,5;7;27,26;0", "17;2,5;6;26;0", "16;10,3;5,9;;0", "15;2,3;2,6;;0", "14;10,1;5;25;0", "13;8,1;4;25,24;0", "12;6,1;3,4;24,23;0", "11;4,1;3;23,22;0", "10;2,1;2;22;0", "9;11,4;1;21,16;0", "8;7,4;;20,19;0", "7;5,4;;19,18;0", "6;1,4;0;17,15;0", "5;11,2;1;16,14;0", "4;7,2;;13,12;0", "3;5,2;;12,11;0", "2;1,2;0;15,10;0", "1;12,3;;9,5;0", "0;0,3;;6,2;0"];
var level14 = ["30;11,5;23,24;;0", "29;9,5;22,23;;0", "28;7,5;21,22;;0", "27;5,5;20,21;;0", "26;3,5;19,20;;0", "25;1,5;18,19;;0", "24;12,4;17;30;0", "23;10,4;16,17;30,29;0", "22;8,4;15,16;29,28;0", "21;6,4;14,15;28,27;0", "20;4,4;13,14;27,26;0", "19;2,4;12,13;26,25;0", "18;0,4;12;25;0", "17;11,3;11;24,23;0", "16;9,3;10,11;23,22;0", "15;7,3;9,10;22,21;0", "14;5,3;8,9;21,20;0", "13;3,3;7,8;20,19;0", "12;1,3;7;19,18;0", "11;10,2;6;17,16;0", "10;8,2;5,6;16,15;0", "9;6,2;4,5;15,14;0", "8;4,2;3,4;14,13;0", "7;2,2;3;13,12;0", "6;9,1;2;11,10;0", "5;7,1;1,2;10,9;0", "4;5,1;0,1;9,8;0", "3;3,1;0;8,7;0", "2;8,0;;6,5;0", "1;6,0;;5,4;0", "0;4,0;;4,3;0"];
var level15 = ["25;10,4;20,21;;0", "24;8,4;19,20;;0", "23;4,4;17,18;;0", "22;2,4;16,17;;0", "21;11,3;14,15;25;0", "20;9,3;13,14;25,24;0", "19;7,3;12,13;24;0", "18;5,3;11,12;23;0", "17;3,3;10,11;23,22;0", "16;1,3;9,10;22;0", "15;12,2;8;21;0", "14;10,2;7,8;21,20;0", "13;8,2;6,7;20,19;0", "12;6,2;5,6;19,18;0", "11;4,2;4,5;18,17;0", "10;2,2;3,4;17,16;0", "9;0,2;3;16;0", "8;11,1;2;15,14;0", "7;9,1;2;14,13;0", "6;7,1;1;13,12;0", "5;5,1;1;12,11;0", "4;3,1;0;11,10;0", "3;1,1;0;10,9;0", "2;10,0;;8,7;0", "1;6,0;;6,5;0", "0;2,0;;4,3;0"];
var level16 = ["24;10,2;14,15,20,21;;0", "23;6,2;12,13,18,19;;0", "22;2,2;10,11,16,17;;0", "21;11,3;6,9;24;0", "20;9,3;5,9;24;0", "19;7,3;5,8;23;0", "18;5,3;4,8;23;0", "17;3,3;4,7;22;0", "16;1,3;3,7;22;0", "15;11,1;2,6;24;0", "14;9,1;2,5;24;0", "13;7,1;1,5;23;0", "12;5,1;1,4;23;0", "11;3,1;0,4;22;0", "10;1,1;0,3;22;0", "9;10,4;;21,20;0", "8;6,4;;19,18;0", "7;2,4;;17,16;0", "6;12,2;;21,15;0", "5;8,2;;20,19,14,13;0", "4;4,2;;18,17,12,11;0", "3;0,2;;16,10;0", "2;10,0;;15,14;0", "1;6,0;;13,12;0", "0;2,0;;11,10;0"];
var level17 = ["26;9,4;20,21;;0", "25;7,4;20;;0", "24;5,4;19;;0", "23;3,4;18,19;;0", "22;12,3;16;;0", "21;10,3;15,16;26;0", "20;8,3;15;26,25;0", "19;4,3;14;24,23;0", "18;2,3;13,14;23;0", "17;0,3;13;;0", "16;11,2;11,12;22,21;0", "15;9,2;10,11;21,20;0", "14;3,2;7,8;19,18;0", "13;1,2;6,7;18,17;0", "12;12,1;5;16;0", "11;10,1;4,5;16,15;0", "10;8,1;3,4;15;0", "9;6,1;2,3;;0", "8;4,1;1,2;14;0", "7;2,1;0,1;14,13;0", "6;0,1;0;13;0", "5;11,0;;12,11;0", "4;9,0;;11,10;0", "3;7,0;;10,9;0", "2;5,0;;9,8;0", "1;3,0;;8,7;0", "0;1,0;;7,6;0"];
var level18 = ["28;8,2;20,21,24,25;;0", "27;6,2;19,20,23,24;;0", "26;4,2;18,19,22,23;;0", "25;9,3;12,16,17;28;0", "24;7,3;15,16;28,27;0", "23;5,3;14,15;27,26;0", "22;3,3;11,13,14;26;0", "21;9,1;9,10,12;28;0", "20;7,1;8,9;28,27;0", "19;5,1;7,8;27,26;0", "18;3,1;6,7,11;26;0", "17;10,4;5;25;0", "16;8,4;;25,24;0", "15;6,4;;24,23;0", "14;4,4;;23,22;0", "13;2,4;4;22;0", "12;10,2;3,5;25,21;0", "11;2,2;2,4;22,18;0", "10;10,0;3;21;0", "9;8,0;;21,20;0", "8;6,0;;20,19;0", "7;4,0;;19,18;0", "6;2,0;2;18;0", "5;11,3;1;17,12;0", "4;1,3;0;13,11;0", "3;11,1;1;12,10;0", "2;1,1;0;11,6;0", "1;12,2;;5,3;0", "0;0,2;;4,2;0"];
}
Symbol 893 MovieClip [__Packages.com.xitex.crgame.utils.MCPlayer] Frame 0
class com.xitex.crgame.utils.MCPlayer
{
static var _instance;
var _timeInterval, __get__fps;
function MCPlayer () {
}
function play(prmTargetMovie, prmDirection, prmNumLoops, prmFrame) {
clearInterval(prmTargetMovie._playID);
prmTargetMovie.gotoAndStop(prmFrame);
prmTargetMovie.numLoops = prmNumLoops;
prmTargetMovie.curLoop = 0;
var thisObj = this;
prmTargetMovie.nextFrameNum = prmFrame + 1;
prmTargetMovie.shiftPlayHeader = function () {
if (prmDirection == thisObj._FORWARD_TYPE) {
if (prmTargetMovie._currentframe == prmTargetMovie._totalframes) {
prmTargetMovie.curLoop++;
if (prmTargetMovie.curLoop == prmTargetMovie.numLoops) {
prmTargetMovie.onEndPlay();
thisObj.stop(prmTargetMovie);
} else {
prmTargetMovie.gotoAndStop(1);
}
} else {
prmTargetMovie.nextFrame();
}
} else if (prmDirection == thisObj._BACKWARD_TYPE) {
if (prmTargetMovie._currentframe == 1) {
prmTargetMovie.curLoop++;
if (prmTargetMovie.curLoop == prmTargetMovie.numLoops) {
prmTargetMovie.onEndPlay();
thisObj.stop(prmTargetMovie);
} else {
prmTargetMovie.gotoAndStop(prmTargetMovie._totalframes);
}
} else {
prmTargetMovie.prevFrame();
}
}
};
prmTargetMovie._playID = setInterval(prmTargetMovie, "shiftPlayHeader", _timeInterval);
}
function stop(prmTargetMovie, prmFrame) {
clearInterval(prmTargetMovie._playID);
delete prmTargetMovie.shiftPlayHeader;
if (prmFrame == undefined) {
prmTargetMovie.stop();
} else {
prmTargetMovie.gotoAndStop(prmFrame);
}
}
function set fps(prmValue) {
_timeInterval = Math.round(1000 / prmValue);
//return(__get__fps());
}
static function get instance() {
if (_instance == undefined) {
_instance = new com.xitex.crgame.utils.MCPlayer();
}
return(_instance);
}
function get FORWARD_TYPE() {
return(_FORWARD_TYPE);
}
function get BACKWARD_TYPE() {
return(_BACKWARD_TYPE);
}
var _FORWARD_TYPE = "forward";
var _BACKWARD_TYPE = "backward";
}
Symbol 894 MovieClip [__Packages.com.xitex.crgame.prng.Randomizer] Frame 0
class com.xitex.crgame.prng.Randomizer
{
var _states, _left, _pNext;
function Randomizer (prmSeed) {
_states = new Array(N);
seed(prmSeed);
}
function getRandomSelection(prmSourceRangeLength, prmNewRangeLength) {
var _local4 = new Array();
var _local2 = 0;
while (_local2 < prmSourceRangeLength) {
_local4[_local2] = true;
_local2++;
}
var _local6 = new Array();
var _local3;
while (_local6.length < prmNewRangeLength) {
_local3 = randInt(prmSourceRangeLength - 1);
if (_local4[_local3] || (prmSourceRangeLength < prmNewRangeLength)) {
_local6.push(_local3);
_local4[_local3] = false;
}
}
return(_local6);
}
function randInt(prmN) {
var _local2 = prmN;
_local2 = _local2 | (_local2 >> 1);
_local2 = _local2 | (_local2 >> 2);
_local2 = _local2 | (_local2 >> 4);
_local2 = _local2 | (_local2 >> 8);
_local2 = _local2 | (_local2 >> 16);
var _local3;
do {
_local3 = pullInt() & _local2;
} while (_local3 > prmN);
return(_local3);
}
function seed(prmSeed) {
initialize(prmSeed);
reload();
}
function pullInt() {
if (_left == 0) {
reload();
}
_left--;
var _local2;
_local2 = _states[_pNext++];
_local2 = _local2 ^ 2514;
return(_local2);
}
function initialize(prmSeed) {
_states[0] = prmSeed & 268435455;
var _local4 = _states.length;
var _local3;
var _local2 = 1;
while (_local2 < _local4) {
_local3 = _states[_local2 - 1];
_states[_local2] = ((_local3 * a) + c) % d;
_local2++;
}
}
function reload() {
var _local2 = 0;
while (_local2 < (N - M)) {
_states[_local2] = twist(_states[(_local2 + N) - M], _states[_local2], _states[_local2 + 1]);
_local2++;
}
var _local3 = _states.length;
_local2 = N - M;
while (_local2 < (_local3 - 1)) {
_states[_local2] = twist(_states[_local2 - (N - M)], _states[_local2], _states[_local2 + 1]);
_local2++;
}
_left = N;
_pNext = 0;
}
function hiBit(prmU) {
return(prmU & 2147483648);
}
function loBit(prmU) {
return(prmU & 1);
}
function loBits(prmU) {
return(prmU & 2147483647);
}
function mixBits(prmU, prmV) {
return(hiBit(prmU) | loBits(prmV));
}
function twist(prmM, prmS0, prmS1) {
return((prmM ^ (mixBits(prmS0, prmS1) >> 1)) ^ ((-loBit(prmS1)) & 3039));
}
static var N = 624;
static var M = 397;
static var d = 714025;
static var a = 4096;
static var c = 150889;
}
Symbol 895 MovieClip [__Packages.com.xitex.crgame.cookie.CRCookie] Frame 0
class com.xitex.crgame.cookie.CRCookie
{
var _typeID, _value, _container, _containerInstance, _blocked, _enable, dispatchEvent;
function CRCookie (prmTypeID, prmValue) {
_typeID = prmTypeID;
_value = prmValue;
mx.events.EventDispatcher.initialize(this);
}
function attach(prmSource, prmContainerInstance) {
_container = prmSource.attachMovie(_CONTAINER_LIBRARY_ID, "CRCookie" + _numObj, prmSource.getNextHighestDepth());
_containerInstance = prmContainerInstance;
updateState();
}
function remove() {
_container.removeMovieClip();
_containerInstance = null;
}
function isCovered() {
return(_blocked);
}
function isAttached() {
return(_containerInstance != null);
}
function setBlock(prmValue) {
_blocked = prmValue;
_container[_CONTAINER_TYPE_NAMES[_typeID]][_BLOCK_CONTAINER_NAME]._visible = prmValue;
if (prmValue) {
removeEvent();
} else {
addEvent();
}
}
function setVisible(prmValue) {
_container[_CONTAINER_TYPE_NAMES[_typeID]]._visible = prmValue;
}
function setSelect(prmValue) {
var _local2 = _container[_CONTAINER_TYPE_NAMES[_typeID]][_SELECT_CONTAINER_NAME];
if (prmValue) {
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_local2, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), Number.POSITIVE_INFINITY, 1);
} else {
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_local2, 1);
}
_container[_CONTAINER_TYPE_NAMES[_typeID]][_SELECT_CONTAINER_NAME]._visible = prmValue;
}
function setEnable(prmValue) {
_enable = prmValue;
}
function toString() {
return(String(((("{typeID: " + _typeID) + ", value: ") + _value) + "}"));
}
function updateState() {
var _local3 = _CONTAINER_TYPE_NAMES.length;
var _local2 = 0;
while (_local2 < _local3) {
if (_typeID == _local2) {
_container[_CONTAINER_TYPE_NAMES[_local2]]._visible = true;
} else {
_container[_CONTAINER_TYPE_NAMES[_local2]]._visible = false;
}
_local2++;
}
_container[_CONTAINER_TYPE_NAMES[_typeID]].gotoAndStop(_value + 1);
}
function insert() {
if ((!_blocked) && (_enable)) {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.INSERT, this));
}
}
function addEvent() {
_container.onPress = mx.utils.Delegate.create(this, insert);
}
function removeEvent() {
delete _container.onPress;
}
function get value() {
return(_value);
}
function get typeID() {
return(_typeID);
}
function get containerInstance() {
return(_containerInstance);
}
static var _numObj = 0;
static var _CONTAINER_LIBRARY_ID = "cookie";
static var _SELECT_CONTAINER_NAME = "select";
static var _BLOCK_CONTAINER_NAME = "block";
static var _CONTAINER_TYPE_NAMES = ["kaka_sylt", "kaka_ruta", "kaka_pepparkaka", "kaka_muffin", "kaka_cookie", "kaka_choklad"];
}
Symbol 896 MovieClip [__Packages.com.xitex.crgame.events.CREvent] Frame 0
class com.xitex.crgame.events.CREvent
{
var _type, _target;
function CREvent (prmType, prmTarget) {
_type = prmType;
_target = prmTarget;
}
function get type() {
return(_type);
}
function get target() {
return(_target);
}
static var INSERT = "onCookieInsert";
static var DEAL = "onDeckDeal";
static var END_EVENT = "onEnd";
static var POP_COOKIE = "onCookiePop";
static var PUSH_COOKIE = "onCookiePush";
static var INIT = "onInit";
static var UPDATE = "onUpdate";
static var SHOW = "onShow";
static var HIDE = "onHide";
static var LOSS_GAME = "onGameLoss";
static var WIN_GAME = "onGameWin";
}
Symbol 897 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 898 MovieClip [__Packages.com.xitex.crgame.cookie.CRCookieFormation] Frame 0
class com.xitex.crgame.cookie.CRCookieFormation
{
var _mainContainer, _transformContainer, _cookieDeck, _formAnimator, _cookieContainers, _structure;
function CRCookieFormation (prmParentContainer, prmCookieDeck, prmFormationAnimator) {
_mainContainer = prmParentContainer[_CONTAINER_NAME];
_transformContainer = _mainContainer.createEmptyMovieClip("transformContainer", 1);
_cookieDeck = prmCookieDeck;
_formAnimator = prmFormationAnimator;
}
function restore() {
var _local3 = _cookieContainers.length;
var _local2 = 0;
while (_local2 < _local3) {
_cookieContainers[_local2].restore();
_local2++;
}
_formAnimator.restore();
}
function generate(prmStructure) {
_structure = prmStructure;
createContainers();
tieContainers();
fillContainers();
align();
createFillingAnim();
}
function getNextEmptyContainer() {
var _local3 = _cookieContainers.length;
var _local2 = _local3 - 1;
while (_local2 >= 0) {
if (_cookieContainers[_local2].isEmpty() && (!_cookieContainers[_local2].isTopContainers())) {
return(_cookieContainers[_local2]);
}
_local2--;
}
return(null);
}
function isEmpty() {
var _local3 = _cookieContainers.length;
var _local2 = 0;
while (_local2 < _local3) {
if (!_cookieContainers[_local2].isEmpty()) {
return(false);
}
_local2++;
}
return(true);
}
function createContainers() {
_cookieContainers = new Array();
var _local3 = _structure.length;
var _local2 = 0;
while (_local2 < _local3) {
_cookieContainers[_local2] = new com.xitex.crgame.cookie.CRCookieFormContainer(_transformContainer, _structure[_local2]);
_cookieContainers[_local2].container._visible = false;
_local2++;
}
}
function tieContainers() {
var _local6 = _structure.length;
var _local7;
var _local3;
var _local4 = 0;
while (_local4 < _local6) {
_local3 = new Array();
var _local5 = _cookieContainers[_local4].bottomCookieIDs.length;
var _local2 = 0;
while (_local2 < _local5) {
_local3[_local2] = getContainerByLevel(_cookieContainers[_local4].bottomCookieIDs[_local2]);
_local2++;
}
_cookieContainers[_local4].setBottomContainers(_local3);
_local4++;
}
_local4 = 0;
while (_local4 < _local6) {
_local3 = new Array();
var _local5 = _cookieContainers[_local4].topCookieIDs.length;
var _local2 = 0;
while (_local2 < _local5) {
_local3[_local2] = getContainerByLevel(_cookieContainers[_local4].topCookieIDs[_local2]);
_local2++;
}
_cookieContainers[_local4].setTopContainers(_local3);
_local4++;
}
}
function fillContainers() {
var _local3 = _structure.length;
var _local2 = _local3 - 1;
while (_local2 >= 0) {
_cookieContainers[_local2].pushCookie(_cookieDeck.getNextCookie());
_local2--;
}
}
function align() {
_transformContainer._x = -Math.round(_transformContainer._width / 2);
_transformContainer._y = -Math.round(_transformContainer._height / 2);
}
function getContainerByLevel(prmLevel) {
var _local3 = _cookieContainers.length;
var _local2 = 0;
while (_local2 < _local3) {
if (_cookieContainers[_local2].getID() == prmLevel) {
return(_cookieContainers[_local2]);
}
_local2++;
}
}
function createFillingAnim() {
var _local2 = _cookieContainers.length - 1;
while (_local2 >= 0) {
_formAnimator.addCookieContainer(_cookieContainers[_local2]);
_local2--;
}
_formAnimator.start();
}
var _CONTAINER_NAME = "cookie_formation_container";
}
Symbol 899 MovieClip [__Packages.com.xitex.crgame.cookie.ICRCookieContainer] Frame 0
interface com.xitex.crgame.cookie.ICRCookieContainer
{
}
Symbol 900 MovieClip [__Packages.com.xitex.crgame.cookie.CRCookieFormContainer] Frame 0
class com.xitex.crgame.cookie.CRCookieFormContainer implements com.xitex.crgame.cookie.ICRCookieContainer
{
var _bottomCookieIDs, _topCookieIDs, _container, _bottomCookieContainers, _topCookieContainers, _cookie, _fatStain;
function CRCookieFormContainer (prmParentContainer, prmStringConfig) {
var _local2 = prmStringConfig.split(";");
_level = Number(_local2[0]);
var _local3 = _local2[1].split(",");
if (_local2[2].length > 0) {
_bottomCookieIDs = _local2[2].split(",");
} else {
_bottomCookieIDs = new Array();
}
if (_local2[3].length > 0) {
_topCookieIDs = _local2[3].split(",");
} else {
_topCookieIDs = new Array();
}
_container = prmParentContainer.createEmptyMovieClip("CRCookieContainer" + _level, _level);
_container._x = Math.round(Number(_local3[0]) * _CELL_WIDTH);
_container._y = Math.round(Number(_local3[1]) * _CELL_HEIGHT);
}
function setBottomContainers(prmContainers) {
if (prmContainers.length == 0) {
addCookieFatStain();
}
_bottomCookieContainers = prmContainers;
}
function setTopContainers(prmContainers) {
_topCookieContainers = prmContainers;
}
function restore() {
if (_cookie != null) {
_cookie = null;
}
}
function pushCookie(prmCookie) {
_cookie = prmCookie;
prmCookie.attach(_container, this);
_cookie.setSelect(false);
_cookie.setEnable(true);
updateBottomContainers();
update();
}
function popCookie() {
var _local2 = _cookie;
_cookie.remove();
_cookie = null;
updateBottomContainers();
return(_local2);
}
function getPoint() {
var _local2 = com.xitex.crgame.utils.CoordinatesConverter.__get__instance().convertToSystemCoordinates(new flash.geom.Point(_container._x, _container._y), _container, 3);
return(_local2);
}
function isEmpty() {
return((_cookie == null) || (_cookie == undefined));
}
function update() {
_cookie.setBlock(isTopContainers());
}
function isTopContainers() {
var _local3 = _topCookieContainers.length;
var _local2 = 0;
while (_local2 < _local3) {
if (!_topCookieContainers[_local2].isEmpty()) {
return(true);
}
_local2++;
}
return(false);
}
function toString() {
return(String(((((((("{level: " + _level) + ", top: ") + _topCookieIDs) + ", bottom: ") + _bottomCookieIDs) + ", cookie: ") + _cookie) + "}"));
}
function getID() {
return(_level);
}
function updateBottomContainers() {
var _local3 = _bottomCookieContainers.length;
var _local2 = 0;
while (_local2 < _local3) {
_bottomCookieContainers[_local2].update();
_local2++;
}
}
function addCookieFatStain() {
_fatStain = _container.attachMovie(_FAT_STAIN_LIBRARY_ID, _FAT_STAIN_LIBRARY_ID, 0);
}
function get topCookieIDs() {
return(_topCookieIDs);
}
function get bottomCookieIDs() {
return(_bottomCookieIDs);
}
function get container() {
return(_container);
}
static var _FAT_STAIN_LIBRARY_ID = "gamefield_stain";
var _CELL_WIDTH = 38;
var _CELL_HEIGHT = 38;
var _level = 0;
}
Symbol 901 MovieClip [__Packages.com.xitex.crgame.utils.CoordinatesConverter] Frame 0
class com.xitex.crgame.utils.CoordinatesConverter
{
static var _instance;
function CoordinatesConverter () {
}
function convertToSystemCoordinates(prmCurPoint, prmCurMovie, prmNumPassingLevels) {
var _local3 = prmCurPoint.x;
var _local4 = prmCurPoint.y;
var _local1 = prmCurMovie;
var _local2 = 0;
while (_local2 < prmNumPassingLevels) {
_local1 = _local1._parent;
_local3 = _local3 + _local1._x;
_local4 = _local4 + _local1._y;
_local2++;
}
return(new flash.geom.Point(_local3, _local4));
}
static function get instance() {
if (_instance == undefined) {
_instance = new com.xitex.crgame.utils.CoordinatesConverter();
}
return(_instance);
}
}
Symbol 902 MovieClip [__Packages.com.xitex.crgame.cookie.CRDeck] Frame 0
class com.xitex.crgame.cookie.CRDeck
{
var _container, _patternCookies, _prng, _useCookies, _enable, _blocked, dispatchEvent;
function CRDeck (prmParentContainer, prmCookies, prmRandomizer) {
_container = prmParentContainer[_CONTAINER_NAME];
_patternCookies = prmCookies;
_prng = prmRandomizer;
mx.events.EventDispatcher.initialize(this);
init();
}
function isEmpty() {
return(_useCookies.length <= 0);
}
function restore() {
setVisible(true);
setEnable(true);
setBlock(false);
updateCookiesNum();
var _local3 = _patternCookies.length;
var _local2 = 0;
while (_local2 < _local3) {
_patternCookies[_local2].remove();
_local2++;
}
_useCookies = new Array();
}
function setVisible(prmValue) {
_container._visible = prmValue;
}
function setEnable(prmValue) {
_enable = prmValue;
}
function setBlock(prmValue) {
_blocked = prmValue;
}
function deal() {
if (_enable && (!_blocked)) {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.DEAL, this));
}
}
function getNextCookie() {
var _local2;
if (_useCookies.length > 0) {
_local2 = _useCookies[_useCookies.length - 1];
deleteLastCookie();
} else {
_local2 = null;
}
return(_local2);
}
function deleteLastCookie() {
_useCookies.length = _useCookies.length - 1;
if (_useCookies.length == 0) {
setBlock(true);
}
updateCookiesNum();
}
function mix(prmNumTypeCookies, prmNumTypes) {
var _local4 = new Array();
var _local6 = true;
var _local5 = new Array();
var _local8 = _patternCookies.length;
var _local2 = 0;
while (_local2 < _local8) {
if ((_patternCookies[_local2].value <= (prmNumTypeCookies - 1)) && (_patternCookies[_local2].typeID <= (prmNumTypes - 1))) {
_local5.push(_patternCookies[_local2]);
}
_local2++;
}
var _local7 = prmNumTypeCookies * prmNumTypes;
while (_local6) {
var _local3 = _prng.randInt(_local7 - 1);
if (_local4[_local3] != "used") {
_useCookies.push(_local5[_local3]);
_local4[_local3] = "used";
}
if (_useCookies.length == _local7) {
_local6 = false;
}
}
}
function getNumRestCookies() {
return(_useCookies.length);
}
function updateCookiesNum() {
_container[_NUM_COOKIES_TEXTFIELD_CONTAINER_NAME][_NUM_COOKIES_TEXTFIELD_NAME].text = _useCookies.length;
}
function init() {
createInteractive();
}
function createInteractive() {
_container[_HIT_NAME].onPress = mx.utils.Delegate.create(this, deal);
}
function get container() {
return(_container);
}
var _CONTAINER_NAME = "jar_shake";
var _NUM_COOKIES_TEXTFIELD_NAME = "num_cookies_field";
var _NUM_COOKIES_TEXTFIELD_CONTAINER_NAME = "num_cookies_field_container";
var _HIT_NAME = "hit";
}
Symbol 903 MovieClip [__Packages.com.xitex.crgame.cookie.CRCookieStack] Frame 0
class com.xitex.crgame.cookie.CRCookieStack implements com.xitex.crgame.cookie.ICRCookieContainer
{
var _container, _cookie, _enable, dispatchEvent;
function CRCookieStack (prmParentContainer) {
_container = prmParentContainer[_CONTAINER_NAME];
mx.events.EventDispatcher.initialize(this);
restore();
}
function getNumRestCookies() {
var _local2;
if (_cookie == null) {
_local2 = 0;
} else {
_local2 = 1;
}
return(_local2);
}
function restore() {
_cookie = null;
setEnable(true);
}
function setEnable(prmValue) {
_cookie.setEnable(prmValue);
_enable = prmValue;
}
function pushCookie(prmCookie) {
popCookie();
_cookie = prmCookie;
prmCookie.attach(_container, this);
_cookie.setSelect(false);
_cookie.setEnable(_enable);
prmCookie.setBlock(false);
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.PUSH_COOKIE, this));
}
function popCookie() {
var _local2 = _cookie;
_local2.setBlock(true);
_local2.setSelect(false);
_local2.setVisible(false);
_cookie.remove();
_cookie = null;
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.POP_COOKIE, this));
return(_local2);
}
function getPoint() {
var _local2 = com.xitex.crgame.utils.CoordinatesConverter.__get__instance().convertToSystemCoordinates(new flash.geom.Point(_container._x, _container._y), _container, 2);
return(_local2);
}
function getID() {
return(_LEVEL);
}
var _LEVEL = -1;
var _CONTAINER_NAME = "cookie_stack";
}
Symbol 904 MovieClip [__Packages.com.xitex.crgame.ui.CRScore] Frame 0
class com.xitex.crgame.ui.CRScore
{
var _textField, _curScore, _totalScore, _deckBonusScore, _comboBonusScore, _seriesLength, _lastRegisteredTime;
function CRScore (prmParentContainer) {
_textField = prmParentContainer[_FIELD_NAME];
_curScore = 0;
_totalScore = 0;
restore();
updateScoreField();
}
function restore() {
_curScore = _totalScore;
updateScoreField();
_deckBonusScore = 0;
_comboBonusScore = 0;
_seriesLength = 0;
_lastRegisteredTime = getTimer();
}
function addColorPairPoints() {
var _local2 = _COLOR_PAIR_POINTS;
_curScore = _curScore + _local2;
updateScoreField();
return(_local2);
}
function addNumberPairPoints() {
var _local2 = _NUMBER_PAIR_POINTS;
_curScore = _curScore + _local2;
updateScoreField();
return(_local2);
}
function addTimePairBonus() {
var _local3 = getTimer();
var _local4 = _local3 - _lastRegisteredTime;
_lastRegisteredTime = _local3;
var _local2 = Math.round(_MAX_TIME_PAIR_POINTS - ((_local4 / 1000) / _DELTA_TIME_PAIR_POINTS));
if (_local2 < 0) {
_local2 = 0;
}
_curScore = _curScore + _local2;
updateScoreField();
return(_local2);
}
function accumulateSeriesBonus() {
var _local2 = _seriesLength * _SERIES_BONUS_POINTS;
_curScore = _curScore + _local2;
_seriesLength++;
updateScoreField();
return(_local2);
}
function restoreSeriesBonus() {
_seriesLength = 0;
}
function addDeckBonus(prmNumCards) {
_deckBonusScore = _DECK_CARD_BONUS_POINTS * prmNumCards;
}
function addComboBonus(prmValue) {
_comboBonusScore = prmValue;
}
function getCurScore() {
return(_curScore);
}
function getDeckBonusScore() {
return(_deckBonusScore);
}
function getComboBonusScore() {
return(_comboBonusScore);
}
function getTotalScore() {
_totalScore = (_curScore + _deckBonusScore) + _comboBonusScore;
return(_totalScore);
}
function updateScoreField() {
_textField.text = String(_curScore);
}
var _FIELD_NAME = "score_value_field";
var _COLOR_PAIR_POINTS = 100;
var _NUMBER_PAIR_POINTS = 250;
var _SERIES_BONUS_POINTS = 50;
var _DECK_CARD_BONUS_POINTS = 200;
var _MAX_TIME_PAIR_POINTS = 10;
var _DELTA_TIME_PAIR_POINTS = 0.5;
}
Symbol 905 MovieClip [__Packages.com.xitex.crgame.sounds.CRSound] Frame 0
class com.xitex.crgame.sounds.CRSound
{
var _sound, _libraryID, _numLoops, dispatchEvent;
function CRSound (prmParentContainer, prmLibraryID, prmPlayType) {
_objs.push(this);
_sound = new Sound(prmParentContainer);
_sound.attachSound(prmLibraryID);
_libraryID = prmLibraryID;
if (prmPlayType == _PLAY_ONCE) {
_numLoops = 1;
} else if (prmPlayType == _PLAY_LOOP) {
_numLoops = _MAX_PLAY_LOOPS;
}
mx.events.EventDispatcher.initialize(this);
_sound.onSoundComplete = mx.utils.Delegate.create(this, completeSound);
}
function setEnable(prmValue) {
var _local2 = (prmValue ? 100 : 0);
_sound.setVolume(_local2);
}
function start() {
_sound.start(0, _numLoops);
}
function stop() {
_sound.stop();
}
function toString() {
return(_libraryID);
}
static function setAllSoundsEnable(prmValue) {
var _local2 = _objs.length;
var _local1 = 0;
while (_local1 < _local2) {
_objs[_local1].setEnable(prmValue);
_local1++;
}
}
function completeSound() {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
static var _objs = new Array();
static var _MAX_PLAY_LOOPS = 10000;
static var _PLAY_LOOP = "playLoop";
static var _PLAY_ONCE = "playOnce";
}
Symbol 906 MovieClip [__Packages.com.xitex.crgame.forms.CRForm] Frame 0
class com.xitex.crgame.forms.CRForm
{
var _container, _CONTAINER_NAME, _bgMusic, _BG_SOUND_LIBRARY_ID, _enable, dispatchEvent;
function CRForm (prmParentContainer) {
_container = prmParentContainer[_CONTAINER_NAME];
_bgMusic = new com.xitex.crgame.sounds.CRSound(_container, _BG_SOUND_LIBRARY_ID, _BG_SOUND_PLAY_TYPE);
mx.events.EventDispatcher.initialize(this);
init();
}
function setEnable(prmValue) {
_enable = prmValue;
if (prmValue) {
_bgMusic.start();
} else {
_bgMusic.stop();
}
}
function show() {
_container._visible = true;
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.SHOW, this));
}
function hide() {
_container._visible = false;
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.HIDE, this));
}
function getContainer() {
return(_container);
}
function init() {
setEnable(false);
hide();
}
var _BG_SOUND_PLAY_TYPE = com.xitex.crgame.sounds.CRSound._PLAY_LOOP;
}
Symbol 907 MovieClip [__Packages.com.xitex.crgame.forms.CRTraceForm] Frame 0
class com.xitex.crgame.forms.CRTraceForm extends com.xitex.crgame.forms.CRForm
{
var _textArea, _container, _draggingHit, _enable, hide, setEnable, show;
function CRTraceForm (prmParentContainer) {
super(prmParentContainer);
}
function addLog(prmText) {
_textArea.text = _textArea.text + prmText;
_textArea.text = _textArea.text + newline;
_textArea.__set__vPosition(_textArea.maxVPosition);
}
function init() {
super.init();
_textArea = _container[_TEXT_AREA_NAME];
_draggingHit = _container[_DRAGGING_HIT_NAME];
Key.addListener(_container);
_container.onKeyDown = mx.utils.Delegate.create(this, handleKeyDownEvent);
_draggingHit.onPress = mx.utils.Delegate.create(this, startDragging);
_draggingHit.onRelease = mx.utils.Delegate.create(this, stopDragging);
}
function handleKeyDownEvent() {
if (Key.getCode() == 32) {
if (_enable) {
hide();
setEnable(false);
} else {
show();
setEnable(true);
}
}
}
function startDragging() {
_container.startDrag();
}
function stopDragging() {
_container.stopDrag();
}
var _CONTAINER_NAME = "trace_form";
var _TEXT_AREA_NAME = "text_area";
var _DRAGGING_HIT_NAME = "hit";
}
Symbol 908 MovieClip [__Packages.com.xitex.crgame.logic.CRLogic] Frame 0
class com.xitex.crgame.logic.CRLogic
{
var _cookies, _cookieDeck, _cookieStack, _cookieFormation, _score, _cookieScoreAnimator, _deckDealAnim, _cookieMovingAnimator, _pastryBonus, _nomovesAnim, _proxyCommander, _releasePairSound, _releaseNumberPairSounds, _blocked, _curSelectedCookie, dispatchEvent;
function CRLogic (prmParentContainer, prmCookies, prmCookieDeck, prmCookieStack, prmCookieFormation, prmScore, prmCookieScoreAnimator, prmDeckDealAnim, prmCookieMovingAnim, prmPastryBonus, prmNomovesAnim, prmProxyCommander) {
_cookies = prmCookies;
_cookieDeck = prmCookieDeck;
_cookieStack = prmCookieStack;
_cookieFormation = prmCookieFormation;
_score = prmScore;
_cookieScoreAnimator = prmCookieScoreAnimator;
_deckDealAnim = prmDeckDealAnim;
_cookieMovingAnimator = prmCookieMovingAnim;
_pastryBonus = prmPastryBonus;
_nomovesAnim = prmNomovesAnim;
_proxyCommander = prmProxyCommander;
_releasePairSound = new com.xitex.crgame.sounds.CRSound(prmParentContainer, _RELEASE_PAIR_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
_releaseNumberPairSounds = new Array();
var _local3 = _RELEASE_NUMBER_PAIR_SOUNDS_LIBRARY_ID.length;
var _local2 = 0;
while (_local2 < _local3) {
_releaseNumberPairSounds[_local2] = new com.xitex.crgame.sounds.CRSound(prmParentContainer, _RELEASE_NUMBER_PAIR_SOUNDS_LIBRARY_ID[_local2], com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
_local2++;
}
mx.events.EventDispatcher.initialize(this);
init();
}
function setBlock(prmValue) {
_blocked = prmValue;
}
function restore() {
_curSelectedCookie = null;
}
function setEnableGameField(prmValue) {
var _local3 = prmValue && (!_blocked);
_cookieStack.setEnable(_local3);
_cookieDeck.setEnable(_local3);
var _local4 = _cookies.length;
var _local2 = 0;
while (_local2 < _local4) {
_cookies[_local2].setEnable(_local3);
_local2++;
}
}
function init() {
initCookies();
initDeck();
initDeckDealAnim();
initCookieMovingAnim();
}
function initCookies() {
var _local3 = _cookies.length;
var _local2 = 0;
while (_local2 < _local3) {
_cookies[_local2].addEventListener(com.xitex.crgame.events.CREvent.INSERT, mx.utils.Delegate.create(this, handleInsertEvent));
_local2++;
}
}
function initDeck() {
_cookieDeck.addEventListener(com.xitex.crgame.events.CREvent.DEAL, mx.utils.Delegate.create(this, handleDealEvent));
}
function initDeckDealAnim() {
_deckDealAnim.addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(this, handleEndAnimEvent));
}
function initCookieMovingAnim() {
_cookieMovingAnimator.addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(this, handleEndAnimEvent));
}
function handleInsertEvent(prmEvent) {
var _local2 = com.xitex.crgame.cookie.CRCookie(prmEvent.__get__target());
var _local6;
var _local4;
var _local5;
var _local3 = 0;
if (_curSelectedCookie == null) {
_local2.setSelect(true);
_curSelectedCookie = _local2;
} else if (_curSelectedCookie != _local2) {
if (_local2.__get__value() == _curSelectedCookie.__get__value()) {
_local2.setSelect(true);
_local6 = _score.addNumberPairPoints();
_local5 = _score.accumulateSeriesBonus();
_local4 = _score.addTimePairBonus();
_local3 = (_local4 + _local6) + _local5;
_pastryBonus.addPairToSeries();
_cookieScoreAnimator.createNumberPairAnim(_local2, _local3);
_cookieScoreAnimator.createNumberPairAnim(_curSelectedCookie, _local3);
_proxyCommander.execDelComm(_local2, _curSelectedCookie, _local4, _local3);
deleteCookies(_local2, _curSelectedCookie);
_releaseNumberPairSounds[Math.round(Math.random() * (_RELEASE_NUMBER_PAIR_SOUNDS_LIBRARY_ID.length - 1))].start();
_curSelectedCookie = null;
} else if (_local2.__get__typeID() == _curSelectedCookie.__get__typeID()) {
_local2.setSelect(true);
_local6 = _score.addColorPairPoints();
_local5 = _score.accumulateSeriesBonus();
_local4 = _score.addTimePairBonus();
_local3 = (_local4 + _local6) + _local5;
_pastryBonus.addPairToSeries();
_cookieScoreAnimator.createTypePairAnim(_local2, _local3);
_cookieScoreAnimator.createTypePairAnim(_curSelectedCookie, _local3);
_proxyCommander.execDelComm(_local2, _curSelectedCookie, _local4, _local3);
deleteCookies(_local2, _curSelectedCookie);
_curSelectedCookie = null;
} else {
_curSelectedCookie.setSelect(false);
_local2.setSelect(true);
_curSelectedCookie = _local2;
}
} else if (_curSelectedCookie == _local2) {
_local2.setSelect(false);
_curSelectedCookie = null;
}
}
function deleteCookies(prmCookie1, prmCookie2) {
if ((prmCookie1.__get__containerInstance() instanceof com.xitex.crgame.cookie.CRCookieFormContainer) && (prmCookie2.__get__containerInstance() instanceof com.xitex.crgame.cookie.CRCookieFormContainer)) {
prmCookie1.__get__containerInstance().popCookie();
prmCookie2.__get__containerInstance().popCookie();
checkGameOver();
}
if ((prmCookie1.__get__containerInstance() instanceof com.xitex.crgame.cookie.CRCookieFormContainer) || (prmCookie2.__get__containerInstance() instanceof com.xitex.crgame.cookie.CRCookieFormContainer)) {
prmCookie1.__get__containerInstance().popCookie();
prmCookie2.__get__containerInstance().popCookie();
if ((!_cookieDeck.isEmpty()) && (!_cookieFormation.isEmpty())) {
_cookieStack.setEnable(false);
_deckDealAnim.start(_cookieStack);
_proxyCommander.execDealComm();
} else {
checkGameOver();
}
}
_releasePairSound.start();
}
function checkGameOver() {
if (_cookieFormation.isEmpty()) {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.WIN_GAME, this));
} else if (!isAnyMoves()) {
_nomovesAnim.start();
_cookieDeck.setVisible(false);
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.LOSS_GAME, this));
}
}
function isAnyMoves() {
var _local5;
var _local4;
if (_cookieDeck.isEmpty()) {
_local4 = getUncoveredCookies();
_local5 = _local4.length;
var _local3 = 0;
while (_local3 < _local5) {
var _local2 = _local3 + 1;
while (_local2 < _local5) {
if ((_local4[_local3].value == _local4[_local2].value) || (_local4[_local3].typeID == _local4[_local2].typeID)) {
return(true);
}
_local2++;
}
_local3++;
}
} else {
return(true);
}
return(false);
}
function getUncoveredCookies() {
var _local3 = new Array();
var _local4 = _cookies.length;
var _local2 = 0;
while (_local2 < _local4) {
if ((!_cookies[_local2].isCovered()) && (_cookies[_local2].isAttached())) {
_local3.push(_cookies[_local2]);
}
_local2++;
}
return(_local3);
}
function handleEndAnimEvent() {
if (((!_cookieMovingAnimator.isRunning()) && (!_deckDealAnim.isRunning())) && (!_cookieFormation.isEmpty())) {
setEnableGameField(true);
checkGameOver();
}
}
function handleDealEvent(prmEvent) {
_curSelectedCookie.setSelect(false);
_curSelectedCookie = null;
setEnableGameField(false);
_deckDealAnim.start(_cookieStack);
_pastryBonus.restoreSeries();
var _local2 = _cookieFormation.getNextEmptyContainer();
if (_local2 != null) {
_cookieMovingAnimator.start(_cookieStack, _local2);
_score.restoreSeriesBonus();
}
_proxyCommander.execDealComm();
}
var _RELEASE_PAIR_SOUND_LIBRARY_ID = "release_pair";
var _RELEASE_NUMBER_PAIR_SOUNDS_LIBRARY_ID = ["swedish_chef_1", "swedish_chef_2", "swedish_chef_3", "swedish_chef_4", "swedish_chef_5", "swedish_chef_6", "swedish_chef_7"];
}
Symbol 909 MovieClip [__Packages.com.xitex.crgame.utils.Timer] Frame 0
class com.xitex.crgame.utils.Timer
{
var _intervalTime, _deductDelta, _curStepNum, _prevRegisteredTime, _startRegisteredTime, _intervalID, dispatchEvent;
function Timer (prmInterval) {
_intervalTime = prmInterval;
mx.events.EventDispatcher.initialize(this);
}
function start() {
stop();
_deductDelta = 0;
_curStepNum = 0;
_prevRegisteredTime = getTimer();
_startRegisteredTime = _prevRegisteredTime;
update();
_intervalID = setInterval(this, "checkUpdate", _INTERVAL_DELTA);
}
function stop() {
clearInterval(_intervalID);
}
function checkUpdate() {
var _local2 = getTimer();
if ((_local2 - _prevRegisteredTime) >= (_intervalTime - _deductDelta)) {
_curStepNum++;
_deductDelta = _local2 - ((_curStepNum * _intervalTime) + _startRegisteredTime);
_prevRegisteredTime = _local2;
update();
}
}
function update() {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.UPDATE, this));
}
var _INTERVAL_DELTA = 10;
}
Symbol 910 MovieClip [__Packages.com.xitex.crgame.ui.CRTimer] Frame 0
class com.xitex.crgame.ui.CRTimer extends com.xitex.crgame.utils.Timer
{
var _titleField, _valueField, _runningOutAnim, _warningSound, _curIntervalNum, _isRunningOutAnim, _intervalTime, dispatchEvent, __get__timeLimit, __get__relaxMode;
function CRTimer (prmParentContainer, prmInterval) {
super(prmInterval);
_titleField = prmParentContainer[_TITLE_FIELD_NAME];
_valueField = prmParentContainer[_VALUE_FIELD_NAME];
_runningOutAnim = prmParentContainer[_RUNNING_OUT_ANIM_CONTAINER_NAME];
_warningSound = new com.xitex.crgame.sounds.CRSound(_runningOutAnim, _WARNING_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_LOOP);
_curIntervalNum = 0;
stopRunningOutAnim();
}
function start() {
super.start();
if (_isRunningOutAnim) {
_warningSound.start();
}
}
function stop() {
super.stop();
_warningSound.stop();
}
function update() {
if (_relaxMode) {
return(undefined);
}
var _local3 = (_timeLimit * _intervalTime) - (_curIntervalNum * _intervalTime);
_curIntervalNum++;
var _local4 = com.xitex.crgame.utils.TypeConverter.__get__instance().numberToDate(_local3);
var _local5 = String(_local4.getMinutes());
var _local2 = String(_local4.getSeconds());
if (_local2.length == 1) {
_local2 = "0" + _local2;
}
_valueField.text = String((_local5 + ":") + _local2);
if (_local3 == (_WARNING_TIME * _intervalTime)) {
startRunningOutAnim();
_warningSound.start();
}
if (_local3 == 0) {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
}
function startRunningOutAnim() {
_isRunningOutAnim = true;
if (_relaxMode) {
return(undefined);
}
_runningOutAnim._visible = true;
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_runningOutAnim, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), Number.POSITIVE_INFINITY, 1);
}
function stopRunningOutAnim() {
_isRunningOutAnim = false;
if (_relaxMode) {
return(undefined);
}
_runningOutAnim._visible = false;
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_runningOutAnim, 1);
}
function set timeLimit(prmValue) {
_timeLimit = prmValue;
//return(__get__timeLimit());
}
function set relaxMode(prmValue) {
if (prmValue) {
_titleField._visible = false;
_valueField._visible = false;
}
_relaxMode = prmValue;
//return(__get__relaxMode());
}
var _TITLE_FIELD_NAME = "time_title_field";
var _VALUE_FIELD_NAME = "time_value_field";
var _RUNNING_OUT_ANIM_CONTAINER_NAME = "time_running_out_anim";
var _WARNING_TIME = 5;
var _WARNING_SOUND_LIBRARY_ID = "warning";
var _timeLimit = 300;
var _relaxMode = false;
}
Symbol 911 MovieClip [__Packages.com.xitex.crgame.utils.TypeConverter] Frame 0
class com.xitex.crgame.utils.TypeConverter
{
static var _instance;
function TypeConverter () {
}
function numberToDate(prmValue) {
var _local1 = new Date();
_local1.setTime(prmValue);
return(_local1);
}
static function get instance() {
if (_instance == undefined) {
_instance = new com.xitex.crgame.utils.TypeConverter();
}
return(_instance);
}
}
Symbol 912 MovieClip [__Packages.com.xitex.crgame.anims.CRCookieScoreAnim] Frame 0
class com.xitex.crgame.anims.CRCookieScoreAnim
{
var _container, _anims;
function CRCookieScoreAnim (prmParentContainer) {
_container = prmParentContainer.createEmptyMovieClip("CRCookieScoreAnim", prmParentContainer.getNextHighestDepth());
_anims = new Array();
}
function createTypePairAnim(prmCookie, prmScore) {
var animId = _anims.length;
var _local2 = _container.attachMovie(_TYPE_SCORE_ANIM_CONTAINER_LIBRARY_IDS[prmCookie.__get__typeID()], _TYPE_SCORE_ANIM_CONTAINER_LIBRARY_IDS[prmCookie.__get__typeID()] + animId, animId);
_local2._x = prmCookie.__get__containerInstance().getPoint().x;
_local2._y = prmCookie.__get__containerInstance().getPoint().y;
var thisObj = this;
_local2[_ANIM_CONTAINER_NAME].onEndPlay = function () {
thisObj.deleteAnim(animId);
};
setScore(_local2[_ANIM_CONTAINER_NAME], prmScore);
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_local2[_ANIM_CONTAINER_NAME], com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
_anims[animId] = _local2;
return(animId);
}
function createNumberPairAnim(prmCookie, prmScore) {
var animId = _anims.length;
var _local2 = _container.attachMovie(_NUMBER_SCORE_ANIM_CONTAINER_LIBRARY_IDS, _NUMBER_SCORE_ANIM_CONTAINER_LIBRARY_IDS + animId, animId);
_local2._x = prmCookie.__get__containerInstance().getPoint().x;
_local2._y = prmCookie.__get__containerInstance().getPoint().y;
var thisObj = this;
_local2[_ANIM_CONTAINER_NAME].onEndPlay = function () {
thisObj.deleteAnim(animId);
};
setScore(_local2[_ANIM_CONTAINER_NAME], prmScore);
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_local2[_ANIM_CONTAINER_NAME], com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
_anims[animId] = _local2;
return(animId);
}
function deleteAnim(prmAnimID) {
_anims[prmAnimID].removeMovieClip();
_anims[prmAnimID] = null;
}
function setScore(prmAnimContainer, prmValue) {
var _local2 = prmAnimContainer[_SCORE_FIELD_CONTAINER_NAME][_SCORE_VALUE_FIELD_NAME];
_local2.text = String(prmValue);
}
var _TYPE_SCORE_ANIM_CONTAINER_LIBRARY_IDS = ["score_jamcake_anim", "score_square_anim", "score_gingerbread_anim", "score_muffin_anim", "score_cookiecake_anim", "score_chocolate_anim"];
var _NUMBER_SCORE_ANIM_CONTAINER_LIBRARY_IDS = "special_score_anim";
var _ANIM_CONTAINER_NAME = "anim_container";
var _SCORE_FIELD_CONTAINER_NAME = "score_field_container";
var _SCORE_VALUE_FIELD_NAME = "score_value_field";
}
Symbol 913 MovieClip [__Packages.com.xitex.crgame.anims.CRDeckDealAnim] Frame 0
class com.xitex.crgame.anims.CRDeckDealAnim implements com.xitex.crgame.cookie.ICRCookieContainer
{
var _deck, _deckAnimContainer, _cookieContainer, _dealSound, _cookie, _targetContainer, _isRunning, dispatchEvent;
function CRDeckDealAnim (prmDeck) {
mx.events.EventDispatcher.initialize(this);
_deck = prmDeck;
_deckAnimContainer = _deck.container;
_cookieContainer = _deckAnimContainer[_COOKIE_CONTAINER_NAME];
_dealSound = new com.xitex.crgame.sounds.CRSound(_cookieContainer, _DEAL_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
restore();
}
function getNumRestCookies() {
var _local2;
if (_cookie == null) {
_local2 = 0;
} else {
_local2 = 1;
}
return(_local2);
}
function pushCookie(prmCookie) {
_cookie = prmCookie;
_cookie.attach(_cookieContainer, this);
_cookie.setSelect(false);
_cookie.setBlock(false);
_cookie.setEnable(false);
}
function popCookie() {
var _local2 = _cookie;
_local2.remove();
_cookie = null;
return(_local2);
}
function restore() {
_targetContainer = null;
_isRunning = false;
_cookie = null;
stop();
}
function start(prmTargetContainer) {
_dealSound.start();
_isRunning = true;
_targetContainer = prmTargetContainer;
pushCookie(_deck.getNextCookie());
_deckAnimContainer.onEndPlay = mx.utils.Delegate.create(this, endAnim);
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_deckAnimContainer, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
_deck.setEnable(false);
}
function stop() {
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_deckAnimContainer, 1);
}
function isRunning() {
return(_isRunning);
}
function getPoint() {
return(null);
}
function getID() {
return(null);
}
function endAnim() {
_targetContainer.pushCookie(popCookie());
_isRunning = false;
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
var _COOKIE_CONTAINER_NAME = "cake_container";
var _DEAL_SOUND_LIBRARY_ID = "cookie_jar_opened";
}
Symbol 914 MovieClip [__Packages.com.xitex.crgame.anims.CRFormationAnim] Frame 0
class com.xitex.crgame.anims.CRFormationAnim
{
var _cookieFormAnims, _timeInterval, _cookieAnimNumSteps, _numSteps, _curDelay, _curStep, _numFormAnims, _animId, dispatchEvent;
function CRFormationAnim () {
_cookieFormAnims = new Array();
_timeInterval = _TIME_INTERVAL;
_cookieAnimNumSteps = _NUM_INTERVALS;
mx.events.EventDispatcher.initialize(this);
}
function restore() {
_numSteps = _cookieAnimNumSteps;
_curDelay = 0;
_cookieFormAnims = new Array();
}
function addCookieContainer(prmCookieContainer) {
var _local3 = getNewStartPoint(prmCookieContainer);
var _local4 = Math.round((_COOKIE_ANGEL_RANGE / 2) - (Math.random() * _COOKIE_ANGEL_RANGE));
var _local2 = Math.round(Math.random() * (_COOKIE_MAX_SCALE - _COOKIE_MIN_SCALE)) + _COOKIE_MIN_SCALE;
_curDelay = _curDelay + Math.round(Math.random() * _COOKIE_MAX_ANIM_DELAY);
_numSteps = _curDelay + _cookieAnimNumSteps;
_cookieFormAnims.push(new com.xitex.crgame.anims.CRCookieFormAnim(prmCookieContainer, _curDelay, _local3, _local4, _local2, _cookieAnimNumSteps));
}
function start() {
_curStep = 0;
_numFormAnims = _cookieFormAnims.length;
clearInterval(_animId);
_animId = setInterval(this, "update", _timeInterval);
}
function stop() {
clearInterval(_animId);
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
function update() {
var _local2 = 0;
while (_local2 < _numFormAnims) {
_cookieFormAnims[_local2].update(_curStep);
_local2++;
}
_curStep++;
if (_curStep == _numSteps) {
stop();
}
}
function getNewStartPoint(prmCookieContainer) {
var _local4 = Math.round((_COOKIE_CORRECT_POINT_MAX_POSITION / 2) - (Math.random() * _COOKIE_CORRECT_POINT_MAX_POSITION));
var _local3 = Math.round((_COOKIE_CORRECT_POINT_MAX_POSITION / 2) - (Math.random() * _COOKIE_CORRECT_POINT_MAX_POSITION));
var _local2 = new flash.geom.Point(_local4, _local3);
_local2.normalize(_COOKIE_MAX_DISTANCE);
return(_local2);
}
var _TIME_INTERVAL = 15;
var _NUM_INTERVALS = 25;
var _COOKIE_ANGEL_RANGE = 360;
var _COOKIE_MIN_SCALE = 500;
var _COOKIE_MAX_SCALE = 800;
var _COOKIE_MAX_DISTANCE = 1200;
var _COOKIE_CORRECT_POINT_MAX_POSITION = 200;
var _COOKIE_MAX_ANIM_DELAY = 2;
}
Symbol 915 MovieClip [__Packages.com.xitex.crgame.anims.CRCookieFormAnim] Frame 0
class com.xitex.crgame.anims.CRCookieFormAnim
{
var _container, _numSteps, _startStepNum, _delay, _scaleSizeVector, _turningAngelVector, _motionPath;
function CRCookieFormAnim (prmCookieContainer, prmDelay, prmStartPoint, prmTurningAngel, prmScaleSize, prmNumSteps, prmStartStepNum) {
_container = prmCookieContainer.container;
_numSteps = prmNumSteps;
_startStepNum = prmStartStepNum;
_delay = prmDelay;
generateMotionPath(prmStartPoint);
generateTurningAngelVector(prmTurningAngel);
generateScaleSizeVector(prmScaleSize);
}
function update(prmUpdateStep) {
if (prmUpdateStep == _delay) {
_container._visible = true;
}
if (prmUpdateStep >= _delay) {
_container._xscale = (_container._yscale = _scaleSizeVector[prmUpdateStep - _delay]);
_container._rotation = _turningAngelVector[prmUpdateStep - _delay];
_container._x = _motionPath[prmUpdateStep - _delay].x;
_container._y = _motionPath[prmUpdateStep - _delay].y;
}
}
function generateMotionPath(prmStartPoint) {
var _local2 = new flash.geom.Point(_container._x, _container._y);
_motionPath = com.xitex.crgame.utils.BezierCurve.createLinearCurve(_numSteps - 1, prmStartPoint, _local2);
}
function generateTurningAngelVector(prmTurningAngel) {
_turningAngelVector = new Array();
var _local3 = Math.round(prmTurningAngel / (_numSteps - 1));
var _local2 = 0;
while (_local2 < (_numSteps - 1)) {
_turningAngelVector[_local2] = prmTurningAngel - (_local3 * _local2);
_local2++;
}
_turningAngelVector[_numSteps - 1] = 0;
}
function generateScaleSizeVector(prmScaleSize) {
_scaleSizeVector = new Array();
var _local3 = Math.round((prmScaleSize - 100) / (_numSteps - 1));
var _local2 = 0;
while (_local2 < (_numSteps - 1)) {
_scaleSizeVector[_local2] = prmScaleSize - (_local3 * _local2);
_local2++;
}
_scaleSizeVector[_numSteps - 1] = 100;
}
}
Symbol 916 MovieClip [__Packages.com.xitex.crgame.utils.BezierCurve] Frame 0
class com.xitex.crgame.utils.BezierCurve
{
function BezierCurve () {
}
static function createLinearCurve(prmNumCurvePoints, prmPoint0, prmPoint1) {
var _local8 = 1 / prmNumCurvePoints;
var _local1 = 0;
var _local3;
var _local4;
var _local7 = new Array();
var _local2 = 0;
while (_local2 < (prmNumCurvePoints + 1)) {
_local1 = _local2 * _local8;
_local3 = ((1 - _local1) * prmPoint0.x) + (_local1 * prmPoint1.x);
_local4 = ((1 - _local1) * prmPoint0.y) + (_local1 * prmPoint1.y);
_local7.push(new flash.geom.Point(Math.round(_local3), Math.round(_local4)));
_local2++;
}
return(_local7);
}
static function createQuadraticCurve(prmNumCurvePoints, prmPoint0, prmPoint1, prmPoint2) {
var _local9 = 1 / prmNumCurvePoints;
var _local1 = 0;
var _local3;
var _local4;
var _local8 = new Array();
var _local2 = 0;
while (_local2 < (prmNumCurvePoints + 1)) {
_local1 = _local2 * _local9;
_local3 = ((((1 - _local1) * (1 - _local1)) * prmPoint0.x) + (((2 * _local1) * (1 - _local1)) * prmPoint1.x)) + ((_local1 * _local1) * prmPoint2.x);
_local4 = ((((1 - _local1) * (1 - _local1)) * prmPoint0.y) + (((2 * _local1) * (1 - _local1)) * prmPoint1.y)) + ((_local1 * _local1) * prmPoint2.y);
_local8.push(new flash.geom.Point(Math.round(_local3), Math.round(_local4)));
_local2++;
}
return(_local8);
}
static function createCubicCurve(prmNumCurvePoints, prmPoint0, prmPoint1, prmPoint2, prmPoint3) {
var _local10 = 1 / prmNumCurvePoints;
var _local1 = 0;
var _local3;
var _local4;
var _local9 = new Array();
var _local2 = 0;
while (_local2 < (prmNumCurvePoints + 1)) {
_local1 = _local2 * _local10;
_local3 = (((((1 - _local1) * (1 - _local1)) * prmPoint0.x) + (((1 - _local1) * (1 - _local1)) * prmPoint1.x)) + (((2 * _local1) * (1 - _local1)) * prmPoint2.x)) + ((_local1 * _local1) * prmPoint3.x);
_local4 = (((((1 - _local1) * (1 - _local1)) * prmPoint0.y) + (((1 - _local1) * (1 - _local1)) * prmPoint1.y)) + (((2 * _local1) * (1 - _local1)) * prmPoint2.y)) + ((_local1 * _local1) * prmPoint3.y);
_local9.push(new flash.geom.Point(Math.round(_local3), Math.round(_local4)));
_local2++;
}
return(_local9);
}
}
Symbol 917 MovieClip [__Packages.com.xitex.crgame.anims.CRCookieMovingAnim] Frame 0
class com.xitex.crgame.anims.CRCookieMovingAnim implements com.xitex.crgame.cookie.ICRCookieContainer
{
var _container, _motionPath, _cookie, _isRunning, _sourceContainer, _targetContainer, _curStep, _animID, dispatchEvent;
function CRCookieMovingAnim (prmParentContainer) {
_container = prmParentContainer.createEmptyMovieClip("CRCookieMovingAnim", prmParentContainer.getNextHighestDepth());
mx.events.EventDispatcher.initialize(this);
}
function pushCookie(prmCookie) {
_container._x = _motionPath[0].x;
_container._y = _motionPath[0].y;
_cookie = prmCookie;
prmCookie.attach(_container, this);
_cookie.setSelect(false);
_cookie.setEnable(false);
_cookie.setBlock(false);
}
function popCookie() {
var _local2 = _cookie;
_cookie.remove();
_cookie = null;
return(_local2);
}
function getPoint() {
return(null);
}
function start(prmStartContainer, prmEndContainer) {
_isRunning = true;
_sourceContainer = prmStartContainer;
_targetContainer = prmEndContainer;
var _local3 = prmStartContainer.getPoint();
var _local2 = prmEndContainer.getPoint();
generatePath(_local3, _local2);
_curStep = 0;
clearInterval(_animID);
_animID = setInterval(this, "update", _TIME_INTERVAL);
}
function stop() {
clearInterval(_animID);
_targetContainer.pushCookie(popCookie());
_isRunning = false;
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
function restore() {
_isRunning = false;
_sourceContainer = null;
_targetContainer = null;
_cookie = null;
_container._visible = true;
clearInterval(_animID);
}
function isRunning() {
return(_isRunning);
}
function getID() {
return(null);
}
function generatePath(prmStartPoint, prmEndPoint) {
_motionPath = com.xitex.crgame.utils.BezierCurve.createLinearCurve(_NUM_INTERVALS, prmStartPoint, prmEndPoint);
}
function update() {
if (_DELAY == _curStep) {
pushCookie(_sourceContainer.popCookie());
}
if (_DELAY < _curStep) {
_container._x = _motionPath[_curStep - _DELAY].x;
_container._y = _motionPath[_curStep - _DELAY].y;
}
if (_curStep == (_NUM_INTERVALS + _DELAY)) {
stop();
}
_curStep++;
}
var _NUM_INTERVALS = 10;
var _TIME_INTERVAL = 20;
var _DELAY = 10;
}
Symbol 918 MovieClip [__Packages.com.xitex.crgame.ui.CRPastryBonus] Frame 0
class com.xitex.crgame.ui.CRPastryBonus
{
var _parentContainer, _releaseComboSound, _curBonusId, _proxyCommander, _releasedBonusIDs, _score, _curPieceNum, _numCumulativePieces;
function CRPastryBonus (prmParentContainer, prmSoundContainer, prmProxyCommander) {
_parentContainer = prmParentContainer;
_releaseComboSound = new com.xitex.crgame.sounds.CRSound(prmSoundContainer, _RELEASE_COMBO_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
_curBonusId = 0;
_proxyCommander = prmProxyCommander;
}
function addPastryBonusIcons(prmContainer) {
var _local6 = _releasedBonusIDs.length;
var _local5 = prmContainer.createEmptyMovieClip("icons_container", 0);
var _local4 = new Array();
var _local3 = 0;
var _local2 = 0;
while (_local2 < _local6) {
_local4[_local2] = _local5.attachMovie(_CAKE_ICONS_LIBRARY_IDS[_releasedBonusIDs[_local2]], _CAKE_ICONS_LIBRARY_IDS[_releasedBonusIDs[_local2]], _local2);
_local4[_local2]._x = _local3;
_local3 = _local3 + _local4[_local2]._width;
_local2++;
}
_local5._x = -Math.round(_local5._width / 2);
return(_local5);
}
function restore() {
_score = 0;
_releasedBonusIDs = new Array();
}
function addPairToSeries() {
var _local2;
if (_curPieceNum == (_CAKE_PIECES_NAMES[_curBonusId].length - 1)) {
_score = _score + _SCORES[_curBonusId];
startReleaseBonusAnim();
_releasedBonusIDs.push(_curBonusId);
_proxyCommander.execAddLogComm(("CAKE " + _curBonusId) + " complete");
_local2 = new com.xitex.crgame.utils.Timeout(this, initNextBonus, null, _NEXT_BONUS_DELAY);
} else if (_curPieceNum < (_CAKE_PIECES_NAMES[_curBonusId].length - 1)) {
startNextCakeFillingAnim();
} else if (_curPieceNum > (_CAKE_PIECES_NAMES[_curBonusId].length - 1)) {
_numCumulativePieces++;
}
_curPieceNum++;
}
function restoreSeries() {
_curPieceNum = 0;
_numCumulativePieces = 0;
if (_curBonusId < _CAKE_ANIM_NAMES.length) {
var _local4 = _CAKE_PIECES_NAMES[_curBonusId].length;
var _local3;
var _local2 = 0;
while (_local2 < _local4) {
_local3 = _parentContainer[_CAKE_ANIM_NAMES[_curBonusId]][_CAKE_PIECES_NAMES[_curBonusId][_local2]];
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_local3, 1);
_local2++;
}
}
}
function initNextBonus() {
_curBonusId++;
initCurBonus();
var _local2 = 0;
while (_local2 < _numCumulativePieces) {
startNextCakeFillingAnim();
_curPieceNum++;
_local2++;
}
_numCumulativePieces = 0;
_proxyCommander.execAddLogComm(("CAKE " + _curBonusId) + " initialize");
}
function initCurBonus() {
_curPieceNum = 0;
var _local3 = _CAKE_ANIM_NAMES.length;
if (_curBonusId < _local3) {
init();
var _local2 = 0;
while (_local2 < _local3) {
if (_curBonusId == _local2) {
_parentContainer[_CAKE_ANIM_NAMES[_local2]]._visible = true;
} else {
_parentContainer[_CAKE_ANIM_NAMES[_local2]]._visible = false;
}
_local2++;
}
}
}
function getScore() {
return(_score);
}
function startNextCakeFillingAnim() {
var _local2 = _parentContainer[_CAKE_ANIM_NAMES[_curBonusId]][_CAKE_PIECES_NAMES[_curBonusId][_curPieceNum]];
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_local2, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
}
function startReleaseBonusAnim() {
_releaseComboSound.start();
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_parentContainer[_CAKE_ANIM_NAMES[_curBonusId]][_RELEASED_CAKE_ANIM_NAME], com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
}
function init() {
var _local6 = _CAKE_ANIM_NAMES.length;
var _local4;
var _local5;
var _local3 = 0;
while (_local3 < _local6) {
_local4 = _parentContainer[_CAKE_ANIM_NAMES[_local3]];
_parentContainer[_CAKE_ANIM_NAMES[_local3]]._visible = false;
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_local4[_RELEASED_CAKE_ANIM_NAME], 1);
_local5 = _CAKE_PIECES_NAMES[_local3].length;
var _local2 = 0;
while (_local2 < _local5) {
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_local4[_CAKE_PIECES_NAMES[_local3][_local2]], 1);
_local2++;
}
_local3++;
}
}
var _CAKE_ANIM_NAMES = ["carrotcake", "prinsesscake", "fruitcake", "chocolate", "operacake"];
var _CAKE_PIECES_NAMES = [["piece_1", "piece_2", "piece_3", "piece_4", "piece_5", "piece_6", "piece_7", "piece_8"], ["piece_1", "piece_2", "piece_3", "piece_4", "piece_5", "piece_6", "piece_7", "piece_8", "piece_9", "piece_10"], ["piece_1", "piece_2", "piece_3", "piece_4", "piece_5", "piece_6", "piece_7", "piece_8", "piece_9", "piece_10", "piece_11", "piece_12"], ["piece_1", "piece_2", "piece_3", "piece_4", "piece_5", "piece_6", "piece_7", "piece_8", "piece_9", "piece_10", "piece_11", "piece_12", "piece_13", "piece_14", "piece_15"], ["piece_1", "piece_2", "piece_3", "piece_4", "piece_5", "piece_6", "piece_7", "piece_8", "piece_9", "piece_10", "piece_11", "piece_12", "piece_13", "piece_14", "piece_15", "piece_16", "piece_17", "piece_18", "piece_19", "piece_20"]];
var _RELEASED_CAKE_ANIM_NAME = "combo_animation";
var _SCORES = [1000, 2000, 3000, 5000, 8000];
var _RELEASE_COMBO_SOUND_LIBRARY_ID = "release_combo";
var _NEXT_BONUS_DELAY = 3;
var _CAKE_ICONS_LIBRARY_IDS = ["carrotcake_icon", "prinsesscake_icon", "fruitcake_icon", "chocolate_icon", "operacake_icon"];
}
Symbol 919 MovieClip [__Packages.com.xitex.crgame.utils.Timeout] Frame 0
class com.xitex.crgame.utils.Timeout
{
var _applyObject, _applyFunc, _applyParams, _id;
function Timeout (prmObj, prmFunc, prmParams, prmTimeInterval) {
_applyObject = prmObj;
_applyFunc = prmFunc;
_applyParams = prmParams;
_id = setInterval(this, "releaseFunc", prmTimeInterval * 1000);
}
function clear() {
clearInterval(_id);
}
function releaseFunc() {
_applyFunc.apply(_applyObject, _applyParams);
clear();
}
}
Symbol 920 MovieClip [__Packages.com.xitex.crgame.anims.CRSpiderAnim] Frame 0
class com.xitex.crgame.anims.CRSpiderAnim
{
var _container, _timeout;
function CRSpiderAnim (prmParentContainer) {
_container = prmParentContainer[_CONTAINER_NAME];
}
function restore() {
stop();
}
function start() {
var _local2 = Math.round((Math.random() * (_MAX_TIMEOUT_TIME - _MIN_TIMEOUT_TIME)) + _MIN_TIMEOUT_TIME);
_timeout = new com.xitex.crgame.utils.Timeout(this, playAnim, null, _local2);
}
function stop() {
_container._visible = false;
_timeout.clear();
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, 1);
}
function playAnim() {
var _local2 = _AVAILABLE_X_POSITIONS[Math.round(Math.random() * (_AVAILABLE_X_POSITIONS.length - 1))];
var _local3 = _AVAILABLE_Y_POSITIONS[Math.round(Math.random() * (_AVAILABLE_Y_POSITIONS.length - 1))];
_container._x = _local2;
_container._y = _local3;
_container._visible = true;
_container.onEndPlay = mx.utils.Delegate.create(this, stop);
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_container, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1, 1);
}
var _CONTAINER_NAME = "spider_anim";
var _AVAILABLE_X_POSITIONS = [530, 570, 70, 25, -75, -30];
var _AVAILABLE_Y_POSITIONS = [-8, -60, -80, -15, -35];
var _MAX_TIMEOUT_TIME = 25;
var _MIN_TIMEOUT_TIME = 5;
}
Symbol 921 MovieClip [__Packages.com.xitex.crgame.anims.CREndFallingAnim] Frame 0
class com.xitex.crgame.anims.CREndFallingAnim
{
var _container, _anims, _addIntervalID, _animId;
function CREndFallingAnim () {
}
function start(prmParentContainer) {
_container = prmParentContainer[_ANIM_CONTAINER_NAME];
_anims = new Array();
_anims.length = 1;
stop();
addNewFalling();
_addIntervalID = setInterval(this, "addNewFalling", CREATION_TIME_INTERVAL);
update();
_animId = setInterval(this, "update", _ANIM_TIME_INTERVAL);
}
function stop() {
clearInterval(_animId);
clearInterval(_addIntervalID);
}
function addNewFalling() {
var _local2 = getNextIndex();
var _local4 = Stage.width + (2 * _X_RANGE);
var _local10 = Stage.height + (2 * _Y_RANGE);
var _local3 = Math.round(Math.random() * _local4) - _X_RANGE;
var _local13 = -Math.round(Math.random() * _Y_RANGE);
var _local9 = _local3 + Math.round((_X_MAX_OFFSET / 2) - (Math.random() * _X_MAX_OFFSET));
var _local7 = _local10 + Math.round(Math.random() * _Y_RANGE);
var _local11 = new flash.geom.Point(_local3, _local13);
var _local6 = new flash.geom.Point(_local9, _local7);
var _local8 = Math.round((_MAX_START_ROTATE_RANGE / 2) - (Math.random() * _MAX_START_ROTATE_RANGE));
var _local12 = Math.round(Math.random() * _MAX_ROTATIONS_NUM);
var _local5 = Math.round(Math.random() * (_FALLING_CAKES_LIBRARY_IDS.length - 1));
_anims[_local2] = new com.xitex.crgame.anims.CRCookieFallingAnim(_container, _FALLING_CAKES_LIBRARY_IDS[_local5], _local2, _NUM_STEPS, _local11, _local6, _local8, _local12);
_anims[_local2].addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(this, deleteCookieFalling));
}
function deleteCookieFalling(prmEvent) {
_anims[prmEvent.__get__target().id].removeEventListener();
delete _anims[prmEvent.__get__target().id];
}
function update() {
var _local3 = _anims.length;
var _local2 = 0;
while (_local2 < _local3) {
_anims[_local2].update();
_local2++;
}
}
function getNextIndex() {
var _local3 = _anims.length;
var _local2 = 0;
while (_local2 < _local3) {
if (!(_anims[_local2] instanceof com.xitex.crgame.anims.CRCookieFallingAnim)) {
return(_local2);
}
_local2++;
}
return(_local3);
}
var _ANIM_CONTAINER_NAME = "falling_anim_container";
var _FALLING_CAKES_LIBRARY_IDS = ["cake1", "cake2", "cake3", "cake4", "cake5"];
var _Y_RANGE = 50;
var _X_RANGE = 50;
var _X_MAX_OFFSET = 500;
var _MAX_START_ROTATE_RANGE = 100;
var _MAX_ROTATIONS_NUM = 10;
var _ANIM_TIME_INTERVAL = 20;
var _NUM_STEPS = 40;
var CREATION_TIME_INTERVAL = 70;
}
Symbol 922 MovieClip [__Packages.com.xitex.crgame.anims.CRCookieFallingAnim] Frame 0
class com.xitex.crgame.anims.CRCookieFallingAnim
{
var _container, _numSteps, _curStep, _id, _motionPath, _turningAngelVector, dispatchEvent;
function CRCookieFallingAnim (prmParentContainer, prmContainerLibraryID, prmID, prmNumSteps, prmStartPoint, prmEndPoint, prmStartAngel, prmNumRotations) {
mx.events.EventDispatcher.initialize(this);
_container = prmParentContainer.attachMovie(prmContainerLibraryID, com.xitex.crgame.anims.CRCookieFallingAnim + prmID, prmID);
_container._visible = false;
_numSteps = prmNumSteps;
_curStep = 0;
_id = prmID;
generateMotionPath(prmStartPoint, prmEndPoint);
generateTurningAngelVector(prmNumRotations, prmStartAngel);
}
function update() {
if (_curStep == 0) {
_container._visible = true;
}
if (_curStep < _numSteps) {
_container._x = _motionPath[_curStep].x;
_container._y = _motionPath[_curStep].y;
_container._rotation = _turningAngelVector[_curStep];
_curStep++;
} else if (_curStep == _numSteps) {
destroy();
}
}
function destroy() {
_container.removeMovieClip();
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.END_EVENT, this));
}
function generateMotionPath(prmStartPoint, prmEndPoint) {
var _local2 = new flash.geom.Point(_container._x, _container._y);
_motionPath = com.xitex.crgame.utils.BezierCurve.createLinearCurve(_numSteps - 1, prmStartPoint, prmEndPoint);
}
function generateTurningAngelVector(prmNumRotations, prmStartAngel) {
_turningAngelVector = new Array();
var _local3 = Math.round((prmNumRotations * 360) / (_numSteps - 1));
var _local2 = 0;
while (_local2 < (_numSteps - 1)) {
_turningAngelVector[_local2] = (prmStartAngel + (_local3 * _local2)) % 360;
_local2++;
}
_turningAngelVector[_numSteps - 1] = prmStartAngel;
}
function get id() {
return(_id);
}
}
Symbol 923 MovieClip [__Packages.com.xitex.crgame.CRGameFlow] Frame 0
class com.xitex.crgame.CRGameFlow
{
var _container, _curLevelNum, _pastryBonus, _complete10LevelsAnim, _exitButton, _soundButton, _logic, _gameState, _introForm, _levels, _mainForm, _proxyCommander, _score, _fallingAnimator, _openVersionForm, _cookieDeck, _cookieFormation, _cookieStack, _deckDealAnim, _noMovesAnim, _spiderAnimator, _timer, _openVersion, _formTimeout, _lastLevelSuccess, _lossGameForm, _winGameForm, _levelCompleteForm, _isSoundEnable, __get__cookieFormation, __get__cookieDeck, __get__cookieStack, __get__score, __get__logic, __get__deckDealAnim, __get__levels, _cookies, __get__cookies, _formationAnimator, __get__formationAnimator, __get__introForm, __get__mainForm, __get__timer, __get__levelCompleteForm, __get__pastryBonusAnim, __get__noMovesAnim, __get__lossGameForm, __get__winGameForm, __get__spiderAnimator, __get__fallingAnimator, __get__proxyCommander, __get__complete10LevelsAnim, __get__soundButton, __get__exitButton, __get__openVersionForm, __get__openVersion;
function CRGameFlow (prmContainer) {
_container = prmContainer;
}
function startGame() {
_curLevelNum = 0;
_pastryBonus.restore();
_complete10LevelsAnim.restore();
_exitButton.restore();
_soundButton.restore();
_logic.setBlock(false);
_gameState = _INTRO_STATE;
_introForm.show();
_introForm.setEnable(true);
}
function nextLevel() {
if (_curLevelNum != _levels.length) {
_gameState = _PLAYING_STATE;
_mainForm.setEnable(true);
restoreGameObjects();
createLevel();
_mainForm.updateLevelTitleField(_curLevelNum);
_proxyCommander.execStartLevelComm(_levels[_curLevelNum].id, _score.getTotalScore());
_curLevelNum++;
}
}
function releaseEndOfOpenVersion() {
_logic.setBlock(true);
_mainForm.setEnable(false);
_logic.setEnableGameField(true);
_fallingAnimator.start(_mainForm.getContainer());
_openVersionForm.show();
_proxyCommander.execBonusComm(0);
_proxyCommander.execEndLevelComm(_score.getTotalScore());
_proxyCommander.execGameEndComm(_score.getTotalScore());
}
function restoreGameObjects() {
_cookieDeck.restore();
_cookieFormation.restore();
_cookieStack.restore();
_score.restore();
_logic.restore();
_deckDealAnim.restore();
_noMovesAnim.restore();
_spiderAnimator.restore();
_pastryBonus.restore();
_pastryBonus.restoreSeries();
}
function createLevel() {
_mainForm.setBG(_levels[_curLevelNum].typeID);
_pastryBonus.initCurBonus();
var _local2 = _levels[_curLevelNum];
_cookieDeck.mix(_local2.__get__numTypeCookies(), _local2.__get__numTypes());
_cookieFormation.generate(_local2.__get__structure());
_spiderAnimator.start();
_logic.setEnableGameField(false);
}
function handleEndFormationAnim() {
if (_gameState == _PLAYING_STATE) {
_timer.start(true);
_logic.setBlock(false);
_logic.setEnableGameField(true);
_cookieDeck.deal();
if (_openVersion && ((_curLevelNum - 1) == _OPEN_VERSION_NUM_AVAILABLE_LEVELS)) {
releaseEndOfOpenVersion();
}
}
}
function handleHideEvent(prmEvent) {
var _local3;
if (prmEvent.__get__target() instanceof com.xitex.crgame.forms.CROpenVersionForm) {
if (_gameState == _PLAYING_STATE) {
_gameState = _END_GAME_STATE;
releaseLossGameForm();
}
} else if (prmEvent.__get__target() instanceof com.xitex.crgame.forms.CRIntroForm) {
if (_gameState == _INTRO_STATE) {
_mainForm.show();
nextLevel();
}
} else if (prmEvent.__get__target() instanceof com.xitex.crgame.forms.CRLevelCompleteForm) {
if (_gameState == _LEVEL_RESULT_STATE) {
nextLevel();
}
} else if (prmEvent.__get__target() instanceof com.xitex.crgame.forms.CRLossGameForm) {
if (_gameState == _END_GAME_STATE) {
_local3 = new com.xitex.crgame.utils.Timeout(_proxyCommander, _proxyCommander.execGameQuitComm, null, _SEND_QUIT_COMMAND_DELAY);
_exitButton.setBlock(true);
_gameState = _CLOSED_GAME_STATE;
}
} else if (prmEvent.__get__target() instanceof com.xitex.crgame.forms.CRWinGameForm) {
if (_gameState == _END_GAME_STATE) {
_local3 = new com.xitex.crgame.utils.Timeout(_proxyCommander, _proxyCommander.execGameQuitComm, null, _SEND_QUIT_COMMAND_DELAY);
_exitButton.setBlock(true);
_gameState = _CLOSED_GAME_STATE;
}
}
}
function endGame(prmSuccess) {
_gameState = _END_GAME_STATE;
_formTimeout.clear();
if (prmSuccess) {
_formTimeout = new com.xitex.crgame.utils.Timeout(this, releaseWinGameForm, null, _WIN_GAME_FORM_TIMEOUT);
} else {
_formTimeout = new com.xitex.crgame.utils.Timeout(this, releaseLossGameForm, null, _LOSS_GAME_FORM_TIMEOUT);
}
_proxyCommander.execGameEndComm(_score.getTotalScore());
}
function endLevel(prmSuccess) {
if (_gameState == _PLAYING_STATE) {
_lastLevelSuccess = prmSuccess;
_timer.stop();
_logic.setBlock(true);
_logic.setEnableGameField(false);
if (prmSuccess) {
_score.addComboBonus(_pastryBonus.getScore());
_score.addDeckBonus((_deckDealAnim.getNumRestCookies() + _cookieDeck.getNumRestCookies()) + _cookieStack.getNumRestCookies());
} else {
_score.addComboBonus(0);
_score.addDeckBonus(0);
}
_proxyCommander.execBonusComm(_score.getDeckBonusScore() + _score.getComboBonusScore());
_proxyCommander.execEndLevelComm(_score.getTotalScore());
if (prmSuccess) {
if (_curLevelNum < _levels.length) {
_gameState = _LEVEL_RESULT_STATE;
_formTimeout.clear();
_formTimeout = new com.xitex.crgame.utils.Timeout(this, releaseLevelCompleteForm, null, _LEVEL_COMPLETE_FORM_TIMEOUT);
} else if (_curLevelNum == _levels.length) {
endGame(true);
}
} else if (_curLevelNum < _GAME_WIN_NUM_LEVELS) {
endGame(false);
} else {
endGame(true);
}
}
}
function releaseLossGameForm() {
_mainForm.setEnable(false);
setScores(_lossGameForm);
_lossGameForm.show();
_fallingAnimator.start(_lossGameForm.getContainer());
_lossGameForm.setEnable(true);
}
function releaseWinGameForm() {
_mainForm.setEnable(false);
setScores(_winGameForm);
_winGameForm.show();
if ((_curLevelNum == 10) && (_lastLevelSuccess)) {
_complete10LevelsAnim.start();
}
_winGameForm.setEnable(true);
}
function releaseLevelCompleteForm() {
_mainForm.setEnable(false);
setScores(_levelCompleteForm);
_levelCompleteForm.show(_pastryBonus);
_levelCompleteForm.setEnable(true);
}
function setScores(prmResultWindow) {
prmResultWindow.setCurScoreValue(_score.getCurScore());
prmResultWindow.setJarBonusValue(_score.getDeckBonusScore());
prmResultWindow.setPastryBonusValue(_score.getComboBonusScore());
prmResultWindow.setTotalScoreValue(_score.getTotalScore());
}
function handleLossGameEvent(prmEvent) {
endLevel(false);
}
function handleWinGameEvent(prmEvent) {
endLevel(true);
}
function handleSoundButtonEvent(prmEvent) {
_isSoundEnable = !_isSoundEnable;
com.xitex.crgame.sounds.CRSound.setAllSoundsEnable(_isSoundEnable);
}
function handleExitButtonEvent(prmEvent) {
_proxyCommander.execAddLogComm("EXIT BUTTON pressed");
switch (_gameState) {
case _INTRO_STATE :
_gameState = _END_GAME_STATE;
releaseLossGameForm();
_introForm.hide();
_introForm.setEnable(false);
_proxyCommander.execGameEndComm(_score.getTotalScore());
break;
case _PLAYING_STATE :
_logic.setBlock(true);
endLevel(false);
break;
case _LEVEL_RESULT_STATE :
_gameState = _END_GAME_STATE;
_formTimeout.clear();
_levelCompleteForm.hide();
if (_curLevelNum < _GAME_WIN_NUM_LEVELS) {
releaseLossGameForm();
} else {
releaseWinGameForm();
}
_proxyCommander.execGameEndComm(_score.getTotalScore());
break;
case _END_GAME_STATE :
if (_curLevelNum < _GAME_WIN_NUM_LEVELS) {
_lossGameForm.hide();
_lossGameForm.setEnable(false);
} else {
_winGameForm.hide();
_winGameForm.setEnable(false);
}
_exitButton.setBlock(true);
}
}
function set cookieFormation(prmValue) {
_cookieFormation = prmValue;
//return(__get__cookieFormation());
}
function set cookieDeck(prmValue) {
_cookieDeck = prmValue;
//return(__get__cookieDeck());
}
function set cookieStack(prmValue) {
_cookieStack = prmValue;
//return(__get__cookieStack());
}
function set score(prmValue) {
_score = prmValue;
//return(__get__score());
}
function set logic(prmValue) {
_logic = prmValue;
_logic.addEventListener(com.xitex.crgame.events.CREvent.LOSS_GAME, mx.utils.Delegate.create(this, handleLossGameEvent));
_logic.addEventListener(com.xitex.crgame.events.CREvent.WIN_GAME, mx.utils.Delegate.create(this, handleWinGameEvent));
//return(__get__logic());
}
function set deckDealAnim(prmValue) {
_deckDealAnim = prmValue;
//return(__get__deckDealAnim());
}
function set levels(prmLevels) {
_levels = prmLevels;
//return(__get__levels());
}
function set cookies(prmValue) {
_cookies = prmValue;
//return(__get__cookies());
}
function set formationAnimator(prmValue) {
_formationAnimator = prmValue;
_formationAnimator.addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(this, handleEndFormationAnim));
//return(__get__formationAnimator());
}
function set introForm(prmValue) {
_introForm = prmValue;
_introForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__introForm());
}
function set mainForm(prmValue) {
_mainForm = prmValue;
_mainForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__mainForm());
}
function set timer(prmValue) {
_timer = prmValue;
_timer.addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(this, handleLossGameEvent));
//return(__get__timer());
}
function set levelCompleteForm(prmValue) {
_levelCompleteForm = prmValue;
_levelCompleteForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__levelCompleteForm());
}
function set pastryBonusAnim(prmValue) {
_pastryBonus = prmValue;
//return(__get__pastryBonusAnim());
}
function set noMovesAnim(prmValue) {
_noMovesAnim = prmValue;
//return(__get__noMovesAnim());
}
function set lossGameForm(prmValue) {
_lossGameForm = prmValue;
_lossGameForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__lossGameForm());
}
function set winGameForm(prmValue) {
_winGameForm = prmValue;
_winGameForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__winGameForm());
}
function set spiderAnimator(prmValue) {
_spiderAnimator = prmValue;
//return(__get__spiderAnimator());
}
function set fallingAnimator(prmValue) {
_fallingAnimator = prmValue;
//return(__get__fallingAnimator());
}
function set proxyCommander(prmValue) {
_proxyCommander = prmValue;
//return(__get__proxyCommander());
}
function set complete10LevelsAnim(prmValue) {
_complete10LevelsAnim = prmValue;
//return(__get__complete10LevelsAnim());
}
function set soundButton(prmValue) {
_soundButton = prmValue;
_isSoundEnable = true;
_soundButton.addEventListener(com.xitex.crgame.events.CREvent.INSERT, mx.utils.Delegate.create(this, handleSoundButtonEvent));
//return(__get__soundButton());
}
function set exitButton(prmValue) {
_exitButton = prmValue;
_exitButton.addEventListener(com.xitex.crgame.events.CREvent.INSERT, mx.utils.Delegate.create(this, handleExitButtonEvent));
//return(__get__exitButton());
}
function set openVersionForm(prmValue) {
_openVersionForm = prmValue;
_openVersionForm.addEventListener(com.xitex.crgame.events.CREvent.HIDE, mx.utils.Delegate.create(this, handleHideEvent));
//return(__get__openVersionForm());
}
function set openVersion(prmValue) {
_openVersion = prmValue;
//return(__get__openVersion());
}
var _SEND_QUIT_COMMAND_DELAY = 1.2;
var _LEVEL_COMPLETE_FORM_TIMEOUT = 1;
var _WIN_GAME_FORM_TIMEOUT = 1.2;
var _LOSS_GAME_FORM_TIMEOUT = 2;
var _INTRO_STATE = "intro_state";
var _PLAYING_STATE = "playing_state";
var _LEVEL_RESULT_STATE = "level_complete_state";
var _END_GAME_STATE = "end_game_state";
var _CLOSED_GAME_STATE = "closed_game_state";
var _GAME_WIN_NUM_LEVELS = 4;
var _OPEN_VERSION_NUM_AVAILABLE_LEVELS = 1;
}
Symbol 924 MovieClip [__Packages.com.xitex.crgame.forms.CRTimeoutForm] Frame 0
class com.xitex.crgame.forms.CRTimeoutForm extends com.xitex.crgame.forms.CRForm
{
var _timer, _startTextField, _container, _startText, _BLOCK_TIME_LIMIT, _blocked, _curTime, _VISIBLE_TIME_LIMIT, setEnable, _enable;
function CRTimeoutForm (prmParentContainer) {
super(prmParentContainer);
_timer = new com.xitex.crgame.utils.Timer(1000);
_timer.addEventListener(com.xitex.crgame.events.CREvent.UPDATE, mx.utils.Delegate.create(this, handleUpdateTimerEvent));
_startTextField = _container[_START_TEXT_FIELD_CONTAINER_NAME][_START_TEXT_FIELD_NAME];
createInteractive();
}
function localize(prmStartText) {
_startText = prmStartText;
}
function show() {
super.show();
startTimer();
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_container, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), _NUM_PLAY_LOOPS, 1);
setBlock(true);
var _local3 = new com.xitex.crgame.utils.Timeout(this, setBlock, [false], _BLOCK_TIME_LIMIT);
}
function hide() {
super.hide();
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, 1);
_timer.stop();
}
function setBlock(prmValue) {
_blocked = prmValue;
}
function getStartText(prmSeconds) {
var _local2 = _startText.split("{0}");
var _local3;
if (_local2[1] == undefined) {
_local3 = _local2[0] + String(prmSeconds);
} else {
_local3 = (_local2[0] + String(prmSeconds)) + _local2[1];
}
return(_local3);
}
function createInteractive() {
_container.useHandCursor = false;
_container.onPress = mx.utils.Delegate.create(this, handleMouseDownEvent);
}
function startTimer() {
_curTime = 0;
_timer.start();
}
function handleUpdateTimerEvent() {
if (_curTime >= _VISIBLE_TIME_LIMIT) {
_timer.stop();
hide();
setEnable(false);
} else {
_curTime++;
_startTextField.text = getStartText(_VISIBLE_TIME_LIMIT - _curTime);
}
}
function handleMouseDownEvent() {
if (_enable && (!_blocked)) {
hide();
setEnable(false);
}
}
var _START_TEXT_FIELD_CONTAINER_NAME = "intro_start_text_container";
var _START_TEXT_FIELD_NAME = "start_text_field";
var _NUM_PLAY_LOOPS = 1;
}
Symbol 925 MovieClip [__Packages.com.xitex.crgame.forms.CROpenVersionForm] Frame 0
class com.xitex.crgame.forms.CROpenVersionForm extends com.xitex.crgame.forms.CRTimeoutForm
{
var _mainTextField, _container;
function CROpenVersionForm (prmParentContainer) {
super(prmParentContainer);
_mainTextField = _container[_MAIN_TEXT_FIELD_CONTAINER_NAME][_MAIN_TEXT_FIELD_NAME];
}
function localize(prmMainText) {
_mainTextField.text = prmMainText;
}
var _CONTAINER_NAME = "open_version_form";
var _VISIBLE_TIME_LIMIT = 5;
var _BLOCK_TIME_LIMIT = 2.5;
var _NUM_PLAY_LOOPS = 1;
var _MAIN_TEXT_FIELD_NAME = "main_text_field";
var _MAIN_TEXT_FIELD_CONTAINER_NAME = "main_text_field_container";
}
Symbol 926 MovieClip [__Packages.com.xitex.crgame.forms.CRIntroForm] Frame 0
class com.xitex.crgame.forms.CRIntroForm extends com.xitex.crgame.forms.CRTimeoutForm
{
var _introText1Field, _container, _introText2Field;
function CRIntroForm (prmParentContainer) {
super(prmParentContainer);
_introText1Field = _container[_INSTRUCTIONS_CONTAINER_NAME][_INTRO_TEXT_1_CONTAINER_NAME][_INSTRUCTIONS_FIELD_NAME];
_introText2Field = _container[_INSTRUCTIONS_CONTAINER_NAME][_INTRO_TEXT_2_CONTAINER_NAME][_INSTRUCTIONS_FIELD_NAME];
}
function localize(prmStartText, prmIntroText1, prmIntroText2) {
super.localize(prmStartText);
_introText1Field.text = prmIntroText1;
_introText2Field.text = prmIntroText2;
}
var _CONTAINER_NAME = "intro";
var _BG_SOUND_LIBRARY_ID = "cookie_intro";
var _NUM_PLAY_LOOPS = Number.POSITIVE_INFINITY;
var _VISIBLE_TIME_LIMIT = 20;
var _BLOCK_TIME_LIMIT = 1;
var _INSTRUCTIONS_CONTAINER_NAME = "instructions_texts";
var _INTRO_TEXT_1_CONTAINER_NAME = "instructions_text_1";
var _INTRO_TEXT_2_CONTAINER_NAME = "instructions_text_2";
var _INSTRUCTIONS_FIELD_NAME = "text_field";
}
Symbol 927 MovieClip [__Packages.com.xitex.crgame.forms.CRResultForm] Frame 0
class com.xitex.crgame.forms.CRResultForm extends com.xitex.crgame.forms.CRTimeoutForm
{
var _resultTitleField, _STRINGS_CONTAINER_NAME, _container, _curScoreTitleField, _jarBonusTitleField, _pastryBonusTitleField, _totalScoreTitleField;
function CRResultForm (prmParentContainer) {
super(prmParentContainer);
_resultTitleField = _container[_STRINGS_CONTAINER_NAME][_RESULT_TITLE_FIELD_NAME];
_curScoreTitleField = _container[_STRINGS_CONTAINER_NAME][_CUR_SCORE_TITLE_FIELD_NAME];
_jarBonusTitleField = _container[_STRINGS_CONTAINER_NAME][_JAR_BONUS_TITLE_FIELD_NAME];
_pastryBonusTitleField = _container[_STRINGS_CONTAINER_NAME][_PASTRY_BONUS_TITLE_FIELD_NAME];
_totalScoreTitleField = _container[_STRINGS_CONTAINER_NAME][_TOTAL_SCORE_TITLE_FIELD_NAME];
}
function localize(prmStartText, prmResultTitle, prmCurScoreTitle, prmJarBonusTitle, prmPastryBonusTitle, prmTotalScoreTitle) {
super.localize(prmStartText);
_resultTitleField.text = prmResultTitle;
_curScoreTitleField.text = prmCurScoreTitle;
_jarBonusTitleField.text = prmJarBonusTitle;
_pastryBonusTitleField.text = prmPastryBonusTitle;
_totalScoreTitleField.text = prmTotalScoreTitle;
}
function setCurScoreValue(prmValue) {
_container[_STRINGS_CONTAINER_NAME][_CUR_SCORE_VALUE_FIELD_NAME].text = String(prmValue);
}
function setJarBonusValue(prmValue) {
_container[_STRINGS_CONTAINER_NAME][_JAR_BONUS_VALUE_FIELD_NAME].text = String(prmValue);
}
function setPastryBonusValue(prmValue) {
_container[_STRINGS_CONTAINER_NAME][_PASTRY_BONUS_VALUE_FIELD_NAME].text = String(prmValue);
}
function setTotalScoreValue(prmValue) {
_container[_STRINGS_CONTAINER_NAME][_TOTAL_SCORE_VALUE_FIELD_NAME].text = String(prmValue);
}
var _CUR_SCORE_VALUE_FIELD_NAME = "cur_score_value_field";
var _JAR_BONUS_VALUE_FIELD_NAME = "jar_bonus_value_field";
var _PASTRY_BONUS_VALUE_FIELD_NAME = "pastry_bonus_value_field";
var _TOTAL_SCORE_VALUE_FIELD_NAME = "total_score_value_field";
var _RESULT_TITLE_FIELD_NAME = "result_title_field";
var _CUR_SCORE_TITLE_FIELD_NAME = "cur_score_title_field";
var _JAR_BONUS_TITLE_FIELD_NAME = "jar_bonus_title_field";
var _PASTRY_BONUS_TITLE_FIELD_NAME = "pastry_bonus_title_field";
var _TOTAL_SCORE_TITLE_FIELD_NAME = "total_score_title_field";
}
Symbol 928 MovieClip [__Packages.com.xitex.crgame.forms.CRLevelCompleteForm] Frame 0
class com.xitex.crgame.forms.CRLevelCompleteForm extends com.xitex.crgame.forms.CRResultForm
{
var _timer, _container, _cakeContainer, _cakeIcon;
function CRLevelCompleteForm (prmParentContainer) {
super(prmParentContainer);
_container.onEndPlay = mx.utils.Delegate.create(_timer, _timer.start);
_cakeContainer = _container[_CAKE_CONTAINER_NAME];
}
function show(prmPastryBonus) {
super.show();
_timer.stop();
_cakeIcon = prmPastryBonus.addPastryBonusIcons(_cakeContainer);
}
function hide() {
super.hide();
_cakeIcon.removeMovieClip();
}
var _START_TEXT_FIELD_CONTAINER_NAME = "strings_container";
var _CONTAINER_NAME = "level_exchange";
var _BG_SOUND_PLAY_TYPE = com.xitex.crgame.sounds.CRSound._PLAY_ONCE;
var _BG_SOUND_LIBRARY_ID = "cookie_level_completed";
var _STRINGS_CONTAINER_NAME = "strings_container";
var _VISIBLE_TIME_LIMIT = 5;
var _BLOCK_TIME_LIMIT = 2;
var _CAKE_CONTAINER_NAME = "released_cake_container";
}
Symbol 929 MovieClip [__Packages.com.xitex.crgame.forms.CRLossGameForm] Frame 0
class com.xitex.crgame.forms.CRLossGameForm extends com.xitex.crgame.forms.CRResultForm
{
var _container;
function CRLossGameForm (prmParentContainer) {
super(prmParentContainer);
_container._visible = false;
}
function hide() {
super.hide();
_container._visible = true;
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, _container._totalframes);
}
var _START_TEXT_FIELD_CONTAINER_NAME = "strings_container";
var _BG_SOUND_PLAY_TYPE = com.xitex.crgame.sounds.CRSound._PLAY_ONCE;
var _CONTAINER_NAME = "loss_game_form";
var _BG_SOUND_LIBRARY_ID = "game_end_negative";
var _STRINGS_CONTAINER_NAME = "strings_container";
var _VISIBLE_TIME_LIMIT = 12;
var _BLOCK_TIME_LIMIT = 2.5;
}
Symbol 930 MovieClip [__Packages.com.xitex.crgame.forms.CRWinGameForm] Frame 0
class com.xitex.crgame.forms.CRWinGameForm extends com.xitex.crgame.forms.CRResultForm
{
var _container;
function CRWinGameForm (prmParentContainer) {
super(prmParentContainer);
_container._visible = false;
}
function hide() {
super.hide();
_container._visible = true;
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, _container._totalframes);
}
var _START_TEXT_FIELD_CONTAINER_NAME = "strings_container";
var _BG_SOUND_PLAY_TYPE = com.xitex.crgame.sounds.CRSound._PLAY_ONCE;
var _CONTAINER_NAME = "win_game";
var _BG_SOUND_LIBRARY_ID = "game_end_positive";
var _STRINGS_CONTAINER_NAME = "strings_container";
var _VISIBLE_TIME_LIMIT = 12;
var _BLOCK_TIME_LIMIT = 2.5;
}
Symbol 931 MovieClip [__Packages.com.xitex.crgame.forms.CRMainForm] Frame 0
class com.xitex.crgame.forms.CRMainForm extends com.xitex.crgame.forms.CRForm
{
var _bgContainer, _container, _levelStartSound, _bgMusic, _levelTitleField, _timeTitleField, _scoreTitleField, _levelTitleText, _enable;
function CRMainForm (prmParentContainer) {
super(prmParentContainer);
_bgContainer = _container[_BG_CONTAINER_NAME];
_levelStartSound = new com.xitex.crgame.sounds.CRSound(_container, _LEVEL_START_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
_levelStartSound.addEventListener(com.xitex.crgame.events.CREvent.END_EVENT, mx.utils.Delegate.create(_bgMusic, _bgMusic.start));
_levelTitleField = _container[_LEVEL_TITLE_FIELD_NAME];
_timeTitleField = _container[_TIME_TITLE_FIELD_NAME];
_scoreTitleField = _container[_SCORE_TITLE_FIELD_NAME];
restore();
}
function updateLevelTitleField(prmLevelNum) {
var _local2 = _levelTitleText.split("{0}");
var _local3;
if (_local2[1] == undefined) {
_local3 = _local2[0] + String(prmLevelNum + 1);
} else {
_local3 = (_local2[0] + String(prmLevelNum + 1)) + _local2[1];
}
_levelTitleField.text = _local3;
}
function localize(prmLevelTitle, prmTimeTitle, prmScoreTitle) {
_levelTitleText = prmLevelTitle;
_timeTitleField.text = prmTimeTitle;
_scoreTitleField.text = prmScoreTitle;
}
function setEnable(prmValue) {
_enable = prmValue;
if (prmValue) {
_levelStartSound.stop();
_bgMusic.stop();
_levelStartSound.start();
} else {
_bgMusic.stop();
}
}
function restore() {
}
function setBG(prmLevelTypeID) {
_bgContainer.attachMovie(_BG_LIBRARY_IDS[prmLevelTypeID], "bg", 1);
}
var _CONTAINER_NAME = "main";
var _BG_SOUND_LIBRARY_ID = "cookie_loop";
var _BG_LIBRARY_IDS = ["bakground_pink", "background_blue", "bakground_green"];
var _BG_CONTAINER_NAME = "bg_container";
var _LEVEL_START_SOUND_LIBRARY_ID = "cookie_start";
var _LEVEL_TITLE_FIELD_NAME = "level_title_field";
var _TIME_TITLE_FIELD_NAME = "time_title_field";
var _SCORE_TITLE_FIELD_NAME = "score_title_field";
}
Symbol 932 MovieClip [__Packages.com.xitex.crgame.anims.CRNomovesAnim] Frame 0
class com.xitex.crgame.anims.CRNomovesAnim
{
var _container, _nomovesSound;
function CRNomovesAnim (prmParentContainer) {
_container = prmParentContainer[_NOMOVES_ANIM_CONTAINER_NAME];
_nomovesSound = new com.xitex.crgame.sounds.CRSound(_container, _NOMORE_MOVES_SOUND_LIBRARY_ID, com.xitex.crgame.sounds.CRSound._PLAY_ONCE);
}
function localize(prmText) {
_container[_NOMORE_MOVES_FIELD_CONTAINER_NAME][_NOMORE_MOVES_FIELD_NAME].text = prmText;
}
function restore() {
stop();
}
function start() {
_container._visible = true;
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_container, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1);
_nomovesSound.start();
}
function stop() {
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, 1);
_container._visible = false;
}
var _NOMOVES_ANIM_CONTAINER_NAME = "no_moves_anim";
var _NOMORE_MOVES_SOUND_LIBRARY_ID = "no_more_moves_sound";
var _NOMORE_MOVES_FIELD_CONTAINER_NAME = "no_moves_field_container";
var _NOMORE_MOVES_FIELD_NAME = "title_field";
}
Symbol 933 MovieClip [__Packages.com.xitex.crgame.anims.CRBestBakerAnim] Frame 0
class com.xitex.crgame.anims.CRBestBakerAnim
{
var _container;
function CRBestBakerAnim (prmParentContainer) {
_container = prmParentContainer[_BEST_BAKER_CONTAINER_ANIM];
}
function restore() {
stop();
}
function start() {
_container._visible = true;
com.xitex.crgame.utils.MCPlayer.__get__instance().play(_container, com.xitex.crgame.utils.MCPlayer.__get__instance().__get__FORWARD_TYPE(), 1);
}
function stop() {
com.xitex.crgame.utils.MCPlayer.__get__instance().stop(_container, 1);
_container._visible = false;
}
var _BEST_BAKER_CONTAINER_ANIM = "best_baker_anim";
}
Symbol 934 MovieClip [__Packages.com.xitex.crgame.proxy.CRProxyCommander] Frame 0
class com.xitex.crgame.proxy.CRProxyCommander
{
var _traceForm;
function CRProxyCommander (prmTraceForm) {
_traceForm = prmTraceForm;
}
function execStartGameComm() {
trace("TAProxyCommander.as LOG: gameStart");
fscommand ("gameStart");
_traceForm.addLog("SEND: gameStart");
}
function execPlayDataComm(prmCommCode, prmData, prmPoints) {
var _local4 = (((String(prmCommCode) + ",") + prmData) + ",0=") + String(prmPoints);
var _local2 = new Date();
var _local3 = (((((_local2.getHours() + ":") + _local2.getMinutes()) + ":") + _local2.getSeconds()) + " ") + _local4;
trace("TAProxyCommander.as LOG: playData " + _local3);
fscommand ("playData", _local4);
_traceForm.addLog("SEND: playData " + _local3);
}
function execGameEndComm(prmPoints) {
trace("TAProxyCommander.as LOG: gameEnd " + prmPoints);
fscommand ("gameEnd", String(prmPoints));
_traceForm.addLog("SEND: gameEnd " + String(prmPoints));
}
function execGameQuitComm() {
trace("TAProxyCommander.as LOG: gameQuit");
fscommand ("gameQuit");
_traceForm.addLog("SEND: gameQuit");
}
function execVersionComm(prmVersion) {
execPlayDataComm(1, prmVersion, 0);
}
function execDelComm(prmCookie1, prmCookie2, prmTimePairBonus, prmTotalPairScore) {
var _local5 = prmCookie1.__get__containerInstance().getID();
var _local4 = prmCookie2.__get__containerInstance().getID();
var _local6 = (((((((((((_local5 + _SEPARATOR) + prmCookie1.__get__typeID()) + _SEPARATOR) + prmCookie1.__get__value()) + _SEPARATOR) + _local4) + _SEPARATOR) + prmCookie2.__get__typeID()) + _SEPARATOR) + prmCookie2.__get__value()) + _SEPARATOR) + prmTimePairBonus;
execPlayDataComm(2, _local6, prmTotalPairScore);
}
function execDealComm() {
execPlayDataComm(3, "", 0);
}
function execStartLevelComm(prmLevelId, prmScore) {
execPlayDataComm(4, String(prmLevelId), prmScore);
}
function execEndLevelComm(prmScore) {
execPlayDataComm(5, "", prmScore);
}
function execBonusComm(prmScore) {
execPlayDataComm(6, "", prmScore);
}
function execAddLogComm(prmLog) {
execPlayDataComm(7, prmLog, 0);
}
var _SEPARATOR = ":";
}
Symbol 935 MovieClip [__Packages.com.xitex.crgame.ui.CRButton] Frame 0
class com.xitex.crgame.ui.CRButton
{
var _container, _CONTAINER_NAME, _enable, _blocked, dispatchEvent, _pressDelay;
function CRButton (prmParentContainer) {
_container = prmParentContainer[_CONTAINER_NAME];
mx.events.EventDispatcher.initialize(this);
init();
}
function localize(prmString) {
_container[_TITLE_FIELD_NAME].text = prmString;
_container[_HIT_NAME]._width = _container[_TITLE_FIELD_NAME].textWidth;
}
function restore() {
setEnable(true);
setBlock(false);
}
function setEnable(prmValue) {
_enable = prmValue;
}
function setBlock(prmValue) {
_blocked = prmValue;
}
function init() {
_container[_HIT_NAME].onPress = mx.utils.Delegate.create(this, press);
}
function press() {
if (_enable && (!_blocked)) {
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.INSERT, this));
setEnable(false);
_pressDelay = new com.xitex.crgame.utils.Timeout(this, setEnable, [true], _PRESS_DELAY_TIME);
}
}
var _HIT_NAME = "hit";
var _TITLE_FIELD_NAME = "title_field";
var _PRESS_DELAY_TIME = 0.5;
}
Symbol 936 MovieClip [__Packages.com.xitex.crgame.ui.CRExitButton] Frame 0
class com.xitex.crgame.ui.CRExitButton extends com.xitex.crgame.ui.CRButton
{
function CRExitButton (prmParentContainer) {
super(prmParentContainer);
}
var _CONTAINER_NAME = "exit_button";
}
Symbol 937 MovieClip [__Packages.com.xitex.crgame.ui.CRSoundButton] Frame 0
class com.xitex.crgame.ui.CRSoundButton extends com.xitex.crgame.ui.CRButton
{
function CRSoundButton (prmParentContainer) {
super(prmParentContainer);
}
var _CONTAINER_NAME = "sound_button";
}
Symbol 938 MovieClip [__Packages.com.xitex.crgame.proxy.CRGameData] Frame 0
class com.xitex.crgame.proxy.CRGameData
{
var _container, _timerID, _localeStrings, _sourceXML, _openVersion, _timeLimit, _seed, _relaxMode, dispatchEvent;
function CRGameData (prmContainer) {
_container = prmContainer;
mx.events.EventDispatcher.initialize(this);
}
function listen() {
_timerID = setInterval(this, "checkUpdate", _LISTEN_TIME_INTERVAL);
}
function checkUpdate() {
if (_container[_GAME_DATA_VAR_NAME] != undefined) {
_localeStrings = new Array();
_sourceXML = new XML();
_sourceXML.ignoreWhite = true;
_sourceXML.parseXML(_container[_GAME_DATA_VAR_NAME]);
var _local3 = new Array();
for (var _local4 in _sourceXML.firstChild.attributes) {
_local3[_local4] = _sourceXML.firstChild.attributes[_local4];
}
var _local2;
for (var _local4 in _sourceXML.firstChild.childNodes[0].childNodes) {
_local2 = _sourceXML.firstChild.childNodes[0].childNodes[_local4];
if (_local2.nodeName == "text") {
_localeStrings[_local2.attributes.id] = _local2.firstChild.nodeValue;
}
}
_openVersion = ((_local3.open_version == "true") ? true : false);
_timeLimit = parseInt(_local3.timelimit);
_seed = parseInt(_local3.randomseed);
_relaxMode = _local3.relaxMode == "true";
clearInterval(_timerID);
dispatchEvent(new com.xitex.crgame.events.CREvent(com.xitex.crgame.events.CREvent.UPDATE, this));
}
}
function get openVersion() {
return(_openVersion);
}
function get timeLimit() {
return(_timeLimit);
}
function get relaxMode() {
return(_relaxMode);
}
function get seed() {
return(_seed);
}
function get localeStrings() {
return(_localeStrings);
}
function get source() {
return(_sourceXML);
}
var _LISTEN_TIME_INTERVAL = 20;
var _GAME_DATA_VAR_NAME = "gameData";
}