Section 1
//MD5 (com.meychi.ascrypt3.MD5)
package com.meychi.ascrypt3 {
public class MD5 {
public function MD5(){
super();
}
public function calculate(src:String):String{
return (hex_md5(src));
}
private static function md5_hh(a:Number, b:Number, c:Number, d:Number, x:Number, s:Number, t:Number):Number{
return (md5_cmn(((b ^ c) ^ d), a, b, x, s, t));
}
private static function md5_ff(a:Number, b:Number, c:Number, d:Number, x:Number, s:Number, t:Number):Number{
return (md5_cmn(((b & c) | (~(b) & d)), a, b, x, s, t));
}
private static function md5_cmn(q:Number, a:Number, b:Number, x:Number, s:Number, t:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
private static function binl2hex(binarray:Array):String{
var str:String;
var tab:String;
var i:Number;
str = new String("");
tab = new String("0123456789abcdef");
i = 0;
while (i < (binarray.length * 4)) {
str = (str + (tab.charAt(((binarray[(i >> 2)] >> (((i % 4) * 8) + 4)) & 15)) + tab.charAt(((binarray[(i >> 2)] >> ((i % 4) * 8)) & 15))));
i++;
};
return (str);
}
private static function str2binl(str:String):Array{
var bin:Array;
var mask:Number;
var i:Number;
bin = new Array();
mask = ((1 << 8) - 1);
i = 0;
while (i < (str.length * 8)) {
bin[(i >> 5)] = (bin[(i >> 5)] | ((str.charCodeAt((i / 8)) & mask) << (i % 32)));
i = (i + 8);
};
return (bin);
}
private static function md5_gg(a:Number, b:Number, c:Number, d:Number, x:Number, s:Number, t:Number):Number{
return (md5_cmn(((b & d) | (c & ~(d))), a, b, x, s, t));
}
private static function md5_ii(a:Number, b:Number, c:Number, d:Number, x:Number, s:Number, t:Number):Number{
return (md5_cmn((c ^ (b | ~(d))), a, b, x, s, t));
}
private static function hex_md5(src:String):String{
return (binl2hex(core_md5(str2binl(src), (src.length * 8))));
}
private static function bit_rol(num:Number, cnt:Number):Number{
return (((num << cnt) | (num >>> (32 - cnt))));
}
private static function core_md5(x:Array, len:Number):Array{
var a:Number;
var b:Number;
var c:Number;
var d:Number;
var i:Number;
var olda:Number;
var oldb:Number;
var oldc:Number;
var oldd:Number;
x[(len >> 5)] = (x[(len >> 5)] | (128 << (len % 32)));
x[((((len + 64) >>> 9) << 4) + 14)] = len;
a = 1732584193;
b = -271733879;
c = -1732584194;
d = 271733878;
i = 0;
while (i < x.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5_ff(a, b, c, d, x[(i + 0)], 7, -680876936);
d = md5_ff(d, a, b, c, x[(i + 1)], 12, -389564586);
c = md5_ff(c, d, a, b, x[(i + 2)], 17, 606105819);
b = md5_ff(b, c, d, a, x[(i + 3)], 22, -1044525330);
a = md5_ff(a, b, c, d, x[(i + 4)], 7, -176418897);
d = md5_ff(d, a, b, c, x[(i + 5)], 12, 1200080426);
c = md5_ff(c, d, a, b, x[(i + 6)], 17, -1473231341);
b = md5_ff(b, c, d, a, x[(i + 7)], 22, -45705983);
a = md5_ff(a, b, c, d, x[(i + 8)], 7, 1770035416);
d = md5_ff(d, a, b, c, x[(i + 9)], 12, -1958414417);
c = md5_ff(c, d, a, b, x[(i + 10)], 17, -42063);
b = md5_ff(b, c, d, a, x[(i + 11)], 22, -1990404162);
a = md5_ff(a, b, c, d, x[(i + 12)], 7, 1804603682);
d = md5_ff(d, a, b, c, x[(i + 13)], 12, -40341101);
c = md5_ff(c, d, a, b, x[(i + 14)], 17, -1502002290);
b = md5_ff(b, c, d, a, x[(i + 15)], 22, 1236535329);
a = md5_gg(a, b, c, d, x[(i + 1)], 5, -165796510);
d = md5_gg(d, a, b, c, x[(i + 6)], 9, -1069501632);
c = md5_gg(c, d, a, b, x[(i + 11)], 14, 643717713);
b = md5_gg(b, c, d, a, x[(i + 0)], 20, -373897302);
a = md5_gg(a, b, c, d, x[(i + 5)], 5, -701558691);
d = md5_gg(d, a, b, c, x[(i + 10)], 9, 38016083);
c = md5_gg(c, d, a, b, x[(i + 15)], 14, -660478335);
b = md5_gg(b, c, d, a, x[(i + 4)], 20, -405537848);
a = md5_gg(a, b, c, d, x[(i + 9)], 5, 568446438);
d = md5_gg(d, a, b, c, x[(i + 14)], 9, -1019803690);
c = md5_gg(c, d, a, b, x[(i + 3)], 14, -187363961);
b = md5_gg(b, c, d, a, x[(i + 8)], 20, 1163531501);
a = md5_gg(a, b, c, d, x[(i + 13)], 5, -1444681467);
d = md5_gg(d, a, b, c, x[(i + 2)], 9, -51403784);
c = md5_gg(c, d, a, b, x[(i + 7)], 14, 1735328473);
b = md5_gg(b, c, d, a, x[(i + 12)], 20, -1926607734);
a = md5_hh(a, b, c, d, x[(i + 5)], 4, -378558);
d = md5_hh(d, a, b, c, x[(i + 8)], 11, -2022574463);
c = md5_hh(c, d, a, b, x[(i + 11)], 16, 1839030562);
b = md5_hh(b, c, d, a, x[(i + 14)], 23, -35309556);
a = md5_hh(a, b, c, d, x[(i + 1)], 4, -1530992060);
d = md5_hh(d, a, b, c, x[(i + 4)], 11, 1272893353);
c = md5_hh(c, d, a, b, x[(i + 7)], 16, -155497632);
b = md5_hh(b, c, d, a, x[(i + 10)], 23, -1094730640);
a = md5_hh(a, b, c, d, x[(i + 13)], 4, 681279174);
d = md5_hh(d, a, b, c, x[(i + 0)], 11, -358537222);
c = md5_hh(c, d, a, b, x[(i + 3)], 16, -722521979);
b = md5_hh(b, c, d, a, x[(i + 6)], 23, 76029189);
a = md5_hh(a, b, c, d, x[(i + 9)], 4, -640364487);
d = md5_hh(d, a, b, c, x[(i + 12)], 11, -421815835);
c = md5_hh(c, d, a, b, x[(i + 15)], 16, 530742520);
b = md5_hh(b, c, d, a, x[(i + 2)], 23, -995338651);
a = md5_ii(a, b, c, d, x[(i + 0)], 6, -198630844);
d = md5_ii(d, a, b, c, x[(i + 7)], 10, 1126891415);
c = md5_ii(c, d, a, b, x[(i + 14)], 15, -1416354905);
b = md5_ii(b, c, d, a, x[(i + 5)], 21, -57434055);
a = md5_ii(a, b, c, d, x[(i + 12)], 6, 1700485571);
d = md5_ii(d, a, b, c, x[(i + 3)], 10, -1894986606);
c = md5_ii(c, d, a, b, x[(i + 10)], 15, -1051523);
b = md5_ii(b, c, d, a, x[(i + 1)], 21, -2054922799);
a = md5_ii(a, b, c, d, x[(i + 8)], 6, 1873313359);
d = md5_ii(d, a, b, c, x[(i + 15)], 10, -30611744);
c = md5_ii(c, d, a, b, x[(i + 6)], 15, -1560198380);
b = md5_ii(b, c, d, a, x[(i + 13)], 21, 1309151649);
a = md5_ii(a, b, c, d, x[(i + 4)], 6, -145523070);
d = md5_ii(d, a, b, c, x[(i + 11)], 10, -1120210379);
c = md5_ii(c, d, a, b, x[(i + 2)], 15, 718787259);
b = md5_ii(b, c, d, a, x[(i + 9)], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
i = (i + 16);
};
return (new Array(a, b, c, d));
}
private static function safe_add(x:Number, y:Number):Number{
var lsw:Number;
var msw:Number;
lsw = ((x & 0xFFFF) + (y & 0xFFFF));
msw = (((x >> 16) + (y >> 16)) + (lsw >> 16));
return (((msw << 16) | (lsw & 0xFFFF)));
}
}
}//package com.meychi.ascrypt3
Section 2
//RC4 (com.meychi.ascrypt3.RC4)
package com.meychi.ascrypt3 {
public class RC4 {
private static var mykey:Array = new Array(0xFF);
private static var sbox:Array = new Array(0xFF);
public function RC4(){
super();
}
public function encrypt(src:String, key:String):String{
var mtxt:Array;
var mkey:Array;
var result:Array;
mtxt = strToChars(src);
mkey = strToChars(key);
result = calculate(mtxt, mkey);
return (charsToHex(result));
}
public function decrypt(src:String, key:String):String{
var mtxt:Array;
var mkey:Array;
var result:Array;
mtxt = hexToChars(src);
mkey = strToChars(key);
result = calculate(mtxt, mkey);
return (charsToStr(result));
}
private static function initialize(pwd:Array):void{
var b:Number;
var tempSwap:Number;
var intLength:Number;
var a:Number;
b = 0;
intLength = pwd.length;
a = 0;
a = 0;
while (a <= 0xFF) {
mykey[a] = pwd[(a % intLength)];
sbox[a] = a;
a++;
};
a = 0;
while (a <= 0xFF) {
b = (((b + sbox[a]) + mykey[a]) % 0x0100);
tempSwap = sbox[a];
sbox[a] = sbox[b];
sbox[b] = tempSwap;
a++;
};
}
private static function strToChars(str:String):Array{
var codes:Array;
var i:Number;
codes = new Array();
i = 0;
while (i < str.length) {
codes.push(str.charCodeAt(i));
i++;
};
return (codes);
}
private static function charsToStr(chars:Array):String{
var result:String;
var i:Number;
result = new String("");
i = 0;
while (i < chars.length) {
result = (result + String.fromCharCode(chars[i]));
i++;
};
return (result);
}
private static function charsToHex(chars:Array):String{
var result:String;
var hexes:Array;
var i:Number;
result = new String("");
hexes = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
i = 0;
while (i < chars.length) {
result = (result + (hexes[(chars[i] >> 4)] + hexes[(chars[i] & 15)]));
i++;
};
return (result);
}
private static function calculate(plaintxt:Array, psw:Array):Array{
var i:Number;
var j:Number;
var cipher:Array;
var k:Number;
var temp:Number;
var cipherby:Number;
var a:Number;
var idx:Number;
initialize(psw);
i = 0;
j = 0;
cipher = new Array();
a = 0;
while (a < plaintxt.length) {
i = ((i + 1) % 0x0100);
j = ((j + sbox[i]) % 0x0100);
temp = sbox[i];
sbox[i] = sbox[j];
sbox[j] = temp;
idx = ((sbox[i] + sbox[j]) % 0x0100);
k = sbox[idx];
cipherby = (plaintxt[a] ^ k);
cipher.push(cipherby);
a++;
};
return (cipher);
}
private static function hexToChars(hex:String):Array{
var codes:Array;
var i:Number;
codes = new Array();
i = ((hex.substr(0, 2))=="0x") ? 2 : 0;
while (i < hex.length) {
codes.push(parseInt(hex.substr(i, 2), 16));
i = (i + 2);
};
return (codes);
}
}
}//package com.meychi.ascrypt3
Section 3
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showClickAwayAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = options;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
sendHostProgress = false;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String;
hostname = server.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (hostname);
};
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = options;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object;
_chk = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var optcopy:Object;
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
optcopy = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = options;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (io:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array;
var i:Number;
nameArray = methodName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip;
mc = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var b:Object;
var w:Number;
var h:Number;
var xy:Array;
b = clip.getBounds(clip.root);
w = 0;
h = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array;
var i:Number;
nameArray = objectName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array;
var i:Number;
nameArray = objectName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_w:Number;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var progress:Number;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = options;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (percent:Number):void{
}, progress_override:function (_clip:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
bar_w = ((w - bar.x) - 10);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number;
p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
progress = Math.min(1, options.progress_override(clip));
f = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object;
_chk = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _clip:Object;
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var clip_total:Number;
var clip_loaded:Number;
var clip_progress:Number;
var clip_pcnt:Number;
var ad_pcnt:Number;
var _inside:Object;
var pcnt:Number;
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_clip = this.parent.parent.root;
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
clip_total = _clip.loaderInfo.bytesTotal;
clip_loaded = _clip.loaderInfo.bytesLoaded;
clip_progress = Math.min(1, options.progress_override(_clip));
if (clip_progress == 1){
complete = true;
};
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
clip_pcnt = ((100 * clip_loaded) / clip_total);
if (!isNaN(clip_progress)){
clip_pcnt = (100 * clip_progress);
};
ad_pcnt = ((100 * elapsed) / chk.ad_msec);
_inside = this._mochiad_bar._inside;
pcnt = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (unloaded){
MochiAd.unload(_clip);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var f:Function;
var mc = mc;
f = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 4
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const LOGGED_IN:String = "LoggedIn";
public static const STORE_ITEMS:String = "StoreItems";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const ITEM_NEW:String = "ItemNew";
public static const USER_INFO:String = "UserInfo";
public static const IO_ERROR:String = "IOError";
public static const ITEM_OWNED:String = "ItemOwned";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOW:String = "LoginShow";
public static const STORE_SHOW:String = "StoreShow";
public static const PROFILE_HIDE:String = "ProfileHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiCoins(){
super();
}
public static function showItem(options:Object=null):void{
if (((!(options)) || (!((typeof(options.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:options}, null, null);
}
public static function saveUserProperties(properties:Object):void{
MochiServices.send("coins_saveUserProperties", properties);
}
public static function triggerEvent(eventType:String, args:Object):void{
_dispatcher.triggerEvent(eventType, args);
}
public static function showLoginWidget(options:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:options});
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(options:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:options}, null, null);
}
public static function addEventListener(eventType:String, delegate:Function):void{
_dispatcher.addEventListener(eventType, delegate);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function removeEventListener(eventType:String, delegate:Function):void{
_dispatcher.removeEventListener(eventType, delegate);
}
public static function showVideo(options:Object=null):void{
if (((!(options)) || (!((typeof(options.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:options}, null, null);
}
}
}//package mochi.as3
Section 5
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(digit:Number=0, index:uint=0):void{
super();
Encoder = 0;
setValue(digit, index);
}
public function set value(v:Number):void{
setValue(v);
}
public function reencode():void{
var newEncode:uint;
newEncode = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (newEncode ^ Encoder));
Encoder = newEncode;
}
public function toString():String{
var s:String;
s = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
s = (s + Sibling.toString());
};
return (s);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(digit:Number=0, index:uint=0):void{
var s:String;
s = digit.toString();
var _temp1 = index;
index = (index + 1);
Fragment = (s.charCodeAt(_temp1) ^ Encoder);
if (index < s.length){
Sibling = new MochiDigits(digit, index);
} else {
Sibling = null;
};
reencode();
}
public function addValue(inc:Number):void{
value = (value + inc);
}
}
}//package mochi.as3
Section 6
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
super();
eventTable = {};
}
public function triggerEvent(event:String, args:Object):void{
var i:Object;
if (eventTable[event] == undefined){
return;
};
for (i in eventTable[event]) {
var _local6 = eventTable[event];
_local6[i](args);
};
}
public function removeEventListener(event:String, delegate:Function):void{
var s:Object;
if (eventTable[event] == undefined){
eventTable[event] = [];
return;
};
for (s in eventTable[event]) {
if (eventTable[event][s] != delegate){
} else {
eventTable[event].splice(Number(s), 1);
};
};
}
public function addEventListener(event:String, delegate:Function):void{
removeEventListener(event, delegate);
eventTable[event].push(delegate);
}
}
}//package mochi.as3
Section 7
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public function MochiEvents(){
super();
}
public static function addEventListener(eventType:String, delegate:Function):void{
_dispatcher.addEventListener(eventType, delegate);
}
public static function removeEventListener(eventType:String, delegate:Function):void{
_dispatcher.removeEventListener(eventType, delegate);
}
public static function startSession(achievementID:String):void{
MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
public static function triggerEvent(eventType:String, args:Object):void{
_dispatcher.triggerEvent(eventType, args);
}
public static function setNotifications(clip:MovieClip, style:Object):void{
var args:Object;
var s:Object;
args = {};
for (s in style) {
args[s] = style[s];
};
args.clip = clip;
MochiServices.send("events_setNotifications", args, null, null);
}
public static function endGame():void{
var delta:Number;
delta = (new Date().time - gameStart);
trigger("end_game", {time:delta});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(kind:String, obj:Object=null):void{
if (obj == null){
obj = {};
} else {
if (obj["kind"] != undefined){
trace("WARNING: optional arguements package contains key 'id', it will be overwritten");
obj["kind"] = kind;
};
};
MochiServices.send("events_triggerEvent", {eventObject:obj}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var delta:Number;
delta = (new Date().time - levelStart);
trigger("end_level", {time:delta});
}
}
}//package mochi.as3
Section 8
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public function MochiScores(){
super();
}
public static function showLeaderboard(options:Object=null):void{
var n:Number;
var options = options;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(callbackObj:Object, callbackMethod:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
public static function requestList(callbackObj:Object, callbackMethod:Object=null):void{
MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
public static function scoresArrayToObjects(scores:Object):Object{
var so:Object;
var i:Number;
var j:Number;
var o:Object;
var row_obj:Object;
var item:String;
var param:String;
so = {};
for (item in scores) {
if (typeof(scores[item]) == "object"){
if (((!((scores[item].cols == null))) && (!((scores[item].rows == null))))){
so[item] = [];
o = scores[item];
j = 0;
while (j < o.rows.length) {
row_obj = {};
i = 0;
while (i < o.cols.length) {
row_obj[o.cols[i]] = o.rows[j][i];
i++;
};
so[item].push(row_obj);
j++;
};
} else {
so[item] = {};
for (param in scores[item]) {
so[item][param] = scores[item][param];
};
};
} else {
so[item] = scores[item];
};
};
return (so);
}
public static function submit(score:Number, name:String, callbackObj:Object=null, callbackMethod:Object=null):void{
score = Number(score);
if (isNaN(score)){
trace((("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((score == Number.NEGATIVE_INFINITY)) || ((score == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(score) != score){
trace((("WARNING: Submitted score '" + String(score)) + "' will be truncated"));
};
score = Number(score);
};
};
MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
public static function onClose(args:Object=null):void{
if (((((args) && ((args.error == true)))) && (onErrorHandler))){
if (args.errorCode == null){
args.errorCode = "IOError";
};
onErrorHandler(args.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(boardID:String):void{
MochiServices.warnID(boardID, true);
MochiScores.boardID = boardID;
MochiServices.send("scores_setBoardID", {boardID:boardID});
}
}
}//package mochi.as3
Section 9
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public function MochiServices(){
super();
}
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(pkg:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = pkg;
cb = pkg.callbackID;
cblst = _clip._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
method.apply(obj, pkg.args);
//unresolved jump
var _slot1 = error;
trace(((("Error invoking callback method '" + methodName) + "': ") + _slot1.toString()));
} else {
if (obj != null){
obj(pkg.args);
//unresolved jump
var _slot1 = error;
trace(("Error invoking method on object: " + _slot1.toString()));
};
};
delete _clip._callbacks[cb];
}
public static function get childClip():Object{
return (_clip);
}
public static function send(methodName:String, args:Object=null, callbackObject:Object=null, callbackMethod:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName));
handleError(args, callbackObject, callbackMethod);
flush(true);
return;
};
_clip._queue.push({methodName:methodName, args:args, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_clip._nextcallbackID++;
};
};
}
private static function init(id:String, clip:Object):void{
_id = id;
if (clip != null){
_container = clip;
loadCommunicator(id, _container);
};
}
private static function clickMovie(url:String, cb:Function):MovieClip{
var avm1_bytecode:Array;
var b:int;
var header:Array;
var footer:Array;
var mc:MovieClip;
var lc:LocalConnection;
var lc_name:String;
var ba:ByteArray;
var cpool:ByteArray;
var actionLength:uint;
var fileLength:uint;
var loader:Loader;
avm1_bytecode = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
header = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
footer = [0, 64, 0, 0, 0];
mc = new MovieClip();
lc = new LocalConnection();
lc_name = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
lc = new LocalConnection();
mc.lc = lc;
mc.click = cb;
lc.client = mc;
lc.connect(lc_name);
ba = new ByteArray();
cpool = new ByteArray();
cpool.endian = Endian.LITTLE_ENDIAN;
cpool.writeShort(1);
cpool.writeUTFBytes(((url + " ") + lc_name));
cpool.writeByte(0);
actionLength = ((avm1_bytecode.length + cpool.length) + 4);
fileLength = (actionLength + 35);
ba.endian = Endian.LITTLE_ENDIAN;
ba.writeUTFBytes("FWS");
ba.writeByte(8);
ba.writeUnsignedInt(fileLength);
for each (b in header) {
ba.writeByte(b);
};
ba.writeUnsignedInt(actionLength);
ba.writeByte(136);
ba.writeShort(cpool.length);
ba.writeBytes(cpool);
for each (b in avm1_bytecode) {
ba.writeByte(b);
};
for each (b in footer) {
ba.writeByte(b);
};
loader = new Loader();
loader.loadBytes(ba);
mc.addChild(loader);
return (mc);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(url:String, burl:String, btn:DisplayObjectContainer, onClick:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = url;
var burl = burl;
var btn = btn;
var onClick = onClick;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (url:String):void{
var rect:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(url, onClick);
rect = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = rect.x;
avm1Click.y = rect.y;
avm1Click.scaleX = (0.01 * rect.width);
avm1Click.scaleY = (0.01 * rect.height);
};
err = function (ev:Object):void{
netup = false;
ev.target.removeEventListener(ev.type, arguments.callee);
setURL(burl);
};
complete = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function warnID(bid:String, leaderboard:Boolean):void{
var i:Number;
bid = bid.toLowerCase();
if (bid.length != 16){
trace((("WARNING: " + (leaderboard) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (bid == "1e113c7239048b3f"){
if (leaderboard){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (bid == "84993a1de4031cd8"){
if (leaderboard){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
i = 0;
while (i < bid.length) {
switch (bid.charAt(i)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + bid));
return;
};
i++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
_mochiLocalConnection.close();
//unresolved jump
var _slot1 = error;
};
if (_timer != null){
_timer.stop();
//unresolved jump
var _slot1 = error;
};
}
public static function allowDomains(server:String):String{
var hostname:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (server.indexOf("http://") != -1){
hostname = server.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(hostname);
Security.allowInsecureDomain(hostname);
};
};
return (hostname);
}
public static function getVersion():String{
return ("3.3 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(error:Boolean):void{
var request:Object;
var callback:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
request = _clip._queue.shift();
callback = null;
if (request != null){
if (request.callbackID != null){
callback = _clip._callbacks[request.callbackID];
};
delete _clip._callbacks[request.callbackID];
if (((error) && (!((callback == null))))){
handleError(request.args, callback.callbackObject, callback.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(pkg:Object):void{
var target:String;
var event:String;
target = pkg.target;
event = pkg.event;
switch (target){
case "events":
MochiEvents.triggerEvent(pkg.event, pkg.args);
break;
case "coins":
MochiCoins.triggerEvent(pkg.event, pkg.args);
break;
case "sync":
servicesSync.triggerEvent(pkg.event, pkg.args);
break;
};
}
private static function urlOptions(clip:Object):Object{
var opts:Object;
var options:String;
var pairs:Array;
var i:Number;
var kv:Array;
opts = {};
if (clip.stage){
options = clip.stage.loaderInfo.parameters.mochiad_options;
} else {
options = clip.loaderInfo.parameters.mochiad_options;
};
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
opts[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
return (opts);
}
public static function setContainer(container:Object=null, doAdd:Boolean=true):void{
if (container != null){
if ((container is Sprite)){
_container = container;
};
};
if (doAdd){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(args:Object, callbackObject:Object, callbackMethod:Object):void{
var args = args;
var callbackObject = callbackObject;
var callbackMethod = callbackMethod;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
var _local5 = callbackObject;
_local5[callbackMethod](args);
//unresolved jump
var _slot1 = error;
} else {
if (callbackMethod != null){
callbackMethod.apply(args);
//unresolved jump
var _slot1 = error;
};
};
};
}
private static function loadError(ev:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(clip:Object):void{
var loader:Loader;
var mochiLCURL:String;
var req:URLRequest;
var complete:Function;
var clip = clip;
loader = new Loader();
mochiLCURL = (_servURL + _mochiLC);
req = new URLRequest(mochiLCURL);
complete = function (ev:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (args:Object):void{
MochiServices.comChannelName = args.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(val:String):void{
if (val != null){
if (val.length > 3){
_sendChannelName = (val + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(id:String, clip:Object):MovieClip{
var clipname:String;
var servicesURL:String;
var req:URLRequest;
var vars:URLVariables;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servURL){
_servURL = urlOptions(clip).servURL;
};
servicesURL = (_servURL + _services);
if (urlOptions(clip).servicesURL){
servicesURL = urlOptions(clip).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
req = new URLRequest(servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
vars.api_version = getVersion();
if (widget){
vars.widget = true;
};
req.data = vars;
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(id:String, clip:Object, onError:Object=null):void{
var id = id;
var clip = clip;
var onError = onError;
warnID(id, false);
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (errorCode:String):void{
trace(errorCode);
};
};
};
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number, doAdd:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = parent;
var name = name;
var depth = depth;
var doAdd = doAdd;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
parent[name] = mc;
//unresolved jump
var _slot1 = e;
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
mc["_name"] = name;
return (mc);
}
public static function bringToTop(e:Event=null):void{
var e = e;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
//unresolved jump
var _slot1 = errorObject;
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
}
public static function connectWait(e:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 10
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
super();
_syncContainer = {};
}
public function triggerEvent(eventType:String, args:Object):void{
switch (eventType){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[args.name] = args.value;
break;
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(name){
return (_syncContainer[name]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(name, value):void{
var n:String;
if (_syncContainer[name] == value){
return;
};
n = name.toString();
_syncContainer[n] = value;
MochiServices.send("sync_propUpdate", {name:n, value:value});
}
}
}//package mochi.as3
Section 11
//biker_instrucoes_left_61 (motorEscape_fla.biker_instrucoes_left_61)
package motorEscape_fla {
import flash.display.*;
public dynamic class biker_instrucoes_left_61 extends MovieClip {
public var m_bstBoost:MovieClip;
public function biker_instrucoes_left_61(){
super();
}
}
}//package motorEscape_fla
Section 12
//biker_instrucoes_right_47 (motorEscape_fla.biker_instrucoes_right_47)
package motorEscape_fla {
import flash.display.*;
public dynamic class biker_instrucoes_right_47 extends MovieClip {
public var m_bstBoost:MovieClip;
public function biker_instrucoes_right_47(){
super();
}
}
}//package motorEscape_fla
Section 13
//CongratsDialog_148 (motorEscape_fla.CongratsDialog_148)
package motorEscape_fla {
import flash.display.*;
import flash.text.*;
public dynamic class CongratsDialog_148 extends MovieClip {
public var m_btnHighscores:SimpleButton;
public var m_txtScore:TextField;
public var m_btnQuit:SimpleButton;
public function CongratsDialog_148(){
super();
}
}
}//package motorEscape_fla
Section 14
//enter_name_39 (motorEscape_fla.enter_name_39)
package motorEscape_fla {
import flash.display.*;
import flash.text.*;
public dynamic class enter_name_39 extends MovieClip {
public var dtName:TextField;
public function enter_name_39(){
super();
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package motorEscape_fla
Section 15
//gameLoading_118 (motorEscape_fla.gameLoading_118)
package motorEscape_fla {
import flash.display.*;
public dynamic class gameLoading_118 extends MovieClip {
public var m_mcLoading:MovieClip;
public function gameLoading_118(){
super();
}
}
}//package motorEscape_fla
Section 16
//levelStart1_120 (motorEscape_fla.levelStart1_120)
package motorEscape_fla {
import flash.display.*;
public dynamic class levelStart1_120 extends MovieClip {
public function levelStart1_120(){
super();
addFrameScript(0, frame1, 19, frame20, 37, frame38);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame38(){
stop();
}
}
}//package motorEscape_fla
Section 17
//levelStart2_122 (motorEscape_fla.levelStart2_122)
package motorEscape_fla {
import flash.display.*;
public dynamic class levelStart2_122 extends MovieClip {
public function levelStart2_122(){
super();
addFrameScript(19, frame20, 37, frame38);
}
function frame20(){
stop();
}
function frame38(){
stop();
}
}
}//package motorEscape_fla
Section 18
//levelStart3_124 (motorEscape_fla.levelStart3_124)
package motorEscape_fla {
import flash.display.*;
public dynamic class levelStart3_124 extends MovieClip {
public function levelStart3_124(){
super();
addFrameScript(19, frame20, 37, frame38);
}
function frame20(){
stop();
}
function frame38(){
stop();
}
}
}//package motorEscape_fla
Section 19
//levelStart4_126 (motorEscape_fla.levelStart4_126)
package motorEscape_fla {
import flash.display.*;
public dynamic class levelStart4_126 extends MovieClip {
public function levelStart4_126(){
super();
addFrameScript(19, frame20, 37, frame38);
}
function frame20(){
stop();
}
function frame38(){
stop();
}
}
}//package motorEscape_fla
Section 20
//levelStart5_128 (motorEscape_fla.levelStart5_128)
package motorEscape_fla {
import flash.display.*;
public dynamic class levelStart5_128 extends MovieClip {
public function levelStart5_128(){
super();
addFrameScript(19, frame20, 38, frame39);
}
function frame20(){
stop();
}
function frame39(){
stop();
}
}
}//package motorEscape_fla
Section 21
//Lives_112 (motorEscape_fla.Lives_112)
package motorEscape_fla {
import flash.display.*;
public dynamic class Lives_112 extends MovieClip {
public function Lives_112(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 22
//logo_overplay_29 (motorEscape_fla.logo_overplay_29)
package motorEscape_fla {
import flash.display.*;
public dynamic class logo_overplay_29 extends MovieClip {
public var mcFadeOut:MovieClip;
public function logo_overplay_29(){
super();
addFrameScript(82, frame83);
}
function frame83(){
stop();
}
}
}//package motorEscape_fla
Section 23
//mc_Enemy_mov_97 (motorEscape_fla.mc_Enemy_mov_97)
package motorEscape_fla {
import flash.display.*;
public dynamic class mc_Enemy_mov_97 extends MovieClip {
public var mcEnemyLateralAnim:MovieClip;
public function mc_Enemy_mov_97(){
super();
addFrameScript(0, frame1, 11, frame12);
}
function frame12(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 24
//mcAnim_Enemy_98 (motorEscape_fla.mcAnim_Enemy_98)
package motorEscape_fla {
import flash.display.*;
import src.ingame.*;
public dynamic class mcAnim_Enemy_98 extends MovieClip {
public var mcEnemyInst:CEnemy;
public function mcAnim_Enemy_98(){
super();
}
}
}//package motorEscape_fla
Section 25
//mcBikeFall_92 (motorEscape_fla.mcBikeFall_92)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcBikeFall_92 extends MovieClip {
public var mcGirl:MovieClip;
public function mcBikeFall_92(){
super();
}
}
}//package motorEscape_fla
Section 26
//mcBikeHitObstacle_96 (motorEscape_fla.mcBikeHitObstacle_96)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcBikeHitObstacle_96 extends MovieClip {
public var mcGirl:MovieClip;
public function mcBikeHitObstacle_96(){
super();
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package motorEscape_fla
Section 27
//mcBikeMove_84 (motorEscape_fla.mcBikeMove_84)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcBikeMove_84 extends MovieClip {
public var mcGirl:MovieClip;
public var bikeHitArea:MovieClip;
public var m_bstBoost:MovieClip;
public function mcBikeMove_84(){
super();
}
}
}//package motorEscape_fla
Section 28
//mcFade_30 (motorEscape_fla.mcFade_30)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcFade_30 extends MovieClip {
public function mcFade_30(){
super();
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package motorEscape_fla
Section 29
//mcGirls_85 (motorEscape_fla.mcGirls_85)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcGirls_85 extends MovieClip {
public function mcGirls_85(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 30
//mcItemBarrel_9 (motorEscape_fla.mcItemBarrel_9)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcItemBarrel_9 extends MovieClip {
public function mcItemBarrel_9(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 31
//mcItemBones_11 (motorEscape_fla.mcItemBones_11)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcItemBones_11 extends MovieClip {
public function mcItemBones_11(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 32
//mcItemCone_12 (motorEscape_fla.mcItemCone_12)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcItemCone_12 extends MovieClip {
public function mcItemCone_12(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 33
//mcItemMissile_13 (motorEscape_fla.mcItemMissile_13)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcItemMissile_13 extends MovieClip {
public function mcItemMissile_13(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 34
//mcItemRoadBlock_14 (motorEscape_fla.mcItemRoadBlock_14)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcItemRoadBlock_14 extends MovieClip {
public function mcItemRoadBlock_14(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 35
//mcLevelBg_79 (motorEscape_fla.mcLevelBg_79)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcLevelBg_79 extends MovieClip {
public function mcLevelBg_79(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 36
//mcLevelChange_117 (motorEscape_fla.mcLevelChange_117)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcLevelChange_117 extends MovieClip {
public function mcLevelChange_117(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 37
//mcLevelSplash_119 (motorEscape_fla.mcLevelSplash_119)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcLevelSplash_119 extends MovieClip {
public var dialog4:MovieClip;
public var dialog3:MovieClip;
public var mcGo:MovieClip;
public var dialog1:MovieClip;
public var dialog5:MovieClip;
public var dialog2:MovieClip;
public function mcLevelSplash_119(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 38
//mcLoadingAnim_6 (motorEscape_fla.mcLoadingAnim_6)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcLoadingAnim_6 extends MovieClip {
public function mcLoadingAnim_6(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 39
//mcLoseMsg_133 (motorEscape_fla.mcLoseMsg_133)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcLoseMsg_133 extends MovieClip {
public var enemyDlg:MovieClip;
public function mcLoseMsg_133(){
super();
}
}
}//package motorEscape_fla
Section 40
//mcRoadMap_113 (motorEscape_fla.mcRoadMap_113)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcRoadMap_113 extends MovieClip {
public var counter:MovieClip;
public function mcRoadMap_113(){
super();
}
}
}//package motorEscape_fla
Section 41
//mcScoreCounter_115 (motorEscape_fla.mcScoreCounter_115)
package motorEscape_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcScoreCounter_115 extends MovieClip {
public var scoreTxt:TextField;
public function mcScoreCounter_115(){
super();
}
}
}//package motorEscape_fla
Section 42
//mcSound_45 (motorEscape_fla.mcSound_45)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcSound_45 extends MovieClip {
public function mcSound_45(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 43
//mcVai_130 (motorEscape_fla.mcVai_130)
package motorEscape_fla {
import flash.display.*;
public dynamic class mcVai_130 extends MovieClip {
public function mcVai_130(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 44
//Mostrador_114 (motorEscape_fla.Mostrador_114)
package motorEscape_fla {
import flash.display.*;
public dynamic class Mostrador_114 extends MovieClip {
public function Mostrador_114(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 45
//sounds_lib_26 (motorEscape_fla.sounds_lib_26)
package motorEscape_fla {
import flash.display.*;
public dynamic class sounds_lib_26 extends MovieClip {
public function sounds_lib_26(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package motorEscape_fla
Section 46
//TryAgainDialog_142 (motorEscape_fla.TryAgainDialog_142)
package motorEscape_fla {
import flash.display.*;
import flash.text.*;
public dynamic class TryAgainDialog_142 extends MovieClip {
public var m_btnHighscores:SimpleButton;
public var m_mcWaiting:MovieClip;
public var m_btnRetryNo:SimpleButton;
public var m_txtScore:TextField;
public var m_mcAdWindow:MovieClip;
public var m_btnRetryYes:SimpleButton;
public function TryAgainDialog_142(){
super();
}
}
}//package motorEscape_fla
Section 47
//CBoost (src.ingame.CBoost)
package src.ingame {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import src.*;
public class CBoost {
private var animControl:CAnimControl;
public var mcBoost:MovieClip;
private var m_bBoostOn:Boolean;
private var m_iBoostTime:int;
private var m_tmrBoost:Timer;
public function CBoost(newMC:MovieClip){
super();
mcBoost = newMC;
animControl = new CAnimControl();
animControl.onNextRender(mcBoost, init);
}
function turnOn(){
mcBoost.visible = true;
m_bBoostOn = true;
if (m_tmrBoost.running){
m_tmrBoost.reset();
};
m_tmrBoost.start();
}
function isOn():Boolean{
return (m_bBoostOn);
}
function onEnd(event:TimerEvent){
turnOff();
}
function init(){
m_bBoostOn = false;
mcBoost.visible = false;
m_iBoostTime = 5;
m_tmrBoost = new Timer((m_iBoostTime * 1000), 1);
m_tmrBoost.addEventListener(TimerEvent.TIMER, onEnd);
}
function turnOff(){
mcBoost.visible = false;
m_bBoostOn = false;
m_tmrBoost.reset();
}
function update(){
if (m_bBoostOn){
if (!mcBoost.visible){
turnOn();
};
};
}
}
}//package src.ingame
Section 48
//CCutsceneMgr (src.ingame.CCutsceneMgr)
package src.ingame {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import src.*;
public class CCutsceneMgr extends MovieClip {
const loseCutsceneDelay:int = 200;
const nGo:int = 3;
public var m_mcLevelStart:MovieClip;
var currCutscene:int;
public var m_tutScreen:CTutorial;
public var animControl:CAnimControl;
var funcAfterCutscene:Function;
var dialogState:int;
public var m_lvLevel:CLevel;
var mcCurrDialog:MovieClip;
public var m_mcLoseGame:MovieClip;
var delayTimer:Timer;
var dialogPaused:Boolean;
public var m_mcLevelChange:MovieClip;
var currGo:int;
static const Cutscene_Lose = 4;
static const Cutscene_Tutorial = 2;
static const Cutscene_Win = 3;
static const Cutscene_LevelStart = 1;
static const Cutscene_ChangeLevel = 0;
public function CCutsceneMgr(){
super();
addFrameScript(0, frame1);
animControl = new CAnimControl();
animControl.onNextRender(this, loopInit);
}
private function startTutorialAnim(){
m_lvLevel.m_gmGame.visible = true;
m_tutScreen.m_cutCutsceneMgr = this;
}
private function onGoMsgUpdate(event:Event){
if (m_mcLevelStart.mcGo.currentFrame < m_mcLevelStart.mcGo.totalFrames){
m_mcLevelStart.mcGo.nextFrame();
} else {
if (currGo > 0){
currGo--;
m_mcLevelStart.mcGo.gotoAndStop(1);
} else {
removeEventListener(Event.ENTER_FRAME, onGoMsgUpdate);
visible = false;
};
};
}
public function afterLevelLose(evt:MouseEvent){
m_lvLevel.removeEventListener(MouseEvent.CLICK, afterLevelLose);
gotoAndStop(1);
funcAfterCutscene();
}
private function startLevelWinAnim(){
}
private function startLevelStartAnim(){
m_mcLevelStart.gotoAndStop(("level" + (CGame.m_gmGame.m_iCurrLevel + 1)));
animControl.onNextRenderWait(this, afterDialogFrameChange);
}
private function showGoMsg(){
m_mcLevelStart.gotoAndStop("go");
animControl.onNextRenderWait(m_mcLevelStart, onGoMsgStart);
}
private function afterCutsceneStartDelay(){
var validCS:Boolean;
validCS = true;
switch (currCutscene){
case Cutscene_ChangeLevel:
gotoAndStop("changeLevel");
break;
case Cutscene_LevelStart:
gotoAndStop("levelStart");
break;
case Cutscene_Win:
gotoAndStop("winGame");
break;
case Cutscene_Lose:
gotoAndStop("loseGame");
break;
case Cutscene_Tutorial:
gotoAndStop("tutorial");
break;
default:
validCS = false;
break;
};
if (validCS){
animControl.onNextRender(this, afterCSFrameChange);
visible = true;
};
}
private function afterCSFrameChange(){
switch (currCutscene){
case Cutscene_ChangeLevel:
startLevelChangeAnim();
break;
case Cutscene_LevelStart:
startLevelStartAnim();
break;
case Cutscene_Win:
startLevelWinAnim();
break;
case Cutscene_Lose:
startLevelLoseAnim();
break;
case Cutscene_Tutorial:
startTutorialAnim();
break;
default:
break;
};
}
private function afterDialogFrameChange(){
mcCurrDialog = m_mcLevelStart[("dialog" + (CGame.m_gmGame.m_iCurrLevel + 1))];
visible = true;
addEventListener(Event.ENTER_FRAME, updateDialog);
}
private function onGoMsgStart(){
m_lvLevel.smSoundMgr.playSfx(CSoundMgr.Sfx_Go, false);
currGo = nGo;
addEventListener(Event.ENTER_FRAME, onGoMsgUpdate);
}
private function onLevelInEnd(){
visible = false;
}
private function unpauseDialog(event:Event){
if (dialogPaused){
dialogPaused = false;
mcCurrDialog.nextFrame();
addEventListener(Event.ENTER_FRAME, updateDialog);
m_lvLevel.removeEventListener(MouseEvent.CLICK, unpauseDialog);
};
}
private function updateDialog(event:Event){
if (!dialogPaused){
if ((((mcCurrDialog.currentLabel == "girlTalk")) || ((mcCurrDialog.currentLabel == "enemyTalk")))){
removeEventListener(Event.ENTER_FRAME, updateDialog);
dialogPaused = true;
m_lvLevel.addEventListener(MouseEvent.CLICK, unpauseDialog);
if (mcCurrDialog.currentLabel == "girlTalk"){
m_lvLevel.initEgoLevel();
};
} else {
if (mcCurrDialog.currentLabel == "end"){
removeEventListener(Event.ENTER_FRAME, updateDialog);
showGoMsg();
funcAfterCutscene();
} else {
mcCurrDialog.nextFrame();
};
};
};
}
private function startLevelLoseAnim(){
m_mcLoseGame.gotoAndStop(("level" + (CGame.m_gmGame.m_iCurrLevel + 1)));
animControl.onNextRenderWait(m_mcLoseGame, onLevelLoseStart);
}
private function startLevelChangeAnim(){
m_lvLevel.m_gmGame.visible = true;
m_mcLevelChange.gotoAndStop("outStart");
animControl.onLabel(m_mcLevelChange, "outEnd", funcAfterCutscene);
}
function showCutscene(cutsceneType:int, funcAfter:Function){
funcAfterCutscene = funcAfter;
currCutscene = cutsceneType;
animControl.onTimerEnd(delayTimer, afterCutsceneStartDelay);
}
private function loopInit(){
m_lvLevel = CLevel(parent);
delayTimer = new Timer(loseCutsceneDelay, 1);
currCutscene = 0;
visible = false;
}
function frame1(){
stop();
}
public function startLevelInAnim(){
m_mcLevelChange.gotoAndStop("inStart");
animControl.onLabel(m_mcLevelChange, "inEnd", onLevelInEnd);
}
private function onLevelLoseEnd(){
trace("onLevelLoseEnd");
m_mcLoseGame.enemyDlg.stop();
m_lvLevel.addEventListener(MouseEvent.CLICK, afterLevelLose);
}
private function onLevelLoseStart(){
animControl.onLabel(m_mcLoseGame.enemyDlg, "end", onLevelLoseEnd);
}
}
}//package src.ingame
Section 49
//CEgo (src.ingame.CEgo)
package src.ingame {
import flash.events.*;
import flash.display.*;
import src.*;
import flash.geom.*;
public class CEgo extends MovieClip implements IRoadObject {
const startY:int = 251;
const startX:int = 300;
private const m_iEnemyDistDeltaY:int = 40;
const TintType_Reverse:int = 1;
const TintType_Normal:int = 0;
private const m_iEnemyDistanceMax:int = 3;
const m_iHitTintTotalTime:int = 1;
public var m_gmGame:CGame;
public var m_mcCurrMC:MovieClip;
private var animControl:CAnimControl;
var centerFrame:Number;
public var m_mcBikeMove:MovieClip;
var positionFunction:Function;
private var bikeSpeedX;
var bikeSpeedY:Number;
public var m_lvLevel:CLevel;
var lastFrame:int;
private var bikeMaxSpeedX:int;
private var bikeMaxSpeedY:int;
public var m_enEnemy:CEnemy;
var egoTint:ColorTransform;
private var m_bstBoost:CBoost;
public var m_mcBikeHitObstacle:MovieClip;
var autoMoveUp:Boolean;
var m_iTintCurrTime:int;
var active;
var invencible:Boolean;
private var m_iMovingSide:int;
private var m_bChangingAnim:Boolean;
private var currState:int;
var m_iTintTotalTime:int;
var afterAutoMoved:Function;
private var m_iEnemyDistance:int;
public var m_mcBikeFall:MovieClip;
private var bikeSpeedFactor:Number;
var m_iCurrTintType;
var autoMoveFinalX;
var autoMoveFinalY:Number;
var egoHitArea:Rectangle;
public static const ESt_hitObstacle:int = 2;
public static const ESt_move:int = 0;
private static const autoMoveTolerance:Number = 3;
public static const side_Right:int = 1;
public static const side_Left:int = 0;
private static const startScale:Number = 0.366;
private static const minScale:Number = 0.005;
public static const ESt_fall:int = 1;
public function CEgo(){
super();
addFrameScript(0, frame1);
trace("[CEgo] Constructor");
m_bstBoost = new CBoost(m_mcBikeMove.m_bstBoost);
animControl = new CAnimControl();
animControl.onNextRender(this, loopInit);
positionFunction = followMouse;
}
public function updateScale(){
scaleX = (scaleY = (minScale + ((y * (startScale - minScale)) / startY)));
}
function setGirl(level:int){
if (level == -1){
m_mcCurrMC.mcGirl.visible = false;
} else {
m_mcCurrMC.mcGirl.gotoAndStop(("level" + (level + 1)));
m_mcCurrMC.mcGirl.visible = true;
};
}
function onCollision(item:CScreenItem){
var itemType:int;
itemType = m_lvLevel.m_arrItemsGroups[item.m_iType];
switch (itemType){
case CItem.ItGroup_Obstacle:
onObstCollision();
break;
case CItem.ItGroup_Bonus:
onBonusCollision(item.m_iType);
break;
case CItem.ItGroup_Special:
onSpecialCollision();
break;
default:
break;
};
}
public function holdStill(){
bikeSpeedX = 0;
bikeSpeedY = 0;
}
private function onHitObstacleAnimStart(){
setState(ESt_hitObstacle);
m_bChangingAnim = false;
startBlinkAnim((m_iHitTintTotalTime * 2));
}
function startTintAnim(duration:int, type:int){
m_iTintCurrTime = 0;
m_iTintTotalTime = duration;
m_iCurrTintType = type;
egoTint = null;
egoTint = new ColorTransform();
egoTint.redMultiplier = 1;
egoTint.greenMultiplier = 1;
egoTint.blueMultiplier = 1;
egoTint.alphaMultiplier = 1;
}
function calculateBikeSpeedX(dist:Number){
bikeSpeedX = (dist * bikeSpeedFactor);
bikeSpeedX = Math.max(Math.min(bikeSpeedX, bikeMaxSpeedX), -(bikeMaxSpeedX));
}
public function autoMove(){
var distX:Number;
var distY:Number;
if (currentLabel != "move"){
return;
};
distX = (autoMoveFinalX - x);
distY = (autoMoveFinalY - y);
if ((((Math.abs(distX) < autoMoveTolerance)) && ((Math.abs(distY) < autoMoveTolerance)))){
this.x = autoMoveFinalX;
this.y = autoMoveFinalY;
endAutoMove();
afterAutoMoved();
} else {
calculateBikeSpeedX(distX);
calculateBikeSpeedY(distY);
this.x = (this.x + bikeSpeedX);
this.y = (this.y + bikeSpeedY);
};
updateScale();
}
function calculateBikeSpeedY(dist:Number){
bikeSpeedY = (dist * bikeSpeedFactor);
bikeSpeedY = Math.max(Math.min(bikeSpeedY, bikeMaxSpeedY), -(bikeMaxSpeedY));
}
private function endAutoMove(){
setSpeedX(0);
positionFunction = holdStill;
}
function center(){
m_bChangingAnim = true;
gotoAndStop("move");
animControl.onNextRender(this, onMoveFirstFrame);
}
function setLevel(level:int){
active = true;
visible = true;
setState(ESt_move);
}
private function onDeathAnimStart(event:Event){
removeEventListener(Event.RENDER, onDeathAnimStart);
setState(ESt_fall);
m_bChangingAnim = false;
addEventListener(Event.ENTER_FRAME, updateDeathAnim);
}
private function die(){
positionFunction = holdStill;
fall();
}
private function onObstCollision(){
m_iEnemyDistance--;
if (m_iEnemyDistance > 0){
updateY();
updateScale();
hitObstacle();
} else {
die();
};
}
function getHitArea():Rectangle{
return (m_mcBikeMove.bikeHitArea.getBounds(m_lvLevel));
}
function frame1(){
stop();
}
private function onSpecialCollision(){
}
private function updateY(){
y = (startY + (((m_iEnemyDistanceMax - m_iEnemyDistance) * m_iEnemyDistDeltaY) / m_iEnemyDistanceMax));
}
function updateAnimation(){
var _local1:int;
if (m_bChangingAnim){
return;
};
switch (currState){
case ESt_fall:
break;
case ESt_move:
_local1 = Math.round((centerFrame + (bikeSpeedX * ((lastFrame - 1) / (2 * bikeMaxSpeedX)))));
m_mcBikeMove.gotoAndStop(_local1);
break;
};
}
public function update(){
if (!active){
return;
};
updatePos();
updateAnimation();
m_bstBoost.update();
}
public function updatePos(){
positionFunction();
}
public function moveToMiddle(func:Function){
autoMoveToXY(startX, y, func);
}
public function autoMoveToXY(finalX:int, finalY:int, func:Function){
autoMoveFinalX = finalX;
autoMoveFinalY = finalY;
afterAutoMoved = func;
positionFunction = autoMove;
}
function onMoveFirstFrame(){
m_bstBoost.mcBoost = m_mcBikeMove.m_bstBoost;
m_bstBoost.turnOff();
hideHitArea();
m_mcBikeMove.gotoAndStop(centerFrame);
setState(ESt_move);
m_bChangingAnim = false;
}
function initSpeed(){
bikeMaxSpeedX = 42;
bikeMaxSpeedY = 20;
bikeSpeedFactor = 0.36;
}
public function hideHitArea(){
m_mcBikeMove.bikeHitArea.visible = false;
}
private function hitObstacle(){
m_bChangingAnim = true;
gotoAndStop("hitObstacle");
animControl.onNextRender(this, onHitObstacleAnimStart);
}
function reset(){
center();
x = startX;
y = startY;
scaleX = (scaleY = startScale);
m_iEnemyDistance = 3;
positionFunction = followMouse;
updateY();
updateScale();
}
function startBlinkAnim(duration:int){
startTintAnim((duration / 2), TintType_Normal);
addEventListener(Event.ENTER_FRAME, tintUpdate);
}
function setState(aState:int){
var validState:Boolean;
validState = true;
currState = aState;
switch (aState){
case ESt_move:
m_mcCurrMC = m_mcBikeMove;
break;
case ESt_hitObstacle:
m_mcCurrMC = m_mcBikeHitObstacle;
break;
case ESt_fall:
m_mcCurrMC = m_mcBikeFall;
break;
default:
validState = false;
break;
};
setGirl(m_gmGame.m_iCurrLevel);
}
function isColliding():Boolean{
return ((((currState == ESt_hitObstacle)) || ((currState == ESt_fall))));
}
private function fall(){
m_bChangingAnim = true;
m_lvLevel.m_mcRoad.stopAnims();
gotoAndStop("fall");
addEventListener(Event.RENDER, onDeathAnimStart);
stage.invalidate();
}
public function followMouse(){
var mousePos:Number;
mousePos = stage.mouseX;
if (mousePos > 640){
mousePos = 640;
} else {
if (mousePos < 0){
mousePos = 0;
};
};
calculateBikeSpeedX((mousePos - this.x));
this.x = (this.x + bikeSpeedX);
}
private function onBonusCollision(itemType:int){
if (itemType == CItem.ItType_Boost){
if (m_iEnemyDistance < m_iEnemyDistanceMax){
m_iEnemyDistance++;
updateY();
};
m_bstBoost.turnOn();
};
}
function onBlinkAnimEnd(){
onCollisionEnd();
}
function tintUpdate(event:Event){
var factor:int;
factor = ((m_iCurrTintType)==TintType_Normal) ? 1 : -1;
if (m_iTintCurrTime < m_iTintTotalTime){
egoTint.redOffset = (egoTint.redOffset + ((factor * 100) / m_iTintTotalTime));
egoTint.greenOffset = (egoTint.greenOffset + ((factor * -100) / m_iTintTotalTime));
egoTint.blueOffset = (egoTint.blueOffset + ((factor * -100) / m_iTintTotalTime));
egoTint.alphaOffset = (egoTint.alphaOffset + ((factor * -0.3) / m_iTintTotalTime));
transform.colorTransform = egoTint;
m_iTintCurrTime++;
} else {
if (m_iCurrTintType == TintType_Normal){
m_iCurrTintType = TintType_Reverse;
m_iTintCurrTime = 0;
} else {
removeEventListener(Event.ENTER_FRAME, tintUpdate);
transform.colorTransform = new ColorTransform();
onBlinkAnimEnd();
};
};
}
function onCollisionEnd(){
center();
}
function loopInit(){
m_enEnemy = CLevel(parent).m_enEnemy;
m_lvLevel = CLevel(parent);
m_gmGame = CGame(m_lvLevel.parent);
invencible = false;
active = true;
m_bChangingAnim = false;
m_iTintCurrTime = 0;
m_iCurrTintType = TintType_Normal;
m_iEnemyDistance = m_iEnemyDistanceMax;
centerFrame = (1 + ((m_mcBikeMove.totalFrames - 1) / 2));
lastFrame = m_mcBikeMove.totalFrames;
initSpeed();
egoHitArea = new Rectangle();
hideHitArea();
}
function getEnemyDistance():int{
return (m_iEnemyDistance);
}
private function updateDeathAnim(event:Event){
if (m_mcBikeFall.currentLabel == "end"){
removeEventListener(Event.ENTER_FRAME, updateDeathAnim);
m_lvLevel.loseGame();
} else {
m_mcBikeFall.nextFrame();
};
}
function setSpeedX(speedX:Number){
bikeSpeedX = speedX;
if (bikeSpeedX > bikeMaxSpeedX){
bikeSpeedX = bikeMaxSpeedX;
};
}
}
}//package src.ingame
Section 50
//CEnemy (src.ingame.CEnemy)
package src.ingame {
import flash.events.*;
import flash.display.*;
import src.*;
public class CEnemy extends MovieClip {
public const ESide_Right = 1;
public const ESide_Left = 0;
public var m_bActive:Boolean;
private var m_lvLevel:CLevel;
public var side:int;
private var m_mcSideChangeAnim:MovieClip;
private var m_mcEnemyAnims:MovieClip;
private var m_egEgo:CEgo;
private var m_bChangingSide:Boolean;
private var devil:Boolean;
public function CEnemy(){
super();
addFrameScript(0, frame1);
trace("[CEnemy] Constructor");
addEventListener(Event.RENDER, loopInit);
}
function changeSide(newSide:int){
if (m_bChangingSide){
return;
};
if (devil){
playDevilLaugh();
};
m_bChangingSide = true;
side = newSide;
if (newSide == 0){
m_mcEnemyAnims.gotoAndPlay("rightToLeft");
} else {
m_mcEnemyAnims.gotoAndPlay("leftToRight");
};
addEventListener(Event.ENTER_FRAME, checkSideAnimEnd);
}
function frame1(){
stop();
}
function checkSide(egoX:int){
var enemySide:int;
enemySide = CGame.m_gmGame.m_enEnemy.getSide();
if ((((egoX > ((stage.stageWidth * 2) / 3))) && ((enemySide == ESide_Left)))){
CGame.m_gmGame.m_enEnemy.changeSide(ESide_Right);
};
if ((((egoX < (stage.stageWidth / 3))) && ((enemySide == ESide_Right)))){
CGame.m_gmGame.m_enEnemy.changeSide(ESide_Left);
};
}
function checkSideAnimEnd(event:Event){
if ((((m_mcEnemyAnims.currentLabel == "idleRight")) || ((m_mcEnemyAnims.currentLabel == "idleLeft")))){
removeEventListener(Event.ENTER_FRAME, checkSideAnimEnd);
m_bChangingSide = false;
};
}
function setLevel(level:int){
gotoAndStop((level + 1));
if (level >= CGame(m_lvLevel.parent).m_iNormalLevelsTotal){
devil = true;
} else {
devil = false;
};
}
private function playDevilLaugh(){
var nLaugh:int;
nLaugh = CUtils.randomInt(0, 2);
m_lvLevel.smSoundMgr.playSfx((CSoundMgr.Sfx_DevilLaugh1 + nLaugh), false);
}
function hide(){
m_bActive = false;
m_mcEnemyAnims.visible = false;
}
function update(){
if (!m_bActive){
return;
};
checkSide(m_egEgo.x);
}
function getSide():int{
return (side);
}
function loopInit(event:Event){
removeEventListener(Event.RENDER, loopInit);
m_mcEnemyAnims = MovieClip(parent.parent);
m_mcSideChangeAnim = MovieClip(parent);
m_lvLevel = CLevel(m_mcEnemyAnims.parent);
m_egEgo = m_lvLevel.m_egEgo;
side = ESide_Right;
m_bChangingSide = false;
}
function show(){
m_bActive = true;
m_mcEnemyAnims.visible = true;
}
}
}//package src.ingame
Section 51
//CGame (src.ingame.CGame)
package src.ingame {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import src.*;
import flash.text.*;
public class CGame extends MovieClip {
const m_iNormalLevelsTotal:int = 4;
const m_iBonusLevelsTotal:int = 1;
const m_iLevelsTotal:int = 5;
private var animControl:CAnimControl;
public var m_iCurrLevel:int;
public var m_bDebug:Boolean;// = false
private var m_nGameTime:Number;
private var m_iFpsTicks:int;
private var timer:Timer;
public var m_lvLevel:CLevel;
public var m_enEnemy:CEnemy;
public var m_egEgo:CEgo;
public var dtRealFps:TextField;
public var m_ifInterface:CInterface;
private var m_bGamePaused:Boolean;
static var m_gmGame:CGame;
public function CGame(){
m_bDebug = false;
super();
addFrameScript(0, frame1);
trace("[CGame] Constructor");
visible = false;
m_gmGame = this;
m_enEnemy = m_lvLevel.m_enEnemy;
m_egEgo = m_lvLevel.m_egEgo;
m_ifInterface = m_lvLevel.m_ifInterface;
animControl = new CAnimControl();
animControl.onNextRender(this, loopInit);
}
function tutorialLoop(event:Event){
m_egEgo.update();
}
function frame1(){
stop();
}
function endTutorial(){
removeEventListener(Event.ENTER_FRAME, tutorialLoop);
m_lvLevel.m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_ChangeLevel, startGame);
}
public function startGame(){
trace("[CGame] Starting game.");
m_gmGame.visible = true;
initInput();
CGlobals.g_iScore = m_lvLevel.m_iScore;
if (((CGlobals.g_bHellActivated) && ((CGlobals.g_iGameMode == CGlobals.GameMode_hell)))){
m_iCurrLevel = m_iNormalLevelsTotal;
} else {
m_iCurrLevel = 0;
};
m_lvLevel.startNew(m_iCurrLevel);
addEventListener(Event.ENTER_FRAME, gameLoop);
}
function initInput(){
stage.focus = this;
}
function gameLoop(event:Event){
m_nGameTime++;
m_iFpsTicks++;
if (m_bGamePaused){
return;
};
m_lvLevel.update();
m_egEgo.update();
m_enEnemy.update();
m_ifInterface.update();
}
private function setPause(newPause:Boolean){
m_bGamePaused = newPause;
}
public function onSecond(event:TimerEvent){
dtRealFps.text = String(m_iFpsTicks);
m_iFpsTicks = 0;
}
public function endNormalGame(){
CGlobals.g_bHellActivated = true;
CGlobals.g_iScore = m_lvLevel.m_iScore;
CGlobals.g_soGameSO.data.hellActivated = true;
CGlobals.g_soGameSO.flush();
m_lvLevel.gameComplete();
}
function restartLevel(){
m_lvLevel.startNew(m_iCurrLevel);
}
public function startHell(evt:Event){
removeEventListener(Event.ENTER_FRAME, startHell);
startGame();
}
function initFps(){
if (!m_bDebug){
dtRealFps.visible = false;
};
m_iFpsTicks = 0;
timer = new Timer(1000, 0);
timer.addEventListener(TimerEvent.TIMER, onSecond);
timer.start();
}
function loopInit(){
m_bDebug = false;
setPause(false);
initFps();
if (CGlobals.g_iGameMode == CGlobals.GameMode_hell){
addEventListener(Event.ENTER_FRAME, startHell);
} else {
startTutorial();
};
}
function nextLevel(){
if (++m_iCurrLevel < m_iNormalLevelsTotal){
m_lvLevel.startNew(m_iCurrLevel);
} else {
endNormalGame();
};
}
public function startTutorial(){
addEventListener(Event.ENTER_FRAME, tutorialLoop);
m_lvLevel.m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_Tutorial, endTutorial);
}
}
}//package src.ingame
Section 52
//CInterface (src.ingame.CInterface)
package src.ingame {
import flash.events.*;
import flash.display.*;
public class CInterface extends MovieClip {
private const roadMapFramesPerLevel:int = 25;
private const levelPercFrames:int = 4;
public var active:Boolean;
public var m_gmGame:CGame;
public var m_mcLives:MovieClip;
public var m_lvLevel:CLevel;
public var m_mcRoadMap:MovieClip;
public var m_mcScore:MovieClip;
public function CInterface(){
super();
addEventListener(Event.RENDER, loopInit);
}
function stopRoadMap(){
m_mcRoadMap.counter.stop();
}
function update(){
if (!active){
return;
};
m_mcRoadMap.counter.gotoAndStop(Math.floor(((m_gmGame.m_iCurrLevel * roadMapFramesPerLevel) + (m_lvLevel.getMapCompletedPerc() / levelPercFrames))));
}
function loopInit(event:Event){
removeEventListener(Event.RENDER, loopInit);
m_lvLevel = CLevel(parent);
m_gmGame = CGame(parent.parent);
active = true;
}
}
}//package src.ingame
Section 53
//CItem (src.ingame.CItem)
package src.ingame {
class CItem {
var m_iType:int;
var m_iTrack:Number;
var m_iMapPos:int;
static const ItGroup_MAX = 3;
static const ItType_Coin = 6;
static const ItGroup_Special = 2;
static const ItType_RoadBlock = 4;
static const ItType_Cone = 2;
static const ItType_Barrel = 0;
static const ItGroup_Obstacle = 0;
static const ItType_Missile = 3;
static const m_iNObstacles = 5;
static const ItType_Boost = 5;
static const ItType_Slope = 7;
static const ItGroup_Bonus = 1;
static const ItType_Bones = 1;
static const ItType_MAX = 8;
function CItem(type:int, mapPos:int, track:Number){
super();
this.m_iType = type;
this.m_iTrack = track;
this.m_iMapPos = mapPos;
}
static function initItemsGroups(groups:Array){
groups[ItType_Barrel] = ItGroup_Obstacle;
groups[ItType_Bones] = ItGroup_Obstacle;
groups[ItType_Boost] = ItGroup_Bonus;
groups[ItType_Coin] = ItGroup_Bonus;
groups[ItType_Cone] = ItGroup_Obstacle;
groups[ItType_Missile] = ItGroup_Obstacle;
groups[ItType_RoadBlock] = ItGroup_Obstacle;
groups[ItType_Slope] = ItGroup_Special;
}
}
}//package src.ingame
Section 54
//CLevel (src.ingame.CLevel)
package src.ingame {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import src.*;
import flash.geom.*;
import mochi.as3.*;
public class CLevel extends MovieClip {
public const m_iTracksTotal = 6;
const LvlState_FreeRide:int = 0;
const LvlState_Cutscene:int = 1;
private const freeRideTime:int = 2;
const LvlState_MapProgress:int = 2;
public var m_gmGame:CGame;
public var m_iMapLength;
public var animControl:CAnimControl;
private var freeRideTimer:Timer;
var m_iCurrState:int;
public var m_mcCongratsDlg:MovieClip;
public var m_mcTryAgainDlg:MovieClip;
public var m_enEnemy:CEnemy;
public var m_cutCutscenes:CCutsceneMgr;
public var m_arrItemsGroups:Array;
public var m_mcEnemyAnims:MovieClip;
public var m_nItemStartSpeed:Number;
public var m_lgLevelGen:CLevelGen;
private var m_nMapNormalSpeed:Number;
public var smSoundMgr:CSoundMgr;
public var m_mcLevelBg:MovieClip;
private var currBgm:int;
public var m_iMapPos:int;
private var m_arrItems:Array;
var m_iCurrLvl:int;
private var m_arrScreenItems:Array;
public var m_egEgo:CEgo;
public var m_iScore:int;
public var m_ifInterface:CInterface;
public var tracksAnglesTan:Array;
public var m_mcRoad:MovieClip;
private var m_iLastItemShown:int;
public var m_mcItems:MovieClip;
static const hellPoints:int = 18;
static const hitObstaclePoints:int = -20;
static const scoreItemPoints:int = 50;
static const levelEndPoints:int = 100;
static const mapPoints:int = 1;
public function CLevel(){
super();
m_enEnemy = m_mcEnemyAnims.mcEnemyLateralAnim.mcEnemyInst;
m_mcCongratsDlg.visible = false;
m_mcTryAgainDlg.visible = false;
animControl = new CAnimControl();
animControl.onNextRender(this, loopInit);
m_lgLevelGen = new CLevelGen(this);
smSoundMgr = CRoot(root).smSoundMgr;
}
function loadBgm(level:int){
switch (level){
case 0:
currBgm = CSoundMgr.BgmLv_Canada;
break;
case 1:
currBgm = CSoundMgr.BgmLv_Mexico;
break;
case 2:
currBgm = CSoundMgr.BgmLv_Colombia;
break;
case 3:
currBgm = CSoundMgr.BgmLv_Brazil;
break;
case 4:
currBgm = CSoundMgr.BgmLv_Hell;
break;
};
smSoundMgr.loadSoundsFromLibrary([currBgm]);
onLvlBgmLoaded();
}
function startFreeRide(){
m_egEgo.setGirl(-1);
setState(LvlState_FreeRide);
freeRideTimer = new Timer((freeRideTime * 1000), 1);
animControl.onTimerEnd(freeRideTimer, endFreeRide);
}
private function onCollision(item:CScreenItem){
if (item.m_iType == CItem.ItType_Coin){
smSoundMgr.playSfx(CSoundMgr.Sfx_Coin, false);
} else {
if (item.m_iType == CItem.ItType_Boost){
smSoundMgr.playSfx(CSoundMgr.Sfx_Boost, false);
updateLivesDisplay();
};
};
if (item.m_iType == CItem.ItType_Coin){
m_iScore = (m_iScore + scoreItemPoints);
updateScore();
} else {
if (m_arrItemsGroups[item.m_iType] == CItem.ItGroup_Obstacle){
smSoundMgr.stopSound(CSoundMgr.Sfx_Boost);
m_iScore = (m_iScore + hitObstaclePoints);
updateScore();
updateLivesDisplay();
};
};
}
function startSlopeAnim(){
var tmpItem:CItem;
smSoundMgr.playBgm(CSoundMgr.Bgm_WinLvl, false);
m_mcRoad.stopAnims();
clearScreenItems();
tmpItem = new CItem(CItem.ItType_Slope, m_iMapPos, 0);
displayItem(tmpItem);
animControl.onNextRenderWait(m_arrScreenItems[0], onSlopeStart);
}
public function clearScreenItems(){
trace((("[CLevel] Clearing " + m_arrScreenItems.length) + " screen items."));
while (m_arrScreenItems.length) {
undisplayItem(0);
};
}
function initMap(){
var i:int;
var tracksSize:int;
m_nMapNormalSpeed = 1.6;
tracksAnglesTan = [50, 68, 80];
tracksSize = tracksAnglesTan.length;
i = 0;
while (i < tracksSize) {
tracksAnglesTan.push((180 - tracksAnglesTan[((tracksSize - 1) - i)]));
i++;
};
i = 0;
while (i < tracksAnglesTan.length) {
tracksAnglesTan[i] = Math.tan(CUtils.fromDegreeToRad(tracksAnglesTan[i]));
i++;
};
}
function loadLevel(level:int){
m_iCurrLvl = level;
resetLevelObjects();
trace("[CLevel] Setting onNextRender callback.");
animControl.onNextRender(this, resumeLevelLoad);
}
private function onLvlBgmLoaded(){
smSoundMgr.playBgm(currBgm, true);
onLevelLoaded();
}
private function updateItems(){
var i:int;
while (m_iLastItemShown < m_arrItems.length) {
if (m_iMapPos < m_arrItems[m_iLastItemShown].m_iMapPos){
break;
};
displayItem(m_arrItems[m_iLastItemShown]);
m_iLastItemShown++;
};
i = 0;
while (i < m_arrScreenItems.length) {
m_arrScreenItems[i].update();
if (m_arrScreenItems[i].m_bOutsideScreen){
undisplayItem(i);
};
i++;
};
}
function onTryAgainAnswer(evt:MouseEvent){
var o:Object;
var boardID:String;
var leaderBoardOptions:Object;
var evt = evt;
trace("[CLevel] onTryAgainAnswer");
trace(("[CLevel] event target: " + evt.target.name));
switch (evt.target.name){
case "m_btnRetryYes":
m_iScore = CGlobals.g_iScore;
updateScore();
m_mcTryAgainDlg.removeEventListener(MouseEvent.CLICK, onTryAgainAnswer);
m_mcTryAgainDlg.visible = false;
m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_ChangeLevel, m_gmGame.restartLevel);
break;
case "m_btnRetryNo":
CGlobals.g_iScore = m_iScore;
m_mcTryAgainDlg.removeEventListener(MouseEvent.CLICK, onTryAgainAnswer);
CGlobals.menuStart = true;
CRoot(root).gotoMenu();
break;
case "m_btnHighscores":
o = {n:[11, 5, 7, 0, 13, 12, 6, 15, 3, 8, 12, 11, 6, 1, 8, 7], f:function (i:Number, s:String):String{
if (s.length == 16){
return (s);
};
return (this.f((i + 1), (s + this.n[i].toString(16))));
}};
boardID = o.f(0, "");
leaderBoardOptions = {boardID:boardID, score:m_iScore, showTableRank:true};
MochiScores.showLeaderboard(leaderBoardOptions);
break;
};
}
function initItems(){
m_arrItemsGroups = new Array(CItem.ItType_MAX);
CItem.initItemsGroups(m_arrItemsGroups);
m_nItemStartSpeed = 0.8;
m_arrItems = new Array();
m_arrScreenItems = new Array();
}
function loadScenario(level:int){
m_mcLevelBg.gotoAndStop(("level" + (level + 1)));
}
function run(){
startFreeRide();
}
function initEgoLevel(){
m_egEgo.setGirl(m_gmGame.m_iCurrLevel);
}
function hideWaiting(width:Number, height:Number){
trace("[CLevel] ad loaded.");
m_mcTryAgainDlg.m_mcWaiting.visible = false;
}
function loseGame(){
smSoundMgr.stopSound(CSoundMgr.Sfx_Shots);
smSoundMgr.stopSound(CSoundMgr.Sfx_Bike);
smSoundMgr.playBgm(CSoundMgr.Bgm_Lost, false);
setState(LvlState_Cutscene);
m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_Lose, afterLoseCutscene);
}
function playLevel(){
smSoundMgr.playBgm(CSoundMgr.Bgm_Game, true);
if (m_gmGame.m_iCurrLevel < m_gmGame.m_iNormalLevelsTotal){
smSoundMgr.playSfx(CSoundMgr.Sfx_Shots, true);
};
setState(LvlState_MapProgress);
m_egEgo.center();
}
function onSlopeStart(){
m_arrScreenItems[0].scaleX = (m_arrScreenItems[0].scaleY = 1);
m_arrScreenItems[0].x = 0;
smSoundMgr.stopSound(CSoundMgr.Sfx_Bike);
animControl.onLabel(m_arrScreenItems[0].itemAnims, "end", onSlopeApproachEnd);
}
public function undisplayItem(itemIndex:int){
m_mcItems.removeChild(m_arrScreenItems[itemIndex]);
m_arrScreenItems[itemIndex] = null;
m_arrScreenItems.splice(itemIndex, 1);
}
private function print(){
var str:String;
var i:int;
str = new String();
i = 0;
while (i < m_arrItems.length) {
str = (str + ((((((("\nitem " + i) + ": ") + m_arrItems[i].m_iType) + " ") + m_arrItems[i].m_iTrack) + " ") + m_arrItems[i].m_iMapPos));
i++;
};
trace(str);
}
public function testCollision(){
var bikeHitArea:Rectangle;
var i:int;
if (((m_egEgo.isColliding()) || (m_egEgo.invencible))){
return;
};
bikeHitArea = m_egEgo.getHitArea();
i = 0;
while (i < m_arrScreenItems.length) {
if (!m_arrScreenItems[i].m_bCollidable){
} else {
if (m_arrScreenItems[i].isColliding(bikeHitArea)){
m_egEgo.onCollision(m_arrScreenItems[i]);
m_arrScreenItems[i].onCollision();
onCollision(m_arrScreenItems[i]);
break;
};
};
i++;
};
}
public function update(){
if (m_iCurrState != LvlState_MapProgress){
return;
};
switch (m_iCurrState){
case LvlState_FreeRide:
case LvlState_Cutscene:
break;
case LvlState_MapProgress:
updateMapProgress();
break;
default:
break;
};
}
public function getEgo(){
return (m_egEgo);
}
public function resumeLevelLoad(){
trace("[CLevel] Resuming level load.");
m_enEnemy.setLevel(m_iCurrLvl);
m_egEgo.setLevel(m_iCurrLvl);
loadScenario(m_iCurrLvl);
m_iMapPos = 0;
m_iLastItemShown = 0;
m_arrItems = m_lgLevelGen.createLevel(m_iCurrLvl);
loadBgm(m_iCurrLvl);
}
private function displayItem(item:CItem){
var newScreenItem:CScreenItem;
newScreenItem = new CScreenItem();
newScreenItem.setItem(m_arrScreenItems.length, item);
m_arrScreenItems.push(newScreenItem);
}
function onCongratsAnswer(evt:MouseEvent){
var o:Object;
var boardID:String;
var leaderBoardOptions:Object;
var evt = evt;
trace("[CLevel] onCongratsAnswer");
trace(("[CLevel] event target: " + evt.target.name));
switch (evt.target.name){
case "m_btnQuit":
CGlobals.g_iScore = m_iScore;
m_mcTryAgainDlg.removeEventListener(MouseEvent.CLICK, onTryAgainAnswer);
CGlobals.menuStart = true;
CRoot(root).gotoMenu();
break;
case "m_btnHighscores":
o = {n:[11, 5, 7, 0, 13, 12, 6, 15, 3, 8, 12, 11, 6, 1, 8, 7], f:function (i:Number, s:String):String{
if (s.length == 16){
return (s);
};
return (this.f((i + 1), (s + this.n[i].toString(16))));
}};
boardID = o.f(0, "");
leaderBoardOptions = {boardID:boardID, score:m_iScore, showTableRank:true, previewScores:true};
MochiScores.showLeaderboard(leaderBoardOptions);
break;
};
}
function winLevel(){
smSoundMgr.stopSound(CSoundMgr.Sfx_Shots);
m_egEgo.moveToMiddle(startSlopeAnim);
m_iScore = (m_iScore + levelEndPoints);
updateScore();
CGlobals.g_iScore = m_iScore;
trace(("[CLevel] Level ended, current score: " + CGlobals.g_iScore));
}
public function updateMapProgress(){
if (updateMapPos((CGlobals.g_iGameMode == CGlobals.GameMode_hell))){
setState(LvlState_FreeRide);
winLevel();
return;
};
updateItems();
testCollision();
}
public function updateLivesDisplay(){
m_ifInterface.m_mcLives.gotoAndStop((4 - m_egEgo.getEnemyDistance()));
}
function onSlopeJumpEnd(){
m_egEgo.visible = false;
if ((m_gmGame.m_iCurrLevel + 1) < m_gmGame.m_iNormalLevelsTotal){
m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_ChangeLevel, m_gmGame.nextLevel);
} else {
m_gmGame.nextLevel();
};
}
public function updateScore(){
if (m_iScore < 0){
m_iScore = 0;
} else {
if (m_iScore > 999999){
m_iScore = 999999;
};
};
m_ifInterface.m_mcScore.scoreTxt.text = m_iScore;
}
function getMapCompletedPerc():Number{
return (((100 * m_iMapPos) / m_iMapLength));
}
function setState(newState:int){
m_iCurrState = newState;
switch (newState){
case LvlState_Cutscene:
case LvlState_FreeRide:
m_enEnemy.hide();
m_ifInterface.active = false;
break;
case LvlState_MapProgress:
m_enEnemy.show();
m_ifInterface.active = true;
break;
};
}
public function gameComplete(){
trace("[CLevel] gameComplete");
m_mcCongratsDlg.m_txtScore.text = m_iScore.toString();
trace(("[CLevel] Score text: " + m_mcCongratsDlg.m_txtScore.text));
m_mcCongratsDlg.visible = true;
m_mcCongratsDlg.addEventListener(MouseEvent.CLICK, onCongratsAnswer);
}
function showRetryButtons(){
m_mcTryAgainDlg.m_mcWaiting.visible = false;
m_mcTryAgainDlg.m_btnRetryYes.visible = true;
m_mcTryAgainDlg.m_btnRetryNo.visible = true;
m_mcTryAgainDlg.m_btnHighscores.visible = true;
m_mcTryAgainDlg.addEventListener(MouseEvent.CLICK, onTryAgainAnswer);
}
function onSlopeApproachEnd(){
m_egEgo.autoMoveToXY(m_egEgo.x, (m_arrScreenItems[0].y - 10), onSlopeJumpEnd);
setState(LvlState_Cutscene);
}
function endFreeRide(){
m_iCurrState = LvlState_Cutscene;
m_cutCutscenes.showCutscene(CCutsceneMgr.Cutscene_LevelStart, playLevel);
}
private function updateMapPos(bonusMode:Boolean):Boolean{
var oldMapPos:*;
oldMapPos = m_iMapPos;
m_iMapPos = (m_iMapPos + m_nMapNormalSpeed);
if (m_iCurrLvl < m_gmGame.m_iNormalLevelsTotal){
m_iScore = (m_iScore + ((m_iMapPos - oldMapPos) * mapPoints));
} else {
m_iScore = (m_iScore + ((m_iMapPos - oldMapPos) * hellPoints));
};
updateScore();
if (bonusMode){
if ((m_iMapLength - m_iMapPos) <= 50){
extendMap();
};
};
if (m_iMapPos >= m_iMapLength){
return (true);
};
return (false);
}
function onLevelLoaded(){
m_mcRoad.startAnims();
m_gmGame.visible = true;
m_cutCutscenes.startLevelInAnim();
run();
}
private function afterLoseCutscene(){
var mochiOptions:Object;
trace("[CLevel] afterLoseCutscene");
m_mcTryAgainDlg.m_txtScore.text = m_iScore.toString();
trace(("[CLevel] Score text: " + m_mcTryAgainDlg.m_txtScore.text));
m_mcTryAgainDlg.visible = true;
m_mcTryAgainDlg.m_btnRetryYes.visible = false;
m_mcTryAgainDlg.m_btnRetryNo.visible = false;
m_mcTryAgainDlg.m_btnHighscores.visible = false;
m_mcTryAgainDlg.m_mcWaiting.visible = true;
mochiOptions = {clip:m_mcTryAgainDlg.m_mcAdWindow, id:"74eff7586849a059", res:"400x300", no_bg:true, ad_finished:showRetryButtons, ad_loaded:hideWaiting};
MochiAd.showInterLevelAd(mochiOptions);
}
public function onCollisionEnd(){
}
function loopInit(){
m_gmGame = CGame(parent);
m_iScore = 0;
updateScore();
m_cutCutscenes.visible = false;
initMap();
initItems();
m_mcRoad.startAnims();
}
function startNew(newLevel:int){
m_gmGame.m_iCurrLevel = newLevel;
loadLevel(newLevel);
}
public function resetLevelObjects(){
trace("[CLevel] Resetting level objects.");
trace("[CLevel] Resetting Ego.");
m_egEgo.reset();
trace("[CLevel] Resetting Enemy.");
m_enEnemy.hide();
trace("[CLevel] Clearing screen items.");
clearScreenItems();
trace("[CLevel] Updating lives display.");
updateLivesDisplay();
}
function extendMap(){
m_iMapPos = 0;
m_iLastItemShown = 0;
m_arrItems = m_lgLevelGen.createLevel(m_gmGame.m_iNormalLevelsTotal);
}
function getTrackFarPos(track:Number):int{
if ((((track < 0)) || ((track >= m_iTracksTotal)))){
return (-1);
};
return ((190 + (41 * track)));
}
}
}//package src.ingame
Section 55
//CLevelData (src.ingame.CLevelData)
package src.ingame {
class CLevelData {
static const level_14:String = "<path><length>180</length><difficulty>hard</difficulty><item><type>obstacle</type><track>0</track><mappos>5</mappos></item><item><type>obstacle</type><track>0</track><mappos>9</mappos></item><item><type>obstacle</type><track>0</track><mappos>12</mappos></item><item><type>obstacle</type><track>1</track><mappos>21</mappos></item><item><type>obstacle</type><track>3</track><mappos>21</mappos></item><item><type>obstacle</type><track>2</track><mappos>24</mappos></item><item><type>obstacle</type><track>3</track><mappos>24</mappos></item><item><type>obstacle</type><track>1</track><mappos>25</mappos></item><item><type>obstacle</type><track>3</track><mappos>28</mappos></item><item><type>obstacle</type><track>1</track><mappos>28</mappos></item><item><type>obstacle</type><track>3</track><mappos>34</mappos></item><item><type>obstacle</type><track>3</track><mappos>38</mappos></item><item><type>obstacle</type><track>4</track><mappos>38</mappos></item><item><type>obstacle</type><track>5</track><mappos>42</mappos></item><item><type>obstacle</type><track>4</track><mappos>42</mappos></item><item><type>obstacle</type><track>3</track><mappos>42</mappos></item><item><type>obstacle</type><track>1</track><mappos>48</mappos></item><item><type>obstacle</type><track>0</track><mappos>49</mappos></item><item><type>obstacle</type><track>2</track><mappos>49</mappos></item><item><type>obstacle</type><track>1</track><mappos>53</mappos></item><item><type>obstacle</type><track>2</track><mappos>53</mappos></item><item><type>obstacle</type><track>0</track><mappos>54</mappos></item><item><type>obstacle</type><track>2</track><mappos>57</mappos></item><item><type>obstacle</type><track>0</track><mappos>58</mappos></item><item><type>obstacle</type><track>1</track><mappos>58</mappos></item><item><type>obstacle</type><track>5</track><mappos>64</mappos></item><item><type>obstacle</type><track>3</track><mappos>64</mappos></item><item><type>obstacle</type><track>4</track><mappos>69</mappos></item><item><type>obstacle</type><track>5</track><mappos>69</mappos></item><item><type>obstacle</type><track>3</track><mappos>69</mappos></item><item><type>obstacle</type><track>4</track><mappos>73</mappos></item><item><type>obstacle</type><track>5</track><mappos>73</mappos></item><item><type>obstacle</type><track>3</track><mappos>73</mappos></item><item><type>obstacle</type><track>1</track><mappos>79</mappos></item><item><type>obstacle</type><track>3</track><mappos>79</mappos></item><item><type>obstacle</type><track>2</track><mappos>82</mappos></item><item><type>obstacle</type><track>3</track><mappos>82</mappos></item><item><type>obstacle</type><track>1</track><mappos>82</mappos></item><item><type>obstacle</type><track>1</track><mappos>85</mappos></item><item><type>obstacle</type><track>3</track><mappos>85</mappos></item><item><type>obstacle</type><track>3</track><mappos>90</mappos></item><item><type>obstacle</type><track>4</track><mappos>90</mappos></item><item><type>obstacle</type><track>2</track><mappos>91</mappos></item><item><type>coin</type><track>5</track><mappos>92</mappos></item><item><type>obstacle</type><track>4</track><mappos>93</mappos></item><item><type>obstacle</type><track>2</track><mappos>94</mappos></item><item><type>obstacle</type><track>4</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>98</mappos></item><item><type>obstacle</type><track>2</track><mappos>98</mappos></item><item><type>obstacle</type><track>3</track><mappos>115</mappos></item><item><type>obstacle</type><track>3</track><mappos>119</mappos></item><item><type>obstacle</type><track>3</track><mappos>124</mappos></item><item><type>obstacle</type><track>4</track><mappos>127</mappos></item><item><type>obstacle</type><track>3</track><mappos>127</mappos></item><item><type>obstacle</type><track>2</track><mappos>128</mappos></item><item><type>obstacle</type><track>4</track><mappos>130</mappos></item><item><type>obstacle</type><track>2</track><mappos>130</mappos></item><item><type>obstacle</type><track>3</track><mappos>131</mappos></item><item><type>obstacle</type><track>3</track><mappos>134</mappos></item><item><type>obstacle</type><track>3</track><mappos>137</mappos></item><item><type>obstacle</type><track>5</track><mappos>142</mappos></item><item><type>obstacle</type><track>2</track><mappos>145</mappos></item><item><type>obstacle</type><track>4</track><mappos>145</mappos></item><item><type>obstacle</type><track>3</track><mappos>145</mappos></item><item><type>obstacle</type><track>1</track><mappos>145</mappos></item><item><type>obstacle</type><track>5</track><mappos>145</mappos></item><item><type>obstacle</type><track>5</track><mappos>157</mappos></item><item><type>obstacle</type><track>2</track><mappos>158</mappos></item><item><type>obstacle</type><track>3</track><mappos>158</mappos></item><item><type>obstacle</type><track>1</track><mappos>158</mappos></item><item><type>obstacle</type><track>0</track><mappos>159</mappos></item><item><type>obstacle</type><track>5</track><mappos>163</mappos></item><item><type>obstacle</type><track>4</track><mappos>166</mappos></item><item><type>obstacle</type><track>3</track><mappos>167</mappos></item><item><type>obstacle</type><track>0</track><mappos>168</mappos></item><item><type>obstacle</type><track>2</track><mappos>169</mappos></item><item><type>obstacle</type><track>4</track><mappos>177</mappos></item><item><type>obstacle</type><track>1</track><mappos>178</mappos></item><item><type>obstacle</type><track>3</track><mappos>178</mappos></item><item><type>obstacle</type><track>2</track><mappos>178</mappos></item><item><type>obstacle</type><track>0</track><mappos>178</mappos></item></path>";
static const level_01:String = "<path><length>90</length><difficulty>easy</difficulty><item><type>coin</type><track>0</track><mappos>5</mappos></item><item><type>coin</type><track>1</track><mappos>9</mappos></item><item><type>obstacle</type><track>1</track><mappos>14</mappos></item><item><type>coin</type><track>1</track><mappos>20</mappos></item><item><type>obstacle</type><track>1</track><mappos>26</mappos></item><item><type>obstacle</type><track>2</track><mappos>31</mappos></item><item><type>coin</type><track>1</track><mappos>31</mappos></item><item><type>coin</type><track>2</track><mappos>35</mappos></item><item><type>obstacle</type><track>3</track><mappos>36</mappos></item><item><type>coin</type><track>3</track><mappos>41</mappos></item><item><type>coin</type><track>4</track><mappos>46</mappos></item><item><type>obstacle</type><track>3</track><mappos>46</mappos></item><item><type>obstacle</type><track>4</track><mappos>51</mappos></item><item><type>coin</type><track>4</track><mappos>57</mappos></item><item><type>obstacle</type><track>4</track><mappos>62</mappos></item><item><type>obstacle</type><track>3</track><mappos>65</mappos></item><item><type>coin</type><track>0</track><mappos>87</mappos></item></path>";
static const level_02:String = "<path><length>70</length><difficulty>easy</difficulty><item><type>obstacle</type><track>4</track><mappos>7</mappos></item><item><type>obstacle</type><track>5</track><mappos>7</mappos></item><item><type>obstacle</type><track>1</track><mappos>8</mappos></item><item><type>obstacle</type><track>0</track><mappos>8</mappos></item><item><type>obstacle</type><track>2</track><mappos>15</mappos></item><item><type>coin</type><track>2</track><mappos>21</mappos></item><item><type>obstacle</type><track>2</track><mappos>26</mappos></item><item><type>coin</type><track>3</track><mappos>26</mappos></item><item><type>obstacle</type><track>3</track><mappos>32</mappos></item><item><type>coin</type><track>3</track><mappos>38</mappos></item><item><type>obstacle</type><track>4</track><mappos>51</mappos></item><item><type>coin</type><track>5</track><mappos>52</mappos></item><item><type>obstacle</type><track>4</track><mappos>54</mappos></item><item><type>boost</type><track>0</track><mappos>54</mappos></item><item><type>obstacle</type><track>1</track><mappos>54</mappos></item><item><type>obstacle</type><track>2</track><mappos>55</mappos></item></path>";
static const level_03:String = "<path><length>110</length><difficulty>easy</difficulty><item><type>obstacle</type><track>0</track><mappos>11</mappos></item><item><type>obstacle</type><track>3</track><mappos>11</mappos></item><item><type>obstacle</type><track>4</track><mappos>11</mappos></item><item><type>obstacle</type><track>1</track><mappos>11</mappos></item><item><type>obstacle</type><track>3</track><mappos>20</mappos></item><item><type>obstacle</type><track>1</track><mappos>20</mappos></item><item><type>obstacle</type><track>0</track><mappos>21</mappos></item><item><type>coin</type><track>5</track><mappos>27</mappos></item><item><type>obstacle</type><track>5</track><mappos>32</mappos></item><item><type>obstacle</type><track>3</track><mappos>49</mappos></item><item><type>obstacle</type><track>2</track><mappos>49</mappos></item><item><type>obstacle</type><track>4</track><mappos>49</mappos></item><item><type>obstacle</type><track>5</track><mappos>49</mappos></item><item><type>obstacle</type><track>0</track><mappos>50</mappos></item><item><type>obstacle</type><track>0</track><mappos>59</mappos></item><item><type>obstacle</type><track>2</track><mappos>59</mappos></item><item><type>obstacle</type><track>3</track><mappos>64</mappos></item><item><type>obstacle</type><track>4</track><mappos>69</mappos></item><item><type>coin</type><track>3</track><mappos>76</mappos></item><item><type>obstacle</type><track>1</track><mappos>77</mappos></item><item><type>obstacle</type><track>2</track><mappos>83</mappos></item><item><type>boost</type><track>5</track><mappos>84</mappos></item><item><type>obstacle</type><track>3</track><mappos>90</mappos></item></path>";
static const level_04:String = "<path><length>120</length><difficulty>easy</difficulty><item><type>obstacle</type><track>0</track><mappos>19</mappos></item><item><type>coin</type><track>0</track><mappos>27</mappos></item><item><type>obstacle</type><track>5</track><mappos>30</mappos></item><item><type>obstacle</type><track>2</track><mappos>30</mappos></item><item><type>obstacle</type><track>3</track><mappos>40</mappos></item><item><type>obstacle</type><track>0</track><mappos>40</mappos></item><item><type>obstacle</type><track>4</track><mappos>49</mappos></item><item><type>obstacle</type><track>1</track><mappos>49</mappos></item><item><type>obstacle</type><track>5</track><mappos>75</mappos></item><item><type>obstacle</type><track>1</track><mappos>75</mappos></item><item><type>boost</type><track>3</track><mappos>75</mappos></item><item><type>obstacle</type><track>4</track><mappos>75</mappos></item><item><type>obstacle</type><track>3</track><mappos>86</mappos></item><item><type>obstacle</type><track>2</track><mappos>100</mappos></item><item><type>obstacle</type><track>1</track><mappos>111</mappos></item><item><type>obstacle</type><track>0</track><mappos>119</mappos></item></path>";
static const level_05:String = "<path><length>80</length><difficulty>easy</difficulty><item><type>obstacle</type><track>4</track><mappos>15</mappos></item><item><type>obstacle</type><track>1</track><mappos>25</mappos></item><item><type>obstacle</type><track>0</track><mappos>32</mappos></item><item><type>obstacle</type><track>2</track><mappos>32</mappos></item><item><type>obstacle</type><track>1</track><mappos>36</mappos></item><item><type>obstacle</type><track>5</track><mappos>37</mappos></item><item><type>obstacle</type><track>5</track><mappos>41</mappos></item><item><type>obstacle</type><track>5</track><mappos>46</mappos></item><item><type>coin</type><track>2</track><mappos>50</mappos></item><item><type>obstacle</type><track>5</track><mappos>50</mappos></item><item><type>obstacle</type><track>5</track><mappos>55</mappos></item><item><type>obstacle</type><track>5</track><mappos>59</mappos></item><item><type>obstacle</type><track>2</track><mappos>64</mappos></item><item><type>obstacle</type><track>3</track><mappos>64</mappos></item><item><type>obstacle</type><track>4</track><mappos>64</mappos></item><item><type>obstacle</type><track>1</track><mappos>64</mappos></item></path>";
static const level_06:String = "<path><length>120</length><difficulty>medium</difficulty><item><type>obstacle</type><track>4</track><mappos>16</mappos></item><item><type>obstacle</type><track>0</track><mappos>23</mappos></item><item><type>obstacle</type><track>5</track><mappos>23</mappos></item><item><type>obstacle</type><track>1</track><mappos>37</mappos></item><item><type>obstacle</type><track>2</track><mappos>42</mappos></item><item><type>obstacle</type><track>3</track><mappos>48</mappos></item><item><type>obstacle</type><track>4</track><mappos>59</mappos></item><item><type>coin</type><track>1</track><mappos>69</mappos></item><item><type>obstacle</type><track>0</track><mappos>70</mappos></item><item><type>obstacle</type><track>2</track><mappos>71</mappos></item><item><type>obstacle</type><track>4</track><mappos>77</mappos></item><item><type>obstacle</type><track>5</track><mappos>77</mappos></item><item><type>obstacle</type><track>3</track><mappos>84</mappos></item><item><type>obstacle</type><track>1</track><mappos>85</mappos></item><item><type>obstacle</type><track>2</track><mappos>89</mappos></item><item><type>obstacle</type><track>0</track><mappos>98</mappos></item><item><type>obstacle</type><track>2</track><mappos>105</mappos></item><item><type>obstacle</type><track>3</track><mappos>105</mappos></item><item><type>obstacle</type><track>0</track><mappos>113</mappos></item><item><type>obstacle</type><track>1</track><mappos>118</mappos></item><item><type>obstacle</type><track>3</track><mappos>118</mappos></item></path>";
static const level_08:String = "<path><length>120</length><difficulty>easy</difficulty><item><type>obstacle</type><track>3</track><mappos>30</mappos></item><item><type>coin</type><track>3</track><mappos>35</mappos></item><item><type>obstacle</type><track>5</track><mappos>39</mappos></item><item><type>obstacle</type><track>3</track><mappos>40</mappos></item><item><type>coin</type><track>3</track><mappos>44</mappos></item><item><type>obstacle</type><track>3</track><mappos>49</mappos></item><item><type>obstacle</type><track>1</track><mappos>49</mappos></item><item><type>obstacle</type><track>2</track><mappos>51</mappos></item><item><type>obstacle</type><track>1</track><mappos>56</mappos></item><item><type>obstacle</type><track>0</track><mappos>58</mappos></item><item><type>obstacle</type><track>2</track><mappos>59</mappos></item><item><type>obstacle</type><track>1</track><mappos>62</mappos></item><item><type>obstacle</type><track>5</track><mappos>62</mappos></item><item><type>obstacle</type><track>5</track><mappos>65</mappos></item><item><type>obstacle</type><track>5</track><mappos>68</mappos></item><item><type>obstacle</type><track>5</track><mappos>72</mappos></item><item><type>coin</type><track>1</track><mappos>73</mappos></item><item><type>obstacle</type><track>5</track><mappos>75</mappos></item><item><type>obstacle</type><track>1</track><mappos>78</mappos></item><item><type>obstacle</type><track>2</track><mappos>82</mappos></item><item><type>obstacle</type><track>3</track><mappos>82</mappos></item><item><type>obstacle</type><track>4</track><mappos>86</mappos></item><item><type>obstacle</type><track>1</track><mappos>90</mappos></item><item><type>obstacle</type><track>2</track><mappos>93</mappos></item><item><type>obstacle</type><track>0</track><mappos>93</mappos></item><item><type>coin</type><track>1</track><mappos>94</mappos></item><item><type>obstacle</type><track>1</track><mappos>97</mappos></item><item><type>obstacle</type><track>4</track><mappos>101</mappos></item><item><type>obstacle</type><track>4</track><mappos>105</mappos></item><item><type>obstacle</type><track>4</track><mappos>107</mappos></item><item><type>coin</type><track>5</track><mappos>107</mappos></item><item><type>obstacle</type><track>4</track><mappos>112</mappos></item><item><type>obstacle</type><track>4</track><mappos>115</mappos></item></path>";
static const level_09:String = "<path><length>120</length><difficulty>medium</difficulty><item><type>obstacle</type><track>1</track><mappos>8</mappos></item><item><type>obstacle</type><track>3</track><mappos>8</mappos></item><item><type>obstacle</type><track>2</track><mappos>10</mappos></item><item><type>obstacle</type><track>2</track><mappos>13</mappos></item><item><type>obstacle</type><track>2</track><mappos>15</mappos></item><item><type>obstacle</type><track>4</track><mappos>20</mappos></item><item><type>obstacle</type><track>5</track><mappos>23</mappos></item><item><type>obstacle</type><track>0</track><mappos>34</mappos></item><item><type>obstacle</type><track>1</track><mappos>40</mappos></item><item><type>obstacle</type><track>2</track><mappos>45</mappos></item><item><type>obstacle</type><track>3</track><mappos>48</mappos></item><item><type>obstacle</type><track>4</track><mappos>57</mappos></item><item><type>obstacle</type><track>4</track><mappos>60</mappos></item><item><type>coin</type><track>1</track><mappos>69</mappos></item><item><type>obstacle</type><track>0</track><mappos>70</mappos></item><item><type>obstacle</type><track>2</track><mappos>71</mappos></item><item><type>obstacle</type><track>4</track><mappos>76</mappos></item><item><type>obstacle</type><track>5</track><mappos>77</mappos></item><item><type>obstacle</type><track>3</track><mappos>84</mappos></item><item><type>obstacle</type><track>1</track><mappos>85</mappos></item><item><type>obstacle</type><track>2</track><mappos>89</mappos></item><item><type>obstacle</type><track>0</track><mappos>97</mappos></item><item><type>obstacle</type><track>2</track><mappos>104</mappos></item><item><type>obstacle</type><track>3</track><mappos>105</mappos></item><item><type>obstacle</type><track>5</track><mappos>111</mappos></item><item><type>obstacle</type><track>0</track><mappos>113</mappos></item><item><type>obstacle</type><track>3</track><mappos>118</mappos></item><item><type>obstacle</type><track>1</track><mappos>118</mappos></item></path>";
static const level_07:String = "<path><length>100</length><difficulty>easy</difficulty><item><type>obstacle</type><track>0</track><mappos>10</mappos></item><item><type>obstacle</type><track>5</track><mappos>14</mappos></item><item><type>obstacle</type><track>3</track><mappos>22</mappos></item><item><type>obstacle</type><track>1</track><mappos>36</mappos></item><item><type>obstacle</type><track>2</track><mappos>36</mappos></item><item><type>obstacle</type><track>2</track><mappos>46</mappos></item><item><type>obstacle</type><track>3</track><mappos>48</mappos></item><item><type>obstacle</type><track>4</track><mappos>52</mappos></item><item><type>obstacle</type><track>4</track><mappos>55</mappos></item><item><type>obstacle</type><track>3</track><mappos>58</mappos></item><item><type>obstacle</type><track>2</track><mappos>61</mappos></item><item><type>obstacle</type><track>1</track><mappos>64</mappos></item><item><type>obstacle</type><track>4</track><mappos>65</mappos></item><item><type>obstacle</type><track>3</track><mappos>68</mappos></item><item><type>obstacle</type><track>1</track><mappos>68</mappos></item><item><type>obstacle</type><track>1</track><mappos>71</mappos></item><item><type>obstacle</type><track>3</track><mappos>71</mappos></item><item><type>obstacle</type><track>4</track><mappos>77</mappos></item><item><type>obstacle</type><track>0</track><mappos>78</mappos></item><item><type>coin</type><track>0</track><mappos>81</mappos></item><item><type>obstacle</type><track>2</track><mappos>84</mappos></item><item><type>obstacle</type><track>5</track><mappos>84</mappos></item><item><type>obstacle</type><track>1</track><mappos>84</mappos></item><item><type>obstacle</type><track>3</track><mappos>97</mappos></item></path>";
static const level_10:String = "<path><length>140</length><difficulty>medium</difficulty><item><type>obstacle</type><track>4</track><mappos>9</mappos></item><item><type>obstacle</type><track>2</track><mappos>10</mappos></item><item><type>obstacle</type><track>3</track><mappos>10</mappos></item><item><type>obstacle</type><track>5</track><mappos>18</mappos></item><item><type>obstacle</type><track>1</track><mappos>20</mappos></item><item><type>obstacle</type><track>2</track><mappos>23</mappos></item><item><type>obstacle</type><track>0</track><mappos>24</mappos></item><item><type>obstacle</type><track>4</track><mappos>25</mappos></item><item><type>obstacle</type><track>5</track><mappos>31</mappos></item><item><type>obstacle</type><track>1</track><mappos>33</mappos></item><item><type>obstacle</type><track>3</track><mappos>33</mappos></item><item><type>obstacle</type><track>2</track><mappos>39</mappos></item><item><type>obstacle</type><track>2</track><mappos>52</mappos></item><item><type>obstacle</type><track>4</track><mappos>52</mappos></item><item><type>obstacle</type><track>5</track><mappos>55</mappos></item><item><type>obstacle</type><track>1</track><mappos>55</mappos></item><item><type>obstacle</type><track>5</track><mappos>60</mappos></item><item><type>obstacle</type><track>3</track><mappos>60</mappos></item><item><type>obstacle</type><track>0</track><mappos>60</mappos></item><item><type>obstacle</type><track>1</track><mappos>69</mappos></item><item><type>obstacle</type><track>0</track><mappos>69</mappos></item><item><type>obstacle</type><track>5</track><mappos>69</mappos></item><item><type>obstacle</type><track>2</track><mappos>69</mappos></item><item><type>obstacle</type><track>5</track><mappos>71</mappos></item><item><type>obstacle</type><track>0</track><mappos>72</mappos></item><item><type>obstacle</type><track>1</track><mappos>73</mappos></item><item><type>obstacle</type><track>5</track><mappos>75</mappos></item><item><type>obstacle</type><track>1</track><mappos>76</mappos></item><item><type>coin</type><track>3</track><mappos>76</mappos></item><item><type>obstacle</type><track>0</track><mappos>76</mappos></item><item><type>obstacle</type><track>3</track><mappos>79</mappos></item><item><type>obstacle</type><track>1</track><mappos>80</mappos></item><item><type>obstacle</type><track>0</track><mappos>80</mappos></item><item><type>obstacle</type><track>1</track><mappos>83</mappos></item><item><type>obstacle</type><track>3</track><mappos>83</mappos></item><item><type>obstacle</type><track>0</track><mappos>83</mappos></item><item><type>obstacle</type><track>5</track><mappos>85</mappos></item><item><type>obstacle</type><track>3</track><mappos>86</mappos></item><item><type>obstacle</type><track>1</track><mappos>86</mappos></item><item><type>obstacle</type><track>4</track><mappos>86</mappos></item><item><type>obstacle</type><track>0</track><mappos>86</mappos></item><item><type>obstacle</type><track>2</track><mappos>92</mappos></item><item><type>obstacle</type><track>1</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>99</mappos></item><item><type>obstacle</type><track>4</track><mappos>100</mappos></item><item><type>obstacle</type><track>5</track><mappos>104</mappos></item><item><type>obstacle</type><track>2</track><mappos>109</mappos></item><item><type>obstacle</type><track>0</track><mappos>112</mappos></item><item><type>obstacle</type><track>2</track><mappos>114</mappos></item><item><type>obstacle</type><track>5</track><mappos>117</mappos></item><item><type>obstacle</type><track>3</track><mappos>117</mappos></item><item><type>obstacle</type><track>0</track><mappos>119</mappos></item><item><type>obstacle</type><track>3</track><mappos>125</mappos></item><item><type>obstacle</type><track>4</track><mappos>125</mappos></item><item><type>obstacle</type><track>5</track><mappos>131</mappos></item><item><type>obstacle</type><track>4</track><mappos>134</mappos></item><item><type>obstacle</type><track>3</track><mappos>135</mappos></item><item><type>obstacle</type><track>1</track><mappos>139</mappos></item></path>";
static const level_11:String = "<path><length>160</length><difficulty>hard</difficulty><item><type>obstacle</type><track>5</track><mappos>4</mappos></item><item><type>obstacle</type><track>0</track><mappos>4</mappos></item><item><type>obstacle</type><track>2</track><mappos>8</mappos></item><item><type>obstacle</type><track>4</track><mappos>8</mappos></item><item><type>obstacle</type><track>0</track><mappos>12</mappos></item><item><type>obstacle</type><track>4</track><mappos>12</mappos></item><item><type>obstacle</type><track>1</track><mappos>15</mappos></item><item><type>obstacle</type><track>5</track><mappos>16</mappos></item><item><type>obstacle</type><track>4</track><mappos>20</mappos></item><item><type>obstacle</type><track>2</track><mappos>20</mappos></item><item><type>obstacle</type><track>1</track><mappos>23</mappos></item><item><type>obstacle</type><track>2</track><mappos>23</mappos></item><item><type>obstacle</type><track>0</track><mappos>27</mappos></item><item><type>obstacle</type><track>3</track><mappos>27</mappos></item><item><type>obstacle</type><track>3</track><mappos>31</mappos></item><item><type>obstacle</type><track>0</track><mappos>32</mappos></item><item><type>obstacle</type><track>4</track><mappos>35</mappos></item><item><type>obstacle</type><track>2</track><mappos>36</mappos></item><item><type>obstacle</type><track>5</track><mappos>39</mappos></item><item><type>obstacle</type><track>2</track><mappos>41</mappos></item><item><type>obstacle</type><track>1</track><mappos>44</mappos></item><item><type>obstacle</type><track>4</track><mappos>44</mappos></item><item><type>obstacle</type><track>4</track><mappos>48</mappos></item><item><type>obstacle</type><track>3</track><mappos>48</mappos></item><item><type>obstacle</type><track>0</track><mappos>48</mappos></item><item><type>obstacle</type><track>5</track><mappos>49</mappos></item><item><type>obstacle</type><track>1</track><mappos>55</mappos></item><item><type>obstacle</type><track>2</track><mappos>58</mappos></item><item><type>obstacle</type><track>5</track><mappos>62</mappos></item><item><type>obstacle</type><track>0</track><mappos>62</mappos></item><item><type>obstacle</type><track>3</track><mappos>66</mappos></item><item><type>obstacle</type><track>4</track><mappos>71</mappos></item><item><type>obstacle</type><track>5</track><mappos>71</mappos></item><item><type>obstacle</type><track>2</track><mappos>72</mappos></item><item><type>obstacle</type><track>0</track><mappos>72</mappos></item><item><type>obstacle</type><track>1</track><mappos>72</mappos></item><item><type>obstacle</type><track>3</track><mappos>78</mappos></item><item><type>obstacle</type><track>4</track><mappos>78</mappos></item><item><type>obstacle</type><track>2</track><mappos>78</mappos></item><item><type>obstacle</type><track>0</track><mappos>83</mappos></item><item><type>obstacle</type><track>3</track><mappos>89</mappos></item><item><type>obstacle</type><track>1</track><mappos>90</mappos></item><item><type>obstacle</type><track>4</track><mappos>91</mappos></item><item><type>obstacle</type><track>1</track><mappos>95</mappos></item><item><type>obstacle</type><track>4</track><mappos>95</mappos></item><item><type>obstacle</type><track>1</track><mappos>97</mappos></item><item><type>obstacle</type><track>4</track><mappos>97</mappos></item><item><type>obstacle</type><track>1</track><mappos>100</mappos></item><item><type>obstacle</type><track>4</track><mappos>100</mappos></item><item><type>coin</type><track>3</track><mappos>101</mappos></item><item><type>obstacle</type><track>3</track><mappos>105</mappos></item><item><type>obstacle</type><track>2</track><mappos>105</mappos></item><item><type>obstacle</type><track>5</track><mappos>113</mappos></item><item><type>obstacle</type><track>4</track><mappos>113</mappos></item><item><type>obstacle</type><track>0</track><mappos>114</mappos></item><item><type>obstacle</type><track>1</track><mappos>115</mappos></item><item><type>obstacle</type><track>2</track><mappos>122</mappos></item><item><type>obstacle</type><track>3</track><mappos>123</mappos></item><item><type>obstacle</type><track>4</track><mappos>130</mappos></item><item><type>obstacle</type><track>1</track><mappos>130</mappos></item><item><type>obstacle</type><track>3</track><mappos>134</mappos></item><item><type>obstacle</type><track>0</track><mappos>134</mappos></item><item><type>obstacle</type><track>2</track><mappos>137</mappos></item><item><type>obstacle</type><track>1</track><mappos>144</mappos></item><item><type>obstacle</type><track>3</track><mappos>146</mappos></item><item><type>obstacle</type><track>4</track><mappos>148</mappos></item><item><type>obstacle</type><track>5</track><mappos>150</mappos></item><item><type>obstacle</type><track>2</track><mappos>154</mappos></item><item><type>obstacle</type><track>0</track><mappos>156</mappos></item><item><type>obstacle</type><track>1</track><mappos>159</mappos></item><item><type>obstacle</type><track>0</track><mappos>160</mappos></item></path>";
static const level_12:String = "<path><length>160</length><difficulty>hard</difficulty><item><type>obstacle</type><track>1</track><mappos>4</mappos></item><item><type>obstacle</type><track>5</track><mappos>8</mappos></item><item><type>obstacle</type><track>4</track><mappos>10</mappos></item><item><type>obstacle</type><track>0</track><mappos>11</mappos></item><item><type>obstacle</type><track>3</track><mappos>15</mappos></item><item><type>obstacle</type><track>2</track><mappos>18</mappos></item><item><type>obstacle</type><track>0</track><mappos>20</mappos></item><item><type>obstacle</type><track>5</track><mappos>24</mappos></item><item><type>obstacle</type><track>0</track><mappos>27</mappos></item><item><type>obstacle</type><track>4</track><mappos>29</mappos></item><item><type>obstacle</type><track>3</track><mappos>32</mappos></item><item><type>obstacle</type><track>5</track><mappos>36</mappos></item><item><type>obstacle</type><track>2</track><mappos>37</mappos></item><item><type>obstacle</type><track>0</track><mappos>40</mappos></item><item><type>obstacle</type><track>5</track><mappos>43</mappos></item><item><type>obstacle</type><track>2</track><mappos>43</mappos></item><item><type>obstacle</type><track>1</track><mappos>43</mappos></item><item><type>obstacle</type><track>4</track><mappos>48</mappos></item><item><type>obstacle</type><track>1</track><mappos>50</mappos></item><item><type>obstacle</type><track>3</track><mappos>51</mappos></item><item><type>obstacle</type><track>4</track><mappos>56</mappos></item><item><type>obstacle</type><track>3</track><mappos>58</mappos></item><item><type>obstacle</type><track>0</track><mappos>60</mappos></item><item><type>obstacle</type><track>2</track><mappos>64</mappos></item><item><type>obstacle</type><track>4</track><mappos>68</mappos></item><item><type>obstacle</type><track>5</track><mappos>71</mappos></item><item><type>obstacle</type><track>0</track><mappos>72</mappos></item><item><type>obstacle</type><track>1</track><mappos>75</mappos></item><item><type>obstacle</type><track>5</track><mappos>75</mappos></item><item><type>obstacle</type><track>2</track><mappos>78</mappos></item><item><type>obstacle</type><track>4</track><mappos>81</mappos></item><item><type>obstacle</type><track>3</track><mappos>83</mappos></item><item><type>obstacle</type><track>1</track><mappos>85</mappos></item><item><type>obstacle</type><track>4</track><mappos>88</mappos></item><item><type>obstacle</type><track>2</track><mappos>89</mappos></item><item><type>obstacle</type><track>3</track><mappos>93</mappos></item><item><type>obstacle</type><track>1</track><mappos>93</mappos></item><item><type>obstacle</type><track>2</track><mappos>94</mappos></item><item><type>obstacle</type><track>5</track><mappos>96</mappos></item><item><type>obstacle</type><track>0</track><mappos>97</mappos></item><item><type>obstacle</type><track>1</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>101</mappos></item><item><type>obstacle</type><track>4</track><mappos>101</mappos></item><item><type>obstacle</type><track>2</track><mappos>104</mappos></item><item><type>obstacle</type><track>1</track><mappos>105</mappos></item><item><type>obstacle</type><track>4</track><mappos>109</mappos></item><item><type>obstacle</type><track>3</track><mappos>109</mappos></item><item><type>obstacle</type><track>5</track><mappos>109</mappos></item><item><type>obstacle</type><track>1</track><mappos>111</mappos></item><item><type>obstacle</type><track>4</track><mappos>113</mappos></item><item><type>obstacle</type><track>3</track><mappos>113</mappos></item><item><type>obstacle</type><track>1</track><mappos>114</mappos></item><item><type>obstacle</type><track>0</track><mappos>117</mappos></item><item><type>obstacle</type><track>2</track><mappos>120</mappos></item><item><type>obstacle</type><track>5</track><mappos>120</mappos></item><item><type>obstacle</type><track>4</track><mappos>124</mappos></item><item><type>obstacle</type><track>2</track><mappos>125</mappos></item><item><type>obstacle</type><track>0</track><mappos>127</mappos></item><item><type>obstacle</type><track>3</track><mappos>132</mappos></item><item><type>obstacle</type><track>4</track><mappos>132</mappos></item><item><type>obstacle</type><track>1</track><mappos>133</mappos></item><item><type>obstacle</type><track>5</track><mappos>138</mappos></item><item><type>obstacle</type><track>0</track><mappos>139</mappos></item><item><type>obstacle</type><track>2</track><mappos>139</mappos></item><item><type>obstacle</type><track>1</track><mappos>142</mappos></item><item><type>obstacle</type><track>2</track><mappos>142</mappos></item><item><type>obstacle</type><track>4</track><mappos>142</mappos></item><item><type>obstacle</type><track>4</track><mappos>145</mappos></item><item><type>obstacle</type><track>2</track><mappos>146</mappos></item><item><type>obstacle</type><track>4</track><mappos>147</mappos></item><item><type>coin</type><track>5</track><mappos>148</mappos></item><item><type>obstacle</type><track>1</track><mappos>148</mappos></item><item><type>obstacle</type><track>4</track><mappos>150</mappos></item><item><type>obstacle</type><track>0</track><mappos>152</mappos></item><item><type>obstacle</type><track>4</track><mappos>152</mappos></item><item><type>obstacle</type><track>4</track><mappos>155</mappos></item></path>";
static const level_13:String = "<path><length>150</length><difficulty>hard</difficulty><item><type>obstacle</type><track>5</track><mappos>2</mappos></item><item><type>obstacle</type><track>1</track><mappos>3</mappos></item><item><type>obstacle</type><track>3</track><mappos>8</mappos></item><item><type>obstacle</type><track>5</track><mappos>12</mappos></item><item><type>obstacle</type><track>2</track><mappos>15</mappos></item><item><type>obstacle</type><track>0</track><mappos>18</mappos></item><item><type>obstacle</type><track>4</track><mappos>23</mappos></item><item><type>obstacle</type><track>2</track><mappos>27</mappos></item><item><type>obstacle</type><track>1</track><mappos>30</mappos></item><item><type>obstacle</type><track>0</track><mappos>30</mappos></item><item><type>obstacle</type><track>2</track><mappos>34</mappos></item><item><type>obstacle</type><track>4</track><mappos>38</mappos></item><item><type>obstacle</type><track>1</track><mappos>41</mappos></item><item><type>obstacle</type><track>3</track><mappos>45</mappos></item><item><type>obstacle</type><track>4</track><mappos>47</mappos></item><item><type>obstacle</type><track>5</track><mappos>50</mappos></item><item><type>obstacle</type><track>3</track><mappos>55</mappos></item><item><type>obstacle</type><track>2</track><mappos>55</mappos></item><item><type>obstacle</type><track>5</track><mappos>59</mappos></item><item><type>obstacle</type><track>0</track><mappos>62</mappos></item><item><type>obstacle</type><track>4</track><mappos>65</mappos></item><item><type>obstacle</type><track>3</track><mappos>68</mappos></item><item><type>obstacle</type><track>1</track><mappos>72</mappos></item><item><type>obstacle</type><track>0</track><mappos>77</mappos></item><item><type>obstacle</type><track>5</track><mappos>77</mappos></item><item><type>obstacle</type><track>2</track><mappos>82</mappos></item><item><type>obstacle</type><track>4</track><mappos>85</mappos></item><item><type>obstacle</type><track>3</track><mappos>85</mappos></item><item><type>obstacle</type><track>4</track><mappos>90</mappos></item><item><type>obstacle</type><track>1</track><mappos>90</mappos></item><item><type>obstacle</type><track>2</track><mappos>93</mappos></item><item><type>obstacle</type><track>3</track><mappos>93</mappos></item><item><type>obstacle</type><track>2</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>97</mappos></item><item><type>obstacle</type><track>3</track><mappos>100</mappos></item><item><type>obstacle</type><track>4</track><mappos>104</mappos></item><item><type>obstacle</type><track>2</track><mappos>107</mappos></item><item><type>obstacle</type><track>3</track><mappos>110</mappos></item><item><type>obstacle</type><track>5</track><mappos>112</mappos></item><item><type>obstacle</type><track>5</track><mappos>115</mappos></item><item><type>obstacle</type><track>3</track><mappos>120</mappos></item><item><type>obstacle</type><track>0</track><mappos>123</mappos></item><item><type>obstacle</type><track>2</track><mappos>125</mappos></item><item><type>obstacle</type><track>3</track><mappos>128</mappos></item><item><type>obstacle</type><track>4</track><mappos>130</mappos></item><item><type>obstacle</type><track>1</track><mappos>132</mappos></item><item><type>obstacle</type><track>5</track><mappos>134</mappos></item><item><type>obstacle</type><track>2</track><mappos>134</mappos></item><item><type>obstacle</type><track>0</track><mappos>135</mappos></item><item><type>obstacle</type><track>1</track><mappos>143</mappos></item><item><type>obstacle</type><track>0</track><mappos>146</mappos></item><item><type>obstacle</type><track>2</track><mappos>146</mappos></item><item><type>coin</type><track>1</track><mappos>146</mappos></item><item><type>obstacle</type><track>1</track><mappos>149</mappos></item></path>";
function CLevelData(){
super();
}
static function getLevelStr(level:int){
switch (level){
case 1:
return (level_01);
case 2:
return (level_02);
case 3:
return (level_03);
case 4:
return (level_04);
case 5:
return (level_05);
case 6:
return (level_06);
case 7:
return (level_07);
case 8:
return (level_08);
case 9:
return (level_09);
case 10:
return (level_10);
case 11:
return (level_11);
case 12:
return (level_12);
case 13:
return (level_13);
case 14:
return (level_14);
default:
return (null);
};
}
}
}//package src.ingame
Section 56
//CLevelGen (src.ingame.CLevelGen)
package src.ingame {
import src.*;
import src.ingame.*;
class CLevelGen {
private const PathDiff_hard:int = 2;
private const nPaths:int = 14;
private const interPathDist:int = 10;
private const PathDiff_medium:int = 1;
private const PathDiff_easy:int = 0;
private var hardPaths:Array;
var level:Array;
private var m_lvLevel:CLevel;
private var easyPaths:Array;
private var loader:CResLoader;
private var mediumPathsToGo:Array;
private var hardPathsToGo:Array;
private var easyPathsToGo:Array;
private var mediumPaths:Array;
function CLevelGen(mcLevel:CLevel){
super();
m_lvLevel = mcLevel;
loadPaths();
}
private function onPathLoaded(xPath:XML){
var xlItems:XMLList;
var xItem:XML;
var items:Array;
var path:CLevelPath;
xlItems = xPath.item;
items = new Array();
for each (xItem in xlItems) {
loadItem(items, xItem);
};
path = new CLevelPath(0, items);
if (xPath.difficulty == "easy"){
easyPaths.push(path);
} else {
if (xPath.difficulty == "medium"){
mediumPaths.push(path);
} else {
if (xPath.difficulty == "hard"){
hardPaths.push(path);
};
};
};
}
private function addPathToLevel(level:Array, path:Object, mirror:Boolean, currMapPos:int){
var item:CItem;
var j:int;
if (mirror){
j = 0;
while (j < path.items.length) {
item = new CItem(path.items[j].m_iType, (path.items[j].m_iMapPos + currMapPos), ((m_lvLevel.m_iTracksTotal - path.items[j].m_iTrack) - 1));
level.push(item);
j++;
};
} else {
j = 0;
while (j < path.items.length) {
item = new CItem(path.items[j].m_iType, (path.items[j].m_iMapPos + currMapPos), path.items[j].m_iTrack);
level.push(item);
j++;
};
};
}
private function addItemsLine(items:Array, mapPos:int, lineItems:Array){
var i:int;
i = 0;
while (i < lineItems.length) {
items.push(new CItem(newRandObstacle(), mapPos, lineItems[i]));
i++;
};
}
function createPaths(){
var path:CLevelPath;
var items:Array;
var item:CItem;
var i:int;
var linePos:int;
}
public function createLevel(nLevel:int){
var currMapPos:int;
var path:CLevelPath;
var currPaths:Array;
var i:int;
currMapPos = 0;
currPaths = new Array();
choosePaths(nLevel, currPaths);
level = new Array();
i = 0;
while (i < currPaths.length) {
path = getDiffPath(currPaths[i]);
addPathToLevel(level, path, currPaths[i].mirror, currMapPos);
currMapPos = (level[(level.length - 1)].m_iMapPos + interPathDist);
i++;
};
m_lvLevel.m_iMapLength = (currMapPos + 80);
return (level);
}
private function choosePaths(nLevel:int, currPaths:Array){
var i:int;
refreshPathsToGo();
switch (nLevel){
case 0:
i = 0;
while (i < 6) {
getNewPath(currPaths, 1, PathDiff_easy);
i++;
};
getNewPath(currPaths, 4, PathDiff_medium);
break;
case 1:
getNewPath(currPaths, 6, PathDiff_easy);
getNewPath(currPaths, 6, PathDiff_medium);
break;
case 2:
getNewPath(currPaths, 4, PathDiff_easy);
getNewPath(currPaths, 8, PathDiff_medium);
getNewPath(currPaths, 2, PathDiff_hard);
break;
case 3:
getNewPath(currPaths, 4, PathDiff_easy);
getNewPath(currPaths, 6, PathDiff_medium);
getNewPath(currPaths, 4, PathDiff_hard);
break;
case 4:
getNewPath(currPaths, 10, PathDiff_hard);
break;
};
}
private function loadItem(items:Array, xItem:XML){
var item:CItem;
if (xItem.type == "obstacle"){
item = new CItem(newRandObstacle(), xItem.mappos, xItem.track);
} else {
if (xItem.type == "coin"){
item = new CItem(CItem.ItType_Coin, xItem.mappos, xItem.track);
} else {
if (xItem.type == "boost"){
item = new CItem(CItem.ItType_Boost, xItem.mappos, xItem.track);
} else {
return;
};
};
};
items.push(item);
}
private function getPathsToGo(diff:int){
switch (diff){
case PathDiff_easy:
return (easyPathsToGo);
case PathDiff_medium:
return (mediumPathsToGo);
case PathDiff_hard:
return (hardPathsToGo);
};
}
private function getDiffPath(path:Object){
switch (path.difficulty){
case PathDiff_easy:
return (easyPaths[path.pathID]);
case PathDiff_medium:
return (mediumPaths[path.pathID]);
case PathDiff_hard:
return (hardPaths[path.pathID]);
};
}
private function loadPaths(){
var i:int;
var currXml:XML;
easyPaths = new Array();
mediumPaths = new Array();
hardPaths = new Array();
i = 1;
while (i < 15) {
currXml = new XML(CLevelData.getLevelStr(i));
onPathLoaded(currXml);
i++;
};
}
private function onLevelsLoaded(){
}
private function newRandObstacle(){
return (CUtils.randomInt(0, (CItem.m_iNObstacles - 1)));
}
private function refreshPathsToGo(){
var i:int;
easyPathsToGo = new Array(easyPaths.length);
i = 0;
while (i < easyPathsToGo.length) {
easyPathsToGo[i] = {nPath:i, mirror:false, noMirror:false};
i++;
};
mediumPathsToGo = new Array(mediumPaths.length);
i = 0;
while (i < mediumPathsToGo.length) {
mediumPathsToGo[i] = {nPath:i, mirror:false, noMirror:false};
i++;
};
hardPathsToGo = new Array(hardPaths.length);
i = 0;
while (i < hardPathsToGo.length) {
hardPathsToGo[i] = {nPath:i, mirror:false, noMirror:false};
i++;
};
}
private function getNewPath(currPaths:Array, nNewPaths:int, diff:int){
var i:*;
var j:*;
var k:int;
var newPathIdx:int;
var pathsToGo:Array;
var makeMirror:Boolean;
pathsToGo = getPathsToGo(diff);
i = 0;
while (i < nNewPaths) {
if (pathsToGo.length == 0){
refreshPathsToGo();
pathsToGo = getPathsToGo(diff);
};
newPathIdx = CUtils.randomInt(0, (pathsToGo.length - 1));
if (pathsToGo[newPathIdx].noMirror){
currPaths.push({pathID:pathsToGo[newPathIdx].nPath, mirror:true, difficulty:diff});
pathsToGo.splice(newPathIdx, 1);
} else {
if (pathsToGo[newPathIdx].mirror){
currPaths.push({pathID:pathsToGo[newPathIdx].nPath, mirror:false, difficulty:diff});
pathsToGo.splice(newPathIdx, 1);
} else {
if (((!(pathsToGo[newPathIdx].mirror)) && (!(pathsToGo[newPathIdx].noMirror)))){
makeMirror = (Math.random() < 0.5);
currPaths.push({pathID:pathsToGo[newPathIdx].nPath, mirror:makeMirror, difficulty:diff});
pathsToGo[newPathIdx].mirror = makeMirror;
pathsToGo[newPathIdx].noMirror = !(makeMirror);
};
};
};
i++;
};
}
}
}//package src.ingame
Section 57
//CLevelPath (src.ingame.CLevelPath)
package src.ingame {
class CLevelPath {
var items:Array;
var id:int;
function CLevelPath(id:int, newItems:Array){
var i:int;
super();
items = new Array();
i = 0;
while (i < newItems.length) {
items.push(newItems[i]);
i++;
};
}
}
}//package src.ingame
Section 58
//CRoad (src.ingame.CRoad)
package src.ingame {
import flash.display.*;
public class CRoad extends MovieClip {
public var mcStripes:MovieClip;
public var mcGround:MovieClip;
public function CRoad(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
function startAnims(){
gotoAndStop("running");
}
function stopAnims(){
gotoAndStop("stopped");
}
}
}//package src.ingame
Section 59
//CScreenItem (src.ingame.CScreenItem)
package src.ingame {
import flash.events.*;
import flash.display.*;
import src.*;
import flash.geom.*;
public class CScreenItem extends MovieClip implements IRoadObject {
const startY:int = 251;
private const ItemSt_Idle:int = 0;
private const ItemSt_Break:int = 1;
var alphaDelta:Number;
var m_nTrackOffset:Number;
var animControl:CAnimControl;
var m_bCollidable:Boolean;
private var m_iStartX:int;
public var itemAnims:MovieClip;
var m_nItemSpeed:Number;
var m_lvLevel:CLevel;
var m_bOutsideScreen:Boolean;
var m_iMapPos:int;
var m_iTrack:Number;
private var m_iCurrState:int;
var m_bReady:Boolean;
var m_iId:int;
var m_nScale:Number;
private var m_iScaleTicks:int;
var m_iType:int;
private static const m_iScaleTime = 3;
private static const startScale:Number = 0.5;
private static const m_nSpeedMultiplier:Number = 1.22;
private static const maxOffset:Number = 16;
private static const minScale:Number = 0.01;
private static const m_iDisappearTime:int = 3;
private static const m_nScaleFactor:Number = 0.012;
private static const nBreakFrames:int = 2;
public function CScreenItem(){
super();
addFrameScript(0, frame1);
m_bReady = false;
animControl = new CAnimControl();
}
public function updateScale(){
scaleX = (scaleY = (minScale + ((y * (startScale - minScale)) / startY)));
}
public function onCollision(){
if (m_iCurrState == ItemSt_Break){
return;
};
m_iCurrState = ItemSt_Break;
m_bCollidable = false;
switch (m_lvLevel.m_arrItemsGroups[m_iType]){
case CItem.ItGroup_Obstacle:
onObstCollision();
break;
case CItem.ItGroup_Bonus:
onBonusCollision(m_iType);
break;
case CItem.ItGroup_Special:
break;
default:
break;
};
}
private function updateAlpha(event:Event){
alpha = (alpha - alphaDelta);
if (alpha == 0){
removeEventListener(Event.ENTER_FRAME, updateAlpha);
m_lvLevel.undisplayItem(m_iId);
};
}
function initType(){
if (m_iType == CItem.ItType_Slope){
m_bReady = false;
};
}
function frame1(){
stop();
}
private function onObstCollision(){
itemAnims.gotoAndPlay("break");
startAlphaAnim(m_iDisappearTime);
}
private function onBonusCollision(type:int){
startAlphaAnim(m_iDisappearTime);
}
private function startAlphaAnim(duration:int){
alphaDelta = (1 / duration);
addEventListener(Event.ENTER_FRAME, updateAlpha);
}
function setItem(id:int, item:CItem){
m_iId = id;
m_iType = item.m_iType;
m_iMapPos = item.m_iMapPos;
m_iTrack = item.m_iTrack;
m_nTrackOffset = (((Math.random() * 2) * maxOffset) - maxOffset);
m_lvLevel = CGame.m_gmGame.m_lvLevel;
m_lvLevel.m_mcItems.addChild(this);
animControl.onNextRender(this, loopInit);
}
public function isColliding(bikeHitArea:Rectangle):Boolean{
if ((x + width) < bikeHitArea.x){
return (false);
};
if ((bikeHitArea.x + bikeHitArea.width) < x){
return (false);
};
if ((y + height) < bikeHitArea.y){
return (false);
};
if ((bikeHitArea.y + bikeHitArea.height) < y){
return (false);
};
return (true);
}
public function update(){
if (!m_bReady){
return;
};
updatePos();
updateScale();
}
public function updatePos(){
var deltaY:*;
var deltaX:*;
deltaY = m_nItemSpeed;
deltaX = (Number(m_nItemSpeed) / m_lvLevel.tracksAnglesTan[m_iTrack]);
y = (y + deltaY);
if (y > stage.stageHeight){
m_bOutsideScreen = true;
};
x = (x - deltaX);
m_nItemSpeed = (m_nItemSpeed * m_nSpeedMultiplier);
}
function loopInit(){
m_iCurrState = ItemSt_Idle;
m_iStartX = m_lvLevel.getTrackFarPos(m_iTrack);
m_nItemSpeed = m_lvLevel.m_nItemStartSpeed;
m_iScaleTicks = 0;
m_bOutsideScreen = false;
m_bCollidable = true;
x = (m_iStartX + m_nTrackOffset);
y = m_lvLevel.m_mcRoad.y;
updateScale();
gotoAndStop((m_iType + 1));
m_bReady = true;
initType();
}
}
}//package src.ingame
Section 60
//CTutorial (src.ingame.CTutorial)
package src.ingame {
import flash.events.*;
import flash.display.*;
public class CTutorial extends MovieClip {
public var m_cutCutsceneMgr:CCutsceneMgr;
public function CTutorial(){
super();
addFrameScript(0, frame1);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onNextClick);
}
function onNextClick(e:MouseEvent){
if (currentFrame == totalFrames){
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onNextClick);
end();
} else {
nextFrame();
};
}
function frame1(){
stop();
}
function end(){
m_cutCutsceneMgr.funcAfterCutscene();
}
}
}//package src.ingame
Section 61
//CUtils (src.ingame.CUtils)
package src.ingame {
class CUtils {
function CUtils(){
super();
}
static function fromDegreeToRad(degrees:Number){
return (((degrees * Math.PI) / 180));
}
static function randomInt(min, max:int):int{
return (Math.floor(((Math.random() * ((max - min) + 1)) + min)));
}
}
}//package src.ingame
Section 62
//IRoadObject (src.ingame.IRoadObject)
package src.ingame {
interface IRoadObject {
function updateScale();
function update();
function updatePos();
}
}//package src.ingame
Section 63
//CAnimControl (src.CAnimControl)
package src {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
public class CAnimControl {
var currTimer:Timer;
var nextMethod:Function;
var currMC:MovieClip;
var nextLabel:String;
public function CAnimControl(){
super();
}
private function onNextRenderAfterFrame(event:Event){
currMC.removeEventListener(Event.ENTER_FRAME, onNextRenderAfterFrame);
currMC.addEventListener(Event.RENDER, onNextRenderAfterRender);
currMC.stage.invalidate();
}
public function onNextRender(mc:MovieClip, func:Function){
nextMethod = func;
currMC = mc;
currMC.addEventListener(Event.RENDER, onNextRenderAfterRender);
currMC.stage.invalidate();
}
private function onTimerEndAfter(event:TimerEvent){
currTimer.removeEventListener(TimerEvent.TIMER, onTimerEndAfter);
nextMethod();
}
private function onNextRenderAfterRender(event:Event){
currMC.removeEventListener(Event.RENDER, onNextRenderAfterRender);
currMC = null;
nextMethod();
}
public function onTimerEnd(timer:Timer, func:Function){
currTimer = timer;
nextMethod = func;
currTimer.addEventListener(TimerEvent.TIMER, onTimerEndAfter);
currTimer.start();
}
private function onLabelAfter(event:Event){
if (currMC.currentLabel == nextLabel){
currMC.removeEventListener(Event.ENTER_FRAME, onLabelAfter);
currMC = null;
nextLabel = null;
nextMethod();
} else {
currMC.nextFrame();
};
}
public function onLabel(mc:MovieClip, aLabel:String, func:Function){
trace(((((("onLabel: " + mc) + " ") + aLabel) + " ") + func));
nextMethod = func;
currMC = mc;
nextLabel = aLabel;
currMC.addEventListener(Event.ENTER_FRAME, onLabelAfter);
}
public function onNextRenderWait(mc:MovieClip, func:Function){
nextMethod = func;
currMC = mc;
currMC.addEventListener(Event.ENTER_FRAME, onNextRenderAfterFrame);
}
}
}//package src
Section 64
//CGlobals (src.CGlobals)
package src {
import flash.net.*;
public class CGlobals {
public static const GameMode_hell = 2;
public static const GameMode_none = 0;
public static const GameMode_normal = 1;
public static const g_iGameId = 2;
public static var g_iScore:int;
public static var menuStart:Boolean;
public static var g_strPlayerName:String;
public static var g_iGameMode:int;
public static var g_bDebug:Boolean = false;
public static var g_soGameSO:SharedObject;
public static var g_strRootDir:String;
public static var g_bHellActivated:Boolean;
public function CGlobals(){
super();
}
}
}//package src
Section 65
//CInstructions (src.CInstructions)
package src {
import flash.events.*;
import flash.display.*;
public class CInstructions extends MovieClip {
public var btReturnMenu:SimpleButton;
public function CInstructions(){
super();
addEventListener(Event.ENTER_FRAME, loopInit);
}
function onBtMenuClick(event:Event){
btReturnMenu.removeEventListener(MouseEvent.CLICK, onBtMenuClick);
CRoot(root).gotoAndStop("menu");
}
public function loopInit(event:Event){
removeEventListener(Event.ENTER_FRAME, loopInit);
btReturnMenu.addEventListener(MouseEvent.CLICK, onBtMenuClick);
}
}
}//package src
Section 66
//CLoading (src.CLoading)
package src {
import flash.display.*;
import mochi.as3.*;
import flash.text.*;
public class CLoading extends MovieClip {
public var mcBar:MovieClip;
public var dtLoading:TextField;
public var m_mcAdWindow:MovieClip;
public function CLoading(){
var mochiOptions:Object;
super();
trace("[CLoading] Constructor");
mochiOptions = {clip:m_mcAdWindow, id:"74eff7586849a059", res:"640x480", no_progress_bar:true, no_bg:true, ad_progress:onRootLoaderProgress, ad_finished:onRootLoaderComplete};
MochiAd.showPreGameAd(mochiOptions);
}
private function onRootLoaderComplete():void{
trace("[CLoading] onRootLoaderComplete");
CRoot(root).loadComplete();
}
private function onRootLoaderProgress(percent:Number):void{
var percentInt:*;
percentInt = int(percent);
dtLoading.text = (String(percentInt) + " %");
mcBar.gotoAndStop(percentInt);
}
}
}//package src
Section 67
//CMenu (src.CMenu)
package src {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CMenu extends MovieClip {
public var mcSoundOn:MovieClip;
public var btInstructions:SimpleButton;
var animControl:CAnimControl;
public var dtName:TextField;
public var btRanking:SimpleButton;
public var btChangeName:SimpleButton;
public var btPlay:SimpleButton;
public var mcEnterName:MovieClip;
public var btHell:SimpleButton;
public function CMenu(){
super();
addFrameScript(0, frame1);
animControl = new CAnimControl();
animControl.onNextRender(this, loopInit);
}
public function onBtRankingClick(event:MouseEvent){
}
public function onBtGameClick(event:MouseEvent){
btPlay.removeEventListener(MouseEvent.CLICK, onBtGameClick);
CGlobals.g_iGameMode = CGlobals.GameMode_normal;
CRoot(root).playGame();
}
public function onBtSoundClick(event:MouseEvent){
CRoot(root).smSoundMgr.toggle();
if ((mcSoundOn.currentLabel == "on")){
mcSoundOn.gotoAndStop("off");
} else {
mcSoundOn.gotoAndStop("on");
};
CGlobals.g_soGameSO.data.soundEnabled = CRoot(root).smSoundMgr.isOn();
}
public function onBtInstructionsClick(event:MouseEvent){
btInstructions.removeEventListener(MouseEvent.CLICK, onBtInstructionsClick);
CRoot(root).gotoInstructions();
}
function frame1(){
stop();
}
public function onBtHellClick(event:MouseEvent){
btHell.removeEventListener(MouseEvent.CLICK, onBtHellClick);
CGlobals.g_iGameMode = CGlobals.GameMode_hell;
CRoot(root).playHell();
}
public function onNameConfirmClick(event:MouseEvent){
if (CGlobals.g_iGameMode == CGlobals.GameMode_normal){
CRoot(root).playGame();
} else {
CRoot(root).playHell();
};
}
public function loopInit(){
CGlobals.g_iGameMode = CGlobals.GameMode_none;
mcEnterName.visible = false;
if (CGlobals.g_bHellActivated){
btHell.visible = true;
btHell.addEventListener(MouseEvent.CLICK, onBtHellClick);
} else {
btHell.visible = false;
};
btPlay.addEventListener(MouseEvent.CLICK, onBtGameClick);
btInstructions.addEventListener(MouseEvent.CLICK, onBtInstructionsClick);
mcSoundOn.addEventListener(MouseEvent.CLICK, onBtSoundClick);
if (CRoot(root).smSoundMgr.isOn()){
mcSoundOn.gotoAndStop("on");
} else {
mcSoundOn.gotoAndStop("off");
};
if (CGlobals.menuStart){
CRoot(root).smSoundMgr.playBgm(CSoundMgr.Bgm_Menu, true);
CGlobals.menuStart = false;
};
}
}
}//package src
Section 68
//CRanking (src.CRanking)
package src {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import com.meychi.ascrypt3.*;
public class CRanking extends MovieClip {
var rankingXML:XML;
public var btPlayHell:SimpleButton;
public var m_mcNamesList:MovieClip;
var urlLoader:URLLoader;
public var btReplayGame:SimpleButton;
public var m_mcLoading:MovieClip;
public var btRankHell:SimpleButton;
var m_iShowingState:int;
var m_iPage:int;
public var btRankGame:SimpleButton;
public var playAgain:Function;
public var btMenu:SimpleButton;
public static const MD5KEY:String = "NSP87fds&@(DISA&";
public static const RC4PASS:String = "Pds8@HS $A0hu&";
public static const SCORE_URL:String = "../score.php";
private static const RankScreen_hell:String = "hell";
private static const RankScreen_normal:String = "normal";
public function CRanking(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
trace("[CRanking] Constructor.");
urlLoader = null;
rankingXML = null;
m_iPage = 1;
initRanking();
}
function onBtMenuClick(event:MouseEvent){
btMenu.removeEventListener(MouseEvent.CLICK, onBtMenuClick);
CRoot(root).gotoMenu();
}
function initHellRanking(){
trace("[CRanking] Init hell ranking.");
m_iShowingState = 2;
btMenu.addEventListener(MouseEvent.CLICK, onBtMenuClick);
btRankGame.addEventListener(MouseEvent.CLICK, onBtRankGameClick);
if (playAgain != null){
btReplayGame.addEventListener(MouseEvent.CLICK, playAgain);
};
initHellButtons();
loadRanking();
}
function saveScore(name:String, score:int){
var request:URLRequest;
var variables:URLVariables;
var encryptedMessage:String;
var md5:MD5;
var rc4:RC4;
var name = name;
var score = score;
trace("[CRanking] Saving score");
request = new URLRequest(SCORE_URL);
variables = new URLVariables();
md5 = new MD5();
rc4 = new RC4();
encryptedMessage = ("game=" + CGlobals.g_iGameId.toString());
encryptedMessage = (encryptedMessage + ("&score=" + CGlobals.g_iScore));
encryptedMessage = (encryptedMessage + ("&nick=" + CGlobals.g_strPlayerName));
encryptedMessage = (encryptedMessage + ("&game_state=" + CGlobals.g_iGameMode));
encryptedMessage = (encryptedMessage + ("&m=" + md5.calculate((encryptedMessage + MD5KEY)).substr(0, 8)));
trace(("[CRanking] Encrypted message: " + encryptedMessage));
variables.op = "save_score";
variables.k = rc4.encrypt(encryptedMessage, RC4PASS);
request.method = URLRequestMethod.GET;
request.data = variables;
urlLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
urlLoader.addEventListener(Event.COMPLETE, completeSaveScore);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
urlLoader.load(request);
//unresolved jump
var _slot1 = error;
trace(("[CRanking] Unable to load URL: " + _slot1));
}
function initRanking(){
trace("[CRanking] Initializing ranking.");
if (CGlobals.g_iGameMode != CGlobals.GameMode_none){
saveScore(CGlobals.g_strPlayerName, CGlobals.g_iScore);
} else {
if (CGlobals.g_iGameMode != CGlobals.GameMode_hell){
initRankingScreen(RankScreen_normal);
} else {
initRankingScreen(RankScreen_hell);
};
};
}
function completeSaveScore(event:Event):void{
trace("[CRanking] completeHandler init");
trace(("[CRanking] urlLoader.data.res:" + urlLoader.data.res));
trace(("[CRanking] event.target.data.res:" + event.target.data.res));
trace("[CRanking] completeHandler end");
if (CGlobals.g_iGameMode == CGlobals.GameMode_normal){
playAgain = onBtReplayGameClick;
initRankingScreen(RankScreen_normal);
} else {
playAgain = onBtPlayHellClick;
initRankingScreen(RankScreen_hell);
};
urlLoader = null;
}
function initNormalRanking(){
trace("[CRanking] Init regular ranking.");
m_iShowingState = 1;
btMenu.addEventListener(MouseEvent.CLICK, onBtMenuClick);
btRankHell.addEventListener(MouseEvent.CLICK, onBtRankHellClick);
btPlayHell.addEventListener(MouseEvent.CLICK, onBtPlayHellClick);
if (playAgain != null){
btReplayGame.addEventListener(MouseEvent.CLICK, playAgain);
};
initNormalButtons();
loadRanking();
}
function clearNameList(){
while (m_mcNamesList.numChildren > 0) {
m_mcNamesList.removeChildAt((m_mcNamesList.numChildren - 1));
};
}
function initRankingScreen(screen:String){
trace("[CRanking] Init ranking screen.");
gotoAndStop(screen);
}
function initHellButtons(){
btRankGame.visible = true;
switch (CGlobals.g_iGameMode){
case CGlobals.GameMode_none:
btReplayGame.visible = false;
break;
case CGlobals.GameMode_normal:
btReplayGame.visible = true;
break;
case CGlobals.GameMode_hell:
btReplayGame.visible = true;
break;
};
}
function onBtPlayHellClick(event:MouseEvent){
trace("[CRanking] Play Again (Hell).");
trace(event.target.name);
event.target.removeEventListener(MouseEvent.CLICK, onBtPlayHellClick);
CGlobals.g_iGameMode = CGlobals.GameMode_hell;
CRoot(root).playHell();
}
function initNormalButtons(){
switch (CGlobals.g_iGameMode){
case CGlobals.GameMode_none:
if (CGlobals.g_bHellActivated){
btRankHell.visible = true;
} else {
btRankHell.visible = false;
};
btReplayGame.visible = false;
btPlayHell.visible = false;
break;
case CGlobals.GameMode_normal:
if (CGlobals.g_bHellActivated){
btRankHell.visible = true;
btPlayHell.visible = true;
} else {
btRankHell.visible = false;
btPlayHell.visible = false;
};
btReplayGame.visible = true;
break;
case CGlobals.GameMode_hell:
btRankHell.visible = true;
btReplayGame.visible = true;
btPlayHell.visible = false;
break;
};
}
function frame3(){
initHellRanking();
}
function loadRanking(){
var header:URLRequestHeader;
var request:URLRequest;
var variables:URLVariables;
header = new URLRequestHeader("pragma", "no-cache");
request = new URLRequest(SCORE_URL);
variables = new URLVariables();
request.requestHeaders.push(header);
variables.op = "get_score";
variables.game = CGlobals.g_iGameId;
variables.limit = "10";
variables.page = m_iPage;
variables.game_state = m_iShowingState.toString();
request.method = URLRequestMethod.GET;
request.data = variables;
m_mcLoading.visible = true;
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, completeLoadRanking);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
urlLoader.load(request);
//unresolved jump
var _slot1 = error;
trace(("[CRanking] Unable to load URL: " + _slot1));
rankingXML = null;
}
function onBtRankHellClick(event:MouseEvent){
btRankHell.removeEventListener(MouseEvent.CLICK, onBtRankHellClick);
clearNameList();
gotoAndStop("hell");
}
function completeLoadRanking(event:Event):void{
trace("[CRanking] completeLoadRanking init");
rankingXML = XML(event.target.data);
populate();
}
function frame2(){
initNormalRanking();
}
function frame1(){
stop();
}
function onBtReplayGameClick(event:MouseEvent){
event.target.removeEventListener(MouseEvent.CLICK, onBtReplayGameClick);
CRoot(root).playGame();
}
private function onIOError(event:IOErrorEvent):void{
CRoot(root).gotoMenu();
}
function onBtRankGameClick(event:MouseEvent){
btRankGame.removeEventListener(MouseEvent.CLICK, onBtRankGameClick);
clearNameList();
gotoAndStop("normal");
}
function populate(){
var idx:int;
var serverDate:Number;
var totalPages:int;
var scorescount:int;
var scoreDisplay:ScoreDisplay;
var position:int;
var prop:XML;
idx = 0;
trace(rankingXML.toXMLString());
trace("[CRanking] completeLoadRanking end");
scorescount = rankingXML.score_prop[0].@count;
totalPages = ((scorescount / 10) + 1);
trace(("[CRanking] totalPages:" + totalPages));
trace(("[CRanking] scorescount:" + scorescount));
clearNameList();
position = 1;
for each (prop in rankingXML.score) {
scoreDisplay = new ScoreDisplay();
scoreDisplay.position.text = (position.toString() + "º");
scoreDisplay.nick.text = prop.@name;
scoreDisplay.score.text = prop.@value;
scoreDisplay.x = 0;
scoreDisplay.y = m_mcNamesList.height;
position++;
m_mcNamesList.addChild(scoreDisplay);
};
m_mcLoading.visible = false;
urlLoader = null;
}
}
}//package src
Section 69
//CResLoader (src.CResLoader)
package src {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class CResLoader {
private const ResType_xml:int = 0;
private const ResType_img:int = 1;
private const ResType_text:int = 0;
private var loaders:Array;
private var currImgSlots:int;
private var queue:Array;
private var textSlots;
private var onCompletee:Function;
private var maxSlots:int;
private var currTextSlots;
private var imgSlots;
private var imgLoaders:Array;
public function CResLoader(l_textSlots, l_imgSlots:int){
super();
textSlots = l_textSlots;
imgSlots = l_imgSlots;
loaders = new Array();
imgLoaders = new Array();
maxSlots = (textSlots + imgSlots);
queue = new Array();
currTextSlots = 0;
currImgSlots = 0;
}
public function addXml(urlString:String, onCompleteFunc:Function){
var queueElem:Object;
trace(("addXml: " + urlString));
queueElem = {type:ResType_xml, url:urlString, onComplete:onCompleteFunc, isLoading:false, loader:URLLoader};
queue.push(queueElem);
}
private function checkQueueEmpty(){
if ((((queue.length == 0)) && (!((onCompletee == null))))){
trace("CResLoader - resources loaded!");
onCompletee();
};
}
private function loadQueueElem(queueElem:Object){
var urlReq:URLRequest;
var i:int;
urlReq = new URLRequest(queueElem.url);
if (queueElem.type <= ResType_text){
loaders.push(new URLLoader());
i = (loaders.length - 1);
queueElem.loader = loaders[i];
queueElem.isLoading = true;
currTextSlots++;
loaders[i].addEventListener(IOErrorEvent.IO_ERROR, onIoError);
loaders[i].addEventListener(Event.COMPLETE, onTextComplete);
loaders[i].load(urlReq);
} else {
imgLoaders.push(new Loader());
i = (imgLoaders.length - 1);
queueElem.loader = imgLoaders[i];
queueElem.isLoading = true;
currImgSlots++;
switch (queueElem.type){
case ResType_img:
imgLoaders[i].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIoError);
imgLoaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, onImgComplete);
break;
};
imgLoaders[i].load(urlReq);
};
}
private function onImgComplete(event:Event){
var i:int;
i = 0;
while (i < imgLoaders.length) {
if (event.target == imgLoaders[i].contentLoaderInfo){
currImgSlots--;
imgLoaders[i].contentLoaderInfo.removeEventListener(Event.COMPLETE, onImgComplete);
imgLoaders[i].contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onIoError);
removeImgFromQueue(imgLoaders[i]);
imgLoaders.splice(i, 1);
break;
};
i++;
};
loadFirst();
}
private function removeTextFromQueue(loader:URLLoader):Object{
var j:int;
var queueElem:Object;
j = 0;
while (j < queue.length) {
if (((queue[j].isLoading) && ((queue[j].loader == loader)))){
queueElem = queue[j];
queue.splice(j, 1);
return (queueElem);
};
j++;
};
return (null);
}
private function onTextComplete(event:Event){
var i:int;
var queueElem:Object;
var loader:URLLoader;
i = 0;
while (i < loaders.length) {
if (event.target == loaders[i]){
currTextSlots--;
queueElem = removeTextFromQueue(loaders[i]);
loaders[i].removeEventListener(Event.COMPLETE, onTextComplete);
loaders[i].removeEventListener(IOErrorEvent.IO_ERROR, onIoError);
loader = loaders[i];
loaders.splice(i, 1);
i--;
callTextCompleteFunc(queueElem, loader);
break;
};
i++;
};
loadFirst();
}
public function addImg(urlString:String, onCompleteFunc:Function){
var queueElem:Object;
queueElem = {type:ResType_img, url:urlString, onComplete:onCompleteFunc, isLoading:false, loader:Loader};
queue.push(queueElem);
}
private function callXmlCompleteFunc(onItemComplete:Function, loader:URLLoader){
var xml:XML;
if (onItemComplete != null){
xml = new XML(loader.data);
xml.ignoreWhitespace = true;
onItemComplete(xml);
};
}
private function onIoError(event:IOErrorEvent){
trace(("Error loading file: " + event));
}
public function load(onCompleteFunc:Function=null){
var i:int;
onCompletee = onCompleteFunc;
trace(("CResLoader - load resources: " + queue.length));
i = 0;
while (i < queue.length) {
if (((((queue[i].isLoading) || ((((queue[i].type <= ResType_xml)) && ((currTextSlots == textSlots)))))) || ((((queue[i].type == ResType_img)) && ((currImgSlots == imgSlots)))))){
} else {
loadQueueElem(queue[i]);
};
i++;
};
}
private function removeImgFromQueue(loader:Loader){
var j:int;
j = 0;
while (j < queue.length) {
if (((queue[j].isLoading) && ((queue[j].loader == loader)))){
callImgCompleteFunc(queue[j].onComplete, loader);
queue.splice(j, 1);
break;
};
j++;
};
}
private function loadFirst(){
var i:int;
checkQueueEmpty();
i = 0;
while (i < queue.length) {
if (((((queue[i].isLoading) || ((((queue[i].type <= ResType_text)) && ((currTextSlots == textSlots)))))) || ((((queue[i].type == ResType_img)) && ((currImgSlots == imgSlots)))))){
} else {
loadQueueElem(queue[i]);
break;
};
i++;
};
}
private function callImgCompleteFunc(onItemComplete:Function, loader:Loader){
if (onItemComplete != null){
onItemComplete(Bitmap(loader.content));
};
}
private function callTextCompleteFunc(item:Object, loader:URLLoader){
if (item.type == ResType_xml){
callXmlCompleteFunc(item.onComplete, loader);
};
}
}
}//package src
Section 70
//CRoot (src.CRoot)
package src {
import flash.events.*;
import flash.display.*;
import src.ingame.*;
import flash.net.*;
import mochi.as3.*;
public class CRoot extends MovieClip {
public var smSoundMgr:CSoundMgr;
protected var mcMenu:CMenu;
protected var mcInstructions:CInstructions;
public var m_mcMochiWindow:MovieClip;
public var mcSplash:CSplash;
protected var mcGame:CGame;
public var mcLoadGame:CLoading;
protected var mcRanking:CRanking;
public function CRoot(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
trace("[CRoot] Constructor");
if (!CGlobals.g_bDebug){
CGlobals.g_strRootDir = "./";
} else {
CGlobals.g_strRootDir = "../";
};
CGlobals.g_bHellActivated = false;
smSoundMgr = new CSoundMgr(this);
loadOptions();
init();
}
public function loadOptions(){
var gameso:SharedObject;
gameso = SharedObject.getLocal("motorEscape");
CGlobals.g_soGameSO = gameso;
CGlobals.g_strPlayerName = new String();
if (CGlobals.g_soGameSO.data.previouslyViewed){
if (CGlobals.g_soGameSO.data.hellActivated){
CGlobals.g_bHellActivated = true;
};
CGlobals.g_strPlayerName = CGlobals.g_soGameSO.data.playerName;
} else {
CGlobals.g_soGameSO.data.previouslyViewed = true;
CGlobals.g_strPlayerName = (CGlobals.g_soGameSO.data.playerName = "");
CGlobals.g_soGameSO.data.soundEnabled = true;
};
smSoundMgr.enable(CGlobals.g_soGameSO.data.soundEnabled);
}
public function init(){
trace("[CRoot] init");
if (stage){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
} else {
trace("[CRoot] No stage.");
};
}
public function pastAssetsFrame(){
var startSounds:*;
trace("[CRoot] Instantiating necessary assets.");
smSoundMgr.getLibraryFiles();
smSoundMgr.loadAllSfx();
startSounds = [CSoundMgr.Bgm_Splash, CSoundMgr.Bgm_Menu, CSoundMgr.Bgm_Game, CSoundMgr.Bgm_Lost, CSoundMgr.Bgm_WinLvl];
smSoundMgr.loadSoundsFromLibrary(startSounds);
MochiServices.connect("74eff7586849a059", m_mcMochiWindow);
}
public function loadComplete(){
play();
}
function frame3(){
stop();
}
public function gotoMenu(){
trace("[CRoot] Go to menu.");
gotoAndStop("menu");
}
public function gotoRanking(){
gotoAndStop("ranking");
}
function frame1(){
MochiBot.track(this, "d3ef11dc");
stop();
}
public function playGame(){
trace("[CRoot] Play game.");
gotoAndStop("game");
}
public function playHell(){
trace("[CRoot] Play hell.");
gotoAndStop("game");
}
public function gotoInstructions(){
gotoAndStop("instructions");
}
function frame2(){
trace("Frame 2");
pastAssetsFrame();
}
public function gotoWebsite(){
var url:String;
var request:URLRequest;
url = "http://www.overplay.com.br";
request = new URLRequest(url);
navigateToURL(request);
//unresolved jump
var _slot1 = e;
}
}
}//package src
Section 71
//CSound (src.CSound)
package src {
import flash.events.*;
import src.*;
import flash.net.*;
import flash.media.*;
class CSound {
var loaded:Boolean;
private var snd:Sound;
private var soundMgr:CSoundMgr;
private var sndChannel:SoundChannel;
var id:int;
function CSound(newSoundMgr:CSoundMgr){
super();
soundMgr = newSoundMgr;
loaded = false;
}
function play(nLoops:int){
if (sndChannel != null){
sndChannel.stop();
};
if (nLoops == 0){
sndChannel = snd.play(0, int.MAX_VALUE);
} else {
sndChannel = snd.play(0, nLoops);
};
setVolume(soundMgr.volume);
}
private function onLoaded(event:Event){
snd.removeEventListener(Event.COMPLETE, onLoaded);
snd.removeEventListener(IOErrorEvent.IO_ERROR, onIoError);
loaded = true;
soundMgr.onSndLoaded();
}
function loadFromSound(newId:int, sound:Sound){
id = newId;
snd = sound;
}
function test(e:Event){
}
function stop(){
if (sndChannel != null){
sndChannel.stop();
};
}
function setVolume(volume:Number){
var transform:SoundTransform;
if (sndChannel != null){
transform = new SoundTransform();
transform.volume = volume;
sndChannel.soundTransform = transform;
};
}
private function onIoError(event:IOErrorEvent):void{
trace(("[CSound] IO Error: " + event.text));
}
function getBytesLoaded(){
return (snd.bytesLoaded);
}
function getBytesTotal(){
return (snd.bytesTotal);
}
function loadFromUrl(newId:int, url:URLRequest, create:Boolean){
id = newId;
if (create){
snd = new Sound();
};
snd.addEventListener(Event.COMPLETE, onLoaded);
snd.addEventListener(IOErrorEvent.IO_ERROR, onIoError);
snd.load(url);
}
}
}//package src
Section 72
//CSoundMgr (src.CSoundMgr)
package src {
import flash.media.*;
public class CSoundMgr {
private const nBgmLvl:int = 5;
private const nSounds = 20;
private const levelBgm:int = 50;
private const nSfx:int = 8;
private const nBgm:int = 7;
private var sounds:Array;
public var m_arrSoundsLoading:Array;
private var idToLibraryFile:Array;
public var volume:Number;
private var m_rtRoot:CRoot;
private var m_bSound:Boolean;
private var onLoadedFunc:Function;
public var loadedSounds:Boolean;
private var nSoundsToLoad:int;
private var soundDir:String;
public static const BgmLv_Canada:int = 51;
public static const BgmLv_Brazil:int = 50;
public static const Bgm_Game:int = 2;
public static const Sfx_Coin:int = 8;
public static const Bgm_WinLvl:int = 5;
public static const Bgm_Level:int = 6;
public static const BgmLv_Mexico:int = 53;
public static const BgmLv_Colombia:int = 52;
public static const Bgm_Hell:int = 3;
public static const Sfx_Bike:int = 11;
public static const Bgm_Splash:int = 0;
public static const Sfx_Boost:int = 7;
public static const BgmLv_Hell:int = 54;
public static const Sfx_DevilLaugh1:int = 12;
public static const Sfx_DevilLaugh2:int = 13;
public static const Sfx_DevilLaugh3:int = 14;
public static const Sfx_Go:int = 10;
public static const Bgm_Lost:int = 4;
public static const Bgm_Menu:int = 1;
public static const Sfx_Shots:int = 9;
public function CSoundMgr(rootMC:CRoot){
var i:int;
super();
trace("[CSoundMgr] Constructor.");
m_bSound = true;
volume = 1;
m_rtRoot = rootMC;
soundDir = (CGlobals.g_strRootDir + "snd/");
sounds = new Array((nBgm + nSfx));
i = 0;
while (i < sounds.length) {
sounds[i] = new CSound(this);
i++;
};
}
public function playBgm(soundId:int, loop:Boolean){
var i:int;
if (soundId >= levelBgm){
soundId = Bgm_Level;
};
i = 0;
while (i < nBgm) {
if (i == soundId){
if (loop){
sounds[soundId].play(0);
} else {
sounds[soundId].play(1);
};
} else {
sounds[i].stop();
};
i++;
};
}
public function enable(toEnable:Boolean){
trace(("[CSoundMgr] Enable " + toEnable));
m_bSound = toEnable;
if (m_bSound){
setVolume(1);
} else {
setVolume(0);
};
}
public function loadSoundsFromLibrary(soundsToLoad:Array){
var i:int;
trace(("[CSoundMgr] Loading Sounds from library: " + soundsToLoad));
i = 0;
while (i < soundsToLoad.length) {
loadSoundFromLibrary(soundsToLoad[i]);
i++;
};
}
public function toggle(){
enable(!(isOn()));
}
private function setVolume(a_Volume:Number){
var transform:SoundTransform;
transform = SoundMixer.soundTransform;
transform.volume = a_Volume;
SoundMixer.soundTransform = transform;
}
public function loadAllSfx(){
var sfxSounds:Array;
var i:int;
sfxSounds = new Array();
i = nBgm;
while (i < (nBgm + nSfx)) {
sfxSounds.push(i);
i++;
};
loadSoundsFromLibrary(sfxSounds);
}
public function stopSound(soundId:int){
sounds[soundId].stop();
}
public function loadSoundFromLibrary(soundId:int){
trace(("[CSoundMgr] Initializing CSound object " + soundId));
if (soundId >= levelBgm){
sounds[Bgm_Level].loadFromSound(Bgm_Level, idToLibraryFile[soundId]);
} else {
sounds[soundId].loadFromSound(soundId, idToLibraryFile[soundId]);
};
}
public function isOn(){
return (m_bSound);
}
public function playSfx(soundId:int, loop:Boolean){
if (loop){
sounds[soundId].play(0);
} else {
sounds[soundId].play(1);
};
}
function onSndLoaded(){
nSoundsToLoad--;
if (nSoundsToLoad == 0){
loadedSounds = true;
if (onLoadedFunc != null){
onLoadedFunc();
onLoadedFunc = null;
};
};
}
function getLibraryFiles(){
trace("[CSoundMgr] Creating Sound instances.");
idToLibraryFile = new Array(nSounds);
idToLibraryFile[Bgm_Splash] = new CSong_splash();
idToLibraryFile[Bgm_Menu] = new CMusic_menu();
idToLibraryFile[Bgm_Game] = new CMusic_game();
idToLibraryFile[Bgm_Hell] = new CMusic_inferno();
idToLibraryFile[Bgm_WinLvl] = new CMusic_winLvl();
idToLibraryFile[Bgm_Lost] = new CMusic_lost();
idToLibraryFile[Bgm_Level] = null;
idToLibraryFile[BgmLv_Brazil] = new CMusic_brasil();
idToLibraryFile[BgmLv_Canada] = new CMusic_canada();
idToLibraryFile[BgmLv_Colombia] = new CMusic_colombia();
idToLibraryFile[BgmLv_Mexico] = new CMusic_mexico();
idToLibraryFile[BgmLv_Hell] = new CMusic_inferno();
idToLibraryFile[Sfx_Boost] = new CSong_boost();
idToLibraryFile[Sfx_Coin] = new CSong_coin();
idToLibraryFile[Sfx_Shots] = new CSong_shots();
idToLibraryFile[Sfx_Go] = new CSong_go();
idToLibraryFile[Sfx_Bike] = new CSong_bike();
idToLibraryFile[Sfx_DevilLaugh1] = new CSong_capeta1();
idToLibraryFile[Sfx_DevilLaugh2] = new CSong_capeta2();
idToLibraryFile[Sfx_DevilLaugh3] = new CSong_capeta3();
}
}
}//package src
Section 73
//CSplash (src.CSplash)
package src {
import flash.events.*;
import flash.display.*;
public class CSplash extends MovieClip {
public var mcLogo:MovieClip;
public function CSplash(){
super();
trace("[CSplash] Constructor.");
addEventListener(Event.RENDER, loopInit);
stage.invalidate();
}
public function checkSplashEnd(event:Event){
if ((((mcLogo.currentLabel == "end")) && (!((mcLogo.mcFadeOut == null))))){
if (mcLogo.mcFadeOut.currentLabel == "end"){
trace("[CSplash] Splash finished, going to menu.");
removeEventListener(Event.ENTER_FRAME, checkSplashEnd);
CGlobals.menuStart = true;
CRoot(root).gotoMenu();
};
};
}
public function loopInit(event:Event){
removeEventListener(Event.RENDER, loopInit);
trace("[CSplash] Playing Splash bgm sound.");
CRoot(root).smSoundMgr.playBgm(CSoundMgr.Bgm_Splash, false);
addEventListener(Event.ENTER_FRAME, checkSplashEnd);
}
}
}//package src
Section 74
//CMusic_brasil (CMusic_brasil)
package {
import flash.media.*;
public dynamic class CMusic_brasil extends Sound {
public function CMusic_brasil(){
super();
}
}
}//package
Section 75
//CMusic_canada (CMusic_canada)
package {
import flash.media.*;
public dynamic class CMusic_canada extends Sound {
public function CMusic_canada(){
super();
}
}
}//package
Section 76
//CMusic_colombia (CMusic_colombia)
package {
import flash.media.*;
public dynamic class CMusic_colombia extends Sound {
public function CMusic_colombia(){
super();
}
}
}//package
Section 77
//CMusic_game (CMusic_game)
package {
import flash.media.*;
public dynamic class CMusic_game extends Sound {
public function CMusic_game(){
super();
}
}
}//package
Section 78
//CMusic_inferno (CMusic_inferno)
package {
import flash.media.*;
public dynamic class CMusic_inferno extends Sound {
public function CMusic_inferno(){
super();
}
}
}//package
Section 79
//CMusic_lost (CMusic_lost)
package {
import flash.media.*;
public dynamic class CMusic_lost extends Sound {
public function CMusic_lost(){
super();
}
}
}//package
Section 80
//CMusic_macho (CMusic_macho)
package {
import flash.media.*;
public dynamic class CMusic_macho extends Sound {
public function CMusic_macho(){
super();
}
}
}//package
Section 81
//CMusic_menu (CMusic_menu)
package {
import flash.media.*;
public dynamic class CMusic_menu extends Sound {
public function CMusic_menu(){
super();
}
}
}//package
Section 82
//CMusic_mexico (CMusic_mexico)
package {
import flash.media.*;
public dynamic class CMusic_mexico extends Sound {
public function CMusic_mexico(){
super();
}
}
}//package
Section 83
//CMusic_winLvl (CMusic_winLvl)
package {
import flash.media.*;
public dynamic class CMusic_winLvl extends Sound {
public function CMusic_winLvl(){
super();
}
}
}//package
Section 84
//CSong_bike (CSong_bike)
package {
import flash.media.*;
public dynamic class CSong_bike extends Sound {
public function CSong_bike(){
super();
}
}
}//package
Section 85
//CSong_boost (CSong_boost)
package {
import flash.media.*;
public dynamic class CSong_boost extends Sound {
public function CSong_boost(){
super();
}
}
}//package
Section 86
//CSong_bump (CSong_bump)
package {
import flash.media.*;
public dynamic class CSong_bump extends Sound {
public function CSong_bump(){
super();
}
}
}//package
Section 87
//CSong_caiu (CSong_caiu)
package {
import flash.media.*;
public dynamic class CSong_caiu extends Sound {
public function CSong_caiu(){
super();
}
}
}//package
Section 88
//CSong_capeta1 (CSong_capeta1)
package {
import flash.media.*;
public dynamic class CSong_capeta1 extends Sound {
public function CSong_capeta1(){
super();
}
}
}//package
Section 89
//CSong_capeta2 (CSong_capeta2)
package {
import flash.media.*;
public dynamic class CSong_capeta2 extends Sound {
public function CSong_capeta2(){
super();
}
}
}//package
Section 90
//CSong_capeta3 (CSong_capeta3)
package {
import flash.media.*;
public dynamic class CSong_capeta3 extends Sound {
public function CSong_capeta3(){
super();
}
}
}//package
Section 91
//CSong_coin (CSong_coin)
package {
import flash.media.*;
public dynamic class CSong_coin extends Sound {
public function CSong_coin(){
super();
}
}
}//package
Section 92
//CSong_go (CSong_go)
package {
import flash.media.*;
public dynamic class CSong_go extends Sound {
public function CSong_go(){
super();
}
}
}//package
Section 93
//CSong_shots (CSong_shots)
package {
import flash.media.*;
public dynamic class CSong_shots extends Sound {
public function CSong_shots(){
super();
}
}
}//package
Section 94
//CSong_splash (CSong_splash)
package {
import flash.media.*;
public dynamic class CSong_splash extends Sound {
public function CSong_splash(){
super();
}
}
}//package
Section 95
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
var self:MochiBot;
var server:String;
var lv:URLVariables;
var url:String;
var req:URLRequest;
var loader:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
self = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
server = "http://core.mochibot.com/my/core.swf";
lv = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
url = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
req = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package
Section 96
//ScoreDisplay (ScoreDisplay)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreDisplay extends MovieClip {
public var position:TextField;
public var nick:TextField;
public var score:TextField;
public function ScoreDisplay(){
super();
}
}
}//package