Section 1
//FlashRelaxAPI (com.flashrelax.utils.FlashRelaxAPI)
package com.flashrelax.utils {
import flash.net.*;
import com.mazestopper.*;
public class FlashRelaxAPI {
private static const STAT_ID_MOREGAMES_REPEAT:int = 4;
private static const STAT_ID_HIGHSCORE_UNIQUE:int = 5;
private static const STAT_ID_INTRO_UNIQUE:int = 7;
private static const BASE_URL:String = "http://www.flashrelax.com";
private static const STAT_ID_HIGHSCORE_REPEAT:int = 6;
private static const STAT_ID_LOADER_UNIQUE:int = 1;
private static const STAT_ID_INTRO_REPEAT:int = 8;
private static const STAT_ID_LOADER_REPEAT:int = 2;
private static const GAME_HASH_CODE:String = "somerandomstring4579980*&DDouiDSKAJF5y8SADFJIHuity95780&%$()GF@*(DSk";
private static const GAME_NAME:String = "Maze-Stopper";
private static const STAT_ID_MOREGAMES_UNIQUE:int = 3;
public static function openMoreGames():void{
var _local1:URLRequest = new URLRequest(BASE_URL);
if (!UserSettings.mSiteOpenedFromMoreGames){
UserSettings.mSiteOpenedFromMoreGames = true;
UserSettings.save();
submitStat(STAT_ID_MOREGAMES_UNIQUE);
} else {
submitStat(STAT_ID_MOREGAMES_REPEAT);
};
navigateToURL(_local1);
}
public static function openIntroSite():void{
var _local1:URLRequest = new URLRequest(BASE_URL);
if (!UserSettings.mSiteOpenedFromIntro){
UserSettings.mSiteOpenedFromIntro = true;
UserSettings.save();
submitStat(STAT_ID_INTRO_UNIQUE);
} else {
submitStat(STAT_ID_INTRO_REPEAT);
};
navigateToURL(_local1);
}
public static function submitStat(_arg1:int):void{
var _local2:int = Math.floor((Math.random() * 1000000));
var _local3:URLVariables = new URLVariables();
_local3.id = ("" + _arg1);
_local3.value = ("" + _local2);
_local3.code = MD5.encrypt(((GAME_HASH_CODE + _local3.value) + _local3.id));
var _local4:URLRequest = new URLRequest();
_local4.url = (BASE_URL + "/submitstat.php");
_local4.data = _local3;
_local4.method = URLRequestMethod.POST;
var _local5:URLLoader = new URLLoader();
_local5.load(_local4);
}
public static function openHighScores(_arg1:int, _arg2:int=0):void{
var _local3:URLRequest = new URLRequest();
var _local4 = (("/score/" + _arg1) + "/");
if (!UserSettings.mSiteOpenedFromHighscore){
UserSettings.mSiteOpenedFromHighscore = true;
UserSettings.save();
submitStat(STAT_ID_HIGHSCORE_UNIQUE);
} else {
submitStat(STAT_ID_HIGHSCORE_REPEAT);
};
if (_arg2 != 0){
_local4 = (_local4 + (("" + _arg2) + "/"));
};
_local3.url = (((((BASE_URL + _local4) + GAME_NAME) + "-level") + _arg1) + ".html");
navigateToURL(_local3);
}
public static function openGameForYourSite():void{
var _local1:URLRequest = new URLRequest("http://www.flashrelax.com/freegames/all.html");
navigateToURL(_local1);
}
public static function submitScore(_arg1:int, _arg2:String, _arg3:int):URLLoader{
var _local4:URLVariables = new URLVariables();
_local4.id = ("" + _arg1);
_local4.value = ("" + _arg3);
_local4.name = _arg2;
_local4.code = MD5.encrypt((((GAME_HASH_CODE + _local4.name) + _local4.value) + _local4.id));
var _local5:URLRequest = new URLRequest();
_local5.url = (BASE_URL + "/submitscore.php");
_local5.data = _local4;
_local5.method = URLRequestMethod.POST;
var _local6:URLLoader = new URLLoader();
_local6.load(_local5);
return (_local6);
}
public static function openLoaderSite():void{
var _local1:URLRequest = new URLRequest(BASE_URL);
if (!UserSettings.mSiteOpenedFromLoader){
UserSettings.mSiteOpenedFromLoader = true;
UserSettings.save();
submitStat(STAT_ID_LOADER_UNIQUE);
} else {
submitStat(STAT_ID_LOADER_REPEAT);
};
navigateToURL(_local1);
}
public static function checkCorrectName(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < _arg1.length) {
switch (_arg1.charAt(_local2)){
case "'":
case "\"":
case "/":
case "\\":
return (false);
};
_local2++;
};
return (true);
}
}
}//package com.flashrelax.utils
Section 2
//MD5 (com.flashrelax.utils.MD5)
package com.flashrelax.utils {
public class MD5 {
public static const HEX_FORMAT_LOWERCASE:uint = 0;
public static const HEX_FORMAT_UPPERCASE:uint = 1;
public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = "";
public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "=";
public static var hexcase:uint = 0;
public static var b64pad:String = "";
public static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
public static function binl_md5(_arg1:Array, _arg2:Number):Array{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
var _local3:Number = 1732584193;
var _local4:Number = -271733879;
var _local5:Number = -1732584194;
var _local6:Number = 271733878;
var _local7:Number = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
public static function str2rstr_utf16le(_arg1:String):String{
var _local2 = "";
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode((_arg1.charCodeAt(_local3) & 0xFF), ((_arg1.charCodeAt(_local3) >>> 8) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function hex_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2hex(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function binl2rstr(_arg1:Array):String{
var _local2 = "";
var _local3:Number = 0;
while (_local3 < (_arg1.length * 32)) {
_local2 = (_local2 + String.fromCharCode(((_arg1[(_local3 >> 5)] >>> (_local3 % 32)) & 0xFF)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2binl(_arg1:String):Array{
var _local2:Array = new Array((_arg1.length >> 2));
var _local3:int;
while (_local3 < _local2.length) {
_local2[_local3] = 0;
_local3++;
};
_local3 = 0;
while (_local3 < (_arg1.length * 8)) {
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | ((_arg1.charCodeAt((_local3 / 8)) & 0xFF) << (_local3 % 32)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_vm_test():Boolean{
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function b64_md5(_arg1:String):String{
return (rstr2b64(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function any_hmac_md5(_arg1:String, _arg2:String, _arg3:String):String{
return (rstr2any(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2)), _arg3));
}
public static function hex_md5(_arg1:String):String{
return (rstr2hex(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function encrypt(_arg1:String):String{
return (hex_md5(_arg1));
}
public static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2hex(_arg1:String):String{
var _local4:Number;
var _local2:String = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
var _local3 = "";
var _local5:Number = 0;
while (_local5 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local5);
_local3 = (_local3 + (_local2.charAt(((_local4 >>> 4) & 15)) + _local2.charAt((_local4 & 15))));
_local5++;
};
return (_local3);
}
public static function any_md5(_arg1:String, _arg2:String):String{
return (rstr2any(rstr_md5(str2rstr_utf8(_arg1)), _arg2));
}
public static function b64_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2b64(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function rstr2b64(_arg1:String):String{
var _local6:Number;
var _local7:Number;
var _local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var _local3 = "";
var _local4:Number = _arg1.length;
var _local5:Number = 0;
while (_local5 < _local4) {
_local6 = (((_arg1.charCodeAt(_local5) << 16) | (((_local5 + 1) < _local4)) ? (_arg1.charCodeAt((_local5 + 1)) << 8) : 0) | (((_local5 + 2) < _local4)) ? _arg1.charCodeAt((_local5 + 2)) : 0);
_local7 = 0;
while (_local7 < 4) {
if (((_local5 * 8) + (_local7 * 6)) > (_arg1.length * 8)){
_local3 = (_local3 + b64pad);
} else {
_local3 = (_local3 + _local2.charAt(((_local6 >>> (6 * (3 - _local7))) & 63)));
};
_local7++;
};
_local5 = (_local5 + 3);
};
return (_local3);
}
public static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
var _local4:Number = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
public static function str2rstr_utf8(_arg1:String):String{
var _local4:Number;
var _local5:Number;
var _local2 = "";
var _local3:Number = -1;
while (++_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
_local5 = (((_local3 + 1) < _arg1.length)) ? _arg1.charCodeAt((_local3 + 1)) : 0;
if ((((((((0xD800 <= _local4)) && ((_local4 <= 56319)))) && ((0xDC00 <= _local5)))) && ((_local5 <= 57343)))){
_local4 = ((65536 + ((_local4 & 1023) << 10)) + (_local5 & 1023));
_local3++;
};
if (_local4 <= 127){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if (_local4 <= 2047){
_local2 = (_local2 + String.fromCharCode((192 | ((_local4 >>> 6) & 31)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 0xFFFF){
_local2 = (_local2 + String.fromCharCode((224 | ((_local4 >>> 12) & 15)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 2097151){
_local2 = (_local2 + String.fromCharCode((240 | ((_local4 >>> 18) & 7)), (128 | ((_local4 >>> 12) & 63)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
};
};
};
};
};
return (_local2);
}
public static function rstr_hmac_md5(_arg1:String, _arg2:String):String{
var _local3:Array = rstr2binl(_arg1);
if (_local3.length > 16){
_local3 = binl_md5(_local3, (_arg1.length * 8));
};
var _local4:Array = new Array(16);
var _local5:Array = new Array(16);
var _local6:Number = 0;
while (_local6 < 16) {
_local4[_local6] = (_local3[_local6] ^ 909522486);
_local5[_local6] = (_local3[_local6] ^ 1549556828);
_local6++;
};
var _local7:Array = binl_md5(_local4.concat(rstr2binl(_arg2)), (0x0200 + (_arg2.length * 8)));
return (binl2rstr(binl_md5(_local5.concat(_local7), (0x0200 + 128))));
}
public static function str2rstr_utf16be(_arg1:String):String{
var _local2 = "";
var _local3:Number = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(((_arg1.charCodeAt(_local3) >>> 8) & 0xFF), (_arg1.charCodeAt(_local3) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function rstr2any(_arg1:String, _arg2:String):String{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local3:Number = _arg2.length;
var _local4:Array = [];
var _local9:Array = new Array((_arg1.length / 2));
_local5 = 0;
while (_local5 < _local9.length) {
_local9[_local5] = ((_arg1.charCodeAt((_local5 * 2)) << 8) | _arg1.charCodeAt(((_local5 * 2) + 1)));
_local5++;
};
while (_local9.length > 0) {
_local8 = [];
_local7 = 0;
_local5 = 0;
while (_local5 < _local9.length) {
_local7 = ((_local7 << 16) + _local9[_local5]);
_local6 = Math.floor((_local7 / _local3));
_local7 = (_local7 - (_local6 * _local3));
if ((((_local8.length > 0)) || ((_local6 > 0)))){
_local8[_local8.length] = _local6;
};
_local5++;
};
_local4[_local4.length] = _local7;
_local9 = _local8;
};
var _local10 = "";
_local5 = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = (_local10 + _arg2.charAt(_local4[_local5]));
_local5--;
};
return (_local10);
}
public static function rstr_md5(_arg1:String):String{
return (binl2rstr(binl_md5(rstr2binl(_arg1), (_arg1.length * 8))));
}
}
}//package com.flashrelax.utils
Section 3
//NGAdObject (com.flashrelax.utils.NGAdObject)
package com.flashrelax.utils {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class NGAdObject extends Sprite {
private var mAdLoader:Loader;
private var mRemoveObj:DisplayObject;
private var mAdSpace:Sprite;
private var mNGButton:SimpleButton;
private var mAdEmpty:MovieClip;
private static var mNGAdLogoClass:Class = NGAdObject_mNGAdLogoClass;
private static var mNGAdMainClass:Class = NGAdObject_mNGAdMainClass;
private static var mNGAdEmptyClass:Class = NGAdObject_mNGAdEmptyClass;
public function NGAdObject(_arg1:DisplayObject=null){
mRemoveObj = _arg1;
addChild(new mNGAdEmptyClass());
var _local2:* = this.getChildAt(0);
mAdSpace = new Sprite();
mAdSpace.addChild(new mNGAdLogoClass());
mAdSpace.addEventListener(MouseEvent.CLICK, loadMySite);
mAdSpace.buttonMode = true;
mAdSpace.x = -150;
mAdSpace.y = -140;
_local2.addChild(mAdSpace);
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
} else {
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
};
}
function ad_Loaded(_arg1:Event):void{
var _local2:* = this.getChildAt(0);
_local2.removeChild(mAdSpace);
removeChild(_local2);
addChild(new mNGAdMainClass());
_local2 = this.getChildAt(0);
_local2.addChild(mAdSpace);
var _local3:* = String(_arg1.target.data);
var _local4:Loader = new Loader();
_local4.load(new URLRequest(_local3));
mAdSpace.addChild(_local4);
mAdLoader = _local4;
_local4.contentLoaderInfo.addEventListener(Event.INIT, swfad_Loaded);
}
function startAd(_arg1):void{
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
var _local2:URLLoader = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function loadMySite(_arg1:Event){
FlashRelaxAPI.openLoaderSite();
}
function swfad_Loaded(_arg1:Event):void{
mAdSpace.removeEventListener(MouseEvent.CLICK, loadMySite);
while (mAdSpace.numChildren > 0) {
mAdSpace.removeChildAt(0);
};
mRemoveObj.parent.removeChild(mRemoveObj);
mRemoveObj = null;
mAdSpace.addChild(mAdLoader);
mAdLoader.contentLoaderInfo.removeEventListener(Event.INIT, swfad_Loaded);
mAdLoader = null;
}
}
}//package com.flashrelax.utils
Section 4
//NGAdObject_mNGAdEmptyClass (com.flashrelax.utils.NGAdObject_mNGAdEmptyClass)
package com.flashrelax.utils {
import mx.core.*;
public class NGAdObject_mNGAdEmptyClass extends SpriteAsset {
}
}//package com.flashrelax.utils
Section 5
//NGAdObject_mNGAdLogoClass (com.flashrelax.utils.NGAdObject_mNGAdLogoClass)
package com.flashrelax.utils {
import mx.core.*;
public class NGAdObject_mNGAdLogoClass extends SpriteAsset {
}
}//package com.flashrelax.utils
Section 6
//NGAdObject_mNGAdMainClass (com.flashrelax.utils.NGAdObject_mNGAdMainClass)
package com.flashrelax.utils {
import mx.core.*;
public class NGAdObject_mNGAdMainClass extends SpriteAsset {
}
}//package com.flashrelax.utils
Section 7
//ProgressBar (com.flashrelax.utils.ProgressBar)
package com.flashrelax.utils {
import flash.display.*;
import flash.geom.*;
public class ProgressBar extends Sprite {
private var mBarWidth:int;
private var mProgress:Number;
private var mMin:Number;
private var mMax:Number;
private var mBarHeight:int;
private static const barRatios:Array = [0, 111, 128, 0xFF];
private static const highlightColors:Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF];
private static const cornerRadius:int = 2;
private static const backgroundBorderColor:uint = 0xB2B2B2;
private static const barAlphas:Array = [1, 1, 1, 1];
private static const backgroundShadowRatios:Array = [0, 7, 247, 0xFF];
private static const barShadowAlphas:Array = [0.2, 0, 0, 0.2];
private static const backgroundColor:uint = 0xC9C9C9;
private static const barColors:Array = [12961279, 9807595, 5323, 4808175];
private static const highlightAlphas:Array = [0.7, 0.1, 0, 0];
private static const barShadowColors:Array = [0x444444, 0x444444, 0x444444, 0x444444];
private static const highlightRatios:Array = [0, 48, 63, 0xFF];
private static const backgroundShadowAlphas:Array = [0.2, 0, 0, 0.2];
private static const borderWidth:int = 1;
private static const barShadowRatios:Array = [0, 7, 247, 0xFF];
private static const backgroundShadowColors:Array = [0x444444, 0x444444, 0x444444, 0x444444];
public function ProgressBar(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Number=0, _arg6:Number=100){
mMin = _arg5;
mMax = _arg6;
x = _arg1;
y = _arg2;
mBarWidth = _arg3;
mBarHeight = _arg4;
}
public function Update(_arg1:Number=NaN):void{
if (!isNaN(_arg1)){
mProgress = _arg1;
};
var _local2:Matrix = new Matrix();
graphics.clear();
graphics.beginFill(backgroundColor, 1);
graphics.lineStyle(borderWidth, backgroundBorderColor, 1);
graphics.drawRoundRect(0, 0, mBarWidth, mBarHeight, cornerRadius, cornerRadius);
graphics.endFill();
graphics.lineStyle(0, 0, 0);
_local2.createGradientBox(mBarWidth, mBarHeight, ((0 / 180) * Math.PI), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, backgroundShadowColors, backgroundShadowAlphas, backgroundShadowRatios, _local2, SpreadMethod.PAD);
graphics.drawRect(1, 1, (mBarWidth - 2), (mBarHeight - 2));
graphics.endFill();
graphics.lineStyle(1, 0xFFFFFF, 0.5);
graphics.drawRect(1, 1, (mBarWidth - 2), (mBarHeight - 2));
var _local3:int = Math.min((((mBarWidth - 2) / (mMax - mMin)) * mProgress), mBarWidth);
_local2.createGradientBox(mBarWidth, mBarHeight, ((90 / 180) * Math.PI), 0, 0);
graphics.lineStyle(0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, barColors, barAlphas, barRatios, _local2, SpreadMethod.PAD);
graphics.drawRect(1, 1, _local3, (mBarHeight - 2));
graphics.endFill();
graphics.lineStyle(0, 0, 0);
_local2.createGradientBox(_local3, mBarHeight, ((0 / 180) * Math.PI), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, barShadowColors, barShadowAlphas, barRatios, _local2, SpreadMethod.PAD);
graphics.drawRect(1, 1, _local3, (mBarHeight - 2));
graphics.endFill();
graphics.lineStyle(0, 0, 0);
_local2.createGradientBox(mBarWidth, mBarHeight, ((90 / 180) * Math.PI), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, highlightColors, highlightAlphas, highlightRatios, _local2, SpreadMethod.PAD);
graphics.drawRect(1, 1, (mBarWidth - 2), (mBarHeight - 2));
graphics.endFill();
}
}
}//package com.flashrelax.utils
Section 8
//QuickText (com.flashrelax.utils.QuickText)
package com.flashrelax.utils {
import flash.text.*;
public class QuickText extends TextField {
private static var mDefaultFont:String;
private static var mAlign:String;
private static var mColor:uint;
private static var mSize:int;
public function QuickText(_arg1:int=12, _arg2:String="left", _arg3:uint=0xFFFFFF){
mSize = _arg1;
mAlign = _arg2;
mColor = _arg3;
changeSettings();
embedFonts = true;
selectable = false;
mouseEnabled = false;
}
public function set align(_arg1:String):void{
mAlign = _arg1;
changeSettings();
}
public function set size(_arg1:int):void{
mSize = _arg1;
changeSettings();
}
public function changeSettings():void{
var _local1:TextFormat = getTextFormat();
_local1.font = mDefaultFont;
_local1.size = mSize;
_local1.align = mAlign;
_local1.color = mColor;
defaultTextFormat = _local1;
}
public function set color(_arg1:uint):void{
mColor = _arg1;
changeSettings();
}
public function setText(_arg1:String):void{
text = "";
appendText(_arg1);
}
public static function setDefaultFont(_arg1:String):void{
mDefaultFont = _arg1;
}
}
}//package com.flashrelax.utils
Section 9
//VisualButton (com.flashrelax.utils.VisualButton)
package com.flashrelax.utils {
import flash.display.*;
import flash.text.*;
public class VisualButton extends Sprite {
private var mVisText:QuickText;
private var mButMC:MovieClip;
private var mText:String;
private var mFontSize:int;
public static var mButtonsSWFClass:Class = VisualButton_mButtonsSWFClass;
public function VisualButton(_arg1:String, _arg2:Number=1, _arg3:Number=1, _arg4:int=12){
mButMC = (new mButtonsSWFClass() as MovieClip);
if (_arg1 == "SPACE"){
mButMC.gotoAndStop(3);
} else {
mButMC.gotoAndStop(1);
};
mButMC.x = 0;
mButMC.y = 0;
mButMC.scaleX = _arg2;
mButMC.scaleY = _arg3;
addChild(mButMC);
mText = _arg1;
mFontSize = _arg4;
if (_arg1.length == 2){
mFontSize--;
};
if (_arg1.length == 3){
mFontSize = (mFontSize - 3);
};
mVisText = new QuickText(mFontSize, TextFormatAlign.CENTER, 0);
mVisText.width = (mButMC.width * 0.8);
mVisText.x = 2;
mVisText.y = 0;
mVisText.setText(mText);
addChild(mVisText);
}
public function setState(_arg1:int):void{
if (mText == "SPACE"){
mButMC.gotoAndStop((3 + _arg1));
} else {
mButMC.gotoAndStop((1 + _arg1));
};
removeChild(mVisText);
if (_arg1 == 1){
mVisText = new QuickText(mFontSize, TextFormatAlign.CENTER, 0x7F00);
} else {
mVisText = new QuickText(mFontSize, TextFormatAlign.CENTER, 0);
};
mVisText.width = (mButMC.width * 0.8);
mVisText.x = 2;
mVisText.y = 0;
mVisText.setText(mText);
addChild(mVisText);
}
}
}//package com.flashrelax.utils
Section 10
//VisualButton_mButtonsSWFClass (com.flashrelax.utils.VisualButton_mButtonsSWFClass)
package com.flashrelax.utils {
import flash.display.*;
import mx.core.*;
public class VisualButton_mButtonsSWFClass extends MovieClipAsset {
public var body1:DisplayObject;
}
}//package com.flashrelax.utils
Section 11
//FakeMousePointer (com.mazestopper.helpanimation.FakeMousePointer)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
public class FakeMousePointer extends Sprite {
private var mTargetX:Number;
private var mTargetY:Number;
private var mMaze:HelpMaze;
private static const SPEED:Number = 15;
public function FakeMousePointer(_arg1:HelpMaze){
mMaze = _arg1;
var _local2:Bitmap = new Bitmap(DataCollection.mMousePointer);
addChild(_local2);
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function onFrame(_arg1:Event):void{
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (Math.abs((x - mTargetX)) <= SPEED){
x = mTargetX;
} else {
if (x < mTargetX){
x = (x + SPEED);
} else {
x = (x - SPEED);
};
};
if (Math.abs((y - mTargetY)) <= SPEED){
y = mTargetY;
} else {
if (y < mTargetY){
y = (y + SPEED);
} else {
y = (y - SPEED);
};
};
mMaze.setPreviewCoords(x, y);
}
public function moveTo(_arg1:Number, _arg2:Number):void{
mTargetX = _arg1;
mTargetY = _arg2;
}
}
}//package com.mazestopper.helpanimation
Section 12
//HelpMaze (com.mazestopper.helpanimation.HelpMaze)
package com.mazestopper.helpanimation {
import flash.display.*;
import com.mazestopper.*;
public class HelpMaze extends Sprite {
private var mFinishObject:LevelFinishObject;
private var mMaze:Array;
private var mTimeFreeze:Boolean;
private var mMazeHeight:int;
private var mMoves:Array;
private var mMazeWidth:int;
public var mPlayerCnt:int;
private var mAttachedObstacle:Bitmap;
private var mOrigMaze:Array;
public var mPlayer:Array;
private var mFinishY:int;
private var mWalls:Sprite;
private var mFinishX:int;
public function HelpMaze(){
mPlayer = new Array(4);
super();
mTimeFreeze = false;
mAttachedObstacle = new Bitmap(new BitmapData(Settings.TILE_WIDTH, Settings.TILE_HEIGHT, false, 0xFFFFFF));
mAttachedObstacle.alpha = 0.5;
}
public function get timeFreeze():Boolean{
return (mTimeFreeze);
}
public function loadLevel(_arg1:Array):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Bitmap;
var _local10:int;
var _local11:HelpSign;
mMazeWidth = _arg1[0].length;
mMazeHeight = _arg1.length;
addChild(TiledBackground.createCustom(mMazeWidth, mMazeHeight));
mWalls = new Sprite();
addChild(mWalls);
mOrigMaze = _arg1;
mMaze = new Array(_arg1.length);
var _local2:int;
while (_local2 < _arg1.length) {
mMaze[_local2] = "";
_local5 = 0;
while (_local5 < _arg1[_local2].length) {
mMaze[_local2] = (mMaze[_local2] + _arg1[_local2].charAt(_local5));
_local5++;
};
_local2++;
};
mPlayerCnt = 0;
_local2 = 0;
while (_local2 < 4) {
mPlayer[_local2] = null;
_local2++;
};
var _local3:Sprite = new Sprite();
_local4 = 0;
while (_local4 < mMazeHeight) {
_local6 = 0;
while (_local6 < mMazeWidth) {
_local7 = (Settings.TILE_WIDTH * _local6);
_local8 = (Settings.TILE_HEIGHT * _local4);
switch (mMaze[_local4].charAt(_local6)){
case "X":
_local9 = new Bitmap(DataCollection.mWall[getWallId()]);
_local9.x = _local7;
_local9.y = _local8;
mWalls.addChild(_local9);
break;
case "1":
case "2":
case "3":
case "4":
_local10 = (mMaze[_local4].charAt(_local6) - 1);
if ((_local10 + 1) > mPlayerCnt){
mPlayerCnt = (_local10 + 1);
};
mPlayer[_local10] = new HelpPlayerCharacter(this, _local10);
mPlayer[_local10].setStartPosition(_local7, _local8);
_local3.addChild(mPlayer[_local10]);
break;
case "#":
mFinishX = _local6;
mFinishY = _local4;
mFinishObject = new LevelFinishObject();
mFinishObject.x = _local7;
mFinishObject.y = _local8;
addChild(mFinishObject);
break;
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
case "g":
case "h":
case "i":
case "j":
case "k":
case "l":
case "m":
_local11 = new HelpSign((mMaze[_local4].charCodeAt(_local6) - 97), _local7, _local8);
addChild(_local11);
break;
};
_local6++;
};
_local4++;
};
addChild(_local3);
createPathFromFinish();
}
public function set timeFreeze(_arg1:Boolean):void{
mTimeFreeze = _arg1;
if (!mTimeFreeze){
clearRemoveMarks();
};
}
public function checkCell(_arg1:Number, _arg2:Number):Boolean{
if ((((_arg1 < 0)) || ((_arg2 < 0)))){
return (false);
};
var _local3:int = Math.floor((_arg1 / Settings.TILE_WIDTH));
var _local4:int = Math.floor((_arg2 / Settings.TILE_HEIGHT));
if ((((_local3 >= mMazeWidth)) || ((_local4 >= mMazeHeight)))){
return (false);
};
if (mMaze[_local4].charAt(_local3) == "X"){
return (false);
};
return (true);
}
public function setPreviewCoords(_arg1:Number, _arg2:Number):void{
var _local4:int;
var _local6:HelpObstacleDeleteButton;
if (mAttachedObstacle.parent == null){
mWalls.addChild(mAttachedObstacle);
};
var _local3:int = ((_arg1 - Settings.MAZE_OFFSET_X) / Settings.TILE_WIDTH);
_local4 = ((_arg2 - Settings.MAZE_OFFSET_Y) / Settings.TILE_HEIGHT);
mAttachedObstacle.x = (Settings.MAZE_OFFSET_X + (_local3 * Settings.TILE_WIDTH));
mAttachedObstacle.y = (Settings.MAZE_OFFSET_Y + (_local4 * Settings.TILE_HEIGHT));
var _local5:int;
while (_local5 < mWalls.numChildren) {
if ((mWalls.getChildAt(_local5) is HelpObstacleDeleteButton)){
_local6 = (mWalls.getChildAt(_local5) as HelpObstacleDeleteButton);
if (_local6.isInside(_arg1, _arg2)){
_local6.simulateOver();
} else {
_local6.simulateOut();
};
};
_local5++;
};
}
public function createPathFromFinish():void{
var qx:Array;
var qy:Array;
var qe:int;
var moveCnt:int;
var j:int;
var nx:int;
var ny:int;
var dx:int;
var dy:int;
var addQ:Function = function (_arg1:int, _arg2:int):void{
if ((((((((((((_arg1 >= 0)) && ((_arg1 < mMazeWidth)))) && ((_arg2 >= 0)))) && ((_arg2 < mMazeHeight)))) && ((mMoves[_arg2][_arg1] == 0)))) && (checkTileCell(_arg1, _arg2)))){
mMoves[_arg2][_arg1] = moveCnt;
qx[qe] = _arg1;
qy[qe] = _arg2;
qe++;
};
};
mMoves = new Array(mMazeHeight);
var i:int;
while (i < mMazeHeight) {
mMoves[i] = new Array(mMazeWidth);
j = 0;
while (j < mMazeWidth) {
mMoves[i][j] = 0;
j = (j + 1);
};
i = (i + 1);
};
qx = new Array((mMazeHeight * mMazeWidth));
qy = new Array((mMazeHeight * mMazeWidth));
var qb:int;
qe = 0;
moveCnt = 1;
addQ(mFinishX, mFinishY);
while (qb != qe) {
nx = qx[qb];
ny = qy[qb];
qb = (qb + 1);
moveCnt = (mMoves[ny][nx] + 1);
dx = -1;
while (dx <= 1) {
dy = -1;
while (dy <= 1) {
if ((((dx == 0)) || ((dy == 0)))){
addQ((nx + dx), (ny + dy));
};
dy = (dy + 1);
};
dx = (dx + 1);
};
};
}
public function findPathToFinish(_arg1:int, _arg2:int):Path{
var _local9:int;
var _local10:int;
var _local11:int;
var _local3:Path = new Path();
_arg1 = (_arg1 / Settings.TILE_WIDTH);
_arg2 = (_arg2 / Settings.TILE_HEIGHT);
if (mMoves[_arg2][_arg1] == 0){
return (null);
};
var _local4:int = mMoves[_arg2][_arg1];
var _local5:int;
var _local6:int;
var _local7 = -1;
while (_local7 <= 1) {
_local9 = -1;
while (_local9 <= 1) {
if ((((_local7 == 0)) || ((_local9 == 0)))){
_local10 = (_arg1 + _local7);
_local11 = (_arg2 + _local9);
if ((((((((((((_local10 >= 0)) && ((_local10 < mMazeWidth)))) && ((_local11 >= 0)))) && ((_local11 < mMazeHeight)))) && (!((mMoves[_local11][_local10] == 0))))) && ((mMoves[_local11][_local10] < _local4)))){
_local4 = mMoves[_local11][_local10];
_local5 = _local7;
_local6 = _local9;
};
};
_local9++;
};
_local7++;
};
var _local8:int = _local4;
_local7 = -1;
while (_local7 <= 1) {
_local9 = -1;
while (_local9 <= 1) {
_local10 = (_arg1 + _local7);
_local11 = (_arg2 + _local9);
if (((((((((((((((((!((_local7 == 0))) && (!((_local9 == 0))))) && ((_local10 >= 0)))) && ((_local10 < mMazeWidth)))) && ((_local11 >= 0)))) && ((_local11 < mMazeHeight)))) && (!((mMoves[_local11][_local10] == 0))))) && (((mMoves[_local11][_local10] + 1) == _local8)))) && ((((mMoves[_local11][_arg1] == _local8)) || ((mMoves[_arg2][_local10] == _local8)))))){
_local4 = mMoves[_local11][_local10];
_local5 = _local7;
_local6 = _local9;
};
_local9++;
};
_local7++;
};
_local3.mNextX = (((_arg1 + _local5) * Settings.TILE_WIDTH) + Settings.MAZE_OFFSET_X);
_local3.mNextY = (((_arg2 + _local6) * Settings.TILE_HEIGHT) + Settings.MAZE_OFFSET_Y);
return (_local3);
}
public function hasReachedExit(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number = Math.abs((mFinishObject.x - _arg1));
var _local4:Number = Math.abs((mFinishObject.y - _arg2));
return ((((_local3 < Settings.ENEMY_SPEED_FAST)) && ((_local4 < Settings.ENEMY_SPEED_FAST))));
}
public function checkTileCell(_arg1:int, _arg2:int):Boolean{
if ((((_arg1 < 0)) || ((_arg2 < 0)))){
return (false);
};
if ((((_arg1 >= mMazeWidth)) || ((_arg2 >= mMazeHeight)))){
return (false);
};
if (mMaze[_arg2].charAt(_arg1) == "X"){
return (false);
};
return (true);
}
public function canMoveTo(_arg1:Number, _arg2:Number):Boolean{
return (((((((checkCell(_arg1, _arg2)) && (checkCell((_arg1 + Settings.ENEMY_WIDTH), _arg2)))) && (checkCell(_arg1, (_arg2 + Settings.ENEMY_HEIGHT))))) && (checkCell((_arg1 + Settings.ENEMY_WIDTH), (_arg2 + Settings.ENEMY_HEIGHT)))));
}
public function clearRemoveMarks():void{
var _local1:int = (mWalls.numChildren - 1);
while (_local1 >= 0) {
if ((mWalls.getChildAt(_local1) is HelpObstacleDeleteButton)){
mWalls.removeChildAt(_local1);
};
_local1--;
};
}
public function simulateMouseClick(_arg1:Number, _arg2:Number):void{
var _local4:HelpObstacleDeleteButton;
var _local3:int = (mWalls.numChildren - 1);
while (_local3 >= 0) {
if ((((_local3 < mWalls.numChildren)) && ((mWalls.getChildAt(_local3) is HelpObstacleDeleteButton)))){
_local4 = (mWalls.getChildAt(_local3) as HelpObstacleDeleteButton);
if (_local4.isInside(_arg1, _arg2)){
_local4.simulateClick();
};
};
_local3--;
};
}
public function createWall(_arg1:int, _arg2:int):Boolean{
var _local8:Bitmap;
var _local9:HelpObstacleDeleteButton;
var _local3:int = _arg1;
var _local4:int = _arg2;
if (!checkTileCell(_local3, _local4)){
return (false);
};
var _local5:String = mMaze[_local4];
mMaze[_local4] = ((_local5.substr(0, _local3) + "X") + _local5.substr((_local3 + 1), ((_local5.length - _local3) - 1)));
createPathFromFinish();
var _local6:Boolean;
var _local7:int;
while (_local7 < mPlayerCnt) {
if (((mPlayer[_local7]) && (((!(findPathToFinish(mPlayer[_local7].x, mPlayer[_local7].y))) || (!(canMoveTo(mPlayer[_local7].x, mPlayer[_local7].y))))))){
_local6 = false;
};
_local7++;
};
if (!_local6){
mMaze[_local4] = _local5;
createPathFromFinish();
return (false);
};
_local8 = new Bitmap(DataCollection.mWall[getWallId()]);
_local8.x = (Settings.MAZE_OFFSET_X + (Settings.TILE_WIDTH * _local3));
_local8.y = (Settings.MAZE_OFFSET_Y + (Settings.TILE_HEIGHT * _local4));
mWalls.addChild(_local8);
if (mTimeFreeze){
_local9 = new HelpObstacleDeleteButton(_local3, _local4, _local8, this);
mWalls.addChild(_local9);
};
return (true);
}
public function clearWall(_arg1:int, _arg2:int):void{
var _local3:String = mMaze[_arg2];
mMaze[_arg2] = ((_local3.substr(0, _arg1) + ".") + _local3.substr((_arg1 + 1), ((_local3.length - _arg1) - 1)));
createPathFromFinish();
}
public function getWallId():int{
return (Math.floor((Math.random() * 5)));
}
public function resetMaze():void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Bitmap;
mTimeFreeze = false;
while (mWalls.numChildren > 0) {
mWalls.removeChildAt(0);
};
var _local1:int;
while (_local1 < mOrigMaze.length) {
mMaze[_local1] = "";
_local3 = 0;
while (_local3 < mOrigMaze[_local1].length) {
mMaze[_local1] = (mMaze[_local1] + mOrigMaze[_local1].charAt(_local3));
_local3++;
};
_local1++;
};
var _local2:int;
while (_local2 < mMazeHeight) {
_local4 = 0;
while (_local4 < mMazeWidth) {
_local5 = (Settings.TILE_WIDTH * _local4);
_local6 = (Settings.TILE_HEIGHT * _local2);
switch (mMaze[_local2].charAt(_local4)){
case "X":
_local7 = new Bitmap(DataCollection.mWall[getWallId()]);
_local7.x = _local5;
_local7.y = _local6;
mWalls.addChild(_local7);
break;
};
_local4++;
};
_local2++;
};
_local1 = 0;
while (_local1 < 4) {
if (mPlayer[_local1]){
mPlayer[_local1].resetPosition();
};
_local1++;
};
createPathFromFinish();
}
}
}//package com.mazestopper.helpanimation
Section 13
//HelpObstacleDeleteButton (com.mazestopper.helpanimation.HelpObstacleDeleteButton)
package com.mazestopper.helpanimation {
import flash.display.*;
import com.mazestopper.*;
public class HelpObstacleDeleteButton extends Sprite {
private var mOver:Sprite;
private var mState:int;
private var mUp:Sprite;
private var mMaze:HelpMaze;
private var mMazeY:int;
private var mMazeX:int;
private var mWall:Bitmap;
private static const CROSS_SIZE:int = 5;
public function HelpObstacleDeleteButton(_arg1:int, _arg2:int, _arg3:Bitmap, _arg4:HelpMaze){
mWall = _arg3;
mMazeX = _arg1;
mMazeY = _arg2;
mMaze = _arg4;
draw();
x = (_arg3.x + (Settings.TILE_WIDTH / 2));
y = (_arg3.y + (Settings.TILE_HEIGHT / 2));
}
public function isInside(_arg1:Number, _arg2:Number):Boolean{
return ((((((((_arg1 >= (x - (Settings.TILE_WIDTH / 2)))) && ((_arg1 <= (x + (Settings.TILE_WIDTH / 2)))))) && ((_arg2 >= (y - (Settings.TILE_HEIGHT / 2)))))) && ((_arg2 <= (y + (Settings.TILE_HEIGHT / 2))))));
}
public function simulateOver():void{
if (mState == 0){
mState = 1;
removeChild(mUp);
addChild(mOver);
};
}
public function simulateOut():void{
if (mState == 1){
mState = 0;
removeChild(mOver);
addChild(mUp);
};
}
public function draw():void{
var _local1:Sprite = new Sprite();
_local1.graphics.lineStyle(4, 0xAF0000);
var _local2 = 3;
_local1.graphics.moveTo(-(_local2), -(_local2));
_local1.graphics.lineTo(_local2, _local2);
_local1.graphics.moveTo(_local2, -(_local2));
_local1.graphics.lineTo(-(_local2), _local2);
mUp = _local1;
_local1 = new Sprite();
_local1.graphics.lineStyle(8, 0xFF4F00);
_local2 = 6;
_local1.graphics.moveTo(-(_local2), -(_local2));
_local1.graphics.lineTo(_local2, _local2);
_local1.graphics.moveTo(_local2, -(_local2));
_local1.graphics.lineTo(-(_local2), _local2);
mOver = _local1;
addChild(mUp);
mState = 0;
}
public function simulateClick():void{
parent.removeChild(mWall);
mWall = null;
parent.removeChild(this);
mMaze.clearWall(mMazeX, mMazeY);
}
}
}//package com.mazestopper.helpanimation
Section 14
//HelpPlayerCharacter (com.mazestopper.helpanimation.HelpPlayerCharacter)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
public class HelpPlayerCharacter extends Sprite {
private var mStartX:int;
private var mStartY:int;
private var mMaze:HelpMaze;
private var mFrame:int;
private var mAnimIdle:MovieClip;
private var mMyDir:int;
private var mAnimSide:MovieClip;
private var mAnimUp:MovieClip;
private var mSpeed:int;
private var mAnimDown:MovieClip;
private var mFrameTime:int;
private var mResetFlag:Boolean;
private var mId:int;
private var mUseMC:MovieClip;
public static const DIR_IDLE:int = 5;
public static const DIR_RIGHT:int = 3;
public static const DIR_UP:int = 0;
private static const OFFSET_X:Number = 5;
public static const DIR_DOWN:int = 1;
public static const DIR_LEFT:int = 2;
private static const OFFSET_Y:Number = 10;
public function HelpPlayerCharacter(_arg1:HelpMaze, _arg2:int){
mId = _arg2;
mMaze = _arg1;
mAnimDown = new DataCollection.mManDownClass();
mAnimUp = new DataCollection.mManUpClass();
mAnimSide = new DataCollection.mManSideClass();
mAnimIdle = new DataCollection.mManIdleClass();
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function setGraphics():void{
switch (mMyDir){
case DIR_DOWN:
removeChild(mUseMC);
mUseMC = mAnimDown;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_UP:
removeChild(mUseMC);
mUseMC = mAnimUp;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_LEFT:
removeChild(mUseMC);
mUseMC = mAnimSide;
mUseMC.scaleX = -1;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_RIGHT:
removeChild(mUseMC);
mUseMC = mAnimSide;
mUseMC.scaleX = 1;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_IDLE:
removeChild(mUseMC);
mUseMC = mAnimIdle;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
};
}
public function onFrame(_arg1:Event):void{
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (mMaze.timeFreeze){
return;
};
if (mMaze.hasReachedExit(x, y)){
mMaze.resetMaze();
mResetFlag = true;
return;
};
var _local2:Number = 0;
var _local3:Number = 0;
var _local4 = -1;
var _local5:Path = mMaze.findPathToFinish(x, y);
if (_local5){
if (_local5.mNextY > y){
_local3 = 1;
_local4 = DIR_DOWN;
};
if (_local5.mNextY < y){
_local3 = -1;
_local4 = DIR_UP;
};
if (_local5.mNextX > x){
_local2 = 1;
_local4 = DIR_RIGHT;
};
if (_local5.mNextX < x){
_local2 = -1;
_local4 = DIR_LEFT;
};
};
if (_local4 == -1){
if (mMyDir != DIR_IDLE){
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
return;
};
mFrameTime++;
if (mFrameTime > 1){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
return;
};
var _local6:Number = (x + (mSpeed * _local2));
if (Math.abs((_local5.mNextX - x)) <= mSpeed){
_local6 = _local5.mNextX;
};
var _local7:Number = (y + (mSpeed * _local3));
if (Math.abs((_local5.mNextY - y)) <= mSpeed){
_local7 = _local5.mNextY;
};
if (((!((_local2 == 0))) && (!((_local3 == 0))))){
_local2 = (_local2 / Math.SQRT2);
_local3 = (_local3 / Math.SQRT2);
};
var _local8:Number = (x + (mSpeed * _local2));
if (Math.abs((_local5.mNextX - x)) <= (mSpeed * Math.abs(_local2))){
_local8 = _local5.mNextX;
};
var _local9:Number = (y + (mSpeed * _local3));
if (Math.abs((_local5.mNextY - y)) <= (mSpeed * Math.abs(_local3))){
_local9 = _local5.mNextY;
};
var _local10:Boolean;
_local10 = mMaze.canMoveTo(_local8, _local9);
if (!_local10){
_local10 = mMaze.canMoveTo(x, _local9);
if (_local10){
_local8 = x;
_local9 = _local7;
if (_local3 < 0){
_local4 = DIR_UP;
};
if (_local3 > 0){
_local4 = DIR_DOWN;
};
};
};
if (!_local10){
_local10 = mMaze.canMoveTo(_local8, y);
if (_local10){
_local9 = y;
_local8 = _local6;
if (_local2 < 0){
_local4 = DIR_LEFT;
};
if (_local2 > 0){
_local4 = DIR_RIGHT;
};
};
};
if (((!(_local10)) || ((((x == _local8)) && ((y == _local9)))))){
if (DIR_IDLE != mMyDir){
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
} else {
mFrameTime++;
if (mFrameTime > 1){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
};
return;
};
x = _local8;
y = _local9;
if (_local4 != mMyDir){
mMyDir = _local4;
mFrame = 0;
mFrameTime = 0;
setGraphics();
} else {
mFrameTime++;
if (mFrameTime > 0){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
};
}
public function get resetFlag():Boolean{
var _local1:Boolean = mResetFlag;
mResetFlag = false;
return (_local1);
}
public function resetPosition():void{
x = mStartX;
y = mStartY;
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
mSpeed = Settings.ENEMY_SPEED;
mResetFlag = false;
}
public function setStartPosition(_arg1:int, _arg2:int):void{
mStartX = _arg1;
mStartY = _arg2;
x = _arg1;
y = _arg2;
mUseMC = mAnimIdle;
mUseMC.gotoAndStop(1);
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
mSpeed = Settings.ENEMY_SPEED;
mResetFlag = false;
}
}
}//package com.mazestopper.helpanimation
Section 15
//Instructions (com.mazestopper.helpanimation.Instructions)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
import flash.text.*;
import com.flashrelax.utils.*;
import flash.ui.*;
public class Instructions extends Window {
private var mPageCounter:QuickText;
private var mText:QuickText;
private var mCurPage:int;
private var mCallType:int;
private var mButtonNext:Button;
private var mButtonPrev:Button;
private var mPage:Sprite;
private var mButton1:Button;
public static const CALL_MAIN_MENU:int = 0;
private static const TEXTAREA_HEIGHT:int = 0xFF;
public static const CALL_LEVEL_START:int = 1;
public static const CALL_GAME:int = 2;
private static const WINDOW_HEIGHT:int = 345;
private static const WINDOW_WIDTH:int = 475;
public static const CALL_TIPS:int = 3;
private static const PageText:Array = [[((("\tKeep the man away from the flag for as long as you can. " + "Click or hold the left mouse button ") + "to create obstacles.\n\n\n\n\n\n\n\n\n") + "\tYou can't block the passage to the flag for the man.")], [((("\tDuring time freeze you can delete accidently placed obstacles " + "by clicking the red X on top of the obstacle. Once you unfreeze ") + "the time, you can't remove any of the already placed obstacles ") + "anymore.")], ["\tUse traps to trick the man as shown in the animation."], [(("\tDid you know that you can use advanced tactics to keep " + "the man away from the flag for much longer? ") + "See the animation to understand how to create traps and trick the man.")]];
private static const PAGE_COUNT:int = 3;
public function Instructions(_arg1:int){
super("Instructions", WINDOW_WIDTH, WINDOW_HEIGHT);
mCallType = _arg1;
mCurPage = 0;
if (mCallType == CALL_TIPS){
mCurPage = 3;
};
if (mCallType != CALL_TIPS){
mPageCounter = new QuickText(12, TextFormatAlign.RIGHT, 0xFFFFFF);
mPageCounter.x = 10;
mPageCounter.y = 10;
mPageCounter.width = (WINDOW_WIDTH - 20);
mPageCounter.height = 20;
addChild(mPageCounter);
};
mPage = new Sprite();
addChild(mPage);
mPage.graphics.lineStyle(1, 0x3F00, 0.95);
mPage.graphics.moveTo(1, TEXTAREA_HEIGHT);
mPage.graphics.lineTo((WINDOW_WIDTH - 1), TEXTAREA_HEIGHT);
mPage.x = 0;
mPage.y = 40;
createPage();
if ((((mCallType == CALL_LEVEL_START)) || ((mCallType == CALL_TIPS)))){
mButton1 = new Button("Continue");
} else {
if (mCallType == CALL_GAME){
mButton1 = new Button("Resume Game");
} else {
mButton1 = new Button("Back");
};
};
mButton1.y = ((mPage.y + TEXTAREA_HEIGHT) + 15);
mButton1.x = ((WINDOW_WIDTH - mButton1.width) / 2);
mButton1.addEventListener(MouseEvent.CLICK, onResume);
addChild(mButton1);
if (mCallType != CALL_TIPS){
mButtonNext = new Button("Next Page >>>");
mButtonNext.y = (mPage.y + TEXTAREA_HEIGHT);
mButtonNext.x = ((WINDOW_WIDTH - mButtonNext.width) - 10);
mButtonNext.addEventListener(MouseEvent.CLICK, onNext);
addChild(mButtonNext);
mButtonPrev = new Button("<<< Prev Page");
mButtonPrev.y = (mPage.y + TEXTAREA_HEIGHT);
mButtonPrev.x = 10;
mButtonPrev.addEventListener(MouseEvent.CLICK, onPrev);
GameState.root.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
};
}
public function onKey(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ESCAPE)) || ((String.fromCharCode(_arg1.charCode).toLowerCase() == "i")))){
onResume(null);
};
if ((((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == Keyboard.DOWN)))) || ((_arg1.keyCode == Keyboard.PAGE_DOWN)))){
onNext(null);
};
if ((((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == Keyboard.UP)))) || ((_arg1.keyCode == Keyboard.PAGE_UP)))){
onPrev(null);
};
}
public function onNext(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
mCurPage++;
createPage();
if (mCurPage >= (PAGE_COUNT - 1)){
removeChild(mButtonNext);
};
if (mCurPage == 1){
addChild(mButtonPrev);
};
}
public function createPage1():void{
var _local1:VisualButton = new VisualButton("SPACE");
_local1.x = 335;
_local1.y = 140;
mPage.addChild(_local1);
var _local2:QuickText = new QuickText(16, TextFormatAlign.LEFT, 0xFFFF00);
_local2.width = 200;
_local2.x = 305;
_local2.y = 170;
mPage.addChild(_local2);
var _local3:Page1 = new Page1(_local1, _local2);
_local3.x = (((WINDOW_WIDTH - 100) - _local3.width) / 2);
_local3.y = 70;
mPage.addChild(_local3);
}
public function createPage2():void{
var _local1:VisualButton = new VisualButton("SPACE");
_local1.x = 335;
_local1.y = 150;
mPage.addChild(_local1);
var _local2:QuickText = new QuickText(16, TextFormatAlign.LEFT, 0xFFFF00);
_local2.width = 200;
_local2.x = 305;
_local2.y = 180;
mPage.addChild(_local2);
var _local3:Page2 = new Page2(_local1, _local2);
_local3.x = (((WINDOW_WIDTH - 100) - _local3.width) / 2);
_local3.y = 95;
mPage.addChild(_local3);
}
public function createPage3():void{
var _local1:VisualButton = new VisualButton("SPACE");
_local1.x = 335;
_local1.y = 110;
mPage.addChild(_local1);
var _local2:QuickText = new QuickText(16, TextFormatAlign.LEFT, 0xFFFF00);
_local2.width = 200;
_local2.x = 305;
_local2.y = 140;
mPage.addChild(_local2);
var _local3:Page3 = new Page3(_local1, _local2);
_local3.x = (((WINDOW_WIDTH - 100) - _local3.width) / 2);
_local3.y = 60;
mPage.addChild(_local3);
}
public function createPage4():void{
var _local1:VisualButton = new VisualButton("SPACE");
_local1.x = 335;
_local1.y = 150;
mPage.addChild(_local1);
var _local2:QuickText = new QuickText(16, TextFormatAlign.LEFT, 0xFFFF00);
_local2.width = 200;
_local2.x = 305;
_local2.y = 180;
mPage.addChild(_local2);
var _local3:Page3 = new Page3(_local1, _local2);
_local3.x = (((WINDOW_WIDTH - 100) - _local3.width) / 2);
_local3.y = 100;
mPage.addChild(_local3);
}
public function createPage5():void{
}
public function onResume(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
parent.removeChild(this);
mButton1.removeEventListener(MouseEvent.CLICK, onResume);
if (mCallType != CALL_TIPS){
mButtonNext.removeEventListener(MouseEvent.CLICK, onNext);
mButtonPrev.removeEventListener(MouseEvent.CLICK, onPrev);
GameState.root.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
};
if (mCallType == CALL_LEVEL_START){
GameProcess.restart(false, false);
};
if (mCallType == CALL_GAME){
GameState.mState = GameState.STATE_GAME;
};
if (mCallType == CALL_TIPS){
GameState.root.addChild(new GameOverWindow());
};
}
public function createPage():void{
clearPage();
if (mCallType != CALL_TIPS){
mPageCounter.setText(((("Page " + (mCurPage + 1)) + " / ") + PAGE_COUNT));
};
mText = new QuickText(18, TextFormatAlign.JUSTIFY, 0xFFFF00);
mPage.addChild(mText);
mText.wordWrap = true;
mText.setText(PageText[mCurPage]);
mText.x = 4;
mText.y = 0;
mText.width = (WINDOW_WIDTH - 8);
mText.height = mPage.height;
switch (mCurPage){
case 0:
createPage1();
break;
case 1:
createPage2();
break;
case 2:
createPage3();
break;
case 3:
createPage4();
break;
case 4:
createPage5();
break;
};
}
public function onPrev(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
mCurPage--;
createPage();
if (mCurPage <= 0){
removeChild(mButtonPrev);
};
if (mCurPage == (PAGE_COUNT - 2)){
addChild(mButtonNext);
};
}
public function clearPage():void{
while (mPage.numChildren > 0) {
mPage.removeChildAt((mPage.numChildren - 1));
};
}
}
}//package com.mazestopper.helpanimation
Section 16
//Page1 (com.mazestopper.helpanimation.Page1)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
import com.flashrelax.utils.*;
public class Page1 extends Sprite {
private var mTimeText:QuickText;
private var mSpaceBut:VisualButton;
private var mMaze:HelpMaze;
private var mFrame:int;
private var mPlayer:HelpPlayerCharacter;
private var mMouse:FakeMousePointer;
private static const MazeData:Array = ["........", "........", "2......#", "........", "........", "........"];
private static const FreezeData:Array = [80, 110, 140, 180, 220];
private static const MovementData:Array = [[1, 15, 1, 0], [15, 16, 1, 1], [17, 18, 2, 1], [19, 20, 2, 2], [21, 22, 1, 3], [23, 24, 1, 4], [40, 49, 2, 1], [52, 58, 2, 2], [64, 68, 1, 2], [100, 120, 3, 5], [122, 123, 3, 4], [124, 125, 3, 3], [126, 127, 3, 2], [128, 129, 3, 1], [160, 190, 5, 1], [191, 192, 6, 1], [196, 201, 6, 3], [202, 203, 5, 3], [210, 247, 6, 2], [260, 277, 7, 1], [290, 305, 5, 4], [320, 330, 7, 5]];
public function Page1(_arg1:VisualButton, _arg2:QuickText){
mSpaceBut = _arg1;
mTimeText = _arg2;
mMaze = new HelpMaze();
mMaze.loadLevel(MazeData);
addChild(mMaze);
mPlayer = mMaze.mPlayer[1];
mMouse = new FakeMousePointer(mMaze);
mMouse.x = ((MovementData[0][2] + 0.5) * Settings.TILE_WIDTH);
mMouse.y = ((MovementData[0][3] + 0.5) * Settings.TILE_HEIGHT);
addChild(mMouse);
mFrame = 0;
setTimeFreeze(true);
addEventListener(Event.ENTER_FRAME, onFrame);
}
private function setTimeFreeze(_arg1:Boolean):void{
if (_arg1){
mTimeText.setText("Time Freeze: on");
} else {
mTimeText.setText("Time Freeze: off");
};
mMaze.timeFreeze = _arg1;
}
public function onFrame(_arg1:Event):void{
var _local3:int;
var _local4:int;
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (mPlayer.resetFlag){
mFrame = 0;
setTimeFreeze(true);
};
mFrame++;
var _local2:int;
while (_local2 < MovementData.length) {
_local3 = MovementData[_local2][2];
_local4 = MovementData[_local2][3];
if (MovementData[_local2][0] == mFrame){
mMouse.moveTo(((_local3 + 0.5) * Settings.TILE_WIDTH), ((_local4 + 0.5) * Settings.TILE_HEIGHT));
};
if (MovementData[_local2][1] == mFrame){
if (!mMaze.createWall(_local3, _local4)){
mMaze.simulateMouseClick(mMouse.x, mMouse.y);
};
};
_local2++;
};
_local2 = 0;
while (_local2 < FreezeData.length) {
if (FreezeData[_local2] == mFrame){
mSpaceBut.setState(1);
setTimeFreeze(!(mMaze.timeFreeze));
};
if (FreezeData[_local2] == (mFrame - 5)){
mSpaceBut.setState(0);
};
_local2++;
};
}
}
}//package com.mazestopper.helpanimation
Section 17
//Page2 (com.mazestopper.helpanimation.Page2)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
import com.flashrelax.utils.*;
public class Page2 extends Sprite {
private var mTimeText:QuickText;
private var mSpaceBut:VisualButton;
private var mMaze:HelpMaze;
private var mFrame:int;
private var mPlayer:HelpPlayerCharacter;
private var mMouse:FakeMousePointer;
private static const MazeData:Array = [".......", ".......", "2.....#", ".......", "......."];
private static const FreezeData:Array = [250];
private static const MovementData:Array = [[1, 15, 2, 0], [15, 16, 2, 1], [17, 18, 2, 2], [19, 20, 2, 3], [31, 38, 4, 4], [39, 40, 4, 3], [41, 42, 4, 2], [43, 44, 4, 1], [60, 65, 6, 0], [80, 88, 2, 0], [90, 95, 2, 1], [100, 105, 2, 2], [110, 115, 2, 3], [125, 130, 4, 4], [135, 140, 4, 3], [145, 150, 4, 2], [155, 160, 4, 1], [170, 175, 6, 0], [190, 198, 1, 0], [199, 200, 1, 1], [201, 202, 1, 2], [203, 204, 1, 3], [210, 215, 3, 4], [216, 217, 3, 3], [218, 219, 3, 2], [220, 221, 3, 1], [228, 233, 5, 0], [234, 235, 5, 1], [236, 237, 5, 2], [239, 239, 5, 3]];
public function Page2(_arg1:VisualButton, _arg2:QuickText){
mSpaceBut = _arg1;
mTimeText = _arg2;
mMaze = new HelpMaze();
mMaze.loadLevel(MazeData);
addChild(mMaze);
mPlayer = mMaze.mPlayer[1];
mMouse = new FakeMousePointer(mMaze);
mMouse.x = ((MovementData[0][2] + 0.5) * Settings.TILE_WIDTH);
mMouse.y = ((MovementData[0][3] + 0.5) * Settings.TILE_HEIGHT);
addChild(mMouse);
mFrame = 0;
setTimeFreeze(true);
addEventListener(Event.ENTER_FRAME, onFrame);
}
private function setTimeFreeze(_arg1:Boolean):void{
if (_arg1){
mTimeText.setText("Time Freeze: on");
} else {
mTimeText.setText("Time Freeze: off");
};
mMaze.timeFreeze = _arg1;
}
public function onFrame(_arg1:Event):void{
var _local3:int;
var _local4:int;
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (mPlayer.resetFlag){
mFrame = 0;
setTimeFreeze(true);
};
mFrame++;
var _local2:int;
while (_local2 < MovementData.length) {
_local3 = MovementData[_local2][2];
_local4 = MovementData[_local2][3];
if (MovementData[_local2][0] == mFrame){
mMouse.moveTo(((_local3 + 0.5) * Settings.TILE_WIDTH), ((_local4 + 0.5) * Settings.TILE_HEIGHT));
};
if (MovementData[_local2][1] == mFrame){
if (!mMaze.createWall(_local3, _local4)){
mMaze.simulateMouseClick(mMouse.x, mMouse.y);
};
};
_local2++;
};
_local2 = 0;
while (_local2 < FreezeData.length) {
if (FreezeData[_local2] == mFrame){
mSpaceBut.setState(1);
setTimeFreeze(!(mMaze.timeFreeze));
};
if (FreezeData[_local2] == (mFrame - 5)){
mSpaceBut.setState(0);
};
_local2++;
};
}
}
}//package com.mazestopper.helpanimation
Section 18
//Page3 (com.mazestopper.helpanimation.Page3)
package com.mazestopper.helpanimation {
import flash.display.*;
import flash.events.*;
import com.mazestopper.*;
import com.flashrelax.utils.*;
public class Page3 extends Sprite {
private var mTimeText:QuickText;
private var mSpaceBut:VisualButton;
private var mMaze:HelpMaze;
private var mFrame:int;
private var mPlayer:HelpPlayerCharacter;
private var mMouse:FakeMousePointer;
private static const MazeData:Array = ["........", "........", "2......#", "........", "........"];
private static const FreezeData:Array = [60];
private static const MovementData:Array = [[1, 15, 1, 1], [15, 16, 2, 1], [17, 18, 3, 1], [19, 20, 4, 1], [21, 22, 5, 1], [23, 24, 6, 1], [30, 35, 6, 3], [36, 37, 5, 3], [38, 39, 4, 3], [40, 41, 3, 3], [42, 43, 2, 3], [44, 45, 1, 3], [55, 85, 6, 2], [100, 155, 7, 1]];
public function Page3(_arg1:VisualButton, _arg2:QuickText){
mSpaceBut = _arg1;
mTimeText = _arg2;
mMaze = new HelpMaze();
mMaze.loadLevel(MazeData);
addChild(mMaze);
mPlayer = mMaze.mPlayer[1];
mMouse = new FakeMousePointer(mMaze);
mMouse.x = ((MovementData[0][2] + 0.5) * Settings.TILE_WIDTH);
mMouse.y = ((MovementData[0][3] + 0.5) * Settings.TILE_HEIGHT);
addChild(mMouse);
mFrame = 0;
setTimeFreeze(true);
addEventListener(Event.ENTER_FRAME, onFrame);
}
private function setTimeFreeze(_arg1:Boolean):void{
if (_arg1){
mTimeText.setText("Time Freeze: on");
} else {
mTimeText.setText("Time Freeze: off");
};
mMaze.timeFreeze = _arg1;
}
public function onFrame(_arg1:Event):void{
var _local3:int;
var _local4:int;
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (mPlayer.resetFlag){
mFrame = 0;
setTimeFreeze(true);
};
mFrame++;
var _local2:int;
while (_local2 < MovementData.length) {
_local3 = MovementData[_local2][2];
_local4 = MovementData[_local2][3];
if (MovementData[_local2][0] == mFrame){
mMouse.moveTo(((_local3 + 0.5) * Settings.TILE_WIDTH), ((_local4 + 0.5) * Settings.TILE_HEIGHT));
};
if (MovementData[_local2][1] == mFrame){
if (!mMaze.createWall(_local3, _local4)){
mMaze.simulateMouseClick(mMouse.x, mMouse.y);
};
};
_local2++;
};
_local2 = 0;
while (_local2 < FreezeData.length) {
if (FreezeData[_local2] == mFrame){
mSpaceBut.setState(1);
setTimeFreeze(!(mMaze.timeFreeze));
};
if (FreezeData[_local2] == (mFrame - 5)){
mSpaceBut.setState(0);
};
_local2++;
};
}
}
}//package com.mazestopper.helpanimation
Section 19
//AmbientMusic (com.mazestopper.AmbientMusic)
package com.mazestopper {
import flash.events.*;
import flash.media.*;
public class AmbientMusic {
private static const MAIN_VOLUME:Number = 0.2;
private static const RANDOM_NOISE_HIGH:int = 400;
private static const RANDOM_NOISE_LOW:int = 200;
private static var mMusicChannel:SoundChannel = null;
private static var mRandomNoiseTime:int;
public static function stop():void{
if (mMusicChannel != null){
mMusicChannel.stop();
mMusicChannel.removeEventListener(Event.SOUND_COMPLETE, onComplete);
mMusicChannel = null;
GameState.root.removeEventListener(Event.ENTER_FRAME, onFrame);
};
}
public static function play(_arg1:Boolean=true):void{
mMusicChannel = DataCollection.mBird1Sfx.play();
mMusicChannel.soundTransform = new SoundTransform(MAIN_VOLUME);
mMusicChannel.addEventListener(Event.SOUND_COMPLETE, onComplete);
if (_arg1){
GameState.root.addEventListener(Event.ENTER_FRAME, onFrame);
mRandomNoiseTime = (RANDOM_NOISE_LOW + (Math.random() * (RANDOM_NOISE_HIGH - RANDOM_NOISE_LOW)));
};
}
public static function onFrame(_arg1:Event):void{
var _local2:int;
if (mRandomNoiseTime <= 0){
mRandomNoiseTime = (RANDOM_NOISE_LOW + (Math.random() * (RANDOM_NOISE_HIGH - RANDOM_NOISE_LOW)));
_local2 = Math.floor((Math.random() * 2));
if (_local2 == 0){
DataCollection.mBird2Sfx.play();
} else {
DataCollection.mBird3Sfx.play();
};
} else {
mRandomNoiseTime--;
};
}
public static function onComplete(_arg1:Event):void{
mMusicChannel.removeEventListener(Event.SOUND_COMPLETE, onComplete);
play(false);
}
}
}//package com.mazestopper
Section 20
//Button (com.mazestopper.Button)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class Button extends SimpleButton {
private var mText:String;
public function Button(_arg1:String, _arg2:int=24){
mText = _arg1;
var _local3:TextField = createLabel(4294901760, _arg2);
var _local4:int = _local3.width;
var _local5:int = _local3.height;
var _local6:Sprite = new Sprite();
_local6.addChild(_local3);
var _local7:Sprite = new Sprite();
_local7.addChild(createLabel(0xFF7F00, _arg2));
var _local8:Sprite = new Sprite();
_local8.addChild(createLabel(0xEFEF00, _arg2));
upState = _local7;
overState = _local8;
downState = _local6;
useHandCursor = true;
hitTestState = _local7;
}
public function createLabel(_arg1:uint, _arg2:int):TextField{
var _local7:Array;
var _local3:TextField = new TextField();
_local3.type = TextFieldType.DYNAMIC;
_local3.selectable = false;
_local3.textColor = _arg1;
var _local4:TextFormat = _local3.getTextFormat();
_local4.font = Settings.GAME_FONT;
_local4.size = _arg2;
_local4.align = TextFormatAlign.CENTER;
_local3.defaultTextFormat = _local4;
_local3.embedFonts = true;
_local3.appendText(mText);
_local3.y = 0;
_local3.x = 0;
if (_arg2 > 12){
_local7 = new Array(1);
_local7[0] = new GlowFilter(0x1F1F00, 1, 6, 6, 3, 1, false, false);
_local3.filters = _local7;
};
var _local5:int = _local3.getLineMetrics(0).width;
var _local6:int = _local3.getLineMetrics(0).height;
_local3.width = (_local5 + 10);
_local3.height = (_local6 + 5);
return (_local3);
}
}
}//package com.mazestopper
Section 21
//DataCollection (com.mazestopper.DataCollection)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
import com.flashrelax.utils.*;
import mx.core.*;
import flash.geom.*;
public class DataCollection {
public static var mSidePanel:BitmapData;
private static var mFloor4Class:Class = DataCollection_mFloor4Class;
private static var mBoomSfxClass:Class = DataCollection_mBoomSfxClass;
public static var mIntroSfx:SoundAsset;
private static var mIntroSfxClass:Class = DataCollection_mIntroSfxClass;
public static var mBird3Sfx:SoundAsset;
public static var mEnemySide:Array;
private static var mPanelBox2Class:Class = DataCollection_mPanelBox2Class;
public static var mEnemyUp:Array;
private static var mFlagStickClass:Class = DataCollection_mFlagStickClass;
private static var mFloor1Class:Class = DataCollection_mFloor1Class;
private static var mPanelBoxClass:Class = DataCollection_mPanelBoxClass;
public static var mManUpClass:Class = DataCollection_mManUpClass;
public static var mCount1Sfx:SoundAsset;
private static var mWall4Class:Class = DataCollection_mWall4Class;
private static var mBird1SfxClass:Class = DataCollection_mBird1SfxClass;
private static var mBird2SfxClass:Class = DataCollection_mBird2SfxClass;
private static var mBird3SfxClass:Class = DataCollection_mBird3SfxClass;
public static var mManSideClass:Class = DataCollection_mManSideClass;
public static var mSfxMenu:SoundAsset;
private static var mSidePanelClass:Class = DataCollection_mSidePanelClass;
public static var mBird1Sfx:SoundAsset;
public static var mEnemyDown:Array;
public static var mTarget:BitmapData;
private static var mSfxMenuClass:Class = DataCollection_mSfxMenuClass;
private static var mFloor3Class:Class = DataCollection_mFloor3Class;
public static var mStarMid:BitmapData;
public static var mBoomSfx:SoundAsset;
private static var mWall6Class:Class = DataCollection_mWall6Class;
private static var mStarOnClass:Class = DataCollection_mStarOnClass;
private static var mFlagClass:Class = DataCollection_mFlagClass;
public static var mButterfly:Array;
public static var mFlag:Array;
private static var mStarMidClass:Class = DataCollection_mStarMidClass;
private static var mMousePointerClass:Class = DataCollection_mMousePointerClass;
public static var mCount2Sfx:SoundAsset;
public static var mEnemyIdle:Array;
public static var mStarOff:BitmapData;
private static var mButterflyClass:Class = DataCollection_mButterflyClass;
private static var mWall3Class:Class = DataCollection_mWall3Class;
public static var mStarOn:BitmapData;
public static var mFloor:Array;
private static var mFloor5Class:Class = DataCollection_mFloor5Class;
public static var mFlagStick:BitmapData;
public static var mBird2Sfx:SoundAsset;
private static var mTargetClass:Class = DataCollection_mTargetClass;
public static var mPanelBox:BitmapData;
private static var mFloor2Class:Class = DataCollection_mFloor2Class;
public static var mManDownClass:Class = DataCollection_mManDownClass;
private static var mStarOffClass:Class = DataCollection_mStarOffClass;
public static var mManIdleClass:Class = DataCollection_mManIdleClass;
private static var mWall5Class:Class = DataCollection_mWall5Class;
public static var mWall:Array;
private static var mWallClass:Class = DataCollection_mWallClass;
private static var mCount1SfxClass:Class = DataCollection_mCount1SfxClass;
private static var mCount2SfxClass:Class = DataCollection_mCount2SfxClass;
public static var mMousePointer:BitmapData;
private static var mGameFont:Class = DataCollection_mGameFont;
public static var mLogoSWFClass:Class = DataCollection_mLogoSWFClass;
private static var mWall2Class:Class = DataCollection_mWall2Class;
public static var mPanelBox2:BitmapData;
public static function init():void{
var _local1:int;
var _local2:BitmapAsset;
var _local5:Rectangle;
var _local6:Point;
Font.registerFont(mGameFont);
QuickText.setDefaultFont(Settings.GAME_FONT);
mWall = new Array(5);
_local2 = (new mWallClass() as BitmapAsset);
mWall[0] = _local2.bitmapData;
_local2 = (new mWall2Class() as BitmapAsset);
mWall[1] = _local2.bitmapData;
_local2 = (new mWall3Class() as BitmapAsset);
mWall[2] = _local2.bitmapData;
_local2 = (new mWall4Class() as BitmapAsset);
mWall[3] = _local2.bitmapData;
_local2 = (new mWall5Class() as BitmapAsset);
mWall[4] = _local2.bitmapData;
_local2 = (new mTargetClass() as BitmapAsset);
mTarget = _local2.bitmapData;
mFloor = new Array(5);
_local2 = (new mFloor1Class() as BitmapAsset);
mFloor[0] = _local2.bitmapData;
_local2 = (new mFloor2Class() as BitmapAsset);
mFloor[1] = _local2.bitmapData;
_local2 = (new mFloor3Class() as BitmapAsset);
mFloor[2] = _local2.bitmapData;
_local2 = (new mFloor4Class() as BitmapAsset);
mFloor[3] = _local2.bitmapData;
_local2 = (new mFloor5Class() as BitmapAsset);
mFloor[4] = _local2.bitmapData;
_local2 = (new mMousePointerClass() as BitmapAsset);
mMousePointer = _local2.bitmapData;
_local2 = (new mSidePanelClass() as BitmapAsset);
mSidePanel = _local2.bitmapData;
_local2 = (new mPanelBoxClass() as BitmapAsset);
mPanelBox = _local2.bitmapData;
_local2 = (new mPanelBox2Class() as BitmapAsset);
mPanelBox2 = _local2.bitmapData;
_local2 = (new mStarOffClass() as BitmapAsset);
mStarOff = _local2.bitmapData;
_local2 = (new mStarOnClass() as BitmapAsset);
mStarOn = _local2.bitmapData;
_local2 = (new mStarMidClass() as BitmapAsset);
mStarMid = _local2.bitmapData;
_local2 = (new mFlagClass() as BitmapAsset);
var _local3:int = (_local2.bitmapData.height / 9);
mFlag = new Array(_local3);
_local1 = 0;
while (_local1 < _local3) {
mFlag[_local1] = new BitmapData(20, 8);
_local5 = new Rectangle(0, (_local1 * 9), 20, 8);
_local6 = new Point(0, 0);
mFlag[_local1].copyPixels(_local2.bitmapData, _local5, _local6);
_local1++;
};
_local2 = (new mFlagStickClass() as BitmapAsset);
mFlagStick = _local2.bitmapData;
_local2 = (new mButterflyClass() as BitmapAsset);
var _local4:int = (_local2.bitmapData.height / 10);
mButterfly = new Array(_local4);
_local1 = 0;
while (_local1 < _local4) {
mButterfly[_local1] = new BitmapData(10, 10);
_local5 = new Rectangle(0, (_local1 * 10), 10, 10);
_local6 = new Point(0, 0);
mButterfly[_local1].copyPixels(_local2.bitmapData, _local5, _local6);
_local1++;
};
mEnemyUp = new Array(1);
mEnemyDown = new Array(1);
mEnemySide = new Array(1);
mEnemyIdle = new Array(1);
_local1 = 0;
while (_local1 < 1) {
mEnemyUp[_local1] = (new mManUpClass() as MovieClip);
mEnemyDown[_local1] = (new mManDownClass() as MovieClip);
mEnemySide[_local1] = (new mManSideClass() as MovieClip);
mEnemyIdle[_local1] = (new mManIdleClass() as MovieClip);
_local1++;
};
mSfxMenu = (new mSfxMenuClass() as SoundAsset);
mCount1Sfx = (new mCount1SfxClass() as SoundAsset);
mCount2Sfx = (new mCount2SfxClass() as SoundAsset);
mBird1Sfx = (new mBird1SfxClass() as SoundAsset);
mBird2Sfx = (new mBird2SfxClass() as SoundAsset);
mBird3Sfx = (new mBird3SfxClass() as SoundAsset);
mIntroSfx = (new mIntroSfxClass() as SoundAsset);
mBoomSfx = (new mBoomSfxClass() as SoundAsset);
}
init();
}
}//package com.mazestopper
Section 22
//DataCollection_mBird1SfxClass (com.mazestopper.DataCollection_mBird1SfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mBird1SfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 23
//DataCollection_mBird2SfxClass (com.mazestopper.DataCollection_mBird2SfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mBird2SfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 24
//DataCollection_mBird3SfxClass (com.mazestopper.DataCollection_mBird3SfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mBird3SfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 25
//DataCollection_mBoomSfxClass (com.mazestopper.DataCollection_mBoomSfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mBoomSfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 26
//DataCollection_mButterflyClass (com.mazestopper.DataCollection_mButterflyClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mButterflyClass extends BitmapAsset {
}
}//package com.mazestopper
Section 27
//DataCollection_mCount1SfxClass (com.mazestopper.DataCollection_mCount1SfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mCount1SfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 28
//DataCollection_mCount2SfxClass (com.mazestopper.DataCollection_mCount2SfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mCount2SfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 29
//DataCollection_mFlagClass (com.mazestopper.DataCollection_mFlagClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFlagClass extends BitmapAsset {
}
}//package com.mazestopper
Section 30
//DataCollection_mFlagStickClass (com.mazestopper.DataCollection_mFlagStickClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFlagStickClass extends BitmapAsset {
}
}//package com.mazestopper
Section 31
//DataCollection_mFloor1Class (com.mazestopper.DataCollection_mFloor1Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFloor1Class extends BitmapAsset {
}
}//package com.mazestopper
Section 32
//DataCollection_mFloor2Class (com.mazestopper.DataCollection_mFloor2Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFloor2Class extends BitmapAsset {
}
}//package com.mazestopper
Section 33
//DataCollection_mFloor3Class (com.mazestopper.DataCollection_mFloor3Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFloor3Class extends BitmapAsset {
}
}//package com.mazestopper
Section 34
//DataCollection_mFloor4Class (com.mazestopper.DataCollection_mFloor4Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFloor4Class extends BitmapAsset {
}
}//package com.mazestopper
Section 35
//DataCollection_mFloor5Class (com.mazestopper.DataCollection_mFloor5Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mFloor5Class extends BitmapAsset {
}
}//package com.mazestopper
Section 36
//DataCollection_mGameFont (com.mazestopper.DataCollection_mGameFont)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mGameFont extends FontAsset {
}
}//package com.mazestopper
Section 37
//DataCollection_mIntroSfxClass (com.mazestopper.DataCollection_mIntroSfxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mIntroSfxClass extends SoundAsset {
}
}//package com.mazestopper
Section 38
//DataCollection_mLogoSWFClass (com.mazestopper.DataCollection_mLogoSWFClass)
package com.mazestopper {
import flash.utils.*;
import mx.core.*;
public class DataCollection_mLogoSWFClass extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function DataCollection_mLogoSWFClass(){
dataClass = DataCollection_mLogoSWFClass_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package com.mazestopper
Section 39
//DataCollection_mLogoSWFClass_dataClass (com.mazestopper.DataCollection_mLogoSWFClass_dataClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mLogoSWFClass_dataClass extends ByteArrayAsset {
}
}//package com.mazestopper
Section 40
//DataCollection_mManDownClass (com.mazestopper.DataCollection_mManDownClass)
package com.mazestopper {
import flash.display.*;
import mx.core.*;
public class DataCollection_mManDownClass extends MovieClipAsset {
public var body1:DisplayObject;
}
}//package com.mazestopper
Section 41
//DataCollection_mManIdleClass (com.mazestopper.DataCollection_mManIdleClass)
package com.mazestopper {
import flash.display.*;
import mx.core.*;
public class DataCollection_mManIdleClass extends MovieClipAsset {
public var body1:DisplayObject;
}
}//package com.mazestopper
Section 42
//DataCollection_mManSideClass (com.mazestopper.DataCollection_mManSideClass)
package com.mazestopper {
import flash.display.*;
import mx.core.*;
public class DataCollection_mManSideClass extends MovieClipAsset {
public var body1:DisplayObject;
}
}//package com.mazestopper
Section 43
//DataCollection_mManUpClass (com.mazestopper.DataCollection_mManUpClass)
package com.mazestopper {
import flash.display.*;
import mx.core.*;
public class DataCollection_mManUpClass extends MovieClipAsset {
public var body1:DisplayObject;
}
}//package com.mazestopper
Section 44
//DataCollection_mMousePointerClass (com.mazestopper.DataCollection_mMousePointerClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mMousePointerClass extends BitmapAsset {
}
}//package com.mazestopper
Section 45
//DataCollection_mPanelBox2Class (com.mazestopper.DataCollection_mPanelBox2Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mPanelBox2Class extends BitmapAsset {
}
}//package com.mazestopper
Section 46
//DataCollection_mPanelBoxClass (com.mazestopper.DataCollection_mPanelBoxClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mPanelBoxClass extends BitmapAsset {
}
}//package com.mazestopper
Section 47
//DataCollection_mSfxMenuClass (com.mazestopper.DataCollection_mSfxMenuClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mSfxMenuClass extends SoundAsset {
}
}//package com.mazestopper
Section 48
//DataCollection_mSidePanelClass (com.mazestopper.DataCollection_mSidePanelClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mSidePanelClass extends BitmapAsset {
}
}//package com.mazestopper
Section 49
//DataCollection_mStarMidClass (com.mazestopper.DataCollection_mStarMidClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mStarMidClass extends BitmapAsset {
}
}//package com.mazestopper
Section 50
//DataCollection_mStarOffClass (com.mazestopper.DataCollection_mStarOffClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mStarOffClass extends BitmapAsset {
}
}//package com.mazestopper
Section 51
//DataCollection_mStarOnClass (com.mazestopper.DataCollection_mStarOnClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mStarOnClass extends BitmapAsset {
}
}//package com.mazestopper
Section 52
//DataCollection_mTargetClass (com.mazestopper.DataCollection_mTargetClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mTargetClass extends BitmapAsset {
}
}//package com.mazestopper
Section 53
//DataCollection_mWall2Class (com.mazestopper.DataCollection_mWall2Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWall2Class extends BitmapAsset {
}
}//package com.mazestopper
Section 54
//DataCollection_mWall3Class (com.mazestopper.DataCollection_mWall3Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWall3Class extends BitmapAsset {
}
}//package com.mazestopper
Section 55
//DataCollection_mWall4Class (com.mazestopper.DataCollection_mWall4Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWall4Class extends BitmapAsset {
}
}//package com.mazestopper
Section 56
//DataCollection_mWall5Class (com.mazestopper.DataCollection_mWall5Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWall5Class extends BitmapAsset {
}
}//package com.mazestopper
Section 57
//DataCollection_mWall6Class (com.mazestopper.DataCollection_mWall6Class)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWall6Class extends BitmapAsset {
}
}//package com.mazestopper
Section 58
//DataCollection_mWallClass (com.mazestopper.DataCollection_mWallClass)
package com.mazestopper {
import mx.core.*;
public class DataCollection_mWallClass extends BitmapAsset {
}
}//package com.mazestopper
Section 59
//Enemy (com.mazestopper.Enemy)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
public class Enemy extends Sprite {
private var mStartX:int;
private var mStartY:int;
private var mFrame:int;
private var mFinishTime:int;
private var mMyDir:int;
private var mSpeed:int;
private var mFrameTime:int;
private var mId:int;
private var mUseMC:MovieClip;
private var mFootFrame:int;
private static const DIR_IDLE:int = 5;
private static const KEY_CNT:int = 4;
private static const DIR_RIGHT:int = 3;
private static const DIR_UP:int = 0;
private static const OFFSET_X:Number = 10;
private static const DIR_DOWN:int = 1;
private static const DIR_LEFT:int = 2;
private static const OFFSET_Y:Number = 15;
public function Enemy(_arg1:int){
mId = _arg1;
mUseMC = DataCollection.mEnemyIdle[mId];
mUseMC.gotoAndStop(1);
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function speedUp():void{
if (mSpeed < Settings.ENEMY_SPEED){
mSpeed = Settings.ENEMY_SPEED;
} else {
if (mSpeed == Settings.ENEMY_SPEED){
mSpeed = Settings.ENEMY_SPEED_FAST;
};
};
}
public function slowDown():void{
if (mSpeed > Settings.ENEMY_SPEED){
mSpeed = Settings.ENEMY_SPEED;
} else {
if (mSpeed == Settings.ENEMY_SPEED){
mSpeed = Settings.ENEMY_SPEED_SLOW;
};
};
}
public function onFrame(_arg1:Event):void{
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
if (((GameState.mTimeFrozen) || (!((GameState.mState == GameState.STATE_GAME))))){
return;
};
mFootFrame++;
if (GameState.mMaze.hasReachedExit(x, y)){
GameState.setFinish(mId);
};
var _local2:Number = 0;
var _local3:Number = 0;
var _local4 = -1;
var _local5:Path = GameState.mMaze.findPathToFinish(x, y);
if (_local5){
if (_local5.mNextY > y){
_local3 = 1;
_local4 = DIR_DOWN;
};
if (_local5.mNextY < y){
_local3 = -1;
_local4 = DIR_UP;
};
if (_local5.mNextX > x){
_local2 = 1;
_local4 = DIR_RIGHT;
};
if (_local5.mNextX < x){
_local2 = -1;
_local4 = DIR_LEFT;
};
};
if (_local4 == -1){
if (mMyDir != DIR_IDLE){
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
return;
};
mFrameTime++;
if (mFrameTime > 1){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
return;
};
var _local6:Number = (x + (mSpeed * _local2));
var _local7:Number = (x + _local2);
if (Math.abs((_local5.mNextX - x)) <= mSpeed){
_local6 = _local5.mNextX;
};
var _local8:Number = (y + (mSpeed * _local3));
var _local9:Number = (y + _local3);
if (Math.abs((_local5.mNextY - y)) <= mSpeed){
_local8 = _local5.mNextY;
};
if (((!((_local2 == 0))) && (!((_local3 == 0))))){
_local2 = (_local2 / Math.SQRT2);
_local3 = (_local3 / Math.SQRT2);
};
var _local10:Number = (x + (mSpeed * _local2));
if (Math.abs((_local5.mNextX - x)) <= (mSpeed * Math.abs(_local2))){
_local10 = _local5.mNextX;
};
var _local11:Number = (y + (mSpeed * _local3));
if (Math.abs((_local5.mNextY - y)) <= (mSpeed * Math.abs(_local3))){
_local11 = _local5.mNextY;
};
var _local12:Boolean;
_local12 = GameState.mMaze.canMoveTo(_local10, _local11);
if (!_local12){
_local12 = GameState.mMaze.canMoveTo(x, _local8);
if (_local12){
_local10 = x;
_local11 = _local8;
if (_local3 < 0){
_local4 = DIR_UP;
};
if (_local3 > 0){
_local4 = DIR_DOWN;
};
};
};
if (!_local12){
_local12 = GameState.mMaze.canMoveTo(_local6, y);
if (_local12){
_local11 = y;
_local10 = _local6;
if (_local2 < 0){
_local4 = DIR_LEFT;
};
if (_local2 > 0){
_local4 = DIR_RIGHT;
};
};
};
if (!_local12){
_local12 = GameState.mMaze.canMoveTo(_local7, y);
if (_local12){
_local11 = y;
_local10 = _local7;
if (_local2 < 0){
_local4 = DIR_LEFT;
};
if (_local2 > 0){
_local4 = DIR_RIGHT;
};
};
};
if (!_local12){
_local12 = GameState.mMaze.canMoveTo(x, _local9);
if (_local12){
_local10 = x;
_local11 = _local9;
if (_local3 < 0){
_local4 = DIR_UP;
};
if (_local3 > 0){
_local4 = DIR_DOWN;
};
};
};
if (((!(_local12)) || ((((x == _local10)) && ((y == _local11)))))){
if (DIR_IDLE != mMyDir){
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
} else {
mFrameTime++;
if (mFrameTime > 1){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
};
return;
};
x = _local10;
y = _local11;
if (_local4 != mMyDir){
mMyDir = _local4;
mFrame = 0;
mFrameTime = 0;
setGraphics();
} else {
mFrameTime++;
if (mFrameTime > 0){
mFrame++;
if (mFrame == mUseMC.framesLoaded){
mFrame = 0;
};
mFrameTime = 0;
setGraphics();
};
};
}
public function get id():int{
return (mId);
}
public function setGraphics():void{
switch (mMyDir){
case DIR_DOWN:
removeChild(mUseMC);
mUseMC = DataCollection.mEnemyDown[mId];
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_UP:
removeChild(mUseMC);
mUseMC = DataCollection.mEnemyUp[mId];
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_LEFT:
removeChild(mUseMC);
mUseMC = DataCollection.mEnemySide[mId];
mUseMC.scaleX = -1;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_RIGHT:
removeChild(mUseMC);
mUseMC = DataCollection.mEnemySide[mId];
mUseMC.scaleX = 1;
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
case DIR_IDLE:
removeChild(mUseMC);
mUseMC = DataCollection.mEnemyIdle[mId];
mUseMC.x = OFFSET_X;
mUseMC.y = OFFSET_Y;
addChild(mUseMC);
mUseMC.gotoAndStop((mFrame + 1));
break;
};
}
public function setStartPosition(_arg1:int, _arg2:int):void{
mStartX = _arg1;
mStartY = _arg2;
x = _arg1;
y = _arg2;
mMyDir = DIR_IDLE;
mFrame = 0;
mFrameTime = 0;
setGraphics();
mSpeed = Settings.ENEMY_SPEED;
mFootFrame = 0;
mFinishTime = 0;
}
}
}//package com.mazestopper
Section 60
//GameLogo (com.mazestopper.GameLogo)
package com.mazestopper {
import flash.display.*;
public class GameLogo extends MovieClip {
}
}//package com.mazestopper
Section 61
//GameOverWindow (com.mazestopper.GameOverWindow)
package com.mazestopper {
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class GameOverWindow extends Window {
private var mLoadingText:QuickText;
private var mScoreSubmitted:Boolean;
private var mButton:Array;
private static const BUTTON_COUNT:int = 4;
private static const COL1_X:int = 30;
private static const COL2_X:int = 190;
private static const BUTTON_Y:int = 100;
private static const WINDOW_HEIGHT:int = 230;
private static const WINDOW_WIDTH:int = 300;
private static const BUTTON_TEXT:Array = ["Next Level", "Submit Level Time", "Restart Level", "Quit to main menu"];
public function GameOverWindow(){
super("Level complete", WINDOW_WIDTH, WINDOW_HEIGHT);
mScoreSubmitted = false;
}
public function removeListeners():void{
var _local1:int;
while (_local1 < mButton.length) {
if (mButton[_local1]){
mButton[_local1].removeEventListener(MouseEvent.CLICK, onClick);
};
_local1++;
};
}
override public function draw():void{
var _local1:QuickText;
var _local5:StarRank;
super.draw();
_local1 = new QuickText(24, TextFormatAlign.LEFT, 0xEFEF00);
_local1.x = COL1_X;
_local1.y = 40;
_local1.width = WINDOW_WIDTH;
_local1.setText("Your time:");
addChild(_local1);
_local1 = new QuickText(24, TextFormatAlign.LEFT, 0xEFEF00);
_local1.x = COL2_X;
_local1.y = 40;
_local1.width = WINDOW_WIDTH;
_local1.setText((((("" + Math.floor((GameState.mScore / 10))) + ".") + (GameState.mScore % 10)) + "s"));
addChild(_local1);
var _local2:int = LevelData.getRank(GameState.mScore);
var _local3:QuickText = new QuickText(24, TextFormatAlign.LEFT, 0xEFEF00);
_local3.x = COL1_X;
_local3.width = (WINDOW_WIDTH - 50);
_local3.y = 70;
_local3.setText("Your rank:");
addChild(_local3);
if (_local2 == 0){
_local3 = new QuickText(24, TextFormatAlign.LEFT, 0xEF0000);
_local3.x = COL2_X;
_local3.width = 100;
_local3.y = 70;
_local3.setText("Failed");
addChild(_local3);
} else {
_local5 = new StarRank(_local2);
_local5.x = COL2_X;
_local5.y = 83;
addChild(_local5);
};
mButton = new Array(BUTTON_COUNT);
var _local4:int;
while (_local4 < BUTTON_COUNT) {
if ((((_local2 > 0)) || ((_local4 >= 2)))){
mButton[_local4] = new Button(BUTTON_TEXT[_local4]);
mButton[_local4].y = (BUTTON_Y + (_local4 * 28));
mButton[_local4].x = ((WINDOW_WIDTH - mButton[_local4].width) / 2);
mButton[_local4].addEventListener(MouseEvent.CLICK, onClick);
addChild(mButton[_local4]);
};
_local4++;
};
}
public function reActivateDialog():void{
var _local1:int;
while (_local1 < mButton.length) {
if (mButton[_local1]){
mButton[_local1].mouseEnabled = true;
};
_local1++;
};
}
public function onClick(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
var _local2:int;
var _local3:int;
while (_local3 < mButton.length) {
if (_arg1.target == mButton[_local3]){
_local2 = _local3;
};
_local3++;
};
switch (_local2){
case 0:
GameState.mLevel++;
if (GameState.mLevel >= 3){
GameState.mLevel = 0;
};
GameProcess.restart(true);
break;
case 1:
parent.addChild(new ScoreSubmitDialog(this));
_local3 = 0;
while (_local3 < mButton.length) {
if (mButton[_local3]){
mButton[_local3].mouseEnabled = false;
};
_local3++;
};
return;
case 2:
GameProcess.restart(false);
break;
case 3:
GameProcess.destroy();
GameState.init();
break;
};
removeListeners();
parent.removeChild(this);
}
public function setScoreSubmitted():void{
var _local1:QuickText;
if (!mScoreSubmitted){
mScoreSubmitted = true;
removeChild(mButton[1]);
mButton[1].removeEventListener(MouseEvent.CLICK, onClick);
_local1 = new QuickText(24, TextFormatAlign.CENTER, 0xFFFFFF);
_local1.x = 0;
_local1.width = WINDOW_WIDTH;
_local1.y = mButton[1].y;
_local1.setText("Time submitted");
mButton[1] = null;
addChild(_local1);
};
}
}
}//package com.mazestopper
Section 62
//GameProcess (com.mazestopper.GameProcess)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.mazestopper.helpanimation.*;
import flash.ui.*;
public class GameProcess extends Sprite {
private static var mSingleton:GameProcess = null;
public function GameProcess(){
mSingleton = this;
GameState.mMaze = new Maze();
addChild(GameState.mMaze);
addEventListener(Event.ENTER_FRAME, onFrame);
GameState.root.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
addChild(new HUD());
GameState.mEnemy = new Array(1);
}
public function onKeyDown(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.SPACE)) && ((((GameState.mState == GameState.STATE_GAME)) || ((GameState.mState == GameState.STATE_GAME_TIMER)))))){
GameState.mTimeFrozen = !(GameState.mTimeFrozen);
if (!GameState.mTimeFrozen){
GameState.mMaze.clearRemoveMarks();
};
};
if ((((String.fromCharCode(_arg1.charCode).toLowerCase() == "i")) && ((GameState.mState == GameState.STATE_GAME)))){
showInstructions();
};
if ((((String.fromCharCode(_arg1.charCode).toLowerCase() == "p")) && ((GameState.mState == GameState.STATE_GAME)))){
pauseGame();
};
}
public function onFrame(_arg1:Event):void{
if (!(GameState.root.stage.focus is TextField)){
GameState.root.stage.focus = GameState.root.stage;
};
if ((((((GameState.mState == GameState.STATE_GAME)) && (!(GameState.mTimeFrozen)))) && (!(GameState.mFinished)))){
GameState.mTime++;
};
}
public static function pauseGame():void{
GameState.mTimeFrozen = true;
GameState.mState = GameState.STATE_PAUSE_MENU;
mSingleton.addChild(new PauseMenu());
}
public static function showInstructions():void{
GameState.mTimeFrozen = true;
GameState.mState = GameState.STATE_PAUSE_MENU;
mSingleton.addChild(new Instructions(Instructions.CALL_GAME));
}
public static function destroy():void{
GameState.root.removeChild(mSingleton);
}
public static function create():void{
if (mSingleton == null){
mSingleton = new (GameProcess);
};
GameState.root.addChild(mSingleton);
restart();
}
public static function restart(_arg1:Boolean=true, _arg2:Boolean=true, _arg3:Boolean=true):void{
GameState.mMaze.clearDrawing();
if (_arg2){
GameState.mMaze.loadLevel();
};
GameState.mFinished = false;
GameState.mScore = 0;
GameState.mTimeFrozen = true;
GameState.mTime = 0;
if (((_arg1) && (!(UserSettings.mTutorialShown)))){
UserSettings.mTutorialShown = true;
UserSettings.save();
GameState.mState = GameState.STATE_PAUSE_MENU;
GameState.root.addChild(new Instructions(Instructions.CALL_LEVEL_START));
return;
};
if (_arg3){
GameState.mState = GameState.STATE_PAUSE_MENU;
GameState.root.addChild(new LevelObjective());
return;
};
GameState.mState = GameState.STATE_GAME;
}
}
}//package com.mazestopper
Section 63
//GameState (com.mazestopper.GameState)
package com.mazestopper {
import flash.display.*;
public class GameState {
public static const STATE_GAME:int = 0;
public static const STATE_MAIN_MENU:int = 3;
public static const STATE_LEVEL_OVER:int = 2;
public static const STATE_GAME_TIMER:int = 1;
public static const STATE_PAUSE_MENU:int = 3;
public static var mEnemyCnt:int;
public static var mMaze:Maze;
public static var mTime:uint;
public static var mEnemy:Array;
public static var mLevel:int;
public static var mTimeFrozen:Boolean;
public static var mState:int;
public static var mScore:int;
public static var root:Sprite;
public static var mFinished:Boolean;
public static function init():void{
mState = STATE_MAIN_MENU;
mLevel = 0;
mScore = 0;
mTimeFrozen = false;
mTime = 0;
mFinished = false;
MainMenu.create();
}
public static function setFinish(_arg1:int):void{
mFinished = true;
}
}
}//package com.mazestopper
Section 64
//HelpSign (com.mazestopper.HelpSign)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class HelpSign extends Sprite {
private var mId:int;
private var mHeight:int;
private var mWidth:int;
private static const SIGN_WIDTH:Array = [114, 114, 114, 114, 155, 150, 174, 135, 135, 174, 115, 125, 145];
private static const FG_COLOR:uint = 0xBF8F00;
private static const BG_COLOR:uint = 0;
private static const SIGN_OFFSET_X:Array = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 6];
private static const SIGN_OFFSET_Y:Array = [2, 2, 2, 2, 6, 8, 6, 8, 8, 2, 2, 2, 8];
private static const SIGN_HEIGHT:Array = [48, 76, 76, 48, 68, 64, 34, 64, 64, 48, 76, 48, 94];
private static const FONT_COLOR:uint = 0x3F1F00;
public function HelpSign(_arg1:int, _arg2:int, _arg3:int){
mId = _arg1;
mWidth = SIGN_WIDTH[mId];
mHeight = SIGN_HEIGHT[mId];
x = (_arg2 + SIGN_OFFSET_X[mId]);
y = (_arg3 + SIGN_OFFSET_Y[mId]);
draw();
mouseEnabled = false;
}
public function drawSign3():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 2;
_local1.y = 0;
_local1.width = (mWidth - 4);
_local1.wordWrap = true;
_local1.setText("Keep the man away from the flag for as long as you can!");
addChild(_local1);
}
public function drawSign12():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("In this level you don't control your mage. Instead you have to keep away your opponents from the flag for at least 20 seconds.");
addChild(_local1);
}
public function drawSign11():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 2;
_local1.y = 0;
_local1.width = (mWidth - 4);
_local1.wordWrap = true;
_local1.setText("Press to activate/deactivate autopilot.");
addChild(_local1);
var _local2:VisualButton = new VisualButton("C");
_local2.scaleX = 0.5;
_local2.scaleY = 0.5;
_local2.x = 44;
_local2.y = 3;
addChild(_local2);
}
public function draw():void{
graphics.lineStyle(1, BG_COLOR, 0.9);
graphics.beginFill(FG_COLOR, 0.9);
graphics.drawRoundRect(0, 0, mWidth, mHeight, 15, 15);
graphics.lineStyle(1, BG_COLOR, 0.9);
graphics.drawRect(5, mHeight, 4, 8);
graphics.drawRect(((mWidth - 5) - 4), mHeight, 4, 8);
switch (mId){
case 0:
drawSign0();
break;
case 1:
drawSign1();
break;
case 2:
drawSign2();
break;
case 3:
drawSign3();
break;
case 4:
drawSign4();
break;
case 5:
drawSign5();
break;
case 6:
drawSign6();
break;
case 7:
drawSign7();
break;
case 8:
drawSign8();
break;
case 9:
drawSign9();
break;
case 10:
drawSign10();
break;
case 11:
drawSign11();
break;
case 12:
drawSign12();
break;
};
}
public function drawSign10():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("Now you have several opponents to compete with! Be the first to reach the flag to win.");
addChild(_local1);
}
public function drawSign0():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 2;
_local1.y = 0;
_local1.width = (mWidth - 4);
_local1.wordWrap = true;
_local1.setText("Click and hold left mouse button to create obstacles.");
addChild(_local1);
}
public function drawSign2():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 2;
_local1.y = 0;
_local1.width = (mWidth - 4);
_local1.wordWrap = true;
_local1.setText("Click the red X on top of the newly placed obstacle during time freeze to remove it.");
addChild(_local1);
}
public function drawSign6():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("If there is not enough mana, you can't place an obstacle.");
addChild(_local1);
}
public function drawSign7():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("Collect powerups, or force your opponent to collect some of them to help you win.");
addChild(_local1);
}
public function drawSign1():void{
var _local1:QuickText;
_local1 = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 2;
_local1.y = 0;
_local1.width = (mWidth - 4);
_local1.wordWrap = true;
_local1.setText("Press to freeze/unfreeze time. You can place obstacles while the time is frozen.");
addChild(_local1);
var _local2:VisualButton = new VisualButton("SPACE");
_local2.scaleX = 0.5;
_local2.scaleY = 0.5;
_local2.x = 44;
_local2.y = 3;
addChild(_local2);
}
public function drawSign9():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 24;
_local1.y = 0;
_local1.width = (mWidth - 28);
_local1.wordWrap = true;
_local1.setText("Adds 10 mana if you pick it up, subtracts 10 mana if your opponent picks it up.");
addChild(_local1);
}
public function drawSign4():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("Click the red X on top of the newly placed obstacle during time freeze to remove it.");
addChild(_local1);
}
public function drawSign5():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 4;
_local1.y = 0;
_local1.width = (mWidth - 8);
_local1.wordWrap = true;
_local1.setText("Notice your mana at the top right corner. You spend 1 mana for each obstacle placed.");
addChild(_local1);
}
public function drawSign8():void{
var _local1:QuickText = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 18;
_local1.y = 0;
_local1.width = (mWidth - 18);
_local1.wordWrap = true;
_local1.setText("Speeds up the player who picked it.");
addChild(_local1);
_local1 = new QuickText(12, TextFormatAlign.LEFT, FONT_COLOR);
_local1.x = 18;
_local1.y = 30;
_local1.width = (mWidth - 18);
_local1.wordWrap = true;
_local1.setText("Slows down the player who picked it.");
addChild(_local1);
}
}
}//package com.mazestopper
Section 65
//HUD (com.mazestopper.HUD)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
import flash.net.*;
public class HUD extends Sprite {
private var mInstructionsButton:Button;
private var mSavedTime:int;
private var mSavedLevel:int;
private var mMusicButton:Button;
private var mGameForSiteButton:Button;
private var mPauseButton:Button;
private var mMusicControl:SoundControl;
private var mTimeFreezeText:QuickText;
private var mStar:StarRank;
private var mSoundControl:SoundControl;
private var mLevelText:QuickText;
private var mSavedRank:int;
private var mTimeText:QuickText;
private var mQualityButton:Button;
private var mQualityControl:QualityControl;
private var mSoundButton:Button;
private var mFreezeButton:Button;
private var mSavedTimeFreeze:Boolean;
private static const BUTTONS_Y:int = (PANEL2_Y + 20);
private static const LEVEL_NAME:Array = ["Small", "Medium", "Large"];
private static const BUTTONS_SYSTEM_DY:int = 37;
private static const BUTTONS_SYSTEM_Y:int = (PANEL3_Y + 15);
private static const STATS_BOX_SIZE:int = 65;
private static const PANEL3_HEIGHT:int = 138;
private static const STATS_X:int = 10;
private static const STATS_Y:int = (PANEL1_Y + 15);
private static const STATS_X2:int = 85;
private static const STATS_DY:int = 20;
private static const PANEL1_HEIGHT:int = 120;
private static const BUTTONS_TEXT_X:int = 52;
private static const PANEL1_Y:int = 102;
private static const PANEL2_Y:int = (PANEL1_Y + PANEL1_HEIGHT);
private static const PANEL3_Y:int = (PANEL2_Y + PANEL2_HEIGHT);
private static const STATS_COL:int = 0xEEEE00;
private static const BUTTONS_DY:int = 30;
private static const STATS_FONT_SIZE:int = 12;
private static const BUTTONS_X:int = 15;
private static const PANEL2_HEIGHT:int = 120;
public function HUD(){
var _local1:QuickText;
super();
x = Settings.GAME_WIDTH;
y = 0;
var _local2:SidePanel = new SidePanel("FlashRelax", PANEL1_Y);
_local2.y = 0;
addChild(_local2);
_local2 = new SidePanel("Game Information", PANEL1_HEIGHT);
_local2.y = PANEL1_Y;
addChild(_local2);
_local2 = new SidePanel("Control Keys", PANEL2_HEIGHT);
_local2.y = PANEL2_Y;
addChild(_local2);
_local2 = new SidePanel("System", PANEL3_HEIGHT);
_local2.y = PANEL3_Y;
addChild(_local2);
_local1 = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
_local1.x = STATS_X;
_local1.y = STATS_Y;
_local1.setText("Level:");
addChild(_local1);
var _local3:PanelBox = new PanelBox(STATS_BOX_SIZE);
_local3.x = (STATS_X2 - 4);
_local3.y = (STATS_Y + 3);
addChild(_local3);
mLevelText = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
mLevelText.x = STATS_X2;
mLevelText.y = STATS_Y;
addChild(mLevelText);
_local1 = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
_local1.x = STATS_X;
_local1.y = (STATS_Y + STATS_DY);
_local1.setText("Time Freeze:");
addChild(_local1);
_local3 = new PanelBox(STATS_BOX_SIZE);
_local3.x = (STATS_X2 - 4);
_local3.y = ((STATS_Y + STATS_DY) + 3);
addChild(_local3);
mTimeFreezeText = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
mTimeFreezeText.x = STATS_X2;
mTimeFreezeText.y = (STATS_Y + STATS_DY);
mTimeFreezeText.width = 200;
addChild(mTimeFreezeText);
_local1 = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
_local1.x = STATS_X;
_local1.y = (STATS_Y + (2 * STATS_DY));
_local1.setText("Time:");
addChild(_local1);
_local3 = new PanelBox(STATS_BOX_SIZE);
_local3.x = (STATS_X2 - 4);
_local3.y = ((STATS_Y + (2 * STATS_DY)) + 3);
addChild(_local3);
mTimeText = new QuickText(STATS_FONT_SIZE, TextFormatAlign.LEFT, STATS_COL);
mTimeText.x = STATS_X2;
mTimeText.y = (STATS_Y + (2 * STATS_DY));
mTimeText.width = 100;
addChild(mTimeText);
_local1 = new QuickText(STATS_FONT_SIZE, TextFormatAlign.CENTER, STATS_COL);
_local1.x = 0;
_local1.y = (STATS_Y + (3 * STATS_DY));
_local1.width = 160;
_local1.setText("Current rank:");
addChild(_local1);
mSavedRank = 0;
mStar = new StarRank(0);
mStar.x = ((160 - mStar.width) / 2);
mStar.y = (STATS_Y + (4 * STATS_DY));
addChild(mStar);
var _local4:VisualButton = new VisualButton("SPACE");
_local4.scaleX = 0.6;
_local4.scaleY = 0.6;
_local4.x = (BUTTONS_X - 2);
_local4.y = (BUTTONS_Y + 4);
addChild(_local4);
mFreezeButton = new Button("Time freeze", 14);
mFreezeButton.x = BUTTONS_TEXT_X;
mFreezeButton.y = (BUTTONS_Y + 1);
mFreezeButton.addEventListener(MouseEvent.CLICK, onFreeze);
addChild(mFreezeButton);
_local4 = new VisualButton("P");
_local4.x = BUTTONS_X;
_local4.y = (BUTTONS_Y + BUTTONS_DY);
addChild(_local4);
mPauseButton = new Button("Pause Menu", 14);
mPauseButton.x = BUTTONS_TEXT_X;
mPauseButton.y = ((BUTTONS_Y + BUTTONS_DY) + 3);
mPauseButton.addEventListener(MouseEvent.CLICK, onPause);
addChild(mPauseButton);
_local4 = new VisualButton("I");
_local4.x = BUTTONS_X;
_local4.y = (BUTTONS_Y + (BUTTONS_DY * 2));
addChild(_local4);
mInstructionsButton = new Button("Instructions", 14);
mInstructionsButton.x = BUTTONS_TEXT_X;
mInstructionsButton.y = ((BUTTONS_Y + (BUTTONS_DY * 2)) + 3);
mInstructionsButton.addEventListener(MouseEvent.CLICK, onInstructions);
addChild(mInstructionsButton);
mQualityControl = new QualityControl();
mQualityControl.x = BUTTONS_X;
mQualityControl.y = BUTTONS_SYSTEM_Y;
addChild(mQualityControl);
mSoundControl = new SoundControl();
mSoundControl.x = BUTTONS_X;
mSoundControl.y = (BUTTONS_SYSTEM_Y + BUTTONS_SYSTEM_DY);
addChild(mSoundControl);
mMusicControl = new SoundControl(1);
mMusicControl.x = BUTTONS_X;
mMusicControl.y = (BUTTONS_SYSTEM_Y + (BUTTONS_SYSTEM_DY * 2));
addChild(mMusicControl);
_local1 = new QuickText(36, TextFormatAlign.CENTER, 0xFFFF00);
_local1.x = 0;
_local1.width = 160;
_local1.y = 8;
_local1.setText("Maze");
addChild(_local1);
_local1 = new QuickText(36, TextFormatAlign.CENTER, 0xFFFF00);
_local1.x = 0;
_local1.width = 160;
_local1.y = 34;
_local1.setText("Stopper");
addChild(_local1);
mGameForSiteButton = new Button("This game for your site", 12);
mGameForSiteButton.x = ((160 - mGameForSiteButton.width) / 2);
mGameForSiteButton.y = 77;
mGameForSiteButton.addEventListener(MouseEvent.CLICK, onGameForYourSite);
addChild(mGameForSiteButton);
addEventListener(Event.ENTER_FRAME, onFrame);
draw();
}
public function draw():void{
mSavedTimeFreeze = GameState.mTimeFrozen;
mSavedLevel = GameState.mLevel;
mSavedTime = Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS));
mLevelText.setText(LEVEL_NAME[GameState.mLevel]);
var _local1:int = Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS));
mTimeText.setText((((("" + Math.floor((_local1 / 10))) + ".") + (_local1 % 10)) + " sec"));
if (GameState.mTimeFrozen){
mTimeFreezeText.setText("On");
} else {
mTimeFreezeText.setText("Off");
};
var _local2:int = LevelData.getRank(_local1);
if (_local2 != mSavedRank){
mSavedRank = _local2;
mStar.setRank(_local2);
};
}
public function setButtonState(_arg1:Boolean):void{
if (mFreezeButton.mouseEnabled != _arg1){
mFreezeButton.mouseEnabled = _arg1;
mPauseButton.mouseEnabled = _arg1;
mInstructionsButton.mouseEnabled = _arg1;
};
}
public function onGameForYourSite(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
FlashRelaxAPI.openGameForYourSite();
}
public function onFreeze(_arg1:MouseEvent):void{
if ((((GameState.mState == GameState.STATE_GAME)) || ((GameState.mState == GameState.STATE_GAME_TIMER)))){
GameState.mTimeFrozen = !(GameState.mTimeFrozen);
if (!GameState.mTimeFrozen){
GameState.mMaze.clearRemoveMarks();
};
};
}
public function removeListeners():void{
mFreezeButton.removeEventListener(MouseEvent.CLICK, onFreeze);
mPauseButton.removeEventListener(MouseEvent.CLICK, onPause);
mInstructionsButton.removeEventListener(MouseEvent.CLICK, onInstructions);
mQualityButton.removeEventListener(MouseEvent.CLICK, onQuality);
removeEventListener(Event.ENTER_FRAME, onFrame);
}
public function onPause(_arg1:MouseEvent):void{
if (GameState.mState == GameState.STATE_GAME){
GameProcess.pauseGame();
};
}
public function onSound(_arg1:MouseEvent):void{
mSoundControl.changeState();
}
public function onQuality(_arg1:MouseEvent):void{
mQualityControl.changeQuality();
}
public function onLink(_arg1:TextEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
navigateToURL(new URLRequest("http://www.flashrelax.com"));
}
public function onInstructions(_arg1:MouseEvent):void{
if (GameState.mState == GameState.STATE_GAME){
GameProcess.showInstructions();
};
}
public function onFrame(_arg1:Event):void{
var _local2:int;
var _local3:int;
if (GameState.mState == GameState.STATE_GAME){
setButtonState(true);
} else {
setButtonState(false);
};
if (((!((GameState.mTimeFrozen == mSavedTimeFreeze))) || (!((GameState.mLevel == mSavedLevel))))){
draw();
};
if (Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS)) != mSavedTime){
mSavedTime = Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS));
_local2 = Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS));
mTimeText.setText((((("" + Math.floor((_local2 / 10))) + ".") + (_local2 % 10)) + " sec"));
_local3 = LevelData.getRank(_local2);
if (_local3 != mSavedRank){
mSavedRank = _local3;
mStar.setRank(_local3);
};
};
}
public function onMusic(_arg1:MouseEvent):void{
mMusicControl.changeState();
}
}
}//package com.mazestopper
Section 66
//LevelData (com.mazestopper.LevelData)
package com.mazestopper {
public class LevelData {
public static const levelArray:Array = [level0, level1, level2];
private static const level0:Array = ["XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXdYYYYYaYYYYYXXXXXX", "XXXXXXYYYYYYYYYYYYXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXX............XXXXXX", "XXXXXX............XXXXXX", "bYYYYY............cYYYYY", "YYYYYY1..........#YYYYYY", "YYYYYY............YYYYYY", "XXXXXX............XXXXXX", "XXXXXX............XXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX"];
private static const level1:Array = ["XXXXXXdYYYYYaYYYYYXXXXXX", "XXXXXXYYYYYYYYYYYYXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXX..................XXX", "XXX..................XXX", "XXX..................XXX", "XXX..................XXX", "XXX1................#XXX", "XXX..................XXX", "XXX..................XXX", "XXX..................XXX", "XXX..................XXX", "XXX..................XXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX"];
private static const level2:Array = ["........................", "........................", "........................", "........................", "........................", "........................", "........................", "........................", "1......................#", "........................", "........................", "........................", "........................", "........................", "........................", "........................"];
public static const levelTimeArray:Array = [[100, 150, 180, 210, 250], [200, 270, 340, 410, 600], [450, 600, 700, 1000, 1500]];
public static function getRank(_arg1:int):int{
var _local3:int;
var _local4:int;
var _local2:int;
while (_local2 < 5) {
if (_arg1 < levelTimeArray[GameState.mLevel][_local2]){
break;
};
_local2++;
};
if ((((_local2 < 5)) && (!((_local2 == 0))))){
_local3 = levelTimeArray[GameState.mLevel][(_local2 - 1)];
_local4 = levelTimeArray[GameState.mLevel][_local2];
_local2 = (_local2 * 2);
if ((_arg1 - _local3) > ((_local4 - _local3) / 2)){
_local2++;
};
return (_local2);
//unresolved jump
};
return ((_local2 * 2));
}
}
}//package com.mazestopper
Section 67
//LevelFinishObject (com.mazestopper.LevelFinishObject)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
public class LevelFinishObject extends Sprite {
private var mFrame:int;
private var mFlag:Bitmap;
private var mTime:int;
public function LevelFinishObject(){
mTime = 0;
mFrame = 0;
var _local1:Bitmap = new Bitmap(DataCollection.mFlagStick);
addChild(_local1);
mFlag = new Bitmap(DataCollection.mFlag[mFrame]);
mFlag.x = 0;
mFlag.y = 2;
addChild(mFlag);
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function onFrame(_arg1:Event):void{
if (root == null){
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
mTime++;
if (mTime >= 3){
mTime = 0;
mFrame++;
if (mFrame >= DataCollection.mFlag.length){
mFrame = 0;
};
mFlag.bitmapData = DataCollection.mFlag[mFrame];
};
}
}
}//package com.mazestopper
Section 68
//LevelObjective (com.mazestopper.LevelObjective)
package com.mazestopper {
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class LevelObjective extends Window {
private var mButton1:Button;
private static const TEXT_Y:int = 40;
private static const COL2_SIZE:int = 100;
private static const COL1_SIZE:int = 140;
private static const TEXT_COLOR:int = 0xDFDF00;
private static const TEXT_SIZE:int = 16;
private static const WINDOW_HEIGHT:int = 270;
private static const WINDOW_WIDTH:int = 300;
private static const TEXT_DY:int = 30;
public function LevelObjective(){
super("Level Objective", WINDOW_WIDTH, WINDOW_HEIGHT);
mButton1 = new Button("Continue");
mButton1.y = (WINDOW_HEIGHT - 30);
mButton1.x = ((WINDOW_WIDTH - mButton1.width) / 2);
mButton1.addEventListener(MouseEvent.CLICK, onResume);
addChild(mButton1);
}
public function onResume(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
parent.removeChild(this);
mButton1.removeEventListener(MouseEvent.CLICK, onResume);
GameProcess.restart(false, false, false);
}
override public function draw():void{
var _local4:QuickText;
var _local6:int;
var _local7:String;
var _local8:String;
var _local9:StarRank;
super.draw();
var _local1:int = (COL1_SIZE + COL2_SIZE);
var _local2:int = (((WINDOW_WIDTH - _local1) / 2) - 10);
var _local3:int = (_local2 + COL1_SIZE);
_local4 = new QuickText(TEXT_SIZE, TextFormatAlign.CENTER, TEXT_COLOR);
_local4.x = _local2;
_local4.width = COL1_SIZE;
_local4.y = TEXT_Y;
_local4.height = TEXT_DY;
_local4.setText("Time");
addChild(_local4);
_local4 = new QuickText(TEXT_SIZE, TextFormatAlign.CENTER, TEXT_COLOR);
_local4.x = _local3;
_local4.width = COL2_SIZE;
_local4.y = TEXT_Y;
_local4.height = TEXT_DY;
_local4.setText("Rank");
addChild(_local4);
var _local5:int;
while (_local5 <= 5) {
_local4 = new QuickText(TEXT_SIZE, TextFormatAlign.CENTER, TEXT_COLOR);
_local4.x = _local2;
_local4.width = COL1_SIZE;
_local4.y = (TEXT_Y + (TEXT_DY * (_local5 + 1)));
_local4.height = TEXT_DY;
if (_local5 == 0){
_local6 = LevelData.levelTimeArray[GameState.mLevel][0];
} else {
_local6 = LevelData.levelTimeArray[GameState.mLevel][(_local5 - 1)];
};
_local7 = "";
_local8 = "";
if (_local5 == 0){
_local7 = "less than ";
};
if (_local5 == 5){
_local8 = " or more";
};
_local4.setText((((((_local7 + Math.floor((_local6 / 10))) + ".") + (_local6 % 10)) + " sec") + _local8));
addChild(_local4);
if (_local5 == 0){
_local4 = new QuickText(TEXT_SIZE, TextFormatAlign.LEFT, 0xEF0000);
_local4.x = (_local3 + 90);
_local4.width = 100;
_local4.y = ((TEXT_Y + (TEXT_DY * (_local5 + 1))) + 1);
_local4.height = TEXT_DY;
_local4.setText("(Fail)");
addChild(_local4);
};
_local9 = new StarRank((_local5 * 2));
_local9.x = (_local3 + 10);
_local9.y = ((TEXT_Y + (TEXT_DY * (_local5 + 1))) + 7);
addChild(_local9);
_local5++;
};
}
}
}//package com.mazestopper
Section 69
//LevelSelectMenu (com.mazestopper.LevelSelectMenu)
package com.mazestopper {
import flash.events.*;
import com.flashrelax.utils.*;
public class LevelSelectMenu extends Window {
private var mHighscore:Boolean;
private var mMainMenu:MainMenu;
private var mButton:Array;
private static const WINDOW_NAME:Array = ["Select Level", "View Level Highscore"];
private static const BUTTON_COUNT:int = 4;
private static const BUTTON_Y:int = 40;
private static const WINDOW_HEIGHT:int = 180;
private static const WINDOW_WIDTH:int = 300;
private static const BUTTON_TEXT:Array = ["Small", "Medium", "Large", "Back"];
public function LevelSelectMenu(_arg1:MainMenu, _arg2:Boolean=false){
super(WINDOW_NAME[int(_arg2)], WINDOW_WIDTH, WINDOW_HEIGHT);
mHighscore = _arg2;
x = (x + 60);
mMainMenu = _arg1;
}
override public function draw():void{
super.draw();
mButton = new Array(BUTTON_COUNT);
var _local1:int = BUTTON_Y;
var _local2:int;
while (_local2 < BUTTON_COUNT) {
mButton[_local2] = new Button(BUTTON_TEXT[_local2]);
mButton[_local2].y = _local1;
mButton[_local2].x = ((WINDOW_WIDTH - mButton[_local2].width) / 2);
mButton[_local2].addEventListener(MouseEvent.CLICK, onClick);
addChild(mButton[_local2]);
_local1 = (_local1 + 28);
if (_local2 == 2){
_local1 = (_local1 + 18);
};
_local2++;
};
}
public function onClick(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
var _local2:int;
var _local3:int;
while (_local3 < mButton.length) {
if (_arg1.target == mButton[_local3]){
_local2 = _local3;
};
_local3++;
};
switch (_local2){
case 0:
case 1:
case 2:
if (mHighscore){
FlashRelaxAPI.openHighScores((_local2 + 1));
return;
};
GameState.mLevel = _local2;
mMainMenu.startGame();
break;
case 3:
mMainMenu.setButtons(true);
break;
};
removeListeners();
parent.removeChild(this);
}
public function removeListeners():void{
var _local1:int;
while (_local1 < mButton.length) {
if (mButton[_local1]){
mButton[_local1].removeEventListener(MouseEvent.CLICK, onClick);
};
_local1++;
};
}
}
}//package com.mazestopper
Section 70
//MainMenu (com.mazestopper.MainMenu)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
import com.mazestopper.helpanimation.*;
public class MainMenu extends Sprite {
protected var mInstructionsButton:Button;
protected var mStartButton:Button;
protected var mMoreGamesButton:Button;
protected var mHighScoreButton:Button;
protected var mGameForYourSiteButton:Button;
private static const BUTTON_DY:int = 40;
private static const BUTTON_Y:int = 180;
private static const BUTTON_START_DY:int = 70;
private static var mSingleton:MainMenu = null;
public function MainMenu(){
x = 0;
y = 0;
addChild(new TiledBackground());
mStartButton = new Button("Start Game", 60);
mStartButton.x = ((640 - mStartButton.width) / 2);
mStartButton.y = BUTTON_Y;
mStartButton.addEventListener(MouseEvent.CLICK, onStartGame);
addChild(mStartButton);
mInstructionsButton = new Button("Instructions", 40);
mInstructionsButton.x = ((640 - mInstructionsButton.width) / 2);
mInstructionsButton.y = (BUTTON_Y + BUTTON_START_DY);
mInstructionsButton.addEventListener(MouseEvent.CLICK, onInstructions);
addChild(mInstructionsButton);
mHighScoreButton = new Button("High scores", 40);
mHighScoreButton.x = ((640 - mHighScoreButton.width) / 2);
mHighScoreButton.y = ((BUTTON_Y + BUTTON_START_DY) + BUTTON_DY);
mHighScoreButton.addEventListener(MouseEvent.CLICK, onHighScore);
addChild(mHighScoreButton);
mMoreGamesButton = new Button("More Games", 40);
mMoreGamesButton.x = ((640 - mMoreGamesButton.width) / 2);
mMoreGamesButton.y = ((BUTTON_Y + BUTTON_START_DY) + (BUTTON_DY * 2));
mMoreGamesButton.addEventListener(MouseEvent.CLICK, onMoreGames);
addChild(mMoreGamesButton);
mGameForYourSiteButton = new Button("Add this game to your website", 20);
mGameForYourSiteButton.x = ((640 - mGameForYourSiteButton.width) / 2);
mGameForYourSiteButton.y = ((480 - mGameForYourSiteButton.height) - 15);
mGameForYourSiteButton.addEventListener(MouseEvent.CLICK, onGameForYourSite);
addChild(mGameForYourSiteButton);
var _local1:QualityControl = new QualityControl();
_local1.x = 520;
_local1.y = 350;
addChild(_local1);
var _local2:SoundControl = new SoundControl();
_local2.x = 520;
_local2.y = 390;
addChild(_local2);
_local2 = new SoundControl(1);
_local2.x = 520;
_local2.y = 430;
addChild(_local2);
var _local3:QuickText = new QuickText(12, TextFormatAlign.CENTER, 15724543);
_local3.setText("(c) 2008 Flash Relax");
_local3.x = 0;
_local3.width = 640;
_local3.y = 462;
addChild(_local3);
var _local4:GameLogo = new GameLogo();
_local4.scaleX = 1.5;
_local4.scaleY = 1.5;
_local4.x = ((640 - _local4.width) / 2);
_local4.y = 40;
addChild(_local4);
}
public function onInstructions(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
var _local2:Instructions = new Instructions(Instructions.CALL_MAIN_MENU);
_local2.x = ((640 - _local2.width) / 2);
GameState.root.addChild(_local2);
}
public function onMoreGames(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
FlashRelaxAPI.openMoreGames();
}
public function onGameForYourSite(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
FlashRelaxAPI.openGameForYourSite();
}
public function startGame():void{
removeListeners();
destroy();
GameProcess.create();
}
public function onHighScore(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
setButtons(false);
addChild(new LevelSelectMenu(this, true));
}
public function removeListeners():void{
mStartButton.removeEventListener(MouseEvent.CLICK, onStartGame);
mInstructionsButton.removeEventListener(MouseEvent.CLICK, onInstructions);
mHighScoreButton.removeEventListener(MouseEvent.CLICK, onHighScore);
mMoreGamesButton.removeEventListener(MouseEvent.CLICK, onMoreGames);
mGameForYourSiteButton.removeEventListener(MouseEvent.CLICK, onGameForYourSite);
}
public function onStartGame(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
setButtons(false);
addChild(new LevelSelectMenu(this));
}
public function setButtons(_arg1:Boolean):void{
mStartButton.mouseEnabled = _arg1;
mInstructionsButton.mouseEnabled = _arg1;
mMoreGamesButton.mouseEnabled = _arg1;
mHighScoreButton.mouseEnabled = _arg1;
}
public static function destroy():void{
GameState.root.removeChild(mSingleton);
mSingleton = null;
}
public static function create():void{
if (mSingleton != null){
destroy();
};
mSingleton = new (MainMenu);
GameState.root.addChild(mSingleton);
}
}
}//package com.mazestopper
Section 71
//Maze (com.mazestopper.Maze)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import com.mazestopper.helpanimation.*;
public class Maze extends Sprite {
private var mFinishObject:LevelFinishObject;
private var mAttachedType:int;
private var mMaze:Array;
private var mMoves:Array;
private var mAttachedObstacle:MouseHighlight;
private var mDrawing:Boolean;
private var mFinishX:int;
private var mFinishY:int;
private var mWalls:Sprite;
public function Maze(){
mDrawing = false;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
addEventListener(Event.ENTER_FRAME, onFrame);
mAttachedType = 0;
mAttachedObstacle = new MouseHighlight();
}
public function onMouseUp(_arg1:MouseEvent):void{
onMouseMove(_arg1);
mDrawing = false;
}
public function onMouseDown(_arg1:MouseEvent):void{
mDrawing = true;
onMouseMove(_arg1);
}
public function checkCell(_arg1:Number, _arg2:Number):Boolean{
_arg1 = (_arg1 - Settings.MAZE_OFFSET_X);
_arg2 = (_arg2 - Settings.MAZE_OFFSET_Y);
if ((((_arg1 < 0)) || ((_arg2 < 0)))){
return (false);
};
var _local3:int = Math.floor((_arg1 / Settings.TILE_WIDTH));
var _local4:int = Math.floor((_arg2 / Settings.TILE_HEIGHT));
if ((((_local3 >= Settings.MAZE_WIDTH)) || ((_local4 >= Settings.MAZE_HEIGHT)))){
return (false);
};
if ((((((mMaze[_local4].charAt(_local3) == "X")) || ((mMaze[_local4].charAt(_local3) == "Y")))) || ((mMaze[_local4].charAt(_local3) == "T")))){
return (false);
};
return (true);
}
public function loadLevel(_arg1:int=-1):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Bitmap;
var _local9:int;
var _local10:int;
var _local11:HelpSign;
var _local12:String;
if (_arg1 == -1){
_arg1 = GameState.mLevel;
};
var _local2:int = (numChildren - 1);
while (_local2 >= 0) {
removeChildAt(_local2);
_local2--;
};
addChild(new TiledBackground(true));
mWalls = new Sprite();
addChild(mWalls);
mMaze = new Array(Settings.MAZE_HEIGHT);
_local2 = 0;
while (_local2 < Settings.MAZE_HEIGHT) {
mMaze[_local2] = ("" + LevelData.levelArray[_arg1][_local2]);
_local2++;
};
GameState.mEnemyCnt = 0;
_local2 = 0;
while (_local2 < GameState.mEnemy.length) {
GameState.mEnemy[_local2] = null;
_local2++;
};
var _local3:Sprite = new Sprite();
_local4 = 0;
while (_local4 < Settings.MAZE_HEIGHT) {
_local5 = 0;
while (_local5 < Settings.MAZE_WIDTH) {
_local6 = (Settings.MAZE_OFFSET_X + (Settings.TILE_WIDTH * _local5));
_local7 = (Settings.MAZE_OFFSET_Y + (Settings.TILE_HEIGHT * _local4));
switch (mMaze[_local4].charAt(_local5)){
case "Y":
break;
case "X":
_local9 = Math.floor((Math.random() * 5));
_local8 = new Bitmap(DataCollection.mWall[_local9]);
_local8.x = _local6;
_local8.y = _local7;
mWalls.addChild(_local8);
break;
case "T":
_local8 = new Bitmap(DataCollection.mWall[5]);
_local8.x = _local6;
_local8.y = _local7;
mWalls.addChild(_local8);
break;
case "1":
case "2":
case "3":
case "4":
_local10 = (mMaze[_local4].charAt(_local5) - 1);
if ((_local10 + 1) > GameState.mEnemyCnt){
GameState.mEnemyCnt = (_local10 + 1);
};
GameState.mEnemy[_local10] = new Enemy(_local10);
GameState.mEnemy[_local10].setStartPosition(_local6, _local7);
_local3.addChild(GameState.mEnemy[_local10]);
break;
case "#":
mFinishX = _local5;
mFinishY = _local4;
mFinishObject = new LevelFinishObject();
mFinishObject.x = _local6;
mFinishObject.y = _local7;
addChild(mFinishObject);
break;
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
case "g":
case "h":
case "i":
case "j":
case "k":
case "l":
case "m":
_local11 = new HelpSign((mMaze[_local4].charCodeAt(_local5) - 97), _local6, _local7);
mWalls.addChild(_local11);
_local12 = mMaze[_local4];
mMaze[_local4] = ((_local12.substr(0, _local5) + "Y") + _local12.substr((_local5 + 1), ((_local12.length - _local5) - 1)));
break;
};
_local5++;
};
_local4++;
};
addChild(_local3);
createPathFromFinish();
}
public function onFrame(_arg1:Event):void{
var _local2:int;
var _local3:int;
var _local4:int;
if ((((GameState.mState == GameState.STATE_GAME)) && (GameState.mFinished))){
GameState.mState = GameState.STATE_LEVEL_OVER;
GameState.mScore = Math.floor(((GameState.mTime * 10) / Settings.GAME_FPS));
_local2 = LevelData.getRank(GameState.mScore);
if ((((((_local2 > 0)) && ((_local2 <= 3)))) && (!(UserSettings.mAdvancedTipsShown)))){
UserSettings.mAdvancedTipsShown = true;
UserSettings.save();
GameState.root.addChild(new Instructions(Instructions.CALL_TIPS));
} else {
GameState.root.addChild(new GameOverWindow());
};
};
if (((!((GameState.mState == GameState.STATE_GAME))) && (!((GameState.mState == GameState.STATE_GAME_TIMER))))){
if (mAttachedObstacle.parent != null){
mWalls.removeChild(mAttachedObstacle);
};
return;
};
if (mAttachedObstacle.parent == null){
_local3 = ((stage.mouseX - Settings.MAZE_OFFSET_X) / Settings.TILE_WIDTH);
_local4 = ((stage.mouseY - Settings.MAZE_OFFSET_Y) / Settings.TILE_HEIGHT);
mAttachedObstacle.x = (Settings.MAZE_OFFSET_X + (_local3 * Settings.TILE_WIDTH));
mAttachedObstacle.y = (Settings.MAZE_OFFSET_Y + (_local4 * Settings.TILE_HEIGHT));
mWalls.addChild(mAttachedObstacle);
};
}
public function clearDrawing():void{
mDrawing = false;
}
public function findPathToFinish(_arg1:int, _arg2:int):Path{
var _local9:int;
var _local10:int;
var _local11:int;
var _local3:Path = new Path();
_arg1 = (_arg1 - Settings.MAZE_OFFSET_X);
_arg2 = (_arg2 - Settings.MAZE_OFFSET_Y);
_arg1 = (_arg1 / Settings.TILE_WIDTH);
_arg2 = (_arg2 / Settings.TILE_HEIGHT);
if (mMoves[_arg2][_arg1] == 0){
return (null);
};
var _local4:int = mMoves[_arg2][_arg1];
var _local5:int;
var _local6:int;
var _local7 = -1;
while (_local7 <= 1) {
_local9 = -1;
while (_local9 <= 1) {
if ((((_local7 == 0)) || ((_local9 == 0)))){
_local10 = (_arg1 + _local7);
_local11 = (_arg2 + _local9);
if ((((((((((((_local10 >= 0)) && ((_local10 < Settings.MAZE_WIDTH)))) && ((_local11 >= 0)))) && ((_local11 < Settings.MAZE_HEIGHT)))) && (!((mMoves[_local11][_local10] == 0))))) && ((mMoves[_local11][_local10] < _local4)))){
_local4 = mMoves[_local11][_local10];
_local5 = _local7;
_local6 = _local9;
};
};
_local9++;
};
_local7++;
};
var _local8:int = _local4;
_local7 = -1;
while (_local7 <= 1) {
_local9 = -1;
while (_local9 <= 1) {
_local10 = (_arg1 + _local7);
_local11 = (_arg2 + _local9);
if (((((((((((((((((!((_local7 == 0))) && (!((_local9 == 0))))) && ((_local10 >= 0)))) && ((_local10 < Settings.MAZE_WIDTH)))) && ((_local11 >= 0)))) && ((_local11 < Settings.MAZE_HEIGHT)))) && (!((mMoves[_local11][_local10] == 0))))) && (((mMoves[_local11][_local10] + 1) == _local8)))) && ((((mMoves[_local11][_arg1] == _local8)) || ((mMoves[_arg2][_local10] == _local8)))))){
_local4 = mMoves[_local11][_local10];
_local5 = _local7;
_local6 = _local9;
};
_local9++;
};
_local7++;
};
_local3.mNextX = (((_arg1 + _local5) * Settings.TILE_WIDTH) + Settings.MAZE_OFFSET_X);
_local3.mNextY = (((_arg2 + _local6) * Settings.TILE_HEIGHT) + Settings.MAZE_OFFSET_Y);
return (_local3);
}
public function clearRemoveMarks():void{
var _local1:int = (mWalls.numChildren - 1);
while (_local1 >= 0) {
if ((mWalls.getChildAt(_local1) is ObstacleDeleteButton)){
(mWalls.getChildAt(_local1) as ObstacleDeleteButton).destroy();
};
_local1--;
};
}
public function hasReachedExit(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number = Math.abs((mFinishObject.x - _arg1));
var _local4:Number = Math.abs((mFinishObject.y - _arg2));
return ((((_local3 < Settings.ENEMY_SPEED_FAST)) && ((_local4 < Settings.ENEMY_SPEED_FAST))));
}
public function checkTileCell(_arg1:int, _arg2:int):Boolean{
if ((((_arg1 < 0)) || ((_arg2 < 0)))){
return (false);
};
if ((((_arg1 >= Settings.MAZE_WIDTH)) || ((_arg2 >= Settings.MAZE_HEIGHT)))){
return (false);
};
if ((((((mMaze[_arg2].charAt(_arg1) == "X")) || ((mMaze[_arg2].charAt(_arg1) == "Y")))) || ((mMaze[_arg2].charAt(_arg1) == "T")))){
return (false);
};
return (true);
}
public function canMoveTo(_arg1:Number, _arg2:Number):Boolean{
return (((((((checkCell(_arg1, _arg2)) && (checkCell((_arg1 + Settings.ENEMY_WIDTH), _arg2)))) && (checkCell(_arg1, (_arg2 + Settings.ENEMY_HEIGHT))))) && (checkCell((_arg1 + Settings.ENEMY_WIDTH), (_arg2 + Settings.ENEMY_HEIGHT)))));
}
public function createPathFromFinish():void{
var qx:Array;
var qy:Array;
var qe:int;
var moveCnt:int;
var j:int;
var nx:int;
var ny:int;
var dx:int;
var dy:int;
var addQ:Function = function (_arg1:int, _arg2:int):void{
if ((((((((((((_arg1 >= 0)) && ((_arg1 < Settings.MAZE_WIDTH)))) && ((_arg2 >= 0)))) && ((_arg2 < Settings.MAZE_HEIGHT)))) && ((mMoves[_arg2][_arg1] == 0)))) && (checkTileCell(_arg1, _arg2)))){
mMoves[_arg2][_arg1] = moveCnt;
qx[qe] = _arg1;
qy[qe] = _arg2;
qe++;
};
};
mMoves = new Array(Settings.MAZE_HEIGHT);
var i:int;
while (i < Settings.MAZE_HEIGHT) {
mMoves[i] = new Array(Settings.MAZE_WIDTH);
j = 0;
while (j < Settings.MAZE_WIDTH) {
mMoves[i][j] = 0;
j = (j + 1);
};
i = (i + 1);
};
qx = new Array((Settings.MAZE_HEIGHT * Settings.MAZE_WIDTH));
qy = new Array((Settings.MAZE_HEIGHT * Settings.MAZE_WIDTH));
var qb:int;
qe = 0;
moveCnt = 1;
addQ(mFinishX, mFinishY);
while (qb != qe) {
nx = qx[qb];
ny = qy[qb];
qb = (qb + 1);
moveCnt = (mMoves[ny][nx] + 1);
dx = -1;
while (dx <= 1) {
dy = -1;
while (dy <= 1) {
if ((((dx == 0)) || ((dy == 0)))){
addQ((nx + dx), (ny + dy));
};
dy = (dy + 1);
};
dx = (dx + 1);
};
};
}
public function clearWall(_arg1:int, _arg2:int):void{
var _local3:String = mMaze[_arg2];
mMaze[_arg2] = ((_local3.substr(0, _arg1) + ".") + _local3.substr((_arg1 + 1), ((_local3.length - _arg1) - 1)));
createPathFromFinish();
}
public function onMouseMove(_arg1:MouseEvent):void{
var _local4:String;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:Bitmap;
var _local9:ObstacleDeleteButton;
var _local2:int = ((_arg1.stageX - Settings.MAZE_OFFSET_X) / Settings.TILE_WIDTH);
var _local3:int = ((_arg1.stageY - Settings.MAZE_OFFSET_Y) / Settings.TILE_HEIGHT);
mAttachedObstacle.x = (Settings.MAZE_OFFSET_X + (_local2 * Settings.TILE_WIDTH));
mAttachedObstacle.y = (Settings.MAZE_OFFSET_Y + (_local3 * Settings.TILE_HEIGHT));
if (((!((GameState.mState == GameState.STATE_GAME))) && (!((GameState.mState == GameState.STATE_GAME_TIMER))))){
if (mAttachedObstacle.parent != null){
mWalls.removeChild(mAttachedObstacle);
};
return;
};
if (mAttachedObstacle.parent == null){
mWalls.addChild(mAttachedObstacle);
};
if (mDrawing){
if (checkTileCell(_local2, _local3)){
_local4 = mMaze[_local3];
mMaze[_local3] = ((_local4.substr(0, _local2) + "X") + _local4.substr((_local2 + 1), ((_local4.length - _local2) - 1)));
createPathFromFinish();
_local5 = true;
_local6 = 0;
while (_local6 < GameState.mEnemyCnt) {
if (GameState.mEnemy[_local6]){
if (((!(findPathToFinish(GameState.mEnemy[_local6].x, GameState.mEnemy[_local6].y))) || (!(canMoveTo(GameState.mEnemy[_local6].x, GameState.mEnemy[_local6].y))))){
_local5 = false;
};
};
_local6++;
};
if (!_local5){
mMaze[_local3] = _local4;
createPathFromFinish();
return;
};
_local7 = mAttachedType;
_local8 = new Bitmap(DataCollection.mWall[_local7]);
_local8.x = (Settings.MAZE_OFFSET_X + (Settings.TILE_WIDTH * _local2));
_local8.y = (Settings.MAZE_OFFSET_Y + (Settings.TILE_HEIGHT * _local3));
mWalls.addChild(_local8);
if (GameState.mTimeFrozen){
_local9 = new ObstacleDeleteButton(_local2, _local3, _local8);
mWalls.addChild(_local9);
};
mAttachedType = Math.floor((Math.random() * 5));
};
};
}
}
}//package com.mazestopper
Section 72
//MouseHighlight (com.mazestopper.MouseHighlight)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class MouseHighlight extends Sprite {
private var mCross:Sprite;
private var mNoMana:QuickText;
private var mTime:int;
public function MouseHighlight(){
var _local1:Bitmap = new Bitmap(new BitmapData(Settings.TILE_WIDTH, Settings.TILE_HEIGHT, false, 0xFFFFFF));
_local1.alpha = 0.5;
addChild(_local1);
mNoMana = null;
}
public function removeManaWarning():void{
if (mNoMana != null){
removeChild(mNoMana);
removeChild(mCross);
mNoMana = null;
mCross = null;
};
}
public function activateManaWarning():void{
var _local1:int;
if (mNoMana == null){
mNoMana = new QuickText(7, TextFormatAlign.CENTER, 20479);
mNoMana.wordWrap = true;
mNoMana.width = 20;
mNoMana.height = 30;
mNoMana.setText("no mana");
mNoMana.mouseEnabled = false;
addChild(mNoMana);
mCross = new Sprite();
mCross.x = (Settings.TILE_WIDTH / 2);
mCross.y = (Settings.TILE_HEIGHT / 2);
mCross.graphics.lineStyle(2, 0xFF4F00);
_local1 = 6;
mCross.graphics.moveTo(-(_local1), -(_local1));
mCross.graphics.lineTo(_local1, _local1);
mCross.graphics.moveTo(_local1, -(_local1));
mCross.graphics.lineTo(-(_local1), _local1);
addChild(mCross);
};
}
}
}//package com.mazestopper
Section 73
//ObstacleDeleteButton (com.mazestopper.ObstacleDeleteButton)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
public class ObstacleDeleteButton extends SimpleButton {
private var mWall:Bitmap;
private var mMazeX:int;
private var mMazeY:int;
private static const CROSS_SIZE:int = 5;
public function ObstacleDeleteButton(_arg1:int, _arg2:int, _arg3:Bitmap){
mWall = _arg3;
mMazeX = _arg1;
mMazeY = _arg2;
draw();
x = (_arg3.x + (Settings.TILE_WIDTH / 2));
y = (_arg3.y + (Settings.TILE_HEIGHT / 2));
addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
public function destroy():void{
mWall = null;
removeEventListener(MouseEvent.CLICK, onClick);
parent.removeChild(this);
}
public function draw():void{
var _local1:Sprite = new Sprite();
_local1.graphics.lineStyle(4, 0xAF0000);
var _local2 = 3;
_local1.graphics.moveTo(-(_local2), -(_local2));
_local1.graphics.lineTo(_local2, _local2);
_local1.graphics.moveTo(_local2, -(_local2));
_local1.graphics.lineTo(-(_local2), _local2);
upState = _local1;
_local1 = new Sprite();
_local1.graphics.lineStyle(8, 0xFF4F00);
_local2 = 6;
_local1.graphics.moveTo(-(_local2), -(_local2));
_local1.graphics.lineTo(_local2, _local2);
_local1.graphics.moveTo(_local2, -(_local2));
_local1.graphics.lineTo(-(_local2), _local2);
overState = _local1;
downState = _local1;
_local1 = new Sprite();
_local1.graphics.beginFill(0xFFFFFF);
_local1.graphics.drawRect((-(Settings.TILE_WIDTH) / 2), (-(Settings.TILE_HEIGHT) / 2), Settings.TILE_WIDTH, Settings.TILE_HEIGHT);
hitTestState = _local1;
useHandCursor = true;
}
public function onClick(_arg1:MouseEvent):void{
removeEventListener(MouseEvent.CLICK, onClick);
parent.removeChild(mWall);
mWall = null;
parent.removeChild(this);
GameState.mMaze.clearWall(mMazeX, mMazeY);
}
}
}//package com.mazestopper
Section 74
//PanelBox (com.mazestopper.PanelBox)
package com.mazestopper {
import flash.display.*;
import flash.geom.*;
public class PanelBox extends Bitmap {
public function PanelBox(_arg1:int, _arg2:int=0){
var _local3:BitmapData = ((_arg2 == 0)) ? DataCollection.mPanelBox : DataCollection.mPanelBox2;
super(new BitmapData(_arg1, _local3.height));
var _local4:int = bitmapData.height;
var _local5:Rectangle = new Rectangle(0, 0, 1, _local4);
var _local6:Point = new Point(0, 0);
bitmapData.copyPixels(_local3, _local5, _local6);
_local5 = new Rectangle(1, 0, 1, _local4);
var _local7 = 1;
while (_local7 < (_arg1 - 1)) {
_local6 = new Point(_local7, 0);
bitmapData.copyPixels(_local3, _local5, _local6);
_local7++;
};
_local5 = new Rectangle(2, 0, 1, _local4);
_local6 = new Point((_arg1 - 1), 0);
bitmapData.copyPixels(_local3, _local5, _local6);
}
}
}//package com.mazestopper
Section 75
//Path (com.mazestopper.Path)
package com.mazestopper {
public class Path {
public var mNextX:Number;
public var mNextY:Number;
}
}//package com.mazestopper
Section 76
//PauseMenu (com.mazestopper.PauseMenu)
package com.mazestopper {
import flash.events.*;
import flash.ui.*;
public class PauseMenu extends Window {
private var mButton:Array;
private static const WINDOW_HEIGHT:int = 140;
private static const WINDOW_WIDTH:int = 300;
private static const BUTTON_COUNT:int = 3;
private static const BUTTON_TEXT:Array = ["Resume Game", "Restart Level", "Quit to main menu"];
private static const BUTTON_Y:int = 40;
public function PauseMenu(){
super("Pause Menu", WINDOW_WIDTH, WINDOW_HEIGHT);
}
public function onKey(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ESCAPE)) || ((String.fromCharCode(_arg1.charCode).toLowerCase() == "p")))){
GameState.mState = GameState.STATE_GAME;
GameState.mMaze.clearDrawing();
removeListeners();
parent.removeChild(this);
};
}
override public function draw():void{
super.draw();
mButton = new Array(BUTTON_COUNT);
var _local1:int = BUTTON_Y;
var _local2:int;
while (_local2 < BUTTON_COUNT) {
mButton[_local2] = new Button(BUTTON_TEXT[_local2]);
mButton[_local2].y = _local1;
mButton[_local2].x = ((WINDOW_WIDTH - mButton[_local2].width) / 2);
mButton[_local2].addEventListener(MouseEvent.CLICK, onClick);
addChild(mButton[_local2]);
_local1 = (_local1 + 28);
_local2++;
};
GameState.root.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
}
public function onClick(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
var _local2:int;
var _local3:int;
while (_local3 < mButton.length) {
if (_arg1.target == mButton[_local3]){
_local2 = _local3;
};
_local3++;
};
switch (_local2){
case 0:
GameState.mState = GameState.STATE_GAME;
GameState.mMaze.clearDrawing();
break;
case 1:
GameProcess.restart(false);
break;
case 2:
GameProcess.destroy();
GameState.init();
break;
};
removeListeners();
parent.removeChild(this);
}
public function removeListeners():void{
var _local1:int;
while (_local1 < mButton.length) {
if (mButton[_local1]){
mButton[_local1].removeEventListener(MouseEvent.CLICK, onClick);
};
_local1++;
};
GameState.root.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
}
}
}//package com.mazestopper
Section 77
//QualityControl (com.mazestopper.QualityControl)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class QualityControl extends Sprite {
private var mHighlight:Sprite;
private var mListenersInstalled:Boolean;
private var mTextButton:Button;
private var mTextHi:Button;
private var mCurQuality:int;
private var mTextMed:Button;
private var mTextLow:Button;
private static const TEXT_COLOR:uint = 0xEFAF00;
public function QualityControl(){
var _local1:VisualButton;
super();
_local1 = new VisualButton("Q");
_local1.x = 0;
_local1.y = 5;
addChild(_local1);
mTextButton = new Button("Quality", 14);
mTextButton.x = 37;
mTextButton.y = 0;
addChild(mTextButton);
mTextLow = new Button("Low", 10);
mTextLow.x = 37;
mTextLow.y = 20;
addChild(mTextLow);
mTextMed = new Button("Med", 10);
mTextMed.x = (37 + 25);
mTextMed.y = 20;
addChild(mTextMed);
mTextHi = new Button("High", 10);
mTextHi.x = (37 + 50);
mTextHi.y = 20;
addChild(mTextHi);
mHighlight = new Sprite();
mHighlight.graphics.lineStyle(1, TEXT_COLOR);
mHighlight.graphics.drawRect(0, 0, 25, 17);
mHighlight.y = 20;
addChild(mHighlight);
getCurrentQuality();
installListeners();
}
public function onKey(_arg1:KeyboardEvent):void{
if ((GameState.root.stage.focus is TextField)){
return;
};
if (String.fromCharCode(_arg1.charCode).toLowerCase() == "q"){
changeQuality();
};
}
public function getCurrentQuality():void{
mCurQuality = 2;
switch (GameState.root.stage.quality.toLowerCase()){
case StageQuality.LOW:
mCurQuality = 0;
break;
case StageQuality.MEDIUM:
mCurQuality = 1;
break;
case StageQuality.HIGH:
mCurQuality = 2;
break;
};
updateHighlight();
}
public function updateHighlight():void{
mHighlight.x = (39 + (mCurQuality * 25));
}
public function onFrame(_arg1:Event):void{
if ((((root == null)) && (mListenersInstalled))){
removeListeners();
};
if (((!((root == null))) && (!(mListenersInstalled)))){
installListeners();
};
}
public function removeListeners():void{
mTextButton.removeEventListener(MouseEvent.CLICK, onClick);
mTextLow.removeEventListener(MouseEvent.CLICK, onClickLow);
mTextMed.removeEventListener(MouseEvent.CLICK, onClickMed);
mTextHi.removeEventListener(MouseEvent.CLICK, onClickHigh);
GameState.root.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
mListenersInstalled = false;
}
public function onClickMed(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
if (mCurQuality != 1){
changeQuality(1);
};
}
public function onClick(_arg1:Event):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
changeQuality();
}
public function onClickLow(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
if (mCurQuality != 0){
changeQuality(0);
};
}
public function changeQuality(_arg1:int=-1):void{
if (_arg1 == -1){
mCurQuality = ((mCurQuality + 1) % 3);
} else {
mCurQuality = _arg1;
};
setQuality();
}
public function onClickHigh(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
if (mCurQuality != 2){
changeQuality(2);
};
}
public function installListeners():void{
addEventListener(Event.ENTER_FRAME, onFrame, false, 0, true);
mTextButton.addEventListener(MouseEvent.CLICK, onClick);
mTextLow.addEventListener(MouseEvent.CLICK, onClickLow);
mTextMed.addEventListener(MouseEvent.CLICK, onClickMed);
mTextHi.addEventListener(MouseEvent.CLICK, onClickHigh);
GameState.root.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
mListenersInstalled = true;
}
public function setQuality():void{
UserSettings.mQuality = mCurQuality;
UserSettings.save();
setUserQuality();
updateHighlight();
}
public static function setUserQuality():void{
switch (UserSettings.mQuality){
case 0:
GameState.root.stage.quality = StageQuality.LOW;
break;
case 1:
GameState.root.stage.quality = StageQuality.MEDIUM;
break;
case 2:
GameState.root.stage.quality = StageQuality.HIGH;
break;
};
}
}
}//package com.mazestopper
Section 78
//ScoreSubmitDialog (com.mazestopper.ScoreSubmitDialog)
package com.mazestopper {
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
import flash.net.*;
public class ScoreSubmitDialog extends Window {
private var mLoader:URLLoader;
private var mSubmitId:int;
private var mButton:Array;
private var mStatus:QuickText;
private var mName:TextField;
private var mNameLabel:QuickText;
private var mLevelDialog:GameOverWindow;
private static const WINDOW_HEIGHT:int = 180;
private static const WINDOW_WIDTH:int = 300;
private static const BUTTON_COUNT:int = 2;
private static const BUTTON_TEXT:Array = ["Submit", "Back", "View Scores"];
private static const BUTTON_Y:int = 110;
public function ScoreSubmitDialog(_arg1:GameOverWindow){
super("Submit Level Time", WINDOW_WIDTH, WINDOW_HEIGHT);
mLoader = null;
mLevelDialog = _arg1;
}
override public function draw():void{
super.draw();
mStatus = new QuickText(16, TextFormatAlign.CENTER, 0xFFFFFF);
mStatus.width = WINDOW_WIDTH;
mStatus.x = 0;
mStatus.y = 50;
mStatus.setText("Enter your name");
addChild(mStatus);
mNameLabel = new QuickText(16, TextFormatAlign.LEFT, 0xFFFFFF);
mNameLabel.setText("Name:");
addChild(mNameLabel);
mName = new TextField();
mName.embedFonts = true;
mName.selectable = true;
mName.mouseEnabled = true;
var _local1:TextFormat = mName.getTextFormat();
_local1.font = Settings.GAME_FONT;
_local1.size = 16;
_local1.align = TextFormatAlign.LEFT;
_local1.color = 0xFFFF00;
mName.defaultTextFormat = _local1;
mName.appendText(UserSettings.mScoreName);
mName.opaqueBackground = true;
mName.backgroundColor = 0;
mName.width = 180;
mName.height = 20;
mName.multiline = false;
mName.maxChars = 20;
mName.type = TextFieldType.INPUT;
mName.x = 80;
mName.y = 78;
mNameLabel.x = 20;
mNameLabel.y = 78;
addChild(mName);
mButton = new Array(BUTTON_COUNT);
var _local2:int = BUTTON_Y;
var _local3:int;
while (_local3 < BUTTON_COUNT) {
mButton[_local3] = new Button(BUTTON_TEXT[_local3]);
mButton[_local3].y = _local2;
mButton[_local3].x = ((WINDOW_WIDTH - mButton[_local3].width) / 2);
mButton[_local3].addEventListener(MouseEvent.CLICK, onClick);
addChild(mButton[_local3]);
_local2 = (_local2 + 28);
_local3++;
};
}
public function onScoreSubmitted(_arg1:Event):void{
var _local2:Boolean;
var _local3:int;
while (_local3 < mLoader.data.length) {
if ((((mLoader.data.charAt(_local3) < "0")) || ((mLoader.data.charAt(_local3) > "9")))){
_local2 = true;
};
_local3++;
};
if (((_local2) || ((mLoader.data == "0")))){
mStatus.setText("Submission failed! Try again.");
addChild(mButton[0]);
addChild(mNameLabel);
addChild(mName);
} else {
mSubmitId = int(mLoader.data);
mStatus.setText("Time submitted successfully!");
mButton[0].removeEventListener(MouseEvent.CLICK, onClick);
mButton[0] = new Button(BUTTON_TEXT[2]);
mButton[0].y = BUTTON_Y;
mButton[0].x = ((WINDOW_WIDTH - mButton[0].width) / 2);
mButton[0].addEventListener(MouseEvent.CLICK, onClick);
addChild(mButton[0]);
mLevelDialog.setScoreSubmitted();
};
mLoader.removeEventListener(Event.COMPLETE, onScoreSubmitted);
mLoader.removeEventListener(IOErrorEvent.IO_ERROR, onScoreSubmitError);
mLoader = null;
}
public function onClick(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
var _local2:int;
var _local3:int;
while (_local3 < mButton.length) {
if (_arg1.target == mButton[_local3]){
_local2 = _local3;
};
_local3++;
};
switch (_local2){
case 0:
if (mName.parent == null){
FlashRelaxAPI.openHighScores((GameState.mLevel + 1), mSubmitId);
return;
};
if (UserSettings.mScoreName != mName.text){
UserSettings.mScoreName = mName.text;
UserSettings.save();
};
if (!FlashRelaxAPI.checkCorrectName(mName.text)){
mStatus.setText("Incorrect name, please use another name!");
return;
};
removeChild(mName);
removeChild(mNameLabel);
mNameLabel.width = WINDOW_WIDTH;
mStatus.setText("Submitting data... Please wait");
removeChild(mButton[0]);
mLoader = FlashRelaxAPI.submitScore((GameState.mLevel + 1), mName.text, GameState.mScore);
mLoader.addEventListener(Event.COMPLETE, onScoreSubmitted);
mLoader.addEventListener(IOErrorEvent.IO_ERROR, onScoreSubmitError);
return;
case 1:
if (mLoader != null){
mLoader.removeEventListener(Event.COMPLETE, onScoreSubmitted);
mLoader.removeEventListener(IOErrorEvent.IO_ERROR, onScoreSubmitError);
mLoader = null;
};
break;
};
removeListeners();
parent.removeChild(this);
mLevelDialog.reActivateDialog();
}
public function removeListeners():void{
var _local1:int;
while (_local1 < mButton.length) {
if (mButton[_local1]){
mButton[_local1].removeEventListener(MouseEvent.CLICK, onClick);
};
_local1++;
};
}
public function onScoreSubmitError(_arg1:IOErrorEvent):void{
mStatus.setText("Submission failed! Try again.");
addChild(mButton[0]);
addChild(mNameLabel);
addChild(mName);
mLoader.removeEventListener(Event.COMPLETE, onScoreSubmitted);
mLoader.removeEventListener(IOErrorEvent.IO_ERROR, onScoreSubmitError);
mLoader = null;
}
}
}//package com.mazestopper
Section 79
//Settings (com.mazestopper.Settings)
package com.mazestopper {
public class Settings {
public static const GAME_FPS:int = 25;
public static const ENEMY_WIDTH:int = 18;
public static const ENEMY_SPEED:int = 4;
public static const GAME_HEIGHT:int = 480;
public static const TILE_WIDTH:int = 20;
public static const ENEMY_SPEED_SLOW:int = 2;
public static const TILE_HEIGHT:int = 30;
public static const GAME_WIDTH:int = 480;
public static const LEVEL_COUNT:int = 40;
public static const ENEMY_HEIGHT:int = 25;
public static const MAZE_WIDTH:int = 24;
public static const MAZE_HEIGHT:int = 16;
public static const ENEMY_SPEED_FAST:int = 6;
public static const MAZE_OFFSET_X:int = 0;
public static const MAZE_OFFSET_Y:int = 0;
public static const GAME_FONT:String = "_MazeFont";
}
}//package com.mazestopper
Section 80
//SidePanel (com.mazestopper.SidePanel)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
import com.flashrelax.utils.*;
import flash.geom.*;
public class SidePanel extends Sprite {
private static const BOTTOM_SIDE_HEIGHT:int = 8;
private static const TOP_SIDE_HEIGHT:int = 17;
public function SidePanel(_arg1:String, _arg2:int){
var _local3:BitmapData = DataCollection.mSidePanel;
var _local4:int = _local3.width;
var _local5:Bitmap = new Bitmap(new BitmapData(_local4, _arg2));
var _local6:Rectangle = new Rectangle(0, 0, _local4, TOP_SIDE_HEIGHT);
var _local7:Point = new Point(0, 0);
_local5.bitmapData.copyPixels(_local3, _local6, _local7);
_local6 = new Rectangle(0, TOP_SIDE_HEIGHT, _local4, 1);
var _local8:int = TOP_SIDE_HEIGHT;
while (_local8 < ((_arg2 + 1) - BOTTOM_SIDE_HEIGHT)) {
_local7 = new Point(0, _local8);
_local5.bitmapData.copyPixels(_local3, _local6, _local7);
_local8++;
};
_local6 = new Rectangle(0, (1 + TOP_SIDE_HEIGHT), _local4, BOTTOM_SIDE_HEIGHT);
_local7 = new Point(0, ((_arg2 + 1) - BOTTOM_SIDE_HEIGHT));
_local5.bitmapData.copyPixels(_local3, _local6, _local7);
addChild(_local5);
var _local9:QuickText = new QuickText(11, TextFormatAlign.CENTER, 0xFFFFFF);
_local9.x = 0;
_local9.width = 160;
_local9.y = 0;
_local9.setText(_arg1);
addChild(_local9);
}
}
}//package com.mazestopper
Section 81
//SoundControl (com.mazestopper.SoundControl)
package com.mazestopper {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.flashrelax.utils.*;
public class SoundControl extends Sprite {
private var mType:int;
private var mListenersInstalled:Boolean;
private var mTextButton:Button;
private var mHighlight:Sprite;
private var mTextOff:Button;
private var mTextOn:Button;
private static const TEXT_COLOR:uint = 0xEFAF00;
public function SoundControl(_arg1:int=0){
var _local2:VisualButton;
super();
mListenersInstalled = false;
_local2 = new VisualButton(((_arg1 == 0)) ? "S" : "M");
_local2.x = 0;
_local2.y = 5;
addChild(_local2);
mTextButton = new Button(((_arg1 == 0)) ? "Sound" : "Music", 14);
mTextButton.x = 37;
mTextButton.y = 0;
addChild(mTextButton);
mType = _arg1;
mTextOff = new Button("Off", 12);
mTextOff.x = 37;
mTextOff.y = 20;
addChild(mTextOff);
mTextOn = new Button("On", 12);
mTextOn.x = (30 + 37);
mTextOn.y = 20;
addChild(mTextOn);
mHighlight = new Sprite();
mHighlight.graphics.lineStyle(1, TEXT_COLOR);
mHighlight.graphics.drawRect(0, 0, 30, 17);
addChild(mHighlight);
mHighlight.y = 20;
updateHighlight();
installListeners();
}
public function onKey(_arg1:KeyboardEvent):void{
if ((GameState.root.stage.focus is TextField)){
return;
};
var _local2:String = String.fromCharCode(_arg1.charCode).toLowerCase();
if ((((((_local2 == "s")) && ((mType == 0)))) || ((((_local2 == "m")) && ((mType == 1)))))){
changeState();
};
}
public function changeState(_arg1:int=-1):void{
if (mType == 0){
if (((!((_arg1 == -1))) && ((UserSettings.mSound == _arg1)))){
return;
};
UserSettings.mSound = !(UserSettings.mSound);
UserSettings.save();
updateHighlight();
} else {
if (((!((_arg1 == -1))) && ((UserSettings.mMusic == _arg1)))){
return;
};
UserSettings.mMusic = !(UserSettings.mMusic);
UserSettings.save();
if (UserSettings.mMusic){
AmbientMusic.play();
} else {
AmbientMusic.stop();
};
updateHighlight();
};
}
public function installListeners():void{
addEventListener(Event.ENTER_FRAME, onFrame, false, 0, true);
mTextButton.addEventListener(MouseEvent.CLICK, onClick);
mTextOff.addEventListener(MouseEvent.CLICK, onStateOff);
mTextOn.addEventListener(MouseEvent.CLICK, onStateOn);
GameState.root.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
mListenersInstalled = true;
}
public function onClick(_arg1:Event):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
changeState();
}
public function updateHighlight():void{
if (((((UserSettings.mSound) && ((mType == 0)))) || (((UserSettings.mMusic) && ((mType == 1)))))){
mHighlight.x = (37 + 30);
} else {
mHighlight.x = 37;
};
}
public function onStateOn(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
changeState(1);
}
public function onFrame(_arg1:Event):void{
if ((((root == null)) && (mListenersInstalled))){
removeListeners();
};
if (((!((root == null))) && (!(mListenersInstalled)))){
installListeners();
};
}
public function removeListeners():void{
mTextButton.removeEventListener(MouseEvent.CLICK, onClick);
mTextOff.removeEventListener(MouseEvent.CLICK, onStateOff);
mTextOn.removeEventListener(MouseEvent.CLICK, onStateOn);
GameState.root.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
mListenersInstalled = false;
}
public function onStateOff(_arg1:MouseEvent):void{
if (UserSettings.mSound){
DataCollection.mSfxMenu.play();
};
changeState(0);
}
}
}//package com.mazestopper
Section 82
//StarRank (com.mazestopper.StarRank)
package com.mazestopper {
import flash.display.*;
public class StarRank extends Sprite {
private var mRank:int;
private var mStar:Array;
public function StarRank(_arg1:int=0){
mStar = new Array(5);
mRank = 0;
var _local2:int;
while (_local2 < 5) {
mStar[_local2] = new Bitmap(DataCollection.mStarOff);
mStar[_local2].x = (16 * _local2);
mStar[_local2].y = 0;
addChild(mStar[_local2]);
_local2++;
};
setRank(_arg1);
}
public function setRank(_arg1:int):void{
if (_arg1 == mRank){
return;
};
mRank = _arg1;
var _local2:int;
while ((2 * _local2) < (_arg1 - 1)) {
mStar[_local2].bitmapData = DataCollection.mStarOn;
_local2++;
};
if ((_arg1 % 2)){
mStar[_local2].bitmapData = DataCollection.mStarMid;
_local2++;
};
while (_local2 < 5) {
mStar[_local2].bitmapData = DataCollection.mStarOff;
_local2++;
};
}
}
}//package com.mazestopper
Section 83
//TiledBackground (com.mazestopper.TiledBackground)
package com.mazestopper {
import flash.display.*;
public class TiledBackground extends Sprite {
private static const TILE_WIDTH:int = 20;
private static const TILE_HEIGHT:int = 30;
public function TiledBackground(_arg1:Boolean=false){
var _local5:int;
var _local6:Bitmap;
super();
var _local2:int = Math.round((Settings.GAME_WIDTH / TILE_WIDTH));
var _local3:int = Math.round((Settings.GAME_HEIGHT / TILE_HEIGHT));
if (!_arg1){
_local2 = Math.round((640 / TILE_WIDTH));
};
var _local4:int;
while (_local4 < _local2) {
_local5 = 0;
while (_local5 < _local3) {
_local6 = new Bitmap(DataCollection.mFloor[getRandomGrassId()]);
_local6.x = (_local4 * TILE_WIDTH);
_local6.y = (_local5 * TILE_HEIGHT);
addChild(_local6);
_local5++;
};
_local4++;
};
}
public static function createCustom(_arg1:int, _arg2:int):Sprite{
var _local3:Sprite;
var _local5:int;
var _local6:Bitmap;
_arg1 = Math.round(((_arg1 * Settings.TILE_WIDTH) / TILE_WIDTH));
_arg2 = Math.round(((_arg2 * Settings.TILE_HEIGHT) / TILE_HEIGHT));
_local3 = new Sprite();
var _local4:int;
while (_local4 < _arg1) {
_local5 = 0;
while (_local5 < _arg2) {
_local6 = new Bitmap(DataCollection.mFloor[getRandomGrassId()]);
_local6.x = (_local4 * 20);
_local6.y = (_local5 * 30);
_local3.addChild(_local6);
_local5++;
};
_local4++;
};
return (_local3);
}
public static function getRandomGrassId():int{
return (0);
}
}
}//package com.mazestopper
Section 84
//UserSettings (com.mazestopper.UserSettings)
package com.mazestopper {
import flash.net.*;
public class UserSettings {
private static const DATA_NAME:String = "MazeStopperSettings";
private static const VERSION:int = 8;
public static var mSiteOpenedFromMoreGames:Boolean;
public static var mSiteOpenedFromHighscore:Boolean;
public static var mScoreName:String;
public static var mAdvancedTipsShown:Boolean;
public static var mQuality:int;
public static var mSiteOpenedFromLoader:Boolean;
public static var mSiteOpenedFromIntro:Boolean;
public static var mSound:Boolean;
public static var mTutorialShown:Boolean;
public static var mMusic:Boolean;
public static function setDefault():void{
mQuality = 2;
mSound = true;
mMusic = true;
mTutorialShown = false;
mAdvancedTipsShown = false;
mScoreName = "FlashRelax";
mSiteOpenedFromMoreGames = false;
mSiteOpenedFromHighscore = false;
mSiteOpenedFromLoader = false;
mSiteOpenedFromIntro = false;
}
public static function load():void{
var _local1:SharedObject = SharedObject.getLocal(DATA_NAME);
if (_local1.data.version != VERSION){
_local1.clear();
setDefault();
save();
} else {
mSound = _local1.data.sound;
mMusic = _local1.data.music;
mTutorialShown = _local1.data.tutorial;
mAdvancedTipsShown = _local1.data.advancedTips;
mQuality = _local1.data.quality;
mScoreName = _local1.data.scoreName;
mSiteOpenedFromMoreGames = _local1.data.siteOpenedFromMoreGames;
mSiteOpenedFromHighscore = _local1.data.siteOpenedFromHighscore;
mSiteOpenedFromLoader = _local1.data.siteOpenedFromLoader;
mSiteOpenedFromIntro = _local1.data.siteOpenedFromIntro;
};
}
public static function save():void{
var _local1:SharedObject = SharedObject.getLocal(DATA_NAME);
_local1.data.version = VERSION;
_local1.data.sound = mSound;
_local1.data.music = mMusic;
_local1.data.tutorial = mTutorialShown;
_local1.data.advancedTips = mAdvancedTipsShown;
_local1.data.quality = mQuality;
_local1.data.levelHighScore = new Array(Settings.LEVEL_COUNT);
_local1.data.scoreName = mScoreName;
_local1.data.siteOpenedFromMoreGames = mSiteOpenedFromMoreGames;
_local1.data.siteOpenedFromHighscore = mSiteOpenedFromHighscore;
_local1.data.siteOpenedFromLoader = mSiteOpenedFromLoader;
_local1.data.siteOpenedFromIntro = mSiteOpenedFromIntro;
_local1.flush();
}
load();
}
}//package com.mazestopper
Section 85
//Window (com.mazestopper.Window)
package com.mazestopper {
import flash.display.*;
import flash.text.*;
public class Window extends Sprite {
protected var mHeight:int;
protected var mWidth:int;
protected var mHeader:String;
private static const HEADER_TEXT_COLOR:uint = 0xFFFFFF;
private static const BG_ALPHA:Number = 0.95;
private static const FG_COLOR:uint = 0x4A00;
private static const HEADER_DY:int = 40;
private static const BG_COLOR:uint = 0;
private static const HEADER_COLOR:uint = 0x6A00;
public function Window(_arg1:String, _arg2:int, _arg3:int){
mHeader = _arg1;
mWidth = _arg2;
mHeight = _arg3;
draw();
}
public function draw():void{
var _local1:TextField;
x = ((Settings.GAME_WIDTH - mWidth) / 2);
y = ((Settings.GAME_HEIGHT - mHeight) / 2);
graphics.lineStyle(1, BG_COLOR, BG_ALPHA);
graphics.beginFill(FG_COLOR, BG_ALPHA);
graphics.drawRoundRect(0, 0, mWidth, mHeight, 15, 15);
graphics.lineStyle(1, BG_COLOR, BG_ALPHA);
graphics.beginFill(HEADER_COLOR, BG_ALPHA);
graphics.drawRoundRect(0, 0, mWidth, HEADER_DY, 15, 15);
_local1 = new TextField();
_local1.type = TextFieldType.DYNAMIC;
_local1.selectable = false;
_local1.textColor = HEADER_TEXT_COLOR;
_local1.width = mWidth;
var _local2:TextFormat = _local1.getTextFormat();
_local2.font = Settings.GAME_FONT;
_local2.size = 30;
_local2.align = TextFormatAlign.CENTER;
_local1.defaultTextFormat = _local2;
_local1.embedFonts = true;
_local1.appendText(mHeader);
_local1.y = 0;
_local1.x = 0;
addChild(_local1);
}
}
}//package com.mazestopper
Section 86
//MochiBot (mochi.MochiBot)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var parent = _arg1;
var tag = _arg2;
var self:MochiBot = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var server = "http://core.mochibot.com/my/core.swf";
var lv:URLVariables = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
var url:String = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
var req:URLRequest = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
var loader:Loader = new Loader();
var f:Function = function (_arg1:Object):void{
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f, false, 0, true);
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package mochi
Section 87
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 88
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 89
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 90
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 91
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 92
//FlexSprite (mx.core.FlexSprite)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexSprite extends Sprite {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexSprite(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 93
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 94
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 95
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 96
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 97
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 98
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 99
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in _local1)){
_local1["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 100
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 101
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 102
//SpriteAsset (mx.core.SpriteAsset)
package mx.core {
public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function SpriteAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 103
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 104
//MainGame (MainGame)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import com.mazestopper.*;
import com.flashrelax.utils.*;
import flash.media.*;
public dynamic class MainGame extends Sprite {
private var mFrame:int;
private var mState:int;
private var mLoaderSprite:Sprite;
private var mDir:int;
private var mTopBG:Bitmap;
private var mIntroSoundChannel:SoundChannel;
private var mLogo:MovieClip;
private static const STATE_GAME_FADEIN:int = 4;
private static const INTRO_WAIT_TIME:int = 115;
private static const STATE_INIT_FADEOUT:int = 0;
private static const STATE_INTRO_WAIT:int = 2;
private static const STATE_INTRO_FADEOUT:int = 3;
private static const STATE_INTRO_FADEIN:int = 1;
public function MainGame(_arg1:Sprite){
mLoaderSprite = _arg1;
addEventListener(Event.ADDED_TO_STAGE, onAdded);
}
public function onAdded(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAdded);
GameState.root = this;
QualityControl.setUserQuality();
mTopBG = new Bitmap(new BitmapData(640, 480, false, 0xFFFFFF));
mTopBG.x = 0;
mTopBG.y = 0;
mTopBG.alpha = 0;
addChild(mTopBG);
mDir = 1;
mState = STATE_INIT_FADEOUT;
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function onFrame(_arg1:Event):void{
if (mState == STATE_INTRO_WAIT){
mFrame++;
if ((((mFrame == 20)) || ((mFrame == 60)))){
DataCollection.mBoomSfx.play();
};
if (mDir == 0){
mDir = 1;
mState = STATE_INTRO_FADEOUT;
} else {
mDir--;
return;
};
};
mTopBG.alpha = (mTopBG.alpha + (mDir * 0.1));
if (mState == STATE_INTRO_FADEIN){
mFrame++;
};
if (mTopBG.alpha <= 0){
mTopBG.alpha = 0;
if (mState == STATE_GAME_FADEIN){
removeChild(mTopBG);
mTopBG = null;
removeEventListener(Event.ENTER_FRAME, onFrame);
return;
};
mDir = INTRO_WAIT_TIME;
mState = STATE_INTRO_WAIT;
} else {
if (mTopBG.alpha >= 1){
mTopBG.alpha = 1;
if (mState == STATE_INIT_FADEOUT){
stage.removeChild(mLoaderSprite);
mLoaderSprite = null;
mLogo = (new DataCollection.mLogoSWFClass() as MovieClip);
mLogo.useHandCursor = true;
mLogo.mouseEnabled = true;
mLogo.buttonMode = true;
mLogo.addEventListener(MouseEvent.CLICK, onIntroClick);
addChildAt(mLogo, 0);
mState = STATE_INTRO_FADEIN;
mFrame = 1;
mIntroSoundChannel = DataCollection.mIntroSfx.play(0, 10);
} else {
mLogo.removeEventListener(MouseEvent.CLICK, onIntroClick);
mLogo.stop();
removeChild(mLogo);
mLogo = null;
mIntroSoundChannel.stop();
mIntroSoundChannel = null;
MochiBot.track(this, "823184cc");
if (UserSettings.mMusic){
AmbientMusic.play();
};
GameState.init();
mState = STATE_GAME_FADEIN;
};
mDir = -1;
};
};
}
public function onIntroClick(_arg1:MouseEvent):void{
FlashRelaxAPI.openIntroSite();
}
}
}//package
Section 105
//MazeStopper (MazeStopper)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import mx.core.*;
import com.flashrelax.utils.*;
import com.mazestopper.*;
public class MazeStopper extends MovieClip {
private const DOMAINS_ALLOWED:Array;
private const NEWGROUNDS_MOVIE_ID:int = 1863;
private const GAME_VERSION:String = "1.0";
private const STARTUP_CLASS_NAME:String = "MainGame";
private var mPlayButton:DisplayObject;
private var mLoader:Loader;
private var mState:int;
private var mFrameLoaded:Boolean;
private var mProgressBar:ProgressBar;
private var mAdCompleted:Boolean;
private var mAdSystem:int;
private static const AD_SYSTEM_NEWGROUNDS:int = 1;
private static const PROGRESS_X:int = 120;
private static const PROGRESS_Y:int = 450;
private static const STATE_WAITING_LOAD:int = 0;
private static const PROGRESS_WIDTH:int = 400;
private static const AD_SYSTEM_MOCHI:int = 0;
private static const PROGRESS_HEIGHT:int = 20;
private static const MOCHI_AD_Y:int = 88;
private static const STATE_WAITING_PLAY_BUTTON:int = 1;
private static var mLogoByClass:Class = MazeStopper_mLogoByClass;
public static var mWebsiteLogoClass:Class = MazeStopper_mWebsiteLogoClass;
public function MazeStopper(){
DOMAINS_ALLOWED = [];
super();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function onLogoClick(_arg1:MouseEvent):void{
FlashRelaxAPI.openLoaderSite();
}
public function startMainGame():void{
mPlayButton = null;
var _local1:Class = Class(loaderInfo.applicationDomain.getDefinition(STARTUP_CLASS_NAME));
var _local2:DisplayObject = DisplayObject(new _local1(this));
if (_local2){
stage.addChild(_local2);
};
}
public function onFrame(_arg1:Event):void{
var _local2:Class;
var _local3:Boolean;
var _local4:Class;
graphics.clear();
switch (mState){
case STATE_WAITING_LOAD:
if (((mAdCompleted) && (mFrameLoaded))){
_local2 = Class(loaderInfo.applicationDomain.getDefinition(STARTUP_CLASS_NAME));
if (_local2){
removeEventListener(Event.ENTER_FRAME, onFrame);
if (mProgressBar != null){
removeChild(mProgressBar);
mProgressBar = null;
};
_local3 = true;
if (DOMAINS_ALLOWED.length > 0){
_local3 = inList(DOMAINS_ALLOWED);
};
if (!_local3){
return;
};
mState = STATE_WAITING_PLAY_BUTTON;
if (mAdSystem == AD_SYSTEM_NEWGROUNDS){
_local4 = Class(loaderInfo.applicationDomain.getDefinition("com.mazestopper.Button"));
mPlayButton = DisplayObject(new _local4("Play", 50));
addChild(mPlayButton);
mPlayButton.y = (PROGRESS_Y - 40);
mPlayButton.x = ((PROGRESS_X + (PROGRESS_WIDTH / 2)) - (mPlayButton.width / 2));
mPlayButton.addEventListener(MouseEvent.CLICK, onPlayClick);
} else {
startMainGame();
};
};
};
break;
};
}
public function onPlayClick(_arg1:MouseEvent):void{
mPlayButton.removeEventListener(MouseEvent.CLICK, onPlayClick);
startMainGame();
}
public function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var _local2:Matrix = new Matrix();
_local2.createGradientBox(640, 480, (Math.PI / 2));
var _local3:Sprite = new Sprite();
_local3.graphics.beginGradientFill(GradientType.LINEAR, [136, 0xFF], [1, 1], [0, 0xFF], _local2);
_local3.graphics.drawRect(0, 0, 640, 480);
_local3.graphics.endFill();
addChild(_local3);
mAdSystem = AD_SYSTEM_NEWGROUNDS;
mAdCompleted = true;
var _local4:GameLogo = new GameLogo();
_local4.y = 0;
_local4.x = ((640 - _local4.width) / 2);
addChild(_local4);
var _local5:Bitmap = new Bitmap((new mLogoByClass() as BitmapAsset).bitmapData);
_local5.x = ((640 - _local5.width) / 2);
_local5.y = 60;
addChild(_local5);
NewgroundsAPI.linkAPI(stage);
NewgroundsAPI.setMovieVersion(GAME_VERSION);
NewgroundsAPI.connectMovie(NEWGROUNDS_MOVIE_ID);
var _local6:NGAdObject = new NGAdObject(_local5);
_local6.x = 320;
_local6.y = 275;
addChild(_local6);
mProgressBar = new ProgressBar(PROGRESS_X, PROGRESS_Y, PROGRESS_WIDTH, PROGRESS_HEIGHT);
addChild(mProgressBar);
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
root.loaderInfo.addEventListener(Event.COMPLETE, onLoadingCompleted);
mFrameLoaded = false;
mState = STATE_WAITING_LOAD;
addEventListener(Event.ENTER_FRAME, onFrame);
}
public function inList(_arg1:Array):Boolean{
var _local4:String;
var _local5:int;
var _local2:Boolean;
var _local3:String = stage.loaderInfo.url.split("/")[2];
for (_local4 in _arg1) {
_local5 = _local3.indexOf(_arg1[_local4]);
if ((((_local5 > -1)) && ((_local5 == (_local3.length - _arg1[_local4].length))))){
_local2 = true;
break;
};
};
return (_local2);
}
private function onLoadingProgress(_arg1:Event):void{
var _local2:Number = ((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100);
mProgressBar.Update(_local2);
}
private function onLoadingCompleted(_arg1:Event):void{
root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
root.loaderInfo.removeEventListener(Event.COMPLETE, onLoadingCompleted);
nextFrame();
mFrameLoaded = true;
}
}
}//package
Section 106
//MazeStopper_mLogoByClass (MazeStopper_mLogoByClass)
package {
import mx.core.*;
public class MazeStopper_mLogoByClass extends BitmapAsset {
}
}//package
Section 107
//MazeStopper_mWebsiteLogoClass (MazeStopper_mWebsiteLogoClass)
package {
import mx.core.*;
import flash.utils.*;
public class MazeStopper_mWebsiteLogoClass extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function MazeStopper_mWebsiteLogoClass(){
dataClass = MazeStopper_mWebsiteLogoClass_dataClass;
super();
initialWidth = (1960 / 20);
initialHeight = (1500 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 108
//MazeStopper_mWebsiteLogoClass_dataClass (MazeStopper_mWebsiteLogoClass_dataClass)
package {
import mx.core.*;
public class MazeStopper_mWebsiteLogoClass_dataClass extends ByteArrayAsset {
}
}//package
Section 109
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
public static var bridge:Stage;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
var XML_Loaded:Function = function (_arg1:Event){
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
var _local2:XML = XML(_arg1.target.data);
var _local3:Object = new Object();
var _local4:XMLList = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1:Stage):void{
bridge = _arg1;
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String):void{
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var _root:*;
var overlay:MovieClip;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
var sw:* = bridge.stageWidth;
var sh:* = bridge.stageHeight;
var tw:* = 350;
var th:* = 160;
var mg:* = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
var overlay_x:* = Math.round(((sw - tw) / 2));
var overlay_y:* = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
var close_x:* = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
var blankarea:TextField = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
var header:TextField = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
var header_format:TextFormat = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
var msgtext:TextField = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
var msgtext_format:TextFormat = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
var msgtext_link:TextFormat = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:* = bridge.stageWidth;
var _local5:* = bridge.stageHeight;
var _local6:* = 350;
var _local7:* = 160;
var _local8:* = bridge.root;
var _local9:MovieClip = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
var _local10:TextField = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
var _local11:TextField = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
var _local12:TextFormat = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
var _local13:TextField = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
var _local14:TextFormat = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
var _local15:TextFormat = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package