STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228097
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

swfchan turned sixteen years old yesterday! (5may2024)

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/59166039?noj=FRM59166039-6DC" width="1" height="1"></div>

Traverse - amazingly polished puzzle game.swf

This is the info page for
Flash #90775

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//MochiAd (mochi.as3.MochiAd) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.utils.*; 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 clip:Object; var mc:MovieClip; var chk:MovieClip; var options = options; var DEFAULTS:Object = {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; var ad_timeout:Number = 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(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = 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); }; chk["onEnterFrame"] = function ():void{ var total:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var ad_clip:Object = this.parent._mochiad_ctr; var elapsed:Number = (getTimer() - this.started); var finished:Boolean; 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 = 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 clip:Object; var mc:MovieClip; var chk:MovieClip; var options = options; var DEFAULTS:Object = {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; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = 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(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = 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{ if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var p:Number = (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 = 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 total:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var ad_clip:Object = this.parent._mochiad_ctr; var elapsed:Number = (getTimer() - this.started); var finished:Boolean; 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 k:String; var pairs:Array; var i:Number; var kv:Array; var optcopy:Object = {}; 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 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); }; var idx:Number = 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 clip:Object; var mc:MovieClip; 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; var DEFAULTS:Object = {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 (!(clip is DisplayObject)){ trace("Warning: Object passed as container clip not a descendant of the DisplayObject type"); return (null); }; if (MovieClip(clip).stage == null){ trace("Warning: Container clip for ad is not attached to the stage"); return (null); }; 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.")); var depth:Number = options.depth; delete options.depth; mc = createEmptyMovieClip(clip, "_mochiad", depth); var wh:Array = 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"); }; var lv:URLVariables = 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(); mc.regContLC = function (lc_name:String):void{ mc._containerLCName = lc_name; }; 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"); }); if (!options.skip){ 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 = methodName.split("."); var i:Number = 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 = 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 xy:Array; var b:Object = clip.getBounds(clip.root); var w:Number = 0; var h:Number = 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 = objectName.split("."); var i:Number = 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 = objectName.split("."); var i:Number = 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 clip:Object; var mc:MovieClip; var chk:MovieClip; var complete:Boolean; var unloaded:Boolean; var sendHostProgress:Boolean; var fn:Function; var r:MovieClip; var options = options; var DEFAULTS:Object = {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; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; if (options.skip){ ad_timeout = 0; }; delete options.ad_timeout; var fadeout_time:Number = 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); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = 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); var bar:MovieClip = 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); }; var bar_w:Number = ((w - bar.x) - 10); var bar_color:Number = options.color; delete options.color; var bar_background:Number = options.background; delete options.background; var bar_outline:Number = options.outline; delete options.outline; var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1); var backing:Object = 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(); var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2); var inside:Object = 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; var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3); var outline:Object = 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 = (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; var progress:Number = Math.min(1, options.progress_override(clip)); var f:Function = 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 = 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); }; sendHostProgress = false; mc.sendHostLoadProgress = function (lc_name:String):void{ sendHostProgress = true; }; chk["onEnterFrame"] = function ():void{ var total:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _clip:Object = this.parent.parent.root; var ad_clip:Object = this.parent._mochiad_ctr; var elapsed:Number = (getTimer() - this.started); var finished:Boolean; var clip_total:Number = _clip.loaderInfo.bytesTotal; var clip_loaded:Number = _clip.loaderInfo.bytesLoaded; var clip_progress:Number = 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; }; var clip_pcnt:Number = ((100 * clip_loaded) / clip_total); if (!isNaN(clip_progress)){ clip_pcnt = (100 * clip_progress); }; var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec); var _inside:Object = this._mochiad_bar._inside; var pcnt:Number = 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 mc = mc; var f:Function = 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 2
//MochiCoins (mochi.as3.MochiCoins) package mochi.as3 { public class MochiCoins { public static const STORE_HIDE:String = "StoreHide"; public static const NO_USER:String = "NoUser"; public static const IO_ERROR:String = "IOError"; public static const ITEM_NEW:String = "ItemNew"; public static const ITEM_OWNED:String = "ItemOwned"; public static const STORE_ITEMS:String = "StoreItems"; public static const ERROR:String = "Error"; public static const STORE_SHOW:String = "StoreShow"; public static var _inventory:MochiInventory; public function MochiCoins(){ super(); } public static function triggerEvent(eventType:String, args:Object):void{ MochiSocial.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ MochiSocial.removeEventListener(eventType, delegate); } public static function addEventListener(eventType:String, delegate:Function):void{ MochiSocial.addEventListener(eventType, delegate); } public static function getStoreItems():void{ MochiServices.send("coins_getStoreItems"); } public static function get inventory():MochiInventory{ return (_inventory); } public static function showStore(options:Object=null):void{ MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:options}, null, null); } 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 getVersion():String{ return (MochiServices.getVersion()); } 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); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (args:Object):void{ _inventory = new MochiInventory(); }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (args:Object):void{ _inventory = null; }); } }//package mochi.as3
Section 3
//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 reencode():void{ var newEncode:uint = int((2147483647 * Math.random())); Fragment = (Fragment ^ (newEncode ^ Encoder)); Encoder = newEncode; } public function set value(v:Number):void{ setValue(v); } public function toString():String{ var s:String = String.fromCharCode((Fragment ^ Encoder)); if (Sibling != null){ s = (s + Sibling.toString()); }; return (s); } public function setValue(digit:Number=0, index:uint=0):void{ var s:String = 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 get value():Number{ return (Number(this.toString())); } public function addValue(inc:Number):void{ value = (value + inc); } } }//package mochi.as3
Section 4
//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 5
//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 endPlay():void{ MochiServices.send("events_clearRoundID", null, null, null); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } public static function trackEvent(tag:String, value=null):void{ MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null); } 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 s:Object; var args:Object = {}; for (s in style) { args[s] = style[s]; }; args.clip = clip; MochiServices.send("events_setNotifications", args, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function startPlay(tag:String="gameplay"):void{ MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null); } } }//package mochi.as3
Section 6
//MochiInventory (mochi.as3.MochiInventory) package mochi.as3 { import flash.events.*; import flash.utils.*; public dynamic class MochiInventory extends Proxy { private var _timer:Timer; private var _names:Array; private var _syncID:Number; private var _consumableProperties:Object; private var _storeSync:Object; private var _outstandingID:Number; private var _syncPending:Boolean; public static const READY:String = "InvReady"; public static const ERROR:String = "Error"; public static const IO_ERROR:String = "IoError"; private static const KEY_SALT:String = " syncMaint"; public static const WRITTEN:String = "InvWritten"; public static const NOT_READY:String = "InvNotReady"; public static const VALUE_ERROR:String = "InvValueError"; private static const CONSUMER_KEY:String = "MochiConsumables"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public function MochiInventory():void{ super(); MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned); MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut); _storeSync = new Object(); _syncPending = false; _outstandingID = 0; _syncID = 0; _timer = new Timer(1000); _timer.addEventListener(TimerEvent.TIMER, sync); _timer.start(); if (MochiSocial.loggedIn){ loggedIn(); } else { loggedOut(); }; } private function newItems(event:Object):void{ if (!this[(event.id + KEY_SALT)]){ this[(event.id + KEY_SALT)] = 0; }; if (!this[event.id]){ this[event.id] = 0; }; this[(event.id + KEY_SALT)] = (this[(event.id + KEY_SALT)] + event.count); this[event.id] = (this[event.id] + event.count); if (event.privateProperties.consumable){ if (!this[event.privateProperties.tag]){ this[event.privateProperties.tag] = 0; }; this[event.privateProperties.tag] = (this[event.privateProperties.tag] + (event.privateProperties.inc * event.count)); }; } public function release():void{ MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(name){ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (-1); }; if (_consumableProperties[name]){ return (MochiDigits(_consumableProperties[name]).value); }; return (undefined); } private function loggedIn(args:Object=null):void{ MochiUserData.get(CONSUMER_KEY, getConsumableBag); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(name):Boolean{ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (false); }; if (_consumableProperties[name] == undefined){ return (false); }; return (true); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(index:int):int{ return (((index)>=_names.length) ? 0 : (index + 1)); } private function putConsumableBag(userData:MochiUserData):void{ _syncPending = false; if (userData.error){ triggerEvent(ERROR, {type:IO_ERROR, error:userData.error}); _outstandingID = -1; }; triggerEvent(WRITTEN, {}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(name, value):void{ var d:MochiDigits; if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return; }; if (!(value is Number)){ triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:value}); return; }; if (_consumableProperties[name]){ d = MochiDigits(_consumableProperties[name]); if (d.value == value){ return; }; d.value = value; } else { _names.push(name); _consumableProperties[name] = new MochiDigits(value); }; _syncID++; } private function itemOwned(event:Object):void{ _storeSync[event.id] = {properties:event.properties, count:event.count}; } private function sync(e:Event=null):void{ var key:String; if (((_syncPending) || ((_syncID == _outstandingID)))){ return; }; _outstandingID = _syncID; var output:Object = {}; for (key in _consumableProperties) { output[key] = MochiDigits(_consumableProperties[key]).value; }; MochiUserData.put(CONSUMER_KEY, output, putConsumableBag); _syncPending = true; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(index:int):String{ return (_names[(index - 1)]); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(name):Boolean{ if (!_consumableProperties[name]){ return (false); }; _names.splice(_names.indexOf(name), 1); delete _consumableProperties[name]; return (true); } private function getConsumableBag(userData:MochiUserData):void{ var key:String; var unsynced:Number; if (userData.error){ triggerEvent(ERROR, {type:IO_ERROR, error:userData.error}); return; }; _consumableProperties = {}; _names = new Array(); if (userData.data){ for (key in userData.data) { _names.push(key); _consumableProperties[key] = new MochiDigits(userData.data[key]); }; }; for (key in _storeSync) { unsynced = _storeSync[key].count; if (_consumableProperties[(key + KEY_SALT)]){ unsynced = (unsynced - _consumableProperties[key]); }; if (unsynced == 0){ } else { newItems({id:key, count:unsynced, properties:_storeSync[key].properties}); }; }; triggerEvent(READY, {}); } private function loggedOut(args:Object=null):void{ _consumableProperties = null; } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } } }//package mochi.as3
Section 7
//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 i:Number; var j:Number; var o:Object; var row_obj:Object; var item:String; var param:String; var so:Object = {}; 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 8
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _queue:Array; 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 _nextCallbackID:Number; 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 _callbacks:Object; 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 methodName:String; var pkg = pkg; var cb:String = pkg.callbackID; var cblst:Object = _callbacks[cb]; if (!cblst){ return; }; var method:* = cblst.callbackMethod; methodName = ""; var obj:Object = 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 _callbacks[cb]; } 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:_nextCallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName)); handleError(args, callbackObject, callbackMethod); flush(true); return; }; _queue.push({methodName:methodName, args:args, callbackID:_nextCallbackID}); }; if (_clip != null){ if (_callbacks != null){ _callbacks[_nextCallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod}; _nextCallbackID++; }; }; } private static function init(id:String, clip:Object):void{ _id = id; if (clip != null){ _container = clip; loadCommunicator(id, _container); }; } public static function get childClip():Object{ return (_clip); } private static function clickMovie(url:String, cb:Function):MovieClip{ var b:int; var loader:Loader; var avm1_bytecode:Array = [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]; var header:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; var footer:Array = [0, 64, 0, 0, 0]; var mc:MovieClip = new MovieClip(); var lc:LocalConnection = new LocalConnection(); var lc_name:String = ((("_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); var ba:ByteArray = new ByteArray(); var cpool:ByteArray = new ByteArray(); cpool.endian = Endian.LITTLE_ENDIAN; cpool.writeShort(1); cpool.writeUTFBytes(((url + " ") + lc_name)); cpool.writeByte(0); var actionLength:uint = ((avm1_bytecode.length + cpool.length) + 4); var fileLength:uint = (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 avm1Click:DisplayObject; 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; var vars:Object = 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); var s = "?"; var i:Number = 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{ if (avm1Click){ btn.removeChild(avm1Click); }; avm1Click = clickMovie(url, onClick); var rect:Rectangle = 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 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.8 as3"); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); } public static function warnID(bid:String, leaderboard:Boolean):void{ 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; }; }; }; var i:Number = 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++; }; } private static function flush(error:Boolean):void{ var request:Object; var callback:Object; if (((_clip) && (_queue))){ while (_queue.length > 0) { request = _queue.shift(); callback = null; if (request != null){ if (request.callbackID != null){ callback = _callbacks[request.callbackID]; }; delete _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 = pkg.target; var event:String = 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 options:String; var pairs:Array; var i:Number; var kv:Array; var opts:Object = {}; 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 (_clip.parent){ _clip.parent.removeChild(_clip); }; if (container != null){ if ((container is DisplayObjectContainer)){ _container = container; }; }; if (doAdd){ if ((_container is DisplayObjectContainer)){ DisplayObjectContainer(_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, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _clip.onReceive = onReceive; _clip.onEvent = onEvent; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; while (_queue.length > 0) { _mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift()); }; }; } private static function loadLCBridge(clip:Object):void{ var loader:Loader; var clip = clip; loader = new Loader(); var mochiLCURL:String = (_servURL + _mochiLC); var req:URLRequest = new URLRequest(mochiLCURL); var complete:Function = 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{ if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; if (urlOptions(clip).servURL){ _servURL = urlOptions(clip).servURL; }; var servicesURL:String = (_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 = new MovieClip(); loadLCBridge(_clip); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); var req:URLRequest = new URLRequest(servicesURL); var vars:URLVariables = 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); _sendChannel = new LocalConnection(); _queue = []; _nextCallbackID = 0; _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 (clip.stage == null){ trace("MochiServices connect requires the containing clip be attached to the stage"); }; 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 updateCopy(args:Object):void{ MochiServices.send("coins_updateCopy", args, null, null); } 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 9
//MochiSocial (mochi.as3.MochiSocial) package mochi.as3 { public class MochiSocial { public static const LOGGED_IN:String = "LoggedIn"; public static const PROFILE_HIDE:String = "ProfileHide"; public static const NO_USER:String = "NoUser"; public static const PROPERTIES_SIZE:String = "PropertiesSize"; public static const IO_ERROR:String = "IOError"; public static const PROPERTIES_SAVED:String = "PropertySaved"; public static const WIDGET_LOADED:String = "WidgetLoaded"; public static const USER_INFO:String = "UserInfo"; public static const ERROR:String = "Error"; public static const LOGIN_SHOW:String = "LoginShow"; public static const LOGGED_OUT:String = "LoggedOut"; public static const PROFILE_SHOW:String = "ProfileShow"; public static const LOGIN_SHOWN:String = "LoginShown"; public static const LOGIN_HIDE:String = "LoginHide"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static var _user_info:Object = null; public function MochiSocial(){ super(); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(properties:Object):void{ MochiServices.send("coins_saveUserProperties", properties); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } 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 showLoginWidget(options:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showLoginWidget", {options:options}); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function requestLogin():void{ MochiServices.send("coins_requestLogin"); } public static function getAPIURL():String{ if (!_user_info){ return (null); }; return (_user_info.api_url); } public static function hideLoginWidget():void{ MochiServices.send("coins_hideLoginWidget"); } public static function getAPIToken():String{ if (!_user_info){ return (null); }; return (_user_info.api_token); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (args:Object):void{ _user_info = args; }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (args:Object):void{ _user_info = null; }); } }//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 = {}; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(name, value):void{ if (_syncContainer[name] == value){ return; }; var n:String = name.toString(); _syncContainer[n] = value; MochiServices.send("sync_propUpdate", {name:n, value:value}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(name){ return (_syncContainer[name]); } 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; }; } } }//package mochi.as3
Section 11
//MochiUserData (mochi.as3.MochiUserData) package mochi.as3 { import flash.events.*; import flash.utils.*; import flash.net.*; public class MochiUserData extends EventDispatcher { public var callback:Function;// = null public var operation:String;// = null public var error:Event;// = null public var data;// = null public var _loader:URLLoader; public var key:String;// = null public function MochiUserData(key:String="", callback:Function=null){ super(); this.key = key; this.callback = callback; } public function serialize(obj):ByteArray{ var arr:ByteArray = new ByteArray(); arr.objectEncoding = ObjectEncoding.AMF3; arr.writeObject(obj); arr.compress(); return (arr); } public function errorHandler(event:IOErrorEvent):void{ data = null; error = event; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function putEvent(obj):void{ request("put", serialize(obj)); } public function deserialize(arr:ByteArray){ arr.objectEncoding = ObjectEncoding.AMF3; arr.uncompress(); return (arr.readObject()); } public function securityErrorHandler(event:SecurityErrorEvent):void{ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + event.toString()))); } public function getEvent():void{ request("get", serialize(null)); } override public function toString():String{ return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]")); } public function performCallback():void{ callback(this); //unresolved jump var _slot1 = e; trace(("[MochiUserData] exception during callback: " + _slot1)); } public function request(_operation:String, _data:ByteArray):void{ var _operation = _operation; var _data = _data; operation = _operation; var api_url:String = MochiSocial.getAPIURL(); var api_token:String = MochiSocial.getAPIToken(); if ((((api_url == null)) || ((api_token == null)))){ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in")); return; }; _loader = new URLLoader(); var args:URLVariables = new URLVariables(); args.op = _operation; args.key = key; var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString())); req.method = URLRequestMethod.POST; req.contentType = "application/x-mochi-userdata"; req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)]; req.data = _data; _loader.dataFormat = URLLoaderDataFormat.BINARY; _loader.addEventListener(Event.COMPLETE, completeHandler); _loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.load(req); //unresolved jump var _slot1 = e; errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _slot1.toString()))); } public function completeHandler(event:Event):void{ var event = event; if (_loader.data.length){ data = deserialize(_loader.data); } else { data = null; }; //unresolved jump var _slot1 = e; errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + _slot1.toString()))); return; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function close():void{ if (_loader){ _loader.removeEventListener(Event.COMPLETE, completeHandler); _loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.close(); _loader = null; }; error = null; callback = null; } public static function get(key:String, callback:Function):void{ var userData:MochiUserData = new MochiUserData(key, callback); userData.getEvent(); } public static function put(key:String, obj, callback:Function):void{ var userData:MochiUserData = new MochiUserData(key, callback); userData.putEvent(obj); } } }//package mochi.as3
Section 12
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "3.4.0.9271"; public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ super(bitmapData, pixelSnapping, smoothing); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } } }//package mx.core
Section 13
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "3.4.0.9271"; public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ var bitmapData = bitmapData; var pixelSnapping = pixelSnapping; var smoothing = smoothing; super(bitmapData, pixelSnapping, smoothing); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 14
//FontAsset (mx.core.FontAsset) package mx.core { import flash.text.*; public class FontAsset extends Font implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; public function FontAsset(){ super(); } } }//package mx.core
Section 15
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 16
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(void:Point):Point; function get name():String; function set width(flash.display:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(flash.display:String):void; function set scaleX(flash.display:Number):void; function set scaleY(flash.display:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(flash.display:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(void:Point):Point; function get height():Number; function set blendMode(flash.display:String):void; function get parent():DisplayObjectContainer; function getBounds(String:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(flash.display:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(flash.display:Number):void; function set accessibilityProperties(flash.display:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(flash.display:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(flash.display:Number):void; function set mask(flash.display:DisplayObject):void; function getRect(String:DisplayObject):Rectangle; function get alpha():Number; function set transform(flash.display:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean; function set opaqueBackground(flash.display:Object):void; function set visible(flash.display:Boolean):void; function get mask():DisplayObject; function set x(flash.display:Number):void; function set y(flash.display:Number):void; function get transform():Transform; function set filters(flash.display:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(flash.display:Number):void; function get stage():Stage; } }//package mx.core
Section 17
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get isDocument():Boolean; function set repeaters(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function initializeRepeaterArrays(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 18
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 19
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; public function SoundAsset(){ super(); } } }//package mx.core
Section 20
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import flash.utils.*; import mx.core.*; public class NameUtil { mx_internal static const VERSION:String = "3.4.0.9271"; private static var counter:int = 0; public function NameUtil(){ super(); } public static function displayObjectToString(displayObject:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = displayObject; o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; //unresolved jump var _slot1 = e; return (result); } public static function createUniqueName(object:Object):String{ if (!object){ return (null); }; var name:String = getQualifiedClassName(object); var index:int = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; var charCode:int = name.charCodeAt((name.length - 1)); if ((((charCode >= 48)) && ((charCode <= 57)))){ name = (name + "_"); }; return ((name + counter++)); } } }//package mx.utils
Section 21
//AdScreen (AdScreen) package { public class AdScreen extends GameScreen { public function AdScreen(){ super(); } override public function run():void{ Control.setScreen(Config.SPONSORSCREEN); } } }//package
Section 22
//AdvancedSound (AdvancedSound) package { import flash.media.*; import flash.utils.*; public class AdvancedSound { public var lastSavedPos:Number;// = 0 private var channel:SoundChannel; public var muted:Boolean;// = false private var playbackSpeed:Number;// = 1 private var dynamicSound:Sound; private var soundFile:Sound; private var bytesPerCallback:int;// = 0x1000 private var soundData:ByteArray; private var phase:Number; private var numSamples:int; public function AdvancedSound(s:Sound):void{ channel = new SoundChannel(); super(); soundFile = s; } public function stop():void{ channel.stop(); } public function mute():void{ lastSavedPos = channel.position; channel.stop(); muted = true; } public function setPlaybackSpeed(v:Number):void{ playbackSpeed = v; } public function play(startTime:Number=0, loops:int=0, sndTransform:SoundTransform=null):SoundChannel{ muted = false; channel = soundFile.play(startTime, loops, sndTransform); return (channel); } } }//package
Section 23
//AudioButton (AudioButton) package { import flash.display.*; import flash.geom.*; import flash.filters.*; public class AudioButton extends Bitmap { private var type:int;// = 0 private var cf:ColorMatrixFilter; private var cm:Array; private var bright:int;// = 0 private var hover:Boolean;// = false private var on:Boolean;// = true public function AudioButton():void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); config(); cf = new ColorMatrixFilter(cm); filters = [cf]; } private function handleClick():void{ on = !(on); if (type == 0){ SoundManager.toggleMusic(); } else { SoundManager.toggleSound(); }; setImage(); } public function config(i:int=0):void{ type = i; setImage(); } public function run():void{ var mp:Point = Control.MOUSEPOINT; if ((((mp.x > x)) && ((mp.x <= (x + width))))){ if ((((mp.y > y)) && ((mp.y <= (y + height))))){ if (Control.MOUSEDOWN){ handleClick(); Control.setMouseDown(false); SoundManager.playSound(SoundManager.MENUSELECT); }; bright = 128; if (!hover){ SoundManager.playSound(SoundManager.MENUHOVER); hover = true; }; } else { hover = false; }; } else { hover = false; }; if (bright > 0){ bright = (bright - 8); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = bright)); cf.matrix = cm; filters = [cf]; on = true; if ((((type == 0)) && (SoundManager.MUSICOFF))){ on = false; }; if ((((type == 1)) && (SoundManager.SOUNDOFF))){ on = false; }; setImage(); } private function setImage():void{ if (on){ bitmapData = ImageHandler.getImageData(ImageHandler.SOUNDBUTTON, 26, 26, ((type * 2) + 1), 0, 0); }; if (!on){ bitmapData = ImageHandler.getImageData(ImageHandler.SOUNDBUTTON, 26, 26, (type * 2), 0, 0); }; } } }//package
Section 24
//Background (Background) package { import flash.display.*; public class Background extends Sprite { private var layerA:Bitmap; private var layerB:Bitmap; private var focus:DisplayObject; private var layerC:Bitmap; public function Background():void{ super(); build(); } public function setFocus(d:DisplayObject):void{ var lAdistY:int; var lBdistX:int; focus = d; var focusDispX:Number = (focus.x / Config.SCREENW); var focusDispY:Number = (focus.y / Config.SCREENH); var lAdistX:int = (Config.SCREENW - layerA.width); lAdistY = (Config.SCREENH - layerA.height); lBdistX = (Config.SCREENW - layerB.width); var lBdistY:int = (Config.SCREENH - layerB.height); var lCdistX:int = (Config.SCREENW - layerC.width); var lCdistY:int = (Config.SCREENH - layerC.height); layerA.x = (lAdistX * focusDispX); layerA.y = (lAdistY * focusDispY); layerB.x = (lBdistX * focusDispX); layerB.y = (lBdistY * focusDispY); layerC.x = (lCdistX * focusDispX); layerC.y = (lCdistY * focusDispY); } public function run():void{ var focusDispX:Number; var focusDispY:Number; var lAdistX:int; var lAdistY:int; var lBdistX:int; var lBdistY:int; var lCdistX:int; var lCdistY:int; var ease:int; if (focus != null){ focusDispX = (focus.x / Config.SCREENW); focusDispY = (focus.y / Config.SCREENH); lAdistX = (Config.SCREENW - layerA.width); lAdistY = (Config.SCREENH - layerA.height); lBdistX = (Config.SCREENW - layerB.width); lBdistY = (Config.SCREENH - layerB.height); lCdistX = (Config.SCREENW - layerC.width); lCdistY = (Config.SCREENH - layerC.height); ease = 5; layerA.x = (layerA.x + (((lAdistX * focusDispX) - layerA.x) / ease)); layerA.y = (layerA.y + (((lAdistY * focusDispY) - layerA.y) / ease)); layerB.x = (layerB.x + (((lBdistX * focusDispX) - layerB.x) / ease)); layerB.y = (layerB.y + (((lBdistY * focusDispY) - layerB.y) / ease)); layerC.x = (layerC.x + (((lCdistX * focusDispX) - layerC.x) / ease)); layerC.y = (layerC.y + (((lCdistY * focusDispY) - layerC.y) / ease)); if (layerA.x > 0){ layerA.x = 0; }; if (layerA.y > 0){ layerA.y = 0; }; if (layerA.x < lAdistX){ layerA.x = lAdistX; }; if (layerA.y < lAdistY){ layerA.y = lAdistY; }; if (layerB.x > 0){ layerB.x = 0; }; if (layerB.y > 0){ layerB.y = 0; }; if (layerB.x < lBdistX){ layerB.x = lBdistX; }; if (layerB.y < lBdistY){ layerB.y = lBdistY; }; if (layerC.x > 0){ layerC.x = 0; }; if (layerC.y > 0){ layerC.y = 0; }; if (layerC.x < lCdistX){ layerC.x = lCdistX; }; if (layerC.y < lCdistY){ layerC.y = lCdistY; }; }; } private function build():void{ addChild(new ImageHandler.BackgroundGradient()); layerA = new ImageHandler.BackgroundStarsA(); addChild(layerA); layerB = new ImageHandler.BackgroundStarsB(); addChild(layerB); layerC = new ImageHandler.BackgroundStarsC(); addChild(layerC); } } }//package
Section 25
//Config (Config) package { public class Config { public static const PLAYSCREEN:int = 5; public static const TITLESCREEN:int = 3; public static const STAGESELECTSCREEN:int = 4; public static const TILEW:int = 24; public static const MAPW:int = 21; public static const SCREENW:int = 640; public static const SPONSORSCREEN:int = 1; public static const MAPH:int = 15; public static const ADSCREEN:int = 0; public static const DEVELOPERSCREEN:int = 2; public static const TILEH:int = 24; public static const SCREENH:int = 480; public function Config(){ super(); } } }//package
Section 26
//Control (Control) package { import flash.events.*; import flash.geom.*; public class Control { public static var ESCAPE:int = 27; public static var MOUSECLICK:Boolean; public static var LEFT:int = 37; public static var MOUSEPOINT:Point; public static var MOUSEUPPOINT:Point; public static var UP:int = 38; public static var MOUSEDOWN:Boolean; public static var MOUSEDOWNPOINT:Point; public static var DOWN:int = 40; private static var main:Main; public static var A:int = 65; public static var D:int = 68; public static var E:int = 69; private static var keysHeld:Array = new Array(); public static var MOUSECLICKPOINT:Point; public static var S:int = 83; public static var M:int = 77; public static var W:int = 87; public static var R:int = 82; public static var SHIFT:int = 16; public static var SPACE:int = 32; private static var keys:Array = new Array(); public static var RIGHT:int = 39; public function Control(){ super(); } private static function mouseUpHandler(ev:MouseEvent):void{ if (MOUSEPOINT == null){ MOUSEUPPOINT = new Point(); }; MOUSEDOWN = false; MOUSEUPPOINT.x = ev.stageX; MOUSEUPPOINT.y = ev.stageY; } public static function init(m:Main):void{ main = m; main.stage.addEventListener(Event.ENTER_FRAME, run); main.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); main.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); main.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); main.stage.addEventListener(MouseEvent.CLICK, mouseClickHandler); main.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); main.stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); MOUSEDOWN = false; MOUSECLICK = false; MOUSEPOINT = new Point(); MOUSEDOWNPOINT = new Point(); MOUSEUPPOINT = new Point(); MOUSECLICKPOINT = new Point(); } public static function isKeyDown(k:Number):Boolean{ var r:Boolean; if ((((keys[k] == undefined)) || ((keys[k] == null)))){ return (false); }; r = keys[k]; keys[k] = false; if (r){ keysHeld[k] = true; }; return (r); } public static function clearMouseClick():void{ MOUSECLICK = false; MOUSECLICKPOINT.x = -1; MOUSECLICKPOINT.y = -1; } private static function run(ev:Event):void{ main.run(); main.stage.focus = main.stage; } public static function setMouseDown(b:Boolean):void{ MOUSEDOWN = b; } private static function keyUpHandler(ev:KeyboardEvent):void{ keys[ev.keyCode] = false; keysHeld[ev.keyCode] = false; } public static function isKeyHeld(k:Number):Boolean{ if ((((keysHeld[k] == undefined)) || ((keysHeld[k] == null)))){ return (false); }; return (keysHeld[k]); } private static function mouseMoveHandler(ev:MouseEvent):void{ if (MOUSEPOINT == null){ MOUSEPOINT = new Point(); }; MOUSEPOINT.x = ev.stageX; MOUSEPOINT.y = ev.stageY; } private static function mouseDownHandler(ev:MouseEvent):void{ if (MOUSEPOINT == null){ MOUSEDOWNPOINT = new Point(); }; MOUSEDOWN = true; MOUSEDOWNPOINT.x = ev.stageX; MOUSEDOWNPOINT.y = ev.stageY; } private static function mouseClickHandler(ev:MouseEvent):void{ if (MOUSEPOINT == null){ MOUSECLICKPOINT = new Point(); }; MOUSECLICK = true; MOUSECLICKPOINT.x = ev.stageX; MOUSECLICKPOINT.y = ev.stageY; MOUSECLICKPOINT.y = ev.stageY; } private static function keyDownHandler(ev:KeyboardEvent):void{ if ((((keys[ev.keyCode] == null)) || ((keys[ev.keyCode] == undefined)))){ keys[ev.keyCode] = false; }; if ((((keysHeld[ev.keyCode] == null)) || ((keys[ev.keyCode] == undefined)))){ keys[ev.keyCode] = false; }; if (((keys[ev.keyCode]) || (keysHeld[ev.keyCode]))){ keysHeld[ev.keyCode] = true; keys[ev.keyCode] = false; } else { keys[ev.keyCode] = true; keysHeld[ev.keyCode] = false; }; } public static function setScreen(s:int):void{ main.setScreen(s); } } }//package
Section 27
//DeveloperScreen (DeveloperScreen) package { import flash.events.*; import flash.display.*; import flash.net.*; public class DeveloperScreen extends GameScreen { private var frames:int;// = 0 private var maxFrames:int;// = 128 public function DeveloperScreen(){ super(); addEventListener(Event.ADDED_TO_STAGE, addedToStage); addChild(new Bitmap(ImageHandler.ESELOGO)); } private function addedToStage(ev:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, addedToStage); stage.addEventListener(MouseEvent.CLICK, onClick); } private function onClick(ev:MouseEvent):void{ MochiBot.track(this, "5cb37f95"); var esLink:URLRequest = new URLRequest("http://www.epicshadow.com/traverse.php"); navigateToURL(esLink, "_blank"); } override public function run():void{ frames++; if (frames >= maxFrames){ stage.removeEventListener(MouseEvent.CLICK, onClick); Control.setScreen(Config.TITLESCREEN); }; } } }//package
Section 28
//DialogWindow (DialogWindow) package { import flash.display.*; public class DialogWindow extends Sprite { private var builds:Array; private var runs:Array; private var text:GameText; private var background:Bitmap; private var button:GameButton; private var label:GameText; private var hud:HUD; private var type:int; public function DialogWindow():void{ builds = [buildStageSelectInfo, buildPlayScreenInfo, buildHelp, buildControls, buildResults, buildGameComplete, buildGameMastered]; runs = [runStageSelectInfo, runPlayScreenInfo, runHelp, runControls, runResults, runGameComplete, runGameMastered]; super(); addChild((background = new Bitmap(ImageHandler.DIALOGBOX))); addChild((label = new GameText())); label.setFont(1); label.x = 4; label.y = 4; addChild((text = new GameText())); text.x = 16; text.y = 48; addChild((button = new GameButton())); button.setPadding(24); } private function runControls():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } private function buildControls():void{ label.setText("Controls"); text.setText("Stage Selection Controls:\n\n Mouse Left-Click: Select planet or button.\n\n\nGameplay Controls:\n\n W or Arrow Key Up - Move your ship up.\n A or Arrow Key Left - Move your ship left.\n S or Arrow Key Down - Move your ship down.\n D or Arrow Key Right - Move your ship right.\n Esc - Exit to stage select.\n R - Restart stage.\n M - Toggle audio."); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } public function run():void{ if (visible){ var _local1 = runs; _local1[type](); }; } private function buildHelp():void{ label.setText("Help"); text.setText("Click on a planet to play that stage.\n More planets will be revealed as you complete stages.\n\nYou may play any level available to you in any order\n you see fit, skipping those that are too hard for\n now.\n\nWhen you reach the final planet in your path, you\n will be able to submit and view scores.\n\nClick on the 'Controls' planet directly beneath\n this one for more information."); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } private function buildGameComplete():void{ label.setText("Congratulations!"); text.setText("You've cleared the final stage in Traverse!\n\nYou can now submit and view high scores from \n the newly added buttons found in the middle of the\n Stage Select screen.\n\nBe sure to go back and complete levels more\n quickly, and in fewer moves to gain a higher score.\n\nIn addition, you may find that there are many\n additional levels still waiting to be unlocked!\n\nBe sure to beat them all for the highest score!"); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } private function buildStageSelectInfo():void{ label.setText("Stage Selection Info"); text.setText("Welcome to Traverse!\n\nYour goal in this game is to navigate your way\nthrough each puzzle.\n\nClick on the planet labeled 'Stage 1' to begin.\n\nYou may visit the 'Help' and 'Controls' planets for\nfurther instruction.\n\nEnjoy the game!"); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } private function buildPlayScreenInfo():void{ label.setText("Gameplay Info"); text.setText("Use \"WASD\" or the Arrow Keys to move your ship.\n\nReach the goal (pulsing blob) to complete a stage.\n\nYour score is determined by how long you take to\n solve the stage and with how many moves.\n\nKeyboard Shortcuts:\n\n (Esc) - Exit to Stage Select\n (R) - Restart Stage\n (M) - Toggle Audio"); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } private function runStageSelectInfo():void{ if (button.clicked){ Global.stageInstructionsShown(); visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } public function setMode(i:int=0):void{ type = i; var _local2 = builds; _local2[type](); } private function buildResults():void{ var ts = 10000; ts = (ts - (hud.levelMoves * 75)); ts = (ts - (hud.levelTime * 25)); label.setText("Level Complete"); text.setText((((((((("\n\n\n Time Taken - " + hud.levelTime) + " second(s)") + "\n\n\n ") + "Total Moves - ") + hud.levelMoves) + "\n\n\n\n\n\n ") + "Level Score - ") + ts)); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } private function runResults():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } private function runHelp():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } private function buildGameMastered():void{ label.setText("Congratulations!!"); text.setText("You've cleared every level in Traverse!\n\nIsn't the design the level layout makes pretty?!\n\nYou did great! The power of problem solving and\n logic is strong with you!\n\nNow click on the 'Play More Games' button and\n complete another!"); button.setText("OK"); button.x = (width - button.width); button.y = (height - button.height); } public function setHUD(h:HUD):void{ hud = h; } private function runGameComplete():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } private function runPlayScreenInfo():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } private function runGameMastered():void{ if (button.clicked){ visible = false; button.clicked = false; }; button.setOffsets(x, y); button.run(); } } }//package
Section 29
//GameButton (GameButton) package { import flash.display.*; import flash.geom.*; import flash.filters.*; public class GameButton extends Sprite { private var stretchBox:StretchBox; private var oX:int;// = 0 private var oY:int;// = 0 private var padding:int;// = 0 private var cf:ColorMatrixFilter; public var clicked:Boolean;// = false private var cm:Array; private var txt:GameText; private var label:String;// = "Button" private var bright:int;// = 0 private var hover:Boolean;// = false public function GameButton(s:String=""):void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); build(); setText(s); } public function run():void{ var mp:Point = Control.MOUSEPOINT; if (((((mp.x - oX) >= x)) && (((mp.x - oX) < (x + width))))){ if (((((mp.y - oY) >= y)) && (((mp.y - oY) < (y + height))))){ if (Control.MOUSEDOWN){ clicked = true; Control.setMouseDown(false); SoundManager.playSound(SoundManager.MENUSELECT); }; bright = 128; if (!hover){ SoundManager.playSound(SoundManager.MENUHOVER); hover = true; }; } else { hover = false; }; } else { hover = false; }; if (bright > 0){ bright = (bright - 8); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = bright)); cf.matrix = cm; filters = [cf]; } public function setPadding(i:int=4):void{ padding = i; updateButton(); } public function setFont(i:int=0):void{ txt.setFont(i); updateButton(); } private function build():void{ stretchBox = new StretchBox(); stretchBox.setTotalWidth(128); addChild(stretchBox); addChild((txt = new GameText())); cf = new ColorMatrixFilter(cm); filters = [cf]; updateButton(); } public function setText(s:String=""):void{ if (s != ""){ label = s; txt.setText(label); }; updateButton(); } private function updateButton():void{ stretchBox.setCenterWidth((txt.width + (padding * 2))); txt.x = Math.floor(((width - txt.width) / 2)); txt.y = Math.floor(((height - txt.height) / 2)); } public function setOffsets(offX:int=0, offY:int=0):void{ oX = offX; oY = offY; } } }//package
Section 30
//GameScreen (GameScreen) package { import flash.display.*; public class GameScreen extends Sprite { public function GameScreen(){ super(); } public function run():void{ } } }//package
Section 31
//GameText (GameText) package { import flash.display.*; import flash.text.*; public class GameText extends Sprite { private const GameFontA:Class; private const GameFontB:Class; private var fonts:Array; private var sField:TextField; private var sFormat:TextFormat; private var sField2:TextField; private var sField3:TextField; private var format:TextFormat; private var field:TextField; public function GameText(s:String=""):void{ GameFontA = GameText_GameFontA; GameFontB = GameText_GameFontB; fonts = [new GameFontA().fontName, new GameFontB().fontName]; super(); field = new TextField(); field.selectable = false; field.autoSize = TextFieldAutoSize.LEFT; field.embedFonts = true; sField = new TextField(); sField.selectable = false; sField.autoSize = TextFieldAutoSize.LEFT; sField.embedFonts = true; sField2 = new TextField(); sField2.selectable = false; sField2.autoSize = TextFieldAutoSize.LEFT; sField2.embedFonts = true; sField3 = new TextField(); sField3.selectable = false; sField3.autoSize = TextFieldAutoSize.LEFT; sField3.embedFonts = true; format = new TextFormat(); format.color = 0xFFFFFF; format.font = fonts[0]; format.size = 16; sFormat = new TextFormat(); sFormat.color = 0; sFormat.font = fonts[0]; sFormat.size = format.size; addChild(sField); addChild(sField2); addChild(sField3); sField.x = 1; sField2.y = 1; sField3.x = (sField3.y = 1); addChild(field); setText(s); } public function setTextColor(u:uint):void{ format.color = u; setFormats(); } private function setFormats():void{ field.setTextFormat(format); sField.setTextFormat(sFormat); sField2.setTextFormat(sFormat); sField3.setTextFormat(sFormat); } public function setTextSize(i:int):void{ format.size = i; sFormat.size = i; setFormats(); } public function setFont(i:int=0):void{ format.font = fonts[i]; sFormat.font = fonts[i]; if (i == 1){ setTextSize(18); }; setFormats(); } public function setText(s:String):void{ field.text = s; sField.text = s; sField2.text = s; sField3.text = s; setFormats(); } } }//package
Section 32
//GameText_GameFontA (GameText_GameFontA) package { import mx.core.*; public class GameText_GameFontA extends FontAsset { } }//package
Section 33
//GameText_GameFontB (GameText_GameFontB) package { import mx.core.*; public class GameText_GameFontB extends FontAsset { } }//package
Section 34
//Global (Global) package { import flash.display.*; import flash.net.*; public class Global { public static var STAGEINSTRUCTIONS:Boolean = false; public static var UNLOCK:Boolean = false; public static var TOTALSCORE:int = 123456789; public static var CURSOR:Bitmap; public static var GAMEINSTRUCTIONS:Boolean = false; public static var GAMECOMPLETEDSHOWN:Boolean = false; public static var SCORES:Array; public static var CURRENTSTAGE:int = 0; public static var GAMEMASTEREDSHOWN:Boolean = false; public function Global(){ super(); } public static function setCurrentStage(i:int=0):void{ CURRENTSTAGE = i; MemoryCard.saveData(SCORES, GAMECOMPLETEDSHOWN, GAMEMASTEREDSHOWN); } public static function setGameMasteredShown(b:Boolean):void{ GAMEMASTEREDSHOWN = b; MemoryCard.saveData(SCORES, GAMECOMPLETEDSHOWN, GAMEMASTEREDSHOWN); } public static function setScore(stage:int=0, score:int=0):void{ if (score > SCORES[stage]){ SCORES[stage] = score; }; updateTotalScore(); } public static function playMoreButton(niggawhat:HUD):void{ navigateToURL(new URLRequest("http://www.ninjakiwi.com")); MochiBot.track(niggawhat, "6a6d8727"); MochiBot.track(niggawhat, "a448dbae"); } public static function stageInstructionsShown():void{ STAGEINSTRUCTIONS = true; } public static function updateTotalScore():void{ TOTALSCORE = 0; var i:int; while (i < SCORES.length) { TOTALSCORE = (TOTALSCORE + SCORES[i]); i++; }; } public static function setCursor(c:Bitmap):void{ CURSOR = c; } public static function gameInstructionsShown():void{ GAMEINSTRUCTIONS = true; } public static function init():void{ var mCard:Object = MemoryCard.loadData(); SCORES = mCard.scores; GAMECOMPLETEDSHOWN = mCard.gameCompletedShown; GAMEMASTEREDSHOWN = mCard.gameMasteredShown; } public static function setGameCompletedShown(b:Boolean):void{ GAMECOMPLETEDSHOWN = b; MemoryCard.saveData(SCORES, GAMECOMPLETEDSHOWN, GAMEMASTEREDSHOWN); } public static function toggleUnlock():void{ UNLOCK = !(UNLOCK); } public static function checkGameMastered():Boolean{ if (GAMEMASTEREDSHOWN){ return (false); }; var i:int; while (i < SCORES.length) { if (SCORES[i] == 0){ return (false); }; i++; }; return (true); } } }//package
Section 35
//HUD (HUD) package { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.net.*; public class HUD extends Sprite { private var playButton:GameButton; private var audioBox:StretchBox; private var barH:int;// = 32 public var levelMoves:int; private var soundButton:AudioButton; public var ready:Boolean;// = true private var movesDisplay:GameButton; private var restartButton:GameButton; private var timeDisplay:GameButton; private var musicButton:AudioButton; private var type:int;// = 0 private var playMoreButton:GameButton; private var playScreen:PlayScreen; private var dialog:DialogWindow; private var scoreDisplay:GameButton; private var screenH:int;// = 480 private var keyContainer:KeyContainer; private var sponsorLogo:LinkButton; private var screenW:int;// = 640 public var levelTime:int; private var stageSelectButton:GameButton; public function HUD(i:int=0):void{ super(); type = i; addEventListener(Event.ADDED_TO_STAGE, config, false, 0, true); } public function run():void{ switch (type){ case 0: runTitleScreen(); break; case 1: runStageSelectScreen(); break; case 2: runPlayScreen(); break; }; runDialog(); runAudioBox(); } private function buildTitleScreen():void{ addBottomBar(); addAudioBox(); playButton = new GameButton(); playButton.setFont(1); playButton.setText("Play"); playButton.setPadding(24); playButton.x = ((screenW - playButton.width) / 2); playButton.y = (screenH - playButton.height); addChild(playButton); addLogo(); } public function showDialog(i:int=0):void{ if (dialog != null){ if (dialog.parent != null){ removeChild(dialog); }; dialog = null; }; dialog = new DialogWindow(); dialog.setHUD(this); dialog.setMode(i); dialog.x = ((screenW - dialog.width) / 2); dialog.y = ((screenH - dialog.height) / 2); addChild(dialog); } private function runPlayScreen():void{ playMoreButton.run(); restartButton.run(); stageSelectButton.run(); keyContainer.setKeys(playScreen.getKeys()); keyContainer.x = ((screenW - keyContainer.width) - 4); keyContainer.y = ((playMoreButton.y - keyContainer.height) - 4); movesDisplay.setText(("Moves: " + playScreen.getMoves())); levelMoves = playScreen.getMoves(); movesDisplay.x = (screenW - movesDisplay.width); timeDisplay.setText(("Time: " + playScreen.getTime())); levelTime = playScreen.getTime(); timeDisplay.x = (movesDisplay.x - timeDisplay.width); if (stageSelectButton.clicked){ playScreen.restart(); stageSelectButton.clicked = false; Control.setMouseDown(false); }; if (restartButton.clicked){ playScreen.die(); restartButton.clicked = false; Control.setMouseDown(false); }; if (playMoreButton.clicked){ playMoreButton.clicked = false; Control.setMouseDown(false); }; } private function addPlayMoreButton():void{ playMoreButton = new GameButton(); playMoreButton.setText("Play More Games"); playMoreButton.x = (audioBox.x - playMoreButton.width); playMoreButton.y = audioBox.y; addChild(playMoreButton); } private function runDialog():void{ if (dialog != null){ dialog.run(); ready = true; if (dialog.visible){ ready = false; }; }; } private function addBottomBar():void{ graphics.beginFill(0, 0.35); graphics.drawRect(0, ((Config.SCREENH - barH) - 8), screenW, barH); graphics.endFill(); } private function runAudioBox():void{ if (musicButton != null){ musicButton.run(); }; if (soundButton != null){ soundButton.run(); }; } private function config(ev:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, config); switch (type){ case 0: buildTitleScreen(); break; case 1: buildStageSelectScreen(); break; case 2: buildPlayScreen(); break; }; stage.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } private function buildPlayScreen():void{ addTopBar(); addBottomBar(); addAudioBox(); addGameName(); addPlayMoreButton(); var sd:GameButton = new GameButton(); sd.setText(("Stage " + int((Global.CURRENTSTAGE + 1)))); addChild(sd); movesDisplay = new GameButton(); movesDisplay.setText("Moves: 0"); movesDisplay.x = (screenW - movesDisplay.width); addChild(movesDisplay); timeDisplay = new GameButton(); timeDisplay.setText("Time: 0"); timeDisplay.x = (movesDisplay.x - timeDisplay.width); addChild(timeDisplay); restartButton = new GameButton(); restartButton.setText("Restart"); restartButton.x = (playMoreButton.x - restartButton.width); restartButton.y = playMoreButton.y; addChild(restartButton); stageSelectButton = new GameButton(); stageSelectButton.setText("Select Stage"); stageSelectButton.x = (restartButton.x - stageSelectButton.width); stageSelectButton.y = restartButton.y; addChild(stageSelectButton); keyContainer = new KeyContainer(); keyContainer.setKeys(0); keyContainer.x = ((screenW - keyContainer.width) - 4); keyContainer.y = ((playMoreButton.y - keyContainer.height) - 4); addChild(keyContainer); if (!Global.GAMEINSTRUCTIONS){ showDialog(1); Global.gameInstructionsShown(); }; } private function runTitleScreen():void{ if (sponsorLogo.clicked){ sponsorLogo.clicked = false; }; if (playButton.clicked){ Control.setScreen(Config.STAGESELECTSCREEN); playButton.clicked = false; }; playButton.run(); sponsorLogo.run(); } public function setPlayScreen(p:PlayScreen):void{ playScreen = p; } private function runStageSelectScreen():void{ if (sponsorLogo.clicked){ sponsorLogo.clicked = false; }; scoreDisplay.setText(("Score: " + Global.TOTALSCORE)); scoreDisplay.x = (screenW - scoreDisplay.width); playMoreButton.run(); if (playMoreButton.clicked){ playMoreButton.clicked = false; }; sponsorLogo.run(); } private function addAudioBox():void{ audioBox = new StretchBox(); audioBox.setTotalWidth(52); audioBox.x = (screenW - audioBox.width); audioBox.y = (screenH - audioBox.height); addChild(audioBox); musicButton = new AudioButton(); musicButton.config(0); musicButton.x = ((screenW - musicButton.width) - 12); musicButton.y = ((screenH - musicButton.height) - 11); addChild(musicButton); soundButton = new AudioButton(); soundButton.config(1); soundButton.x = (musicButton.x - soundButton.width); soundButton.y = musicButton.y; addChild(soundButton); } private function addGameName():void{ var gn:Bitmap = new Bitmap(ImageHandler.LOGOSMALL); gn.x = 8; gn.y = ((screenH - gn.height) - 12); addChild(gn); } private function buildStageSelectScreen():void{ addTopBar(); addBottomBar(); addAudioBox(); addGameName(); addPlayMoreButton(); addLogo(1); var ss:GameButton = new GameButton(); ss.setFont(1); ss.setText("Stage Select"); addChild(ss); scoreDisplay = new GameButton(); scoreDisplay.setText("Score: 0000000"); scoreDisplay.x = (screenW - scoreDisplay.width); addChild(scoreDisplay); if (!Global.STAGEINSTRUCTIONS){ showDialog(0); Global.stageInstructionsShown(); }; } private function addLogo(posX:int=0):void{ sponsorLogo = new LinkButton(); if (posX == 0){ sponsorLogo.x = 20; } else { sponsorLogo.x = 250; }; sponsorLogo.y = ((screenH - sponsorLogo.height) + 10); addChild(sponsorLogo); } private function onClick(ev:MouseEvent):void{ var mp:Point = new Point(ev.stageX, ev.stageY); if (type == 0){ if ((((((((mp.x >= sponsorLogo.x)) && ((mp.x < (sponsorLogo.x + sponsorLogo.width))))) && ((mp.y >= sponsorLogo.y)))) && ((mp.y < (sponsorLogo.y + sponsorLogo.height))))){ navigateToURL(new URLRequest("http://www.ninjakiwi.com"), "_blank"); MochiBot.track(this, "6a6d8727"); MochiBot.track(this, "a448dbae"); }; } else { if (type == 1){ if ((((((((mp.x >= sponsorLogo.x)) && ((mp.x < (sponsorLogo.x + sponsorLogo.width))))) && ((mp.y >= sponsorLogo.y)))) && ((mp.y < (sponsorLogo.y + sponsorLogo.height))))){ navigateToURL(new URLRequest("http://www.ninjakiwi.com"), "_blank"); MochiBot.track(this, "6a6d8727"); MochiBot.track(this, "a448dbae"); }; if ((((((((mp.x >= playMoreButton.x)) && ((mp.x < (playMoreButton.x + playMoreButton.width))))) && ((mp.y >= playMoreButton.y)))) && ((mp.y < (playMoreButton.y + playMoreButton.height))))){ navigateToURL(new URLRequest("http://www.ninjakiwi.com"), "_blank"); MochiBot.track(this, "6a6d8727"); MochiBot.track(this, "a448dbae"); }; } else { if (type == 2){ if ((((((((mp.x >= playMoreButton.x)) && ((mp.x < (playMoreButton.x + playMoreButton.width))))) && ((mp.y >= playMoreButton.y)))) && ((mp.y < (playMoreButton.y + playMoreButton.height))))){ navigateToURL(new URLRequest("http://www.ninjakiwi.com"), "_blank"); MochiBot.track(this, "6a6d8727"); MochiBot.track(this, "a448dbae"); }; }; }; }; } private function addTopBar():void{ graphics.beginFill(0, 0.35); graphics.drawRect(0, 8, screenW, barH); graphics.endFill(); } } }//package
Section 36
//ImageHandler (ImageHandler) package { import flash.display.*; import flash.geom.*; public class ImageHandler { private static const SoundButton:Class = ImageHandler_SoundButton; private static const MapSheet:Class = ImageHandler_MapSheet; private static const PlanetSheet:Class = ImageHandler_PlanetSheet; public static const TooltipPreviewFrame:Class = ImageHandler_TooltipPreviewFrame; public static const ESELOGO:BitmapData = new ESELogo().bitmapData; public static const MAPSHEET:BitmapData = new MapSheet().bitmapData; private static const LogoSmall:Class = ImageHandler_LogoSmall; private static const MAPH:int = 15; public static const STAGEBUTTON:BitmapData = new StageButton().bitmapData; private static const MAPW:int = 21; public static const LOGOSMALL:BitmapData = new LogoSmall().bitmapData; public static const StageSelectHUD:Class = ImageHandler_StageSelectHUD; public static const BackgroundGradient:Class = ImageHandler_BackgroundGradient; private static const ESELogo:Class = ImageHandler_ESELogo; private static const EpicShadowPlanet:Class = ImageHandler_EpicShadowPlanet; private static const TooltipCornerSheet:Class = ImageHandler_TooltipCornerSheet; public static const TILEANIMATIONS:BitmapData = new TileAnimations().bitmapData; private static const StageButton:Class = ImageHandler_StageButton; private static const ScoreTiles:Class = ImageHandler_ScoreTiles; private static const LogoBig:Class = ImageHandler_LogoBig; public static const PLANETSHEET:BitmapData = new PlanetSheet().bitmapData; public static const BUTTON:BitmapData = new GameButton().bitmapData; private static const SponsorLogoSmall:Class = ImageHandler_SponsorLogoSmall; private static const DialogBox:Class = ImageHandler_DialogBox; public static const TOOLTIPCORNERSHEET:BitmapData = new TooltipCornerSheet().bitmapData; public static const SCORETILES:BitmapData = new ScoreTiles().bitmapData; public static const EPICSHADOWPLANET:BitmapData = new EpicShadowPlanet().bitmapData; public static const LOGOBIG:BitmapData = new LogoBig().bitmapData; public static const CURSOR:BitmapData = new Cursor().bitmapData; private static const Hud:Class = ImageHandler_Hud; private static const StretchBoxSheet:Class = ImageHandler_StretchBoxSheet; private static const TileAnimations:Class = ImageHandler_TileAnimations; public static const NINJAKIWIPLANET:BitmapData = new NinjaKiwiPlanet().bitmapData; public static const SOUNDBUTTON:BitmapData = new SoundButton().bitmapData; public static const DIALOGBOX:BitmapData = new DialogBox().bitmapData; private static const GameButton:Class = ImageHandler_GameButton; private static const Tiles:Class = ImageHandler_Tiles; public static const STRETCHBOXSHEET:BitmapData = new StretchBoxSheet().bitmapData; public static const SPONSORLOGOSMALL:BitmapData = new SponsorLogoSmall().bitmapData; public static const BackgroundStarsA:Class = ImageHandler_BackgroundStarsA; public static const BackgroundStarsB:Class = ImageHandler_BackgroundStarsB; public static const BackgroundStarsC:Class = ImageHandler_BackgroundStarsC; public static const TooltipBackground:Class = ImageHandler_TooltipBackground; private static const NinjaKiwiPlanet:Class = ImageHandler_NinjaKiwiPlanet; public static const TILES:BitmapData = new Tiles().bitmapData; private static const Cursor:Class = ImageHandler_Cursor; public static const HUD:BitmapData = new Hud().bitmapData; public static const TitleScreenPlanet:Class = ImageHandler_TitleScreenPlanet; public function ImageHandler(){ super(); } public static function getMapData(i:int=0):BitmapData{ return (getImageData(MAPSHEET, MAPW, MAPH, i, 0, 0)); } public static function getImageData(sheet:BitmapData, imageW:int=1, imageH:int=1, frame:int=0, offsetX:int=0, offsetY:int=0):BitmapData{ var cols:int = (sheet.width / imageW); var col:int = (frame % cols); var row:int = Math.floor((frame / cols)); var rect:Rectangle = new Rectangle((offsetX + (col * imageW)), (offsetY + (row * imageH)), imageW, imageH); var pt:Point = new Point(0, 0); var bmp:BitmapData = new BitmapData(imageW, imageH, true, 0); bmp.copyPixels(sheet, rect, pt, null, null, true); return (bmp); } } }//package
Section 37
//ImageHandler_BackgroundGradient (ImageHandler_BackgroundGradient) package { import mx.core.*; public class ImageHandler_BackgroundGradient extends BitmapAsset { } }//package
Section 38
//ImageHandler_BackgroundStarsA (ImageHandler_BackgroundStarsA) package { import mx.core.*; public class ImageHandler_BackgroundStarsA extends BitmapAsset { } }//package
Section 39
//ImageHandler_BackgroundStarsB (ImageHandler_BackgroundStarsB) package { import mx.core.*; public class ImageHandler_BackgroundStarsB extends BitmapAsset { } }//package
Section 40
//ImageHandler_BackgroundStarsC (ImageHandler_BackgroundStarsC) package { import mx.core.*; public class ImageHandler_BackgroundStarsC extends BitmapAsset { } }//package
Section 41
//ImageHandler_Cursor (ImageHandler_Cursor) package { import mx.core.*; public class ImageHandler_Cursor extends BitmapAsset { } }//package
Section 42
//ImageHandler_DialogBox (ImageHandler_DialogBox) package { import mx.core.*; public class ImageHandler_DialogBox extends BitmapAsset { } }//package
Section 43
//ImageHandler_EpicShadowPlanet (ImageHandler_EpicShadowPlanet) package { import mx.core.*; public class ImageHandler_EpicShadowPlanet extends BitmapAsset { } }//package
Section 44
//ImageHandler_ESELogo (ImageHandler_ESELogo) package { import mx.core.*; public class ImageHandler_ESELogo extends BitmapAsset { } }//package
Section 45
//ImageHandler_GameButton (ImageHandler_GameButton) package { import mx.core.*; public class ImageHandler_GameButton extends BitmapAsset { } }//package
Section 46
//ImageHandler_Hud (ImageHandler_Hud) package { import mx.core.*; public class ImageHandler_Hud extends BitmapAsset { } }//package
Section 47
//ImageHandler_LogoBig (ImageHandler_LogoBig) package { import mx.core.*; public class ImageHandler_LogoBig extends BitmapAsset { } }//package
Section 48
//ImageHandler_LogoSmall (ImageHandler_LogoSmall) package { import mx.core.*; public class ImageHandler_LogoSmall extends BitmapAsset { } }//package
Section 49
//ImageHandler_MapSheet (ImageHandler_MapSheet) package { import mx.core.*; public class ImageHandler_MapSheet extends BitmapAsset { } }//package
Section 50
//ImageHandler_NinjaKiwiPlanet (ImageHandler_NinjaKiwiPlanet) package { import mx.core.*; public class ImageHandler_NinjaKiwiPlanet extends BitmapAsset { } }//package
Section 51
//ImageHandler_PlanetSheet (ImageHandler_PlanetSheet) package { import mx.core.*; public class ImageHandler_PlanetSheet extends BitmapAsset { } }//package
Section 52
//ImageHandler_ScoreTiles (ImageHandler_ScoreTiles) package { import mx.core.*; public class ImageHandler_ScoreTiles extends BitmapAsset { } }//package
Section 53
//ImageHandler_SoundButton (ImageHandler_SoundButton) package { import mx.core.*; public class ImageHandler_SoundButton extends BitmapAsset { } }//package
Section 54
//ImageHandler_SponsorLogoSmall (ImageHandler_SponsorLogoSmall) package { import mx.core.*; public class ImageHandler_SponsorLogoSmall extends BitmapAsset { } }//package
Section 55
//ImageHandler_StageButton (ImageHandler_StageButton) package { import mx.core.*; public class ImageHandler_StageButton extends BitmapAsset { } }//package
Section 56
//ImageHandler_StageSelectHUD (ImageHandler_StageSelectHUD) package { import mx.core.*; public class ImageHandler_StageSelectHUD extends BitmapAsset { } }//package
Section 57
//ImageHandler_StretchBoxSheet (ImageHandler_StretchBoxSheet) package { import mx.core.*; public class ImageHandler_StretchBoxSheet extends BitmapAsset { } }//package
Section 58
//ImageHandler_TileAnimations (ImageHandler_TileAnimations) package { import mx.core.*; public class ImageHandler_TileAnimations extends BitmapAsset { } }//package
Section 59
//ImageHandler_Tiles (ImageHandler_Tiles) package { import mx.core.*; public class ImageHandler_Tiles extends BitmapAsset { } }//package
Section 60
//ImageHandler_TitleScreenPlanet (ImageHandler_TitleScreenPlanet) package { import mx.core.*; public class ImageHandler_TitleScreenPlanet extends BitmapAsset { } }//package
Section 61
//ImageHandler_TooltipBackground (ImageHandler_TooltipBackground) package { import mx.core.*; public class ImageHandler_TooltipBackground extends BitmapAsset { } }//package
Section 62
//ImageHandler_TooltipCornerSheet (ImageHandler_TooltipCornerSheet) package { import mx.core.*; public class ImageHandler_TooltipCornerSheet extends BitmapAsset { } }//package
Section 63
//ImageHandler_TooltipPreviewFrame (ImageHandler_TooltipPreviewFrame) package { import mx.core.*; public class ImageHandler_TooltipPreviewFrame extends BitmapAsset { } }//package
Section 64
//KeyContainer (KeyContainer) package { import flash.display.*; public class KeyContainer extends Sprite { private var keyData:BitmapData; private var keyArray:Array; private var keys:int;// = 0 public function KeyContainer():void{ super(); keyArray = new Array(); keyData = ImageHandler.getImageData(ImageHandler.TILES, 24, 24, 2); } private function emptyKeys():void{ var i:int; while (i < keyArray.length) { removeChild(keyArray[i]); keyArray[i] = null; i++; }; keyArray = Toolkit.cleanArray(keyArray); } private function addKeys():void{ var k:Bitmap; var i:int; while (i < keys) { k = new Bitmap(keyData); k.x = 4; k.y = (4 + (i * 24)); addChild(k); keyArray.push(k); i++; }; } public function setKeys(k:int=0):void{ if (keys != k){ keys = k; emptyKeys(); addKeys(); graphics.clear(); if (keys > 0){ graphics.beginFill(0, 0.35); graphics.drawRect(0, 0, 32, (8 + (keys * 24))); graphics.endFill(); }; }; } } }//package
Section 65
//LinkButton (LinkButton) package { import flash.display.*; import flash.geom.*; import flash.filters.*; public class LinkButton extends Sprite { private var cf:ColorMatrixFilter; public var clicked:Boolean;// = false private var img:Bitmap; private var cm:Array; private var bright:int;// = 0 private var hover:Boolean;// = false public function LinkButton(s:String=""):void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); build(); } public function run():void{ var mp:Point = Control.MOUSEPOINT; if ((((mp.x >= x)) && ((mp.x < (x + width))))){ if ((((mp.y >= y)) && ((mp.y < (y + height))))){ if (Control.MOUSEDOWN){ clicked = true; Control.setMouseDown(false); SoundManager.playSound(SoundManager.MENUSELECT); }; bright = 128; if (!hover){ SoundManager.playSound(SoundManager.MENUHOVER); hover = true; }; } else { hover = false; }; } else { hover = false; }; if (bright > 0){ bright = (bright - 8); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = bright)); cf.matrix = cm; filters = [cf]; } private function build():void{ img = new Bitmap(ImageHandler.SPONSORLOGOSMALL); addChild(img); cf = new ColorMatrixFilter(cm); filters = [cf]; } } }//package
Section 66
//Main (Main) package { import flash.events.*; import flash.display.*; import flash.geom.*; import mochi.as3.*; import flash.ui.*; public class Main extends Sprite { private var pendingScreen:int;// = 0 private var adPlaying:Boolean; private var screen:GameScreen; private var fadeOut:Boolean;// = false private var mc:MovieClip; private var fade:Sprite; private var cursor:Bitmap; public function Main():void{ super(); if (stage){ init(); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } private function buildGame():void{ MochiBot.track(this, "b9594e2c"); Control.init(this); Global.init(); cursor = new Bitmap(ImageHandler.CURSOR); Global.setCursor(cursor); fade = new Sprite(); fade.graphics.beginFill(0, 1); fade.graphics.drawRect(0, 0, Config.SCREENW, Config.SCREENH); fade.graphics.endFill(); mc = new MovieClip(); addChild(mc); var mochiAdConfig:Object = {clip:mc, id:"826d37d692650dc9", res:"640x480", ad_finished:adFinish}; MochiServices.connect("826d37d692650dc9", mc, onConnectError); MochiAd.showPreGameAd(mochiAdConfig); adPlaying = true; swapScreens(); } public function setScreen(s:int=0):void{ fadeOut = true; pendingScreen = s; } public function run(ev:Event=null):void{ if (!adPlaying){ if (fadeOut){ fade.alpha = (fade.alpha + 0.025); if (fade.alpha >= 1){ swapScreens(); }; } else { if (fade.alpha > 0){ fade.alpha = (fade.alpha - 0.025); }; if (!Toolkit.SITELOCKED){ if (screen != null){ screen.run(); }; scrollRect = new Rectangle(0, 0, Config.SCREENW, Config.SCREENH); cursor.x = Control.MOUSEPOINT.x; cursor.y = Control.MOUSEPOINT.y; SoundManager.run(); }; }; }; } public function adFinish():void{ adPlaying = false; } private function init(e:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); buildGame(); } public function swapScreens():void{ if (screen != null){ removeChild(screen); screen = null; }; if (cursor.parent != null){ removeChild(cursor); }; if (fade.parent != null){ removeChild(fade); }; if (((!((mc == null))) && (!((mc.parent == null))))){ removeChild(mc); }; switch (pendingScreen){ case Config.ADSCREEN: screen = new AdScreen(); break; case Config.SPONSORSCREEN: screen = new SponsorScreen(); break; case Config.DEVELOPERSCREEN: screen = new DeveloperScreen(); break; case Config.TITLESCREEN: screen = new TitleScreen(); break; case Config.STAGESELECTSCREEN: screen = new StageSelectScreen(); break; case Config.PLAYSCREEN: screen = new PlayScreen(); break; }; addChild(screen); addChild(fade); addChild(mc); if (pendingScreen >= Config.TITLESCREEN){ addChild(cursor); }; fadeOut = false; if (pendingScreen >= Config.TITLESCREEN){ Mouse.hide(); }; } public function onConnectError(status:String):void{ trace("couldn't connect"); } } }//package
Section 67
//MapTile (MapTile) package { import flash.display.*; import flash.filters.*; public class MapTile extends Bitmap { public var animation:Array; public var portalY:int;// = 0 public var cornerTL:Boolean;// = false public var cornerTR:Boolean;// = false public var exit:Boolean;// = false public var environment:PlayScreen; public var walkable:Boolean;// = false public var blinkPaused:Boolean;// = false public var lock:Boolean;// = false public var playAnimation:Boolean;// = false public var breakable:Boolean;// = false public var blink:Boolean;// = false public var cornerBL:Boolean;// = false private var cf:ColorMatrixFilter; public var cornerBR:Boolean;// = false public var key:Boolean;// = false private var cm:Array; public var tileY:int;// = 0 public var portal:Boolean;// = false public var frame:int;// = 0 public var tileX:int;// = 0 public var unlocked:Boolean;// = false public var portalX:int;// = 0 private var bright:int;// = 0 private var blinkSkip:Boolean;// = false public var counter:int;// = 0 public function MapTile(i:int=0):void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); config(i); } public function run():void{ if (bright > 0){ bright = (bright - 16); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = bright)); cf.matrix = cm; filters = [cf]; if (((!((animation == null))) && (playAnimation))){ bitmapData = ImageHandler.getImageData(ImageHandler.TILEANIMATIONS, 24, 24, animation[frame], 0, 0); counter++; if (breakable){ if (frame < 10){ if ((counter % 16) == 0){ frame++; }; } else { if (frame == 10){ SoundManager.playSound(SoundManager.BOMB); }; walkable = true; if ((counter % 4) == 0){ frame++; }; }; }; if (lock){ if ((counter % 4) == 0){ frame++; }; }; if (key){ if ((counter % 12) == 0){ frame++; }; }; if (exit){ if ((counter % 4) == 0){ frame++; }; }; if (portal){ if ((counter % 8) == 0){ frame++; }; }; if (blink){ if (blinkPaused){ if ((counter % 64) == 0){ if (!blinkSkip){ blinkPaused = false; } else { blinkSkip = false; }; }; } else { if ((counter % 2) == 0){ frame++; if ((((frame == 4)) || ((frame == animation.length)))){ blinkPaused = true; if (frame == 4){ walkable = true; } else { walkable = false; }; }; }; }; }; if (frame > (animation.length - 1)){ frame = 0; if (((breakable) || (lock))){ environment.removeTile(this); }; }; } else { counter = 0; }; } public function setPos(px:int=0, py:int=0):void{ x = (px * 24); y = (py * 24); tileX = px; tileY = py; } public function hit():void{ if (breakable){ if (((((breakable) && (playAnimation))) && ((frame < 10)))){ frame = 10; }; playAnimation = true; }; if (((((((cornerBL) || (cornerBR))) || (cornerTL))) || (cornerTR))){ SoundManager.playSound(SoundManager.BUMPER); }; bright = 0xFF; } public function config(i:int=0):void{ var tile:int = (i - 1); switch (i){ case 1: walkable = false; break; case 2: walkable = false; breakable = true; animation = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; break; case 3: walkable = true; key = true; animation = [16, 17, 18, 19]; playAnimation = true; break; case 4: walkable = false; lock = true; animation = [20, 21, 22, 23]; break; case 5: walkable = true; cornerTL = true; break; case 6: walkable = true; cornerTR = true; break; case 7: walkable = true; cornerBL = true; break; case 8: walkable = true; cornerBR = true; break; case 9: walkable = true; portal = true; animation = [32, 33, 34, 35]; playAnimation = true; break; case 10: walkable = false; blink = true; animation = [36, 37, 38, 39, 40, 41, 42, 43]; playAnimation = true; break; case 12: walkable = true; exit = true; animation = [24, 25, 26, 27, 28, 27, 26, 25, 24, 25, 29, 30, 31, 30, 29, 25]; playAnimation = true; break; case 13: walkable = false; blink = true; animation = [36, 37, 38, 39, 40, 41, 42, 43]; playAnimation = true; blinkSkip = true; default: walkable = true; break; }; bitmapData = ImageHandler.getImageData(ImageHandler.TILES, 24, 24, tile, 0, 0); cf = new ColorMatrixFilter(cm); filters = [cf]; } public function unlock():void{ SoundManager.playSound(SoundManager.UNLOCK); playAnimation = true; unlocked = true; } public function setEnvironment(p:PlayScreen):void{ environment = p; } public function setPortal(a:Array):void{ if (a != null){ if (a[0] != undefined){ portalX = a[0]; }; if (a[1] != undefined){ portalY = a[1]; }; }; } } }//package
Section 68
//MemoryCard (MemoryCard) package { import flash.net.*; public class MemoryCard { public static var sharedObject:SharedObject; public function MemoryCard(){ super(); } public static function loadData():Object{ var i:int; if (sharedObject == null){ init(); }; var o:Object = new Object(); if ((((sharedObject.data.scores == undefined)) || ((sharedObject.data.scores == null)))){ o.scores = new Array(); i = 0; while (i < 25) { o.scores.push(0); i++; }; o.gameCompletedShown = false; o.gameMasteredShown = false; } else { o.scores = sharedObject.data.scores; o.gameCompletedShown = sharedObject.data.gameCompletedShown; o.gameMasteredShown = sharedObject.data.gameMasteredShown; }; return (o); } public static function saveData(scores:Array, gameCompletedShown:Boolean, gameMasteredShown:Boolean):void{ if (sharedObject == null){ init(); }; sharedObject.data.scores = scores; sharedObject.data.gameCompletedShown = gameCompletedShown; sharedObject.data.gameMasteredShown = gameMasteredShown; sharedObject.flush(); } public static function init():void{ sharedObject = SharedObject.getLocal("traverse"); } } }//package
Section 69
//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{ if (Security.sandboxType == "localWithFile"){ return (null); }; var self:MochiBot = new (MochiBot); parent.addChild(self); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var server:String = "http://core.mochibot.com/my/core.swf"; var lv:URLVariables = new URLVariables(); lv["sb"] = Security.sandboxType; lv["v"] = Capabilities.version; lv["swfid"] = tag; lv["mv"] = "8"; lv["fv"] = "9"; var url:String = self.root.loaderInfo.loaderURL; if (url.indexOf("http") == 0){ lv["url"] = url; } else { lv["url"] = "local"; }; var req:URLRequest = new URLRequest(server); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; var loader:Loader = new Loader(); self.addChild(loader); loader.load(req); return (self); } } }//package
Section 70
//NinjaKiwiSplash (NinjaKiwiSplash) package { import flash.display.*; public dynamic class NinjaKiwiSplash extends MovieClip { public function NinjaKiwiSplash(){ addFrameScript(0, frame1); } function frame1(){ } } }//package
Section 71
//Player (Player) package { import flash.display.*; public class Player extends Bitmap { private var moving:Boolean;// = false private var environment:PlayScreen; private var hitH:int; private var tileH:int;// = 24 private var hitW:int; private var moveX:int;// = 0 private var moveY:int;// = 0 private var tileW:int;// = 24 private var spd:int;// = 24 private var lastScoreTile:ScoreTile; public var keys:int;// = 0 public function Player():void{ hitH = tileH; hitW = tileW; super(); bitmapData = ImageHandler.getImageData(ImageHandler.TILES, tileW, tileH, 10, 0, 0); } public function run():void{ if (moving){ move(moveX, moveY); } else { if (((!(moving)) && (((Control.isKeyDown(Control.LEFT)) || (Control.isKeyDown(Control.A)))))){ move(-1, 0); environment.addMove(); }; if (((!(moving)) && (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.W)))))){ move(0, -1); environment.addMove(); }; if (((!(moving)) && (((Control.isKeyDown(Control.RIGHT)) || (Control.isKeyDown(Control.D)))))){ move(1, 0); environment.addMove(); }; if (((!(moving)) && (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.S)))))){ move(0, 1); environment.addMove(); }; }; } protected function move(dx:int=0, dy:int=0):void{ var tile:MapTile = getTile((x + (dx * spd)), (y + (dy * spd))); var ndx:int; var ndy:int; moving = false; if (dx < 0){ if (tile != null){ if (((((tile.walkable) && (!(tile.cornerTR)))) && (!(tile.cornerBR)))){ x = (x - spd); moving = true; if (tile.cornerTL){ ndx = 0; ndy = 1; tile.hit(); }; if (tile.cornerBL){ ndx = 0; ndy = -1; tile.hit(); }; } else { x = (tile.x + tileW); if (((((tile.lock) && (!(tile.unlocked)))) && ((keys > 0)))){ keys--; tile.unlock(); }; tile.hit(); }; } else { x = (x - spd); moving = true; }; }; if (dy < 0){ if (tile != null){ if (((((tile.walkable) && (!(tile.cornerBL)))) && (!(tile.cornerBR)))){ y = (y - spd); moving = true; if (tile.cornerTL){ ndx = 1; ndy = 0; tile.hit(); }; if (tile.cornerTR){ ndx = -1; ndy = 0; tile.hit(); }; } else { y = (tile.y + tileH); if (((((tile.lock) && (!(tile.unlocked)))) && ((keys > 0)))){ keys--; tile.unlock(); }; tile.hit(); }; } else { y = (y - spd); moving = true; }; }; if (dx > 0){ if (tile != null){ if (((((tile.walkable) && (!(tile.cornerTL)))) && (!(tile.cornerBL)))){ x = (x + spd); moving = true; if (tile.cornerTR){ ndx = 0; ndy = 1; tile.hit(); }; if (tile.cornerBR){ ndx = 0; ndy = -1; tile.hit(); }; } else { x = (tile.x - tileW); if (((((tile.lock) && (!(tile.unlocked)))) && ((keys > 0)))){ keys--; tile.unlock(); }; tile.hit(); }; } else { x = (x + spd); moving = true; }; }; if (dy > 0){ if (tile != null){ if (((((tile.walkable) && (!(tile.cornerTL)))) && (!(tile.cornerTR)))){ y = (y + spd); moving = true; if (tile.cornerBL){ ndx = 1; ndy = 0; tile.hit(); }; if (tile.cornerBR){ ndx = -1; ndy = 0; tile.hit(); }; } else { y = (tile.y - tileH); if (((((tile.lock) && (!(tile.unlocked)))) && ((keys > 0)))){ keys--; tile.unlock(); }; tile.hit(); }; } else { y = (y + spd); moving = true; }; }; if (moving){ moveX = dx; moveY = dy; if (((!((ndx == 0))) || (!((ndy == 0))))){ moveX = ndx; moveY = ndy; }; } else { moveX = (moveY = 0); }; tile = getTile(x, y); if (tile != null){ if (tile.key){ keys++; environment.removeTile(tile); SoundManager.playSound(SoundManager.COLLECTKEY); }; if (tile.portal){ setPos(tile.portalX, tile.portalY); }; if (tile.exit){ environment.advance(); }; }; var scoreTile:ScoreTile = getScoreTile(x, y); if (scoreTile != null){ if (lastScoreTile != scoreTile){ scoreTile.hit(); lastScoreTile = scoreTile; }; }; if ((((((((x < (-(Config.SCREENW) / 2))) || ((y < (-(Config.SCREENH) / 2))))) || ((x > (Config.SCREENW * 1.5))))) || ((y > (Config.SCREENH * 1.5))))){ environment.die(); }; } public function setEnvironment(e:PlayScreen):void{ environment = e; } public function setPos(px:int=0, py:int=0):void{ x = (px * 24); y = (py * 24); SoundManager.playSound(SoundManager.PORTAL); } private function getTile(px:int=0, py:int=0):MapTile{ var tile:MapTile; var tileX:int = Math.floor((px / tileW)); var tileY:int = Math.floor((py / tileH)); if (environment.tiles[tileY] != undefined){ if (environment.tiles[tileY][tileX] != undefined){ tile = environment.tiles[tileY][tileX]; }; }; return (tile); } private function getScoreTile(px:int=0, py:int=0):ScoreTile{ var tile:ScoreTile; var tileX:int = Math.floor((px / tileW)); var tileY:int = Math.floor((py / tileH)); if (environment.scoreTiles[tileY] != undefined){ if (environment.scoreTiles[tileY][tileX] != undefined){ tile = environment.scoreTiles[tileY][tileX]; }; }; return (tile); } } }//package
Section 72
//PlayScreen (PlayScreen) package { import flash.display.*; public class PlayScreen extends GameScreen { private const stageH:int = 15; private const stageW:int = 21; private const offsetX:int = 68; private const offsetY:int = 60; private const tileH:int = 24; private const tileW:int = 24; private var currentStage:int; private var portals:Array; private var resultsDisplayed:Boolean;// = false public var tiles:Array; private var score:int;// = 0 public var scoreTiles:Array; private var moveX:int;// = 0 private var moveY:int;// = 0 private var keyText:GameText; private var entityLayer:Sprite; private var background:Background; private var dying:Boolean;// = false private var moves:int; private var time:int; private var scoreLayer:Sprite; private var player:Player; private var particleEmitters:Array; private var colors:Array; private var particleLayer:Sprite; private var stageLayer:Sprite; private var hud:HUD; private var keyIcon:Bitmap; public function PlayScreen():void{ colors = [0, 0xFF0000, 0x808080, 0x8000, 0xFF0080, 0x800080, 0x8000FF, 0xFF00FF, 0xFFC000, 128, 33023, 0x404040, 4255808]; portals = [[], [], [], [], [], [], [], [], [], [], [], [[10, 11], [10, 3]], [], [], [], [], [], [], [], [[12, 7], [8, 7]], [[16, 3], [5, 3]], [], [[20, 7], [0, 7]], [[20, 7], [0, 7]], [[13, 8], [7, 8]]]; currentStage = Global.CURRENTSTAGE; super(); build(); } public function die():void{ SoundManager.playSound(SoundManager.DEATH); dying = true; restart(); } public function advance():void{ hud.showDialog(4); resultsDisplayed = true; } public function restart():void{ if (dying){ Control.setScreen(Config.PLAYSCREEN); } else { Control.setScreen(Config.STAGESELECTSCREEN); }; } public function getMoves():int{ return (moves); } public function addMove():void{ moves++; } override public function run():void{ var j:int; var k:int; var i:int; background.run(); hud.run(); if (hud.ready){ if (resultsDisplayed){ levelFinish(); }; time++; if (Control.isKeyDown(Control.R)){ die(); }; if (((((((Control.isKeyHeld(Control.SPACE)) && (Control.isKeyHeld(Control.SHIFT)))) && (Control.isKeyHeld(Control.W)))) && (Control.isKeyDown(Control.DOWN)))){ advance(); }; if (Control.isKeyDown(Control.ESCAPE)){ restart(); }; j = 0; while (j < tiles.length) { i = 0; while (i < tiles[0].length) { if (tiles[j][i] != null){ tiles[j][i].run(); }; if (scoreTiles[j][i] != null){ scoreTiles[j][i].run(); }; i++; }; j++; }; k = 0; while (k < particleEmitters.length) { particleEmitters[k].run(); k++; }; if (player != null){ player.run(); }; }; } private function buildStage():void{ var i:int; var nst:ScoreTile; var type:int; var nt:MapTile; tiles = Toolkit.create2DArray(stageW, stageH); scoreTiles = Toolkit.create2DArray(stageW, stageH); var map:BitmapData = ImageHandler.getMapData(currentStage); var portalCount:int; var j:int; while (j < stageH) { i = 0; while (i < stageW) { nst = new ScoreTile(); nst.setPos(i, j); nst.setEnvironment(this); scoreLayer.addChild(nst); scoreTiles[j][i] = nst; type = getType(map.getPixel(i, j)); if (((!((type == 0))) && (!((type == 11))))){ nt = new MapTile(type); nt.setPos(i, j); nt.setEnvironment(this); stageLayer.addChild(nt); tiles[j][i] = nt; if (type == 9){ nt.setPortal(portals[currentStage][portalCount]); portalCount++; }; }; if (type == 11){ player = new Player(); entityLayer.addChild(player); player.x = (i * 24); player.y = (j * 24); player.setEnvironment(this); background.setFocus(player); }; i++; }; j++; }; } private function getType(c:uint=0):int{ var i:int; while (i < colors.length) { if (c == colors[i]){ return ((i + 1)); }; i++; }; return (0); } public function getTime():int{ return (Math.floor((time / 48))); } public function levelFinish():void{ SoundManager.playSound(SoundManager.LEVELCOMPLETE); Global.setScore(currentStage, getScore()); restart(); } public function removeTile(t:MapTile):void{ stageLayer.removeChild(t); tiles[t.tileY][t.tileX] = null; } public function getKeys():int{ if (player != null){ return (player.keys); }; return (0); } public function getScore():int{ var ts = 10000; ts = (ts - (moves * 75)); ts = (ts - (getTime() * 25)); if (ts < 1000){ ts = 1000; }; return (ts); } private function build():void{ addChild((background = new Background())); addChild((scoreLayer = new Sprite())); addChild((stageLayer = new Sprite())); addChild((entityLayer = new Sprite())); addChild((particleLayer = new Sprite())); particleEmitters = new Array(); scoreLayer.x = offsetX; scoreLayer.y = offsetY; stageLayer.x = offsetX; stageLayer.y = offsetY; entityLayer.x = offsetX; entityLayer.y = offsetY; particleLayer.x = offsetX; particleLayer.y = offsetY; buildStage(); SoundManager.changeLoop(SoundManager.MUSICGAMEPLAYLOOP); hud = new HUD(2); hud.setPlayScreen(this); addChild(hud); } } }//package
Section 73
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import flash.utils.*; public class Preloader extends MovieClip { public function Preloader():void{ super(); addEventListener(Event.ENTER_FRAME, checkFrame); loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress); build(); } private function handleClick(ev:MouseEvent=null):void{ } private function startup():void{ destroy(); stop(); loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress); var mainClass:Class = (getDefinitionByName("Main") as Class); addChild((new (mainClass) as DisplayObject)); } private function checkFrame(ev:Event=null):void{ if (currentFrame == totalFrames){ removeEventListener(Event.ENTER_FRAME, checkFrame); startup(); }; run(); } private function update():void{ } private function destroy():void{ removeEventListener(MouseEvent.CLICK, handleClick); } private function run():void{ } private function progress(ev:ProgressEvent=null):void{ update(); } private function build():void{ } } }//package
Section 74
//ScoreTile (ScoreTile) package { import flash.display.*; import flash.filters.*; public class ScoreTile extends Bitmap { private var cf:ColorMatrixFilter; private var cm:Array; public var tileY:int;// = 0 public var tileX:int;// = 0 public var environment:PlayScreen; private var bright:int;// = 0 public function ScoreTile():void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); config(); } public function run():void{ if (bright > 0){ bright = (bright - 8); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = bright)); cf.matrix = cm; filters = [cf]; } public function config():void{ bitmapData = ImageHandler.getImageData(ImageHandler.SCORETILES, 24, 24, 0, 0); cf = new ColorMatrixFilter(cm); filters = [cf]; } public function setPos(px:int=0, py:int=0):void{ x = (px * 24); y = (py * 24); tileX = px; tileY = py; } public function hit():void{ bright = 0xFF; } public function setEnvironment(p:PlayScreen):void{ environment = p; } } }//package
Section 75
//SoundManager (SoundManager) package { import flash.media.*; import flash.utils.*; public class SoundManager { private static const Bumper:Class = SoundManager_Bumper; private static const Portal:Class = SoundManager_Portal; private static const Bomb:Class = SoundManager_Bomb; private static const Death:Class = SoundManager_Death; private static const LevelComplete:Class = SoundManager_LevelComplete; private static const MenuSelect:Class = SoundManager_MenuSelect; private static const Unlock:Class = SoundManager_Unlock; private static const MenuMusic:Class = SoundManager_MenuMusic; private static const CollectKey:Class = SoundManager_CollectKey; private static const MenuHover:Class = SoundManager_MenuHover; private static const GameplayMusic:Class = SoundManager_GameplayMusic; public static var SOUNDOFF:Boolean = false; public static var MUSICMENULOOP:AdvancedSound = new AdvancedSound(new MenuMusic()); public static var CURRENTLOOP:AdvancedSound; public static var MENUSELECT:Sound = new MenuSelect(); public static var MENUHOVER:Sound = new MenuHover(); public static var LEVELCOMPLETE:Sound = new LevelComplete(); public static var BOMB:Sound = new Bomb(); public static var MUSICOFF:Boolean = false; public static var PANRANGE:int = 240; public static var VOLUMERANGE:int = 480; public static var UNLOCK:Sound = new Unlock(); public static var MUSICGAMEPLAYLOOP:AdvancedSound = new AdvancedSound(new GameplayMusic()); public static var DEATH:Sound = new Death(); public static var BUMPER:Sound = new Bumper(); public static var PORTAL:Sound = new Portal(); public static var LOOPPLAYING:Boolean = false; public static var COLLECTKEY:Sound = new CollectKey(); public function SoundManager(){ super(); } public function playLoadedSound(s:Sound):void{ var bytes:ByteArray = new ByteArray(); } public static function run():void{ if (Control.isKeyDown(Control.M)){ toggleMute(); }; if (CURRENTLOOP != null){ if (MUSICOFF){ if (!CURRENTLOOP.muted){ CURRENTLOOP.mute(); }; }; if (!MUSICOFF){ if (CURRENTLOOP.muted){ CURRENTLOOP.play(CURRENTLOOP.lastSavedPos, 99999); LOOPPLAYING = true; }; }; }; } public static function toggleMute():void{ toggleSound(); toggleMusic(); } public static function toggleMusic():void{ MUSICOFF = (MUSICOFF) ? false : true; } public static function toggleSound():void{ SOUNDOFF = (SOUNDOFF) ? false : true; } public static function playSound(s:Sound):void{ if (!SOUNDOFF){ s.play(); }; } public static function changeLoop(l:AdvancedSound):void{ if (CURRENTLOOP != l){ if (LOOPPLAYING){ CURRENTLOOP.stop(); LOOPPLAYING = false; }; CURRENTLOOP = l; if (((!(MUSICOFF)) && (!(LOOPPLAYING)))){ CURRENTLOOP.play(0, 99999); LOOPPLAYING = true; }; }; } } }//package
Section 76
//SoundManager_Bomb (SoundManager_Bomb) package { import mx.core.*; public class SoundManager_Bomb extends SoundAsset { } }//package
Section 77
//SoundManager_Bumper (SoundManager_Bumper) package { import mx.core.*; public class SoundManager_Bumper extends SoundAsset { } }//package
Section 78
//SoundManager_CollectKey (SoundManager_CollectKey) package { import mx.core.*; public class SoundManager_CollectKey extends SoundAsset { } }//package
Section 79
//SoundManager_Death (SoundManager_Death) package { import mx.core.*; public class SoundManager_Death extends SoundAsset { } }//package
Section 80
//SoundManager_GameplayMusic (SoundManager_GameplayMusic) package { import mx.core.*; public class SoundManager_GameplayMusic extends SoundAsset { } }//package
Section 81
//SoundManager_LevelComplete (SoundManager_LevelComplete) package { import mx.core.*; public class SoundManager_LevelComplete extends SoundAsset { } }//package
Section 82
//SoundManager_MenuHover (SoundManager_MenuHover) package { import mx.core.*; public class SoundManager_MenuHover extends SoundAsset { } }//package
Section 83
//SoundManager_MenuMusic (SoundManager_MenuMusic) package { import mx.core.*; public class SoundManager_MenuMusic extends SoundAsset { } }//package
Section 84
//SoundManager_MenuSelect (SoundManager_MenuSelect) package { import mx.core.*; public class SoundManager_MenuSelect extends SoundAsset { } }//package
Section 85
//SoundManager_Portal (SoundManager_Portal) package { import mx.core.*; public class SoundManager_Portal extends SoundAsset { } }//package
Section 86
//SoundManager_Unlock (SoundManager_Unlock) package { import mx.core.*; public class SoundManager_Unlock extends SoundAsset { } }//package
Section 87
//SponsorScreen (SponsorScreen) package { import flash.events.*; import flash.net.*; public class SponsorScreen extends GameScreen { private var Traverse_Splash:String;// = "c95bcf0e" private var splash:NinjaKiwiSplash; private var Traverse_Click:String;// = "516e5aed" public function SponsorScreen(){ super(); addEventListener(Event.ADDED_TO_STAGE, addedToStage); addChild((splash = new NinjaKiwiSplash())); splash.x = 320; splash.y = 240; } override public function run():void{ if (splash.currentFrame == splash.totalFrames){ stage.removeEventListener(MouseEvent.CLICK, onClick); splash.gotoAndStop(splash.totalFrames); Control.setScreen(Config.DEVELOPERSCREEN); }; } private function onClick(ev:MouseEvent):void{ MochiBot.track(this, Traverse_Click); MochiBot.track(this, "a7d974a7"); var nklink:URLRequest = new URLRequest("http://www.ninjakiwi.com/"); navigateToURL(new URLRequest("http://www.ninjakiwi.com/"), "_blank"); } private function addedToStage(ev:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, addedToStage); stage.addEventListener(MouseEvent.CLICK, onClick); MochiBot.track(this, Traverse_Splash); } } }//package
Section 88
//StageButton (StageButton) package { import flash.display.*; import flash.geom.*; import flash.filters.*; public class StageButton extends Sprite { public var type:int;// = 0 private var df:GlowFilter; private var img:Bitmap; private var gf:GlowFilter; private var cf:ColorMatrixFilter; public var offsetX:int;// = 0 public var offsetY:int;// = 0 public var clicked:Boolean;// = false private var cm:Array; private var dark:int;// = 0 private var bright:int;// = 0 public var hover:Boolean;// = false public function StageButton(t:int=0):void{ cm = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; super(); type = t; build(); } public function run():void{ var mp:Point = Control.MOUSEPOINT; if ((((mp.x >= (x + offsetX))) && ((mp.x < ((x + offsetX) + width))))){ if ((((mp.y >= (y + offsetY))) && ((mp.y < ((y + offsetY) + height))))){ if (Control.MOUSEDOWN){ clicked = true; Control.setMouseDown(false); SoundManager.playSound(SoundManager.MENUSELECT); }; bright = 128; if (!hover){ SoundManager.playSound(SoundManager.MENUHOVER); hover = true; }; } else { hover = false; }; } else { hover = false; }; if (bright > 0){ bright = (bright - 8); } else { bright = 0; }; cm[4] = (cm[9] = (cm[14] = (bright + dark))); cf.matrix = cm; filters = [cf, df]; if (dark == 0){ filters = [cf, gf]; }; } private function build():void{ img = new Bitmap(ImageHandler.getImageData(ImageHandler.PLANETSHEET, 64, 64, type, 0, 0)); addChild(img); if (type == 28){ img.bitmapData = ImageHandler.getImageData(ImageHandler.EPICSHADOWPLANET, 64, 85, 0, 0, 0); }; if (type == 29){ img.bitmapData = ImageHandler.getImageData(ImageHandler.NINJAKIWIPLANET, 64, 85, 0, 0, 0); }; cf = new ColorMatrixFilter(cm); if (Global.SCORES[(type - 3)] == 0){ dark = -128; }; gf = new GlowFilter(0xFFFFFF, 1, 16, 16, 2, 2); df = new GlowFilter(0, 1, 16, 16, 2, 2); filters = [cf, df]; if (dark == 0){ filters = [cf, gf]; }; } public function updateOffsets(ox:int, oy:int):void{ offsetX = ox; offsetY = oy; } public function resetClick():void{ clicked = false; } } }//package
Section 89
//StageSelectScreen (StageSelectScreen) package { import flash.events.*; import flash.display.*; import flash.geom.*; import mochi.as3.*; import flash.net.*; import flash.ui.*; public class StageSelectScreen extends GameScreen { private var buttons:Array; private var tooltip:Tooltip; private var containerLayer:Sprite; private var buttonConfig:Array; private var planetLayer:Sprite; private var cheatProgress:int;// = 0 private var unlocked:Array; private var offsetX:int;// = 0 private var offsetY:int;// = 0 private var submitScoreButton:GameButton; private var code:Array; private var background:Background; private var phantom:Sprite; private var hud:HUD; private var viewScoresButton:GameButton; private var lineLayer:Sprite; private var mochiDisplayed:Boolean;// = false public function StageSelectScreen():void{ buttonConfig = [[0, 0, [1, 2, 3, 28, 29]], [-48, -64, []], [-48, 64, []], [96, 0, [4, 5]], [160, -96, [6, 8]], [160, 96, [7, 9]], [264, -64, [7, 12]], [264, 64, [6, 13]], [160, -224, [10]], [160, 224, [11]], [288, -264, [12, 16]], [288, 264, [13, 17]], [336, -144, [6, 10, 14]], [336, 144, [7, 11, 15]], [464, -144, [12, 18, 20]], [464, 144, [13, 19, 21]], [400, -352, [18]], [400, 352, [19]], [0x0200, -264, [14, 22]], [0x0200, 264, [15, 23]], [536, -64, [14, 21, 24]], [536, 64, [15, 20, 25]], [640, -224, [24]], [640, 224, [25]], [640, -96, [20, 26]], [640, 96, [21, 26]], [704, 0, [27]], [800, 0, []], [32, -160, []], [32, 160, []]]; code = [0, 0, 2, 2, 3, 1, 4]; super(); addEventListener(Event.ADDED_TO_STAGE, build); } private function handleClick(i:int=0):void{ switch (i){ case 0: Control.setScreen(Config.TITLESCREEN); break; case 1: hud.showDialog(2); break; case 2: hud.showDialog(3); break; case 28: break; case 29: break; default: Global.setCurrentStage((i - 3)); Control.setScreen(Config.PLAYSCREEN); break; }; } override public function run():void{ var o:Object; var boardID:String; var i:int; if (Global.checkGameMastered()){ Global.setGameMasteredShown(true); hud.showDialog(6); }; var mp:Point = Control.MOUSEPOINT; phantom.x = mp.x; phantom.y = mp.y; if (((viewScoresButton.clicked) && (!(mochiDisplayed)))){ Control.setMouseDown(false); o = {n:[15, 1, 14, 2, 0, 1, 6, 1, 5, 4, 12, 15, 1, 7, 10, 9], 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, ""); MochiScores.showLeaderboard({boardID:"f1e2016154cf17a9", onDisplay:mochiOpen, onClose:mochiClose, onError:mochiClose}); viewScoresButton.clicked = false; }; if (((submitScoreButton.clicked) && (!(mochiDisplayed)))){ Control.setMouseDown(false); o = {n:[15, 1, 14, 2, 0, 1, 6, 1, 5, 4, 12, 15, 1, 7, 10, 9], 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, ""); MochiScores.showLeaderboard({boardID:"f1e2016154cf17a9", score:Global.TOTALSCORE, onDisplay:mochiOpen, onClose:mochiClose, onError:mochiClose}); submitScoreButton.clicked = false; }; background.run(); adjustCamera(); tooltip.reset(); hud.run(); if (hud.ready){ i = 0; while (i < buttons.length) { if (buttons[i] != null){ if (buttons[i].clicked){ handleClick(i); Control.setMouseDown(false); buttons[i].resetClick(); }; buttons[i].updateOffsets((containerLayer.x + planetLayer.x), (containerLayer.y + planetLayer.y)); buttons[i].run(); if (buttons[i].hover){ tooltip.config(buttons[i]); }; }; i = (i + 1); }; if (Control.isKeyDown(Control.W)){ cheatKey(0); }; if (Control.isKeyDown(Control.A)){ cheatKey(1); }; if (Control.isKeyDown(Control.S)){ cheatKey(2); }; if (Control.isKeyDown(Control.D)){ cheatKey(3); }; if (Control.isKeyDown(Control.SPACE)){ cheatKey(4); }; }; if (Global.SCORES[24] <= 0){ submitScoreButton.visible = false; viewScoresButton.visible = false; } else { if (!Global.GAMECOMPLETEDSHOWN){ hud.showDialog(5); Global.setGameCompletedShown(true); }; submitScoreButton.visible = true; submitScoreButton.setOffsets(containerLayer.x, containerLayer.y); submitScoreButton.run(); viewScoresButton.visible = true; viewScoresButton.setOffsets(containerLayer.x, containerLayer.y); viewScoresButton.run(); }; } private function cheatKey(k:int):void{ if (code[cheatProgress] == k){ cheatProgress++; } else { cheatProgress = 0; }; if (cheatProgress == code.length){ Global.toggleUnlock(); Control.setScreen(Config.STAGESELECTSCREEN); }; } private function mochiClose():void{ mochiDisplayed = false; Mouse.hide(); Global.CURSOR.visible = true; } private function build(ev:Event=null):void{ var ns:Bitmap; var blankPixel:BitmapData; var lH:int; var l:int; var nb:StageButton; var j:int; var target:int; removeEventListener(Event.ADDED_TO_STAGE, build); stage.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); phantom = new Sprite(); phantom.x = Control.MOUSEPOINT.x; phantom.y = Control.MOUSEPOINT.y; addChild((background = new Background())); background.setFocus(phantom); addChild((containerLayer = new Sprite())); containerLayer.addChild((lineLayer = new Sprite())); containerLayer.addChild((planetLayer = new Sprite())); hud = new HUD(1); addChild(hud); buttons = new Array(); unlocked = new Array(); var m:int; while (m < buttonConfig.length) { unlocked[m] = Global.UNLOCK; m++; }; var k:int; while (k < buttonConfig.length) { if ((((k < 4)) || ((k > 27)))){ unlocked[k] = true; }; if (Global.SCORES[(k - 3)] > 0){ l = 0; while (l < buttonConfig[k][2].length) { unlocked[buttonConfig[k][2][l]] = true; l++; }; }; k++; }; var i:int; while (i < buttonConfig.length) { if (unlocked[i]){ nb = new StageButton(i); planetLayer.addChild(nb); buttons.push(nb); nb.x = (buttonConfig[i][0] - (nb.width / 2)); nb.y = (buttonConfig[i][1] - (nb.height / 2)); if (buttonConfig[i][0] < offsetX){ offsetX = buttonConfig[i][0]; }; if (buttonConfig[i][1] > offsetY){ offsetY = buttonConfig[i][1]; }; if ((((i < 3)) || ((Global.SCORES[(i - 3)] > 0)))){ j = 0; while (j < buttonConfig[i][2].length) { target = buttonConfig[i][2][j]; if (((!((buttonConfig[target] == null))) && (unlocked[target]))){ lineLayer.graphics.lineStyle(1, 0xFFFFFF, 1); lineLayer.graphics.moveTo(buttonConfig[i][0], buttonConfig[i][1]); lineLayer.graphics.lineTo(buttonConfig[target][0], buttonConfig[target][1]); }; j++; }; }; } else { buttons.push(null); }; i++; }; blankPixel = new BitmapData(1, 1, true, 0xFFFFFF); var lW = 0x0500; lH = 960; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = 0; ns.y = 0; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = (lW - 1); ns.y = 0; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = 0; ns.y = (lH - 1); ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = (lW - 1); ns.y = (lH - 1); planetLayer.x = (Math.floor(((containerLayer.width - planetLayer.width) / 2)) - Math.floor((offsetX / 2))); planetLayer.y = (Math.floor(((containerLayer.height - planetLayer.height) / 2)) + Math.floor((offsetY / 2))); lineLayer.x = planetLayer.x; lineLayer.y = planetLayer.y; lineLayer.alpha = 0.5; adjustCamera(false); tooltip = new Tooltip(); addChild(tooltip); containerLayer.addChild((submitScoreButton = new GameButton())); submitScoreButton.setText("Submit Score"); submitScoreButton.x = ((containerLayer.width - submitScoreButton.width) / 2); submitScoreButton.y = (((containerLayer.height - submitScoreButton.height) / 2) - 32); containerLayer.addChild((viewScoresButton = new GameButton())); viewScoresButton.setText("View Hi Scores"); viewScoresButton.x = ((containerLayer.width - viewScoresButton.width) / 2); viewScoresButton.y = (((containerLayer.height - viewScoresButton.height) / 2) + 32); SoundManager.changeLoop(SoundManager.MUSICMENULOOP); Global.updateTotalScore(); } private function onClick(ev:MouseEvent):void{ var button:StageButton; var mp:Point = new Point(ev.stageX, ev.stageY); button = buttons[28]; if ((((((((mp.x >= (button.x + button.offsetX))) && ((mp.x < ((button.x + button.offsetX) + button.width))))) && ((mp.y >= (button.y + button.offsetY))))) && ((mp.y < ((button.y + button.offsetY) + button.height))))){ navigateToURL(new URLRequest("http://www.epicshadow.com/traverse.php"), "_blank"); MochiBot.track(this, "56ef1611"); }; button = buttons[29]; if ((((((((mp.x >= (button.x + button.offsetX))) && ((mp.x < ((button.x + button.offsetX) + button.width))))) && ((mp.y >= (button.y + button.offsetY))))) && ((mp.y < ((button.y + button.offsetY) + button.height))))){ navigateToURL(new URLRequest("http://www.ninjakiwi.com"), "_blank"); MochiBot.track(this, "6a6d8727"); MochiBot.track(this, "a448dbae"); }; } private function adjustCamera(e:Boolean=true):void{ var focusDispY:Number; var focusDispX:Number = (phantom.x / Config.SCREENW); focusDispY = (phantom.y / Config.SCREENH); var distX:int = (Config.SCREENW - containerLayer.width); var distY:int = (Config.SCREENH - containerLayer.height); var ease = 5; if (e){ containerLayer.x = (containerLayer.x + (((distX * focusDispX) - containerLayer.x) / ease)); containerLayer.y = (containerLayer.y + (((distY * focusDispY) - containerLayer.y) / ease)); } else { containerLayer.x = (distX * focusDispX); containerLayer.y = (distY * focusDispY); }; if (containerLayer.x > 0){ containerLayer.x = 0; }; if (containerLayer.y > 0){ containerLayer.y = 0; }; if (containerLayer.x < distX){ containerLayer.x = distX; }; if (containerLayer.y < distY){ containerLayer.y = distY; }; } private function mochiOpen():void{ mochiDisplayed = true; Mouse.show(); Global.CURSOR.visible = false; } } }//package
Section 90
//StretchBox (StretchBox) package { import flash.display.*; import flash.geom.*; public class StretchBox extends Bitmap { private var gfx:BitmapData; private var boxW:int;// = 64 private var centerRect:Rectangle; private var endW:int;// = 16 private var boxH:int;// = 48 private var endRect:Rectangle; public function StretchBox():void{ gfx = ImageHandler.STRETCHBOXSHEET; endRect = new Rectangle(0, 0, endW, boxH); centerRect = new Rectangle(0, 0, 1, boxH); super(); drawBox(); } public function setTotalWidth(w:int=64):void{ boxW = (w - (endW / 2)); drawBox(); } private function drawBox():void{ var bmp:BitmapData = new BitmapData(((endW * 2) + boxW), boxH, true, 0); bmp.copyPixels(ImageHandler.getImageData(gfx, endW, boxH, 0, 0, 0), endRect, new Point(0, 0), null, null, true); var pt:Point = new Point(endW, 0); var i:int; while (i < boxW) { bmp.copyPixels(ImageHandler.getImageData(gfx, 1, boxH, 0, (endW + 1), 0), centerRect, pt, null, null, true); pt.x++; i++; }; bmp.copyPixels(ImageHandler.getImageData(gfx, endW, boxH, 0, 20, 0), endRect, new Point((endW + boxW), 0), null, null, true); bitmapData = bmp; } public function setCenterWidth(w:int=64):void{ boxW = w; drawBox(); } } }//package
Section 91
//TitleScreen (TitleScreen) package { import flash.display.*; public class TitleScreen extends GameScreen { private var phantom:Sprite; private var containerLayer:Sprite; private var hud:HUD; private var planetLayer:Bitmap; private var background:Background; public function TitleScreen():void{ super(); build(); } override public function run():void{ phantom.x = Control.MOUSEPOINT.x; phantom.y = Control.MOUSEPOINT.y; background.run(); adjustCamera(); hud.run(); } private function adjustCamera(e:Boolean=true):void{ var focusDispX:Number = (phantom.x / Config.SCREENW); var focusDispY:Number = (phantom.y / Config.SCREENH); var distX:int = (Config.SCREENW - containerLayer.width); var distY:int = (Config.SCREENH - containerLayer.height); var ease = 5; if (e){ containerLayer.x = (containerLayer.x + (((distX * focusDispX) - containerLayer.x) / ease)); containerLayer.y = (containerLayer.y + (((distY * focusDispY) - containerLayer.y) / ease)); } else { containerLayer.x = (distX * focusDispX); containerLayer.y = (distY * focusDispY); }; if (containerLayer.x > 0){ containerLayer.x = 0; }; if (containerLayer.y > 0){ containerLayer.y = 0; }; if (containerLayer.x < distX){ containerLayer.x = distX; }; if (containerLayer.y < distY){ containerLayer.y = distY; }; } private function build():void{ var ns:Bitmap; var lH:int; phantom = new Sprite(); phantom.x = Control.MOUSEPOINT.x; phantom.y = Control.MOUSEPOINT.y; addChild((background = new Background())); background.setFocus(phantom); addChild((containerLayer = new Sprite())); var blankPixel:BitmapData = new BitmapData(1, 1, true, 0xFFFFFF); var lW = 0x0500; lH = 960; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = 0; ns.y = 0; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = (lW - 1); ns.y = 0; ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = 0; ns.y = (lH - 1); ns = new Bitmap(blankPixel); containerLayer.addChild(ns); ns.x = (lW - 1); ns.y = (lH - 1); containerLayer.addChild((planetLayer = new ImageHandler.TitleScreenPlanet())); planetLayer.x = Math.floor(((containerLayer.width - planetLayer.width) / 2)); planetLayer.y = Math.floor(((containerLayer.height - planetLayer.height) / 2)); adjustCamera(false); var logo:Bitmap = new Bitmap(ImageHandler.LOGOBIG); addChild(logo); logo.x = ((Config.SCREENW - logo.width) / 2); logo.y = 16; SoundManager.changeLoop(SoundManager.MUSICMENULOOP); hud = new HUD(); addChild(hud); } } }//package
Section 92
//Toolkit (Toolkit) package { import flash.display.*; import flash.geom.*; import flash.net.*; public class Toolkit { private static var SQRT:Function = Math.sqrt; public static var SITELOCKED:Boolean = false; public function Toolkit(){ super(); } public static function copyArray(a:Array):Array{ var tempArray:Array = new Array(); var i:int; while (i < a.length) { tempArray.push(a[i]); i++; }; return (tempArray); } public static function create2DArray(w:int, h:int):Array{ var array2D:Array = new Array(h); var i:int; while (i < h) { array2D[i] = new Array(w); i++; }; return (array2D); } public static function randomInt(a:Number, b:Number):Number{ return (Math.round((a + (Math.random() * (b - a))))); } public static function cleanArray(a:Array):Array{ var tempArray:Array = new Array(); var i:int; while (i < a.length) { if (a[i] != null){ tempArray.push(a[i]); }; i++; }; return (tempArray); } public static function siteLock(s:Stage, dest:String, urls:Array):void{ SITELOCKED = true; var hostURL:String = s.loaderInfo.url; var hostURLStart:int = (hostURL.indexOf("://") + 3); var hostURLEnd:int = hostURL.indexOf("/", hostURLStart); var hostDomain:String = hostURL.substring(hostURLStart, hostURLEnd); var hostLastDot:int = (hostDomain.lastIndexOf(".") - 1); var hostDomainEnd:int = (hostDomain.lastIndexOf(".", hostLastDot) + 1); hostDomain = hostDomain.substring(hostDomainEnd, hostDomain.length); var i:int; while (i < urls.length) { if (hostDomain == urls[i]){ SITELOCKED = false; return; }; i++; }; if (((SITELOCKED) && (!((dest == "none"))))){ navigateToURL(new URLRequest(dest), "_top"); }; } public static function distanceBetween(da:Point, db:Point):Number{ var distance:Number = SQRT((((da.x - db.x) * (da.x - db.x)) + ((da.y - db.y) * (da.y - db.y)))); return (distance); } public static function shortAngleDifference(a:Number, b:Number):Number{ var angle:Number = (Math.abs((a - b)) % 360); if (angle > 180){ angle = (360 - angle); }; return (angle); } public static function angleBetween(pa:Point, pb:Point):Number{ var theX:int = (pb.x - pa.x); var theY:int = (pb.y - pa.y); var angle:int = (Math.atan2(theY, theX) * (180 / Math.PI)); if (angle < 0){ angle = (angle + 360); }; return (angle); } public static function randomDec(a:Number, b:Number, c:Number):Number{ var mod:Number = 1; var i:int; while (i < c) { mod = (mod * 10); i++; }; return ((Math.round(((a + (Math.random() * (b - a))) * mod)) / mod)); } } }//package
Section 93
//Tooltip (Tooltip) package { import flash.display.*; public class Tooltip extends Sprite { private var labelText:GameText; private var corners:Array; private var preview:Bitmap; private var previewFrame:Bitmap; private var background:Bitmap; private var extraText:GameText; private var blankData:BitmapData; private var scoreText:GameText; public function Tooltip():void{ var nc:Bitmap; super(); corners = new Array(); var i:int; while (i < 4) { nc = new Bitmap(ImageHandler.getImageData(ImageHandler.TOOLTIPCORNERSHEET, 20, 20, i)); addChild(nc); corners.push(nc); if ((((i == 1)) || ((i == 3)))){ nc.x = 156; }; if ((((i == 2)) || ((i == 3)))){ nc.y = 92; }; i++; }; background = new ImageHandler.TooltipBackground(); addChild(background); background.x = 8; background.y = 8; labelText = new GameText("Planet Name"); addChild(labelText); labelText.x = (background.x + 4); labelText.y = (background.y + 4); extraText = new GameText(""); addChild(extraText); extraText.x = labelText.x; extraText.y = ((labelText.y + labelText.height) + 4); blankData = new BitmapData(1, 1, true, 0); previewFrame = new ImageHandler.TooltipPreviewFrame(); addChild(previewFrame); preview = new Bitmap(blankData); addChild(preview); preview.x = (background.x + 12); preview.y = (background.y + 25); previewFrame.x = (preview.x - 1); previewFrame.y = (preview.y - 1); scoreText = new GameText("Score: 0"); addChild(scoreText); scoreText.x = (((background.x + background.width) - scoreText.width) - 4); scoreText.y = (((background.y + background.height) - scoreText.height) - 4); reset(); } public function config(b:StageButton):void{ var offsetX:int; var offsetY:int; var txt:String; var l:Boolean; var t:Boolean; if (b.x < (b.parent.width / 2)){ offsetX = 48; }; if (b.x >= (b.parent.width / 2)){ offsetX = (16 - width); l = false; }; if (b.y < 0){ offsetY = 48; }; if (b.y >= 0){ offsetY = (16 - height); t = false; }; x = ((b.offsetX + b.x) + offsetX); y = ((b.offsetY + b.y) + offsetY); switch (b.type){ case 0: labelText.setText("Title"); extraText.setText("Go to Title Screen."); scoreText.setText(""); break; case 1: labelText.setText("Help"); extraText.setText("Click here for the \nbasics on how to \nplay Traverse."); scoreText.setText(""); break; case 2: labelText.setText("Controls"); extraText.setText("Click here to view \nthe controls for \nTraverse."); scoreText.setText(""); break; case 28: labelText.setText("Epic Shadow Ent."); extraText.setText("www.epicshadow.com"); scoreText.setText("Developer Planet"); break; case 29: labelText.setText("Ninja Kiwi"); extraText.setText("www.ninjakiwi.com"); scoreText.setText("Sponsor Planet"); break; default: labelText.setText(("Stage " + int((b.type - 2)))); extraText.setText(""); scoreText.setText(("Score: " + Global.SCORES[(b.type - 3)])); break; }; scoreText.x = (((background.x + background.width) - scoreText.width) - 4); scoreText.y = (((background.y + background.height) - scoreText.height) - 4); makeRadarImage(b.type); corners[0].visible = false; corners[1].visible = false; corners[2].visible = false; corners[3].visible = false; if (((l) && (t))){ corners[0].visible = true; }; if (((!(l)) && (t))){ corners[1].visible = true; }; if (((l) && (!(t)))){ corners[2].visible = true; }; if (((!(l)) && (!(t)))){ corners[3].visible = true; }; } public function reset():void{ x = -1000; y = -1000; } public function makeRadarImage(t:int=0):void{ var i:int; var c:uint; var bmp:BitmapData = new BitmapData(21, 15, false, 0); var copy:BitmapData = ImageHandler.getMapData((t - 3)); var j:int; while (j < copy.height) { i = 0; while (i < copy.width) { c = copy.getPixel(i, j); if (((!((c == 0xFFFFFF))) && (!((c == 0xC0C0C0))))){ c = 4227264; bmp.setPixel(i, j, c); }; i++; }; j++; }; preview.bitmapData = bmp; preview.scaleX = (preview.scaleY = 3); preview.visible = true; if ((((t < 3)) || ((t > 27)))){ preview.visible = false; }; previewFrame.visible = preview.visible; } public function run():void{ } } }//package

Library Items

Symbol 1 Sound {SoundManager_Bumper} [SoundManager_Bumper]
Symbol 2 Sound {SoundManager_Death} [SoundManager_Death]
Symbol 3 Sound {SoundManager_LevelComplete} [SoundManager_LevelComplete]
Symbol 4 Sound {SoundManager_Unlock} [SoundManager_Unlock]
Symbol 5 Sound {SoundManager_CollectKey} [SoundManager_CollectKey]
Symbol 6 Sound {SoundManager_MenuMusic} [SoundManager_MenuMusic]
Symbol 7 Sound {SoundManager_GameplayMusic} [SoundManager_GameplayMusic]
Symbol 8 Sound {SoundManager_Bomb} [SoundManager_Bomb]
Symbol 9 Sound {SoundManager_MenuSelect} [SoundManager_MenuSelect]
Symbol 10 Sound {SoundManager_MenuHover} [SoundManager_MenuHover]
Symbol 11 Sound {SoundManager_Portal} [SoundManager_Portal]
Symbol 12 GraphicUsed by:56
Symbol 13 ShapeTweeningUsed by:56
Symbol 14 GraphicUsed by:15
Symbol 15 MovieClipUses:14Used by:56
Symbol 16 GraphicUsed by:17
Symbol 17 MovieClipUses:16Used by:56
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClipUses:18Used by:56
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClipUses:20Used by:56
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClipUses:22Used by:56
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClipUses:24Used by:56
Symbol 26 ShapeTweeningUsed by:56
Symbol 27 ShapeTweeningUsed by:56
Symbol 28 GraphicUsed by:56
Symbol 29 ShapeTweeningUsed by:56
Symbol 30 ShapeTweeningUsed by:56
Symbol 31 GraphicUsed by:56
Symbol 32 ShapeTweeningUsed by:56
Symbol 33 GraphicUsed by:56
Symbol 34 ShapeTweeningUsed by:56
Symbol 35 ShapeTweeningUsed by:56
Symbol 36 GraphicUsed by:56
Symbol 37 GraphicUsed by:38
Symbol 38 MovieClipUses:37Used by:56
Symbol 39 GraphicUsed by:56
Symbol 40 ShapeTweeningUsed by:56
Symbol 41 GraphicUsed by:56
Symbol 42 ShapeTweeningUsed by:56
Symbol 43 GraphicUsed by:56
Symbol 44 ShapeTweeningUsed by:56
Symbol 45 GraphicUsed by:46
Symbol 46 MovieClipUses:45Used by:56
Symbol 47 GraphicUsed by:56
Symbol 48 GraphicUsed by:49
Symbol 49 MovieClipUses:48Used by:56
Symbol 50 GraphicUsed by:56
Symbol 51 GraphicUsed by:56
Symbol 52 GraphicUsed by:56
Symbol 53 GraphicUsed by:56
Symbol 54 GraphicUsed by:55
Symbol 55 MovieClipUses:54Used by:56
Symbol 56 MovieClip {NinjaKiwiSplash} [NinjaKiwiSplash]Uses:12 13 15 17 19 21 23 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 46 47 49 50 51 52 53 55
Symbol 57 Bitmap {ImageHandler_SoundButton}
Symbol 58 Bitmap {ImageHandler_TooltipBackground}
Symbol 59 Bitmap {ImageHandler_LogoBig}
Symbol 60 Bitmap {ImageHandler_Tiles}
Symbol 61 Font {GameText_GameFontA}
Symbol 62 Font {GameText_GameFontB}
Symbol 63 Bitmap {ImageHandler_NinjaKiwiPlanet}
Symbol 64 Bitmap {ImageHandler_StageSelectHUD}
Symbol 65 Bitmap {ImageHandler_PlanetSheet}
Symbol 66 Bitmap {ImageHandler_StageButton}
Symbol 67 Bitmap {ImageHandler_SponsorLogoSmall}
Symbol 68 Bitmap {ImageHandler_BackgroundStarsC}
Symbol 69 Bitmap {ImageHandler_Hud}
Symbol 70 Bitmap {ImageHandler_StretchBoxSheet}
Symbol 71 Bitmap {ImageHandler_BackgroundStarsA}
Symbol 72 Bitmap {ImageHandler_BackgroundStarsB}
Symbol 73 Bitmap {ImageHandler_GameButton}
Symbol 74 Bitmap {ImageHandler_DialogBox}
Symbol 75 Bitmap {ImageHandler_ESELogo}
Symbol 76 Bitmap {ImageHandler_MapSheet}
Symbol 77 Bitmap {ImageHandler_TooltipCornerSheet}
Symbol 78 Bitmap {ImageHandler_TooltipPreviewFrame}
Symbol 79 Bitmap {ImageHandler_EpicShadowPlanet}
Symbol 80 Bitmap {ImageHandler_ScoreTiles}
Symbol 81 Bitmap {ImageHandler_BackgroundGradient}
Symbol 82 Bitmap {ImageHandler_TitleScreenPlanet}
Symbol 83 Bitmap {ImageHandler_LogoSmall}
Symbol 84 Bitmap {ImageHandler_TileAnimations}
Symbol 85 Bitmap {ImageHandler_Cursor}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1458 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 2Symbol 1 as "SoundManager_Bumper"
ExportAssets (56)Timeline Frame 2Symbol 2 as "SoundManager_Death"
ExportAssets (56)Timeline Frame 2Symbol 3 as "SoundManager_LevelComplete"
ExportAssets (56)Timeline Frame 2Symbol 4 as "SoundManager_Unlock"
ExportAssets (56)Timeline Frame 2Symbol 5 as "SoundManager_CollectKey"
ExportAssets (56)Timeline Frame 2Symbol 6 as "SoundManager_MenuMusic"
ExportAssets (56)Timeline Frame 2Symbol 7 as "SoundManager_GameplayMusic"
ExportAssets (56)Timeline Frame 2Symbol 8 as "SoundManager_Bomb"
ExportAssets (56)Timeline Frame 2Symbol 9 as "SoundManager_MenuSelect"
ExportAssets (56)Timeline Frame 2Symbol 10 as "SoundManager_MenuHover"
ExportAssets (56)Timeline Frame 2Symbol 11 as "SoundManager_Portal"
ExportAssets (56)Timeline Frame 2Symbol 56 as "NinjaKiwiSplash"
EnableDebugger2 (64)Timeline Frame 131 bytes "u.$1$zP$hMf/Ehi/x6Z6aGR.RnZge1."
DebugMX1 (63)Timeline Frame 1
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"start"Frame 2




http://swfchan.com/19/90775/info.shtml
Created: 28/3 -2019 06:09:08 Last modified: 28/3 -2019 06:09:08 Server time: 06/05 -2024 20:23:55