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

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

Vector Runner.swf

This is the info page for
Flash #135067

(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.net.*; import flash.utils.*; import flash.system.*; public class MochiAd { public static function getVersion():String{ return (MochiServices.getVersion()); } public static function showClickAwayAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; 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 (_arg1:Number, _arg2: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 (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; var sendHostProgress:Boolean; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; _local3 = true; chk.started = getTimer(); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (this.root == null){ _local3 = true; }; if (_local3){ delete this.onEnterFrame; }; }; doOnEnterFrame(chk); } public static function _isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function _allowDomains(_arg1:String):String{ var _local2:String = _arg1.split("/")[2].split(":")[0]; if (Security.sandboxType == "application"){ return (_local2); }; Security.allowDomain("*"); Security.allowDomain(_local2); Security.allowInsecureDomain("*"); Security.allowInsecureDomain(_local2); return (_local2); } public static function unload(_arg1:Object):Boolean{ if (((_arg1.clip) && (_arg1.clip._mochiad))){ _arg1 = _arg1.clip; }; if (_arg1.origFrameRate != undefined){ _arg1.stage.frameRate = _arg1.origFrameRate; }; if (!_arg1._mochiad){ return (false); }; if (_arg1._mochiad._containerLCName != undefined){ _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"}); }; if (_arg1._mochiad.onUnload){ _arg1._mochiad.onUnload(); }; delete _arg1._mochiad_loaded; delete _arg1._mochiad; return (true); } public static function showInterLevelAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; 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 (_arg1:Number, _arg2: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 _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 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 (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = (_arg1 - 250); }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (_local2 > chk.ad_msec){ _local3 = true; }; if (_local3){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = this.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function _parseOptions(_arg1:Object, _arg2:Object):Object{ var _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; if (_arg1){ for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; }; if (_local3.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.")); }; _arg1 = _local3.clip.loaderInfo.parameters.mochiad_options; if (_arg1){ _local5 = _arg1.split("&"); _local6 = 0; while (_local6 < _local5.length) { _local7 = _local5[_local6].split("="); _local3[unescape(_local7[0])] = unescape(_local7[1]); _local6++; }; }; if (_local3.id == "test"){ trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!"); }; return (_local3); } public static function _cleanup(_arg1:Object):void{ var k:String; var lc:LocalConnection; var f:Function; var mc = _arg1; if (("lc" in mc)){ lc = mc.lc; f = function ():void{ try { lc.client = null; lc.close(); } catch(e:Error) { }; }; 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(_arg1:Object):MovieClip{ var clip:Object; 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 = _arg1; 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); }; try { if (clip._mochiad_loaded){ return (null); }; } catch(e:Error) { 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; var mc:MovieClip = 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(); loader = new Loader(); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.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 (_arg1: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(_arg1:Object, _arg2:String, _arg3:Array):Object{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return (undefined); }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; if (typeof(_arg1[_local4[_local5]]) == "function"){ return (_arg1[_local4[_local5]].apply(_arg1, _arg3)); }; return (undefined); } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{ var _local4:MovieClip = new MovieClip(); if (((false) && (_arg3))){ _arg1.addChildAt(_local4, _arg3); } else { _arg1.addChild(_local4); }; _arg1[_arg2] = _local4; _local4["_name"] = _arg2; return (_local4); } public static function _getRes(_arg1:Object, _arg2:Object):Array{ var _local6:Array; var _local3:Object = _arg2.getBounds(_arg2.root); var _local4:Number = 0; var _local5:Number = 0; if (typeof(_arg1.res) != "undefined"){ _local6 = _arg1.res.split("x"); _local4 = parseFloat(_local6[0]); _local5 = parseFloat(_local6[1]); } else { _local4 = (_local3.xMax - _local3.xMin); _local5 = (_local3.yMax - _local3.yMin); }; if ((((_local4 == 0)) || ((_local5 == 0)))){ _local4 = _arg2.stage.stageWidth; _local5 = _arg2.stage.stageHeight; }; return ([_local4, _local5]); } public static function adShowing(_arg1:Object):void{ _arg1.origFrameRate = _arg1.stage.frameRate; _arg1.stage.frameRate = 30; } public static function getValue(_arg1:Object, _arg2:String):Object{ var _local3:Array = _arg2.split("."); var _local4:Number = 0; while (_local4 < (_local3.length - 1)) { if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){ return (undefined); }; _arg1 = _arg1[_local3[_local4]]; _local4++; }; return (_arg1[_local3[_local4]]); } public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{ var _local4:Object; var _local5:Object; switch (_arg3.id){ case "setValue": MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value); break; case "getValue": _local4 = MochiAd.getValue(_arg1, _arg3.objectName); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4); break; case "runMethod": _local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5); break; default: trace(("[mochiads rpc] unknown rpc id: " + _arg3.id)); }; } public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return; }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; _arg1[_local4[_local5]] = _arg3; } public static function showPreGameAd(_arg1: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 = _arg1; 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 (_arg1:Number, _arg2: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 (_arg1:Number):void{ }, progress_override:function (_arg1: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 _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 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 (_arg1:Event):void{ _arg1.target.removeEventListener(_arg1.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 (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = _arg1; }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; mc.rpcTestFn = function (_arg1:String):Object{ trace(("[MOCHIAD rpcTestFn] " + _arg1)); return (_arg1); }; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; sendHostProgress = false; mc.sendHostLoadProgress = function (_arg1:String):void{ sendHostProgress = true; }; chk["onEnterFrame"] = function ():void{ var _local12:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _local1:Object = this.parent.parent.root; var _local2:Object = this.parent._mochiad_ctr; var _local3:Number = (getTimer() - this.started); var _local4:Boolean; var _local5:Number = _local1.loaderInfo.bytesTotal; var _local6:Number = _local1.loaderInfo.bytesLoaded; var _local7:Number = Math.min(1, options.progress_override(_local1)); if (_local7 == 1){ complete = true; }; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; var _local8:Number = ((100 * _local6) / _local5); if (!isNaN(_local7)){ _local8 = (100 * _local7); }; var _local9:Number = ((100 * _local3) / chk.ad_msec); var _local10:Object = this._mochiad_bar._inside; var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9)); _local11 = Math.max(this.last_pcnt, _local11); this.last_pcnt = _local11; _local10.scaleX = (_local11 * 0.01); options.ad_progress(_local11); if (sendHostProgress){ clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8}); if (_local8 >= 100){ sendHostProgress = false; }; }; if (!chk.showing){ _local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local12 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){ options.ad_failed(); _local4 = true; }; }; }; if (_local3 > chk.ad_msec){ _local4 = true; }; if (((complete) && (_local4))){ if (unloaded){ MochiAd.unload(_local1); } else { if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = chk.fadeFunction; }; }; }; }; doOnEnterFrame(chk); } public static function showPreloaderAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0"); MochiAd.showPreGameAd(_arg1); } public static function showTimedAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0"); MochiAd.showInterLevelAd(_arg1); } public static function doOnEnterFrame(_arg1:MovieClip):void{ var mc = _arg1; var f:Function = function (_arg1:Object):void{ if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){ mc.onEnterFrame(); } else { _arg1.target.removeEventListener(_arg1.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 static function triggerEvent(_arg1:String, _arg2:Object):void{ MochiSocial.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.addEventListener(_arg1, _arg2); } public static function getStoreItems():void{ MochiServices.send("coins_getStoreItems"); } public static function get inventory():MochiInventory{ return (_inventory); } public static function showStore(_arg1:Object=null):void{ MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:_arg1}, null, null); } public static function showItem(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showItem call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showItem", {options:_arg1}, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function showVideo(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showVideo call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showVideo", {options:_arg1}, null, null); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _inventory = new MochiInventory(); }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1: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(_arg1:Number=0, _arg2:uint=0):void{ Encoder = 0; setValue(_arg1, _arg2); } public function reencode():void{ var _local1:uint = int((2147483647 * Math.random())); Fragment = (Fragment ^ (_local1 ^ Encoder)); Encoder = _local1; } public function set value(_arg1:Number):void{ setValue(_arg1); } public function toString():String{ var _local1:String = String.fromCharCode((Fragment ^ Encoder)); if (Sibling != null){ _local1 = (_local1 + Sibling.toString()); }; return (_local1); } public function setValue(_arg1:Number=0, _arg2:uint=0):void{ var _local3:String = _arg1.toString(); var _temp1 = _arg2; _arg2 = (_arg2 + 1); Fragment = (_local3.charCodeAt(_temp1) ^ Encoder); if (_arg2 < _local3.length){ Sibling = new MochiDigits(_arg1, _arg2); } else { Sibling = null; }; reencode(); } public function get value():Number{ return (Number(this.toString())); } public function addValue(_arg1:Number):void{ value = (value + _arg1); } } }//package mochi.as3
Section 4
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher) package mochi.as3 { public class MochiEventDispatcher { private var eventTable:Object; public function MochiEventDispatcher():void{ eventTable = {}; } public function triggerEvent(_arg1:String, _arg2:Object):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ return; }; for (_local3 in eventTable[_arg1]) { var _local6 = eventTable[_arg1]; _local6[_local3](_arg2); }; } public function removeEventListener(_arg1:String, _arg2:Function):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ eventTable[_arg1] = []; return; }; for (_local3 in eventTable[_arg1]) { if (eventTable[_arg1][_local3] != _arg2){ } else { eventTable[_arg1].splice(Number(_local3), 1); }; }; } public function addEventListener(_arg1:String, _arg2:Function):void{ removeEventListener(_arg1, _arg2); eventTable[_arg1].push(_arg2); } } }//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 static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function startSession(_arg1:String):void{ MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{ var _local4:Object; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; _local3.clip = _arg1; MochiServices.send("events_setNotifications", _local3, null, null); } public static function endGame():void{ var _local1:Number = (new Date().time - gameStart); trigger("end_game", {time:_local1}); } public static function startGame():void{ gameStart = new Date().time; trigger("start_game"); } public static function trigger(_arg1:String, _arg2:Object=null):void{ if (_arg2 == null){ _arg2 = {}; } else { if (_arg2["kind"] != undefined){ trace("WARNING: optional arguments package contains key 'id', it will be overwritten"); _arg2["kind"] = _arg1; }; }; MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function startLevel():void{ levelStart = new Date().time; trigger("start_level"); } public static function endLevel():void{ var _local1:Number = (new Date().time - levelStart); trigger("end_level", {time:_local1}); } } }//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{ 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(_arg1:Object):void{ if (!this[(_arg1.id + KEY_SALT)]){ this[(_arg1.id + KEY_SALT)] = 0; }; if (!this[_arg1.id]){ this[_arg1.id] = 0; }; this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count); this[_arg1.id] = (this[_arg1.id] + _arg1.count); if (_arg1.privateProperties.consumable){ if (!this[_arg1.privateProperties.tag]){ this[_arg1.privateProperties.tag] = 0; }; this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.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(_arg1){ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (-1); }; if (_consumableProperties[_arg1]){ return (MochiDigits(_consumableProperties[_arg1]).value); }; return (undefined); } private function loggedIn(_arg1:Object=null):void{ MochiUserData.get(CONSUMER_KEY, getConsumableBag); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (false); }; if (_consumableProperties[_arg1] == undefined){ return (false); }; return (true); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{ return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1)); } private function putConsumableBag(_arg1:MochiUserData):void{ _syncPending = false; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); _outstandingID = -1; }; triggerEvent(WRITTEN, {}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:MochiDigits; if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return; }; if (!(_arg2 is Number)){ triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2}); return; }; if (_consumableProperties[_arg1]){ _local3 = MochiDigits(_consumableProperties[_arg1]); if (_local3.value == _arg2){ return; }; _local3.value = _arg2; } else { _names.push(_arg1); _consumableProperties[_arg1] = new MochiDigits(_arg2); }; _syncID++; } private function itemOwned(_arg1:Object):void{ _storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count}; } private function sync(_arg1:Event=null):void{ var _local3:String; if (((_syncPending) || ((_syncID == _outstandingID)))){ return; }; _outstandingID = _syncID; var _local2:Object = {}; for (_local3 in _consumableProperties) { _local2[_local3] = MochiDigits(_consumableProperties[_local3]).value; }; MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag); _syncPending = true; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{ return (_names[(_arg1 - 1)]); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{ if (!_consumableProperties[_arg1]){ return (false); }; _names.splice(_names.indexOf(_arg1), 1); delete _consumableProperties[_arg1]; return (true); } private function getConsumableBag(_arg1:MochiUserData):void{ var _local2:String; var _local3:Number; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); return; }; _consumableProperties = {}; _names = new Array(); if (_arg1.data){ for (_local2 in _arg1.data) { _names.push(_local2); _consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]); }; }; for (_local2 in _storeSync) { _local3 = _storeSync[_local2].count; if (_consumableProperties[(_local2 + KEY_SALT)]){ _local3 = (_local3 - _consumableProperties[_local2]); }; if (_local3 == 0){ } else { newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties}); }; }; triggerEvent(READY, {}); } private function loggedOut(_arg1:Object=null):void{ _consumableProperties = null; } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } } }//package mochi.as3
Section 7
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.net.*; import flash.utils.*; import flash.geom.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _swfVersion:String; private static var _preserved:Object; public static var netupAttempted:Boolean = false; private static var _sendChannel:LocalConnection; public static var servicesSync:MochiSync = new MochiSync(); private static var _clip:MovieClip; private static var _id:String; private static var _services:String = "services.swf"; private static var _servURL:String = "http://www.mochiads.com/static/lib/services/"; public static var widget:Boolean = false; private static var _timer:Timer; private static var _sendChannelName:String; private static var _loader:Loader; private static var _connecting:Boolean = false; private static var _mochiLocalConnection:MovieClip; private static var _listenChannelName:String = "__ms_"; public static var onError:Object; public static var netup:Boolean = true; private static var _mochiLC:String = "MochiLC.swf"; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function get connected():Boolean{ return (_connected); } private static function onReceive(_arg1:Object):void{ var methodName:String; var pkg = _arg1; var cb:String = pkg.callbackID; var cblst:Object = _clip._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){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete _clip._callbacks[cb]; } public static function get childClip():Object{ return (_clip); } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1)); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); }; if (_clip != null){ if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){ _clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _clip._nextcallbackID++; }; }; } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{ var _local4:int; var _local14:Loader; var _local3: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 _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; var _local6:Array = [0, 64, 0, 0, 0]; var _local7:MovieClip = new MovieClip(); var _local8:LocalConnection = new LocalConnection(); var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time)); _local8 = new LocalConnection(); _local7.lc = _local8; _local7.click = _arg2; _local8.client = _local7; _local8.connect(_local9); var _local10:ByteArray = new ByteArray(); var _local11:ByteArray = new ByteArray(); _local11.endian = Endian.LITTLE_ENDIAN; _local11.writeShort(1); _local11.writeUTFBytes(((_arg1 + " ") + _local9)); _local11.writeByte(0); var _local12:uint = ((_local3.length + _local11.length) + 4); var _local13:uint = (_local12 + 35); _local10.endian = Endian.LITTLE_ENDIAN; _local10.writeUTFBytes("FWS"); _local10.writeByte(8); _local10.writeUnsignedInt(_local13); for each (_local4 in _local5) { _local10.writeByte(_local4); }; _local10.writeUnsignedInt(_local12); _local10.writeByte(136); _local10.writeShort(_local11.length); _local10.writeBytes(_local11); for each (_local4 in _local3) { _local10.writeByte(_local4); }; for each (_local4 in _local6) { _local10.writeByte(_local4); }; _local14 = new Loader(); _local14.loadBytes(_local10); _local7.addChild(_local14); return (_local7); } 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(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4: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 = _arg1; var burl = _arg2; var btn = _arg3; var onClick = _arg4; 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 (_arg1:String):void{ if (avm1Click){ btn.removeChild(avm1Click); }; avm1Click = clickMovie(_arg1, onClick); var _local2:Rectangle = btn.getBounds(btn); btn.addChild(avm1Click); avm1Click.x = _local2.x; avm1Click.y = _local2.y; avm1Click.scaleX = (0.01 * _local2.width); avm1Click.scaleY = (0.01 * _local2.height); }; err = function (_arg1:Object):void{ netup = false; _arg1.target.removeEventListener(_arg1.type, arguments.callee); setURL(burl); }; complete = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; if (netup){ setURL((url + s)); } else { setURL(burl); }; if (!((netupAttempted) || (_connected))){ netupAttempted = true; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.load(req); }; } public static function warnID(_arg1:String, _arg2:Boolean):void{ _arg1 = _arg1.toLowerCase(); if (_arg1.length != 16){ trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length")); return; } else { if (_arg1 == "1e113c7239048b3f"){ if (_arg2){ trace("WARNING: Using testing board ID"); } else { trace("WARNING: Using testing board ID as game ID"); }; return; } else { if (_arg1 == "84993a1de4031cd8"){ if (_arg2){ trace("WARNING: Using testing game ID as board ID"); } else { trace("WARNING: Using testing game ID"); }; return; }; }; }; var _local3:Number = 0; while (_local3 < _arg1.length) { switch (_arg1.charAt(_local3)){ 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: " + _arg1)); return; }; _local3++; }; } 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); try { _mochiLocalConnection.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; if (Security.sandboxType != "application"){ Security.allowDomain("*"); Security.allowInsecureDomain("*"); }; if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; if (Security.sandboxType != "application"){ Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; }; return (_local2); } public static function getVersion():String{ return ("3.7 as3"); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (((_clip) && (_clip._queue))){ while (_clip._queue.length > 0) { _local2 = _clip._queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _clip._callbacks[_local2.callbackID]; }; delete _clip._callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; } public static function get id():String{ return (_id); } private static function onEvent(_arg1:Object):void{ var _local2:String = _arg1.target; var _local3:String = _arg1.event; switch (_local2){ case "events": MochiEvents.triggerEvent(_arg1.event, _arg1.args); break; case "coins": MochiCoins.triggerEvent(_arg1.event, _arg1.args); break; case "sync": servicesSync.triggerEvent(_arg1.event, _arg1.args); break; }; } private static function urlOptions(_arg1:Object):Object{ var _local3:String; var _local4:Array; var _local5:Number; var _local6:Array; var _local2:Object = {}; if (_arg1.stage){ _local3 = _arg1.stage.loaderInfo.parameters.mochiad_options; } else { _local3 = _arg1.loaderInfo.parameters.mochiad_options; }; if (_local3){ _local4 = _local3.split("&"); _local5 = 0; while (_local5 < _local4.length) { _local6 = _local4[_local5].split("="); _local2[unescape(_local6[0])] = unescape(_local6[1]); _local5++; }; }; return (_local2); } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_arg1 != null){ if ((_arg1 is Sprite)){ _container = _arg1; }; }; if (_arg2){ if ((_container is Sprite)){ Sprite(_container).addChild(_clip); }; }; } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; 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)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } private static function loadError(_arg1: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 (_clip._queue.length > 0) { _mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift()); }; }; } private static function loadLCBridge(_arg1:Object):void{ var loader:Loader; var clip = _arg1; loader = new Loader(); var mochiLCURL:String = (_servURL + _mochiLC); var req:URLRequest = new URLRequest(mochiLCURL); var complete:Function = function (_arg1: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 (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; trace("Waiting for MochiAds services to connect..."); } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var _local3:String = ("_mochiservices_com_" + _arg1); if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; if (urlOptions(_arg2).servURL){ _servURL = urlOptions(_arg2).servURL; }; var _local4:String = (_servURL + _services); if (urlOptions(_arg2).servicesURL){ _local4 = urlOptions(_arg2).servicesURL; }; _listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999)))); MochiServices.allowDomains(_local4); _clip = createEmptyMovieClip(_arg2, _local3, 10336, false); loadLCBridge(_clip); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); var _local5:URLRequest = new URLRequest(_local4); var _local6:URLVariables = new URLVariables(); _local6.listenLC = _listenChannelName; _local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options; _local6.api_version = getVersion(); if (widget){ _local6.widget = true; }; _local5.data = _local6; _loader.load(_local5); _clip.addChild(_loader); _clip._mochiservices_com = _loader; _sendChannel = new LocalConnection(); _clip._queue = []; _clip._nextcallbackID = 0; _clip._callbacks = {}; _timer = new Timer(10000, 1); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); return (_clip); } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; 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 (_arg1:String):void{ trace(_arg1); }; }; }; } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{ var parent = _arg1; var name = _arg2; var depth = _arg3; var doAdd = _arg4; var mc:MovieClip = new MovieClip(); if (doAdd){ if (((false) && (depth))){ parent.addChildAt(mc, depth); } else { parent.addChild(mc); }; }; try { parent[name] = mc; } catch(e:Error) { throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; mc["_name"] = name; return (mc); } public static function bringToTop(_arg1:Event=null):void{ var e = _arg1; if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; } public static function connectWait(_arg1:TimerEvent):void{ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load. (timeout)"); MochiServices.disconnect(); MochiServices.onError("IOError"); }; } } }//package mochi.as3
Section 8
//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 static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(_arg1:Object):void{ MochiServices.send("coins_saveUserProperties", _arg1); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function getUserInfo():void{ MochiServices.send("coins_getUserInfo"); } public static function showLoginWidget(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showLoginWidget", {options:_arg1}); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } 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 (_arg1:Object):void{ _user_info = _arg1; }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _user_info = null; }); } }//package mochi.as3
Section 9
//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{ _syncContainer = {}; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ if (_syncContainer[_arg1] == _arg2){ return; }; var _local3:String = _arg1.toString(); _syncContainer[_local3] = _arg2; MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ return (_syncContainer[_arg1]); } public function triggerEvent(_arg1:String, _arg2:Object):void{ switch (_arg1){ case SYNC_REQUEST: MochiServices.send("sync_syncronize", _syncContainer); break; case SYNC_PROPERTY: _syncContainer[_arg2.name] = _arg2.value; break; }; } } }//package mochi.as3
Section 10
//MochiUserData (mochi.as3.MochiUserData) package mochi.as3 { import flash.events.*; import flash.net.*; import flash.utils.*; 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(_arg1:String="", _arg2:Function=null){ this.key = _arg1; this.callback = _arg2; } public function serialize(_arg1):ByteArray{ var _local2:ByteArray = new ByteArray(); _local2.objectEncoding = ObjectEncoding.AMF3; _local2.writeObject(_arg1); _local2.compress(); return (_local2); } public function errorHandler(_arg1:IOErrorEvent):void{ data = null; error = _arg1; if (callback != null){ performCallback(); } else { dispatchEvent(_arg1); }; close(); } public function putEvent(_arg1):void{ request("put", serialize(_arg1)); } public function deserialize(_arg1:ByteArray){ _arg1.objectEncoding = ObjectEncoding.AMF3; _arg1.uncompress(); return (_arg1.readObject()); } public function securityErrorHandler(_arg1:SecurityErrorEvent):void{ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.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{ try { callback(this); } catch(e:Error) { trace(("[MochiUserData] exception during callback: " + e)); }; } public function request(_arg1:String, _arg2:ByteArray):void{ var _operation = _arg1; var _data = _arg2; 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); try { _loader.load(req); } catch(e:SecurityError) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString()))); }; } public function completeHandler(_arg1:Event):void{ var event = _arg1; try { if (_loader.data.length){ data = deserialize(_loader.data); } else { data = null; }; } catch(e:Error) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.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(_arg1:String, _arg2:Function):void{ var _local3:MochiUserData = new MochiUserData(_arg1, _arg2); _local3.getEvent(); } public static function put(_arg1:String, _arg2, _arg3:Function):void{ var _local4:MochiUserData = new MochiUserData(_arg1, _arg3); _local4.putEvent(_arg2); } } }//package mochi.as3
Section 11
//MochiScores (unitescore.mochi.MochiScores) package unitescore.mochi { 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 static function showLeaderboard(_arg1:Object=null):void{ var options = _arg1; if (options != null){ if (options.clip != null){ if ((options.clip is Sprite)){ MochiServices.setContainer(options.clip); }; delete options.clip; } else { MochiServices.setContainer(); }; MochiServices.stayOnTop(); 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; }; }; }; 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.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2); } public static function requestList(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_requestList", null, _arg1, _arg2); } public static function scoresArrayToObjects(_arg1:Object):Object{ var _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; var _local2:Object = {}; for (_local7 in _arg1) { if (typeof(_arg1[_local7]) == "object"){ if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){ _local2[_local7] = []; _local5 = _arg1[_local7]; _local4 = 0; while (_local4 < _local5.rows.length) { _local6 = {}; _local3 = 0; while (_local3 < _local5.cols.length) { _local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3]; _local3++; }; _local2[_local7].push(_local6); _local4++; }; } else { _local2[_local7] = {}; for (_local8 in _arg1[_local7]) { _local2[_local7][_local8] = _arg1[_local7][_local8]; }; }; } else { _local2[_local7] = _arg1[_local7]; }; }; return (_local2); } public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{ MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4); } public static function onClose(_arg1:Object=null):void{ if (_arg1 != null){ if (_arg1.error != null){ if (_arg1.error == true){ if (onErrorHandler != null){ if (_arg1.errorCode == null){ _arg1.errorCode = "IOError"; }; onErrorHandler(_arg1.errorCode); MochiServices.doClose(); return; }; }; }; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(_arg1:String):void{ MochiScores.boardID = _arg1; MochiServices.send("scores_setBoardID", {boardID:_arg1}); } } }//package unitescore.mochi
Section 12
//MochiServices (unitescore.mochi.MochiServices) package unitescore.mochi { import flash.events.*; import flash.display.*; import flash.net.*; import flash.utils.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _swfVersion:String; private static var _sendChannel:LocalConnection; private static var _rcvChannelName:String; private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf"; private static var _clip:MovieClip; private static var _loader:Loader; private static var _id:String; private static var _listenChannel:LocalConnection; private static var _timer:Timer; private static var _sendChannelName:String; private static var _startTime:Number; private static var _connecting:Boolean = false; public static var onError:Object; private static var _listenChannelName:String = "__mochiservices"; private static var _rcvChannel:LocalConnection; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ onError("NotConnected"); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); }; if (_clip != null){ if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){ _clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _clip._nextcallbackID++; }; }; } public static function get connected():Boolean{ return (_connected); } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (_clip != null){ if (_clip._queue != null){ while (_clip._queue.length > 0) { _local2 = _clip._queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _clip._callbacks[_local2.callbackID]; }; delete _clip._callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; }; } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } public static function get childClip():Object{ return (_clip); } public static function get id():String{ return (_id); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function getVersion():String{ return ("1.34"); } 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); try { _listenChannel.close(); _rcvChannel.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; Security.allowDomain("*"); Security.allowInsecureDomain("*"); if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; return (_local2); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); if (_clip.parent != null){ Sprite(_clip.parent).removeChild(_clip); }; } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_arg1 != null){ if ((_arg1 is Sprite)){ _container = _arg1; }; }; if (_arg2){ if ((_container is Sprite)){ Sprite(_container).addChild(_clip); }; }; } private static function onStatus(_arg1:StatusEvent):void{ switch (_arg1.level){ case "error": _connected = false; _listenChannel.connect(_listenChannelName); break; }; } private static function initComChannels():void{ if (!_connected){ _sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _clip.onReceive = function (_arg1:Object):void{ var methodName:String; var pkg = _arg1; var cb:String = pkg.callbackID; var cblst:Object = this.client._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){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete this.client._callbacks[cb]; }; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; _rcvChannel.connect(_rcvChannelName); trace("connected!"); _connecting = false; _connected = true; _listenChannel.close(); while (_clip._queue.length > 0) { _sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift()); }; }; } private static function listen():void{ _listenChannel = new LocalConnection(); _listenChannel.client = _clip; _clip.handshake = function (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; _listenChannel.allowDomain("*", "localhost"); _listenChannel.allowInsecureDomain("*", "localhost"); _listenChannel.connect(_listenChannelName); trace("Waiting for MochiAds services to connect..."); } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; 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)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); _rcvChannelName = _arg1; initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var id = _arg1; var clip = _arg2; var clipname:String = ("_mochiservices_com_" + id); if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; MochiServices.allowDomains(_gatewayURL); _clip = createEmptyMovieClip(clip, clipname, 10336, false); _loader = new Loader(); _timer = new Timer(1000, 0); _startTime = getTimer(); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); var f:Function = function (_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); var req:URLRequest = new URLRequest(_gatewayURL); _loader.load(req); _clip.addChild(_loader); _clip._mochiservices_com = _loader; _sendChannel = new LocalConnection(); _clip._queue = []; _rcvChannel = new LocalConnection(); _rcvChannel.allowDomain("*", "localhost"); _rcvChannel.allowInsecureDomain("*", "localhost"); _rcvChannel.client = _clip; _clip._nextcallbackID = 0; _clip._callbacks = {}; listen(); return (_clip); } public static function bringToTop(_arg1:Event):void{ var e = _arg1; if (MochiServices.clip != null){ if (MochiServices.childClip != null){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; }; } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; if ((clip is DisplayObject)){ if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{ var parent = _arg1; var name = _arg2; var depth = _arg3; var doAdd = _arg4; var mc:MovieClip = new MovieClip(); if (doAdd){ if (((false) && (depth))){ parent.addChildAt(mc, depth); } else { parent.addChild(mc); }; }; try { parent[name] = mc; } catch(e:Error) { throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; mc["_name"] = name; return (mc); } public static function connectWait(_arg1:TimerEvent):void{ if ((getTimer() - _startTime) > 10000){ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _timer.stop(); }; } } }//package unitescore.mochi
Section 13
//NonobaAPI (unitescore.nonoba.NonobaAPI) package unitescore.nonoba { import flash.events.*; import flash.display.*; import flash.net.*; import flash.system.*; public class NonobaAPI { public static const SUCCESS:String = "success"; public static const ERROR:String = "error"; public static const NOT_LOGGED_IN:String = "user not logged in"; private static var isInited:Boolean = false; private static var port:Number; private static var server:String; private static var cachedRequests:Array = []; private static var api:Object; private static var loaderObject:Sprite; private static var loading:Boolean = false; private static var failed:Boolean = false; public function NonobaAPI(){ throw (new Error("You cannot create an instance of the NonobaAPI class!")); } private static function emptyQueue():void{ var _local1:int; while (_local1 < cachedRequests.length) { var _local2 = cachedRequests; _local2[_local1](); _local1++; }; cachedRequests = []; } public static function Login(_arg1:Stage, _arg2:Function):void{ var stage = _arg1; var callback = _arg2; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR); }; return; }; if (((api.content) && (api.content.SubmitScore))){ api.content.Login(stage, callback); } else { cachedRequests.push(function ():void{ Login(stage, callback); }); }; } public static function HasShopItem(_arg1:Stage, _arg2, _arg3:Function=null):void{ var stage = _arg1; var key = _arg2; var callback = _arg3; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR, false, null); }; return; }; if (((api.content) && (api.content.SubmitScore))){ api.content.HasShopItem(stage, key, callback); } else { cachedRequests.push(function ():void{ HasShopItem(stage, key, callback); }); }; } private static function handleLoadCompleate(_arg1:Event):void{ emptyQueue(); if (loaderObject != null){ api.parent.removeEventListener(Event.ENTER_FRAME, handleLoad); }; } public static function SubmitScore(_arg1:Stage, _arg2:String, _arg3:Number, _arg4:Function=null):void{ var stage = _arg1; var key = _arg2; var score = _arg3; var callback = _arg4; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR); }; return; }; if (((api.content) && (api.content.SubmitScore))){ api.content.SubmitScore(stage, key, score, callback); } else { cachedRequests.push(function ():void{ SubmitScore(stage, key, score, callback); }); }; } public static function GetShopItemKeys(_arg1:Stage, _arg2:Function=null):void{ var stage = _arg1; var callback = _arg2; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR, null); }; return; }; if (((api.content) && (api.content.SubmitScore))){ api.content.GetShopItemKeys(stage, callback); } else { cachedRequests.push(function ():void{ GetShopItemKeys(stage, callback); }); }; } public static function AwardAchievement(_arg1:Stage, _arg2:String, _arg3:Function=null):void{ var stage = _arg1; var key = _arg2; var callback = _arg3; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR, 0); }; return; }; if (((api.content) && (api.content.AwardAchievement))){ api.content.AwardAchievement(stage, key, callback); } else { cachedRequests.push(function ():void{ AwardAchievement(stage, key, callback); }); }; } private static function init(_arg1:Stage):void{ var _local2:Object = LoaderInfo(_arg1.root.loaderInfo).parameters; loadAPI(_arg1, _local2.nonoba$apicodeas3); } private static function loadAPI(_arg1:Stage, _arg2:String):void{ isInited = true; if (!_arg2){ enterErrorState(); return; }; Security.allowDomain("*"); Security.allowInsecureDomain("*"); api = new Loader(); var _local3:URLRequest = new URLRequest(_arg2); api.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoadCompleate); api.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, enterErrorState); api.load(_local3); _arg1.addChild((api as Loader)); } private static function enterErrorState(_arg1:Event=null):void{ failed = true; emptyQueue(); } public static function GetUserData(_arg1:Stage, _arg2:String, _arg3:Function=null):void{ var stage = _arg1; var key = _arg2; var callback = _arg3; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR); }; return; }; if (((api.content) && (api.content.GetUserData))){ api.content.GetUserData(stage, key, callback); } else { cachedRequests.push(function ():void{ GetUserData(stage, key, callback); }); }; } private static function handleLoad(_arg1:Event):void{ var _local2:LoaderInfo = api.loaderInfo; var _local3:LoaderInfo = api.contentLoaderInfo; drawLoader((_arg1.target as Stage), (((_local2.bytesLoaded + _local3.bytesLoaded) / (_local2.bytesTotal + _local3.bytesTotal)) / 3)); } public static function ShowShop(_arg1:Stage, _arg2:String, _arg3:Function):void{ var stage = _arg1; var item = _arg2; var callback = _arg3; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR, false); }; return; }; if (((api.content) && (api.content.SubmitScore))){ api.content.ShowShop(stage, item, callback); } else { cachedRequests.push(function ():void{ ShowShop(stage, item, callback); }); }; } public static function SetUserData(_arg1:Stage, _arg2:String, _arg3:String, _arg4:Function=null):void{ var stage = _arg1; var key = _arg2; var value = _arg3; var callback = _arg4; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR); }; return; }; if (((api.content) && (api.content.SetUserData))){ api.content.SetUserData(stage, key, value, callback); } else { cachedRequests.push(function ():void{ SetUserData(stage, key, value, callback); }); }; } public static function GetUsername(_arg1:Stage, _arg2:Function=null){ var stage = _arg1; var callback = _arg2; if (!isInited){ init(stage); }; if (failed){ if (callback != null){ callback(ERROR, ""); }; return; }; if (((api.content) && (api.content.GetUsername))){ api.content.GetUsername(stage, callback); } else { cachedRequests.push(function ():void{ GetUsername(stage, callback); }); }; } private static function drawLoader(_arg1:Stage, _arg2:Number):void{ var _local3:int = (_arg1.stageWidth / 2); var _local4:int = (_arg1.stageHeight / 2); var _local5:Graphics = loaderObject.graphics; _local5.clear(); _local5.beginFill(0xFFFFFF); _local5.drawRect(0, 0, (_local3 * 2), (_local4 * 2)); _local5.lineStyle(0, 0x555555, 1); _local5.beginFill(0xAAAAAA); _local5.drawRect((_local3 - 100), (_local4 - 5), 200, 10); _local5.beginFill(0xFFFFFF); _local5.drawRect((_local3 - 100), (_local4 - 5), (200 * _arg2), 10); } } }//package unitescore.nonoba
Section 14
//URLVars (unitescore.utils.URLVars) package unitescore.utils { public dynamic class URLVars { public const maxObjectDepth:int = 32; public const maxBuffLen:int = 64; protected var urlEncoding:String; private var urlIndex:int;// = 0 private var pairs:Array; public function URLVars(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=true, _arg4:Boolean=false){ urlEncoding = _arg1; pairs = new Array(0); urlIndex = 0; parsePairs(); if (_arg3){ percentDecodeValues(); }; if (_arg2){ evalValueTypes(); }; convertPairsToVariables(); if (!_arg4){ pairs = null; }; } public function toURLString():String{ return (urlEncoding); } protected function grabPair():Array{ var _local1:String = grabName(); while (_local1 == "") { if (urlIndex >= urlEncoding.length){ return (null); }; _local1 = grabName(); }; var _local2:String = grabValue(); if ((((_local2 == "")) && ((urlIndex >= urlEncoding.length)))){ return (null); }; return (new Array(_local1, _local2)); } protected function evalValueTypes():void{ var _local2:Number; var _local1:int; while (_local1 < pairs.length) { if (pairs[_local1][1].search(/[^0-9\.\-]/) == -1){ _local2 = Number(pairs[_local1][1]); if (_local2 == Math.floor(Math.abs(_local2))){ pairs[_local1][1] = int(_local2); } else { pairs[_local1][1] = _local2; }; } else { switch (pairs[_local1][1].toLowerCase()){ case "object": pairs[_local1][1] = new Object(); break; case "true": pairs[_local1][1] = true; break; case "false": pairs[_local1][1] = false; break; default: break; }; }; _local1++; }; } public function toString():String{ if (pairs == null){ return (urlEncoding); }; return (pairs.toString()); } protected function parsePairs():void{ var _local1:Array = grabPair(); while (_local1 != null) { pairs.push(_local1); _local1 = grabPair(); }; } protected function setRef(_arg1:String, _arg2):Object{ var _local3:* = this; var _local4:Array = _arg1.split(".", maxObjectDepth); var _local5:int; while (_local5 < (_local4.length - 1)) { if (_local3[_local4[_local5]] == null){ _local3[_local4[_local5]] = new Object(); }; _local3 = _local3[_local4[_local5]]; _local5++; }; if (_local3[_local4[(_local4.length - 1)]] == null){ _local3[_local4[(_local4.length - 1)]] = _arg2; }; return (_local3); } protected function grabValue():String{ var _local1:int = urlIndex; while (((!((urlEncoding.charAt(_local1) == "&"))) && (!((urlEncoding.charAt(_local1) == ""))))) { _local1++; }; var _local2:String = urlEncoding.substring(urlIndex, _local1); urlIndex = (_local1 + 1); return (_local2); } protected function percentDecodeValues():void{ var _local1:int; while (_local1 < pairs.length) { pairs[_local1][1] = percentDecode(pairs[_local1][1]); _local1++; }; } protected function convertPairsToVariables():void{ var _local1:int; while (_local1 < pairs.length) { setRef(pairs[_local1][0], pairs[_local1][1]); _local1++; }; } protected function grabName():String{ var _local1:int = urlIndex; var _local2:int; while (urlEncoding.charAt(_local1) != "=") { if (_local2 > maxBuffLen){ while (urlEncoding.charAt(_local1) != "&") { _local1++; }; urlIndex = _local1; return (""); }; if ((((urlEncoding.charAt(_local1) == "&")) || ((urlEncoding.charAt(_local1) == "")))){ urlIndex = (_local1 + 1); return (""); }; _local2++; _local1++; }; var _local3:String = urlEncoding.substring(urlIndex, _local1); urlIndex = (_local1 + 1); return (_local3); } public function contence():Array{ return (pairs); } public static function percentDecode(_arg1:String):String{ var _local3:int; var _local4:String; var _local2:int = _arg1.indexOf("%", 0); while (_local2 != -1) { _local3 = int(("0x" + _arg1.substr((_local2 + 1), 2))); if ((((_local3 < 32)) || ((_local3 == 127)))){ _local4 = ""; } else { _local4 = String.fromCharCode(_local3); }; _arg1 = ((_arg1.substring(0, _local2) + _local4) + _arg1.substring((_local2 + 3))); _local2 = _arg1.indexOf("%", (_local2 + 1)); }; return (_arg1); } public static function stripAnds(_arg1:String):String{ var _local3:int; var _local2 = -1; while ((_local2 = _arg1.indexOf("&", (_local2 + 1))) != -1) { _local3 = _local2; do { ++_local3; } while (_arg1.charAt(_local3) == "&"); _arg1 = (_arg1.substring(0, (_local2 + 1)) + _arg1.substring(_local3)); }; if (_arg1.charAt(0) == "&"){ _arg1 = _arg1.substring(1); }; if (_arg1.charAt((_arg1.length - 1)) == "&"){ _arg1 = _arg1.substring(0, (_arg1.length - 1)); }; return (_arg1); } } }//package unitescore.utils
Section 15
//CUniteScoreAS3 (unitescore.CUniteScoreAS3) package unitescore { import flash.events.*; import flash.display.*; import flash.text.*; import flash.net.*; import flash.utils.*; import unitescore.mochi.*; import unitescore.utils.*; import unitescore.nonoba.*; import flash.external.*; public class CUniteScoreAS3 { private var sendLocalConnection:LocalConnection; public var DEBUGFIELD:TextField; private var logoStartStamp:int; private var initTimer:Timer; private var gameParams:Object; private var mindJoltAPI:Object; private var apiGUIParams:Object; private var logo_mc:MovieClip; private var logoSet:Boolean; private var scoreParams:Array; private var pendingScore:int; private var logoLayout:int; private var kongregateAPI:Object; private var apiGUI:DisplayObject; private var urlOrig:String; private var mochiadsGameID:String; private var logoDuration:int; private var url:String; private var mochiadsBoardID:String; public var mainScoreCategory:String;// = "" private var ipb_compatible:Boolean;// = false private var logoClasses:Array; public static var LEFT:int = 6; public static var BOTTOM_RIGHT:int = 3; public static var BOTTOM:int = 4; public static var CENTER:int = 8; public static var TOP_LEFT:int = 7; public static var TOP_RIGHT:int = 1; public static var theroot:MovieClip; public static var TOP:int = 0; public static var BOTTOM_LEFT:int = 5; public static var RIGHT:int = 2; public function CUniteScoreAS3(_arg1:MovieClip, _arg2:TextField=null, _arg3:String=null, _arg4:Object=null){ var _local5:String; sendLocalConnection = new LocalConnection(); logoClasses = [{mcclass:"MCkongregate", domain:"kongregate.com"}, {mcclass:"MCpepere", domain:"pepere.org"}, {mcclass:"MCbubblebox", domain:"bubblebox.com"}, {mcclass:"MCnewgrounds", domain:"ungrounded.net"}, {mcclass:"MCnonoba", domain:"nonoba.com"}, {mcclass:"MCmindjolt", domain:"mindjolt.com"}, {mcclass:"MCaddictinggames", domain:"addictinggames.com"}, {mcclass:"MCgamesgarden", domain:"games-garden.com"}, {mcclass:"MCgamegarage", domain:"gamegarage.co.uk"}, {mcclass:"MCgameshot", domain:"gameshot.org"}, {mcclass:"MCgamebrew", domain:"gamebrew.com"}, {mcclass:"MCminijuegos", domain:"72.36.157."}, {mcclass:"MCminijuegos", domain:"72.232."}, {mcclass:"MConemorelevel", domain:"onemorelevel.com"}]; scoreParams = [{domain:"kongregate.com", GUI:false, needUrlVars:["api_path"]}, {domain:"pepere.org", GUI:false, needUrlVars:["pepereGameID"]}, {domain:"jeuxgratuits.net", GUI:false, needUrlVars:[]}, {domain:"bubblebox.com", GUI:true, needUrlVars:["bubbleboxGameID", "bubbleboxApiPath"]}, {domain:"gamegarage.co.uk", GUI:true, needUrlVars:["game_id", "gamegarageApiPath"]}, {domain:"nonoba.com", GUI:false, needUrlVars:[]}, {domain:"mindjolt.com", GUI:false, needUrlVars:["mjPath"]}, {domain:"gr8games.eu", GUI:false, needUrlVars:["gr8games_api"]}, {domain:"e-gierki.com", GUI:false, needUrlVars:["gr8games_api"]}, {domain:"gamebrew.com", GUI:false, needUrlVars:[]}, {domain:"games-garden.com", GUI:true, needUrlVars:["isUser", "gname"]}]; super(); if (_arg2 != null){ DEBUGFIELD = _arg2; }; if (DEBUGFIELD){ DEBUGFIELD.appendText("\n"); }; CUniteScoreAS3.theroot = _arg1; if (_arg3 == null){ url = theroot.stage.loaderInfo.url; } else { url = _arg3; }; urlOrig = url; url = url.toLocaleLowerCase(); if (_arg4 == null){ gameParams = LoaderInfo(theroot.loaderInfo).parameters; } else { gameParams = _arg4; }; sendLocalConnection.addEventListener(StatusEvent.STATUS, onConnStatus); init(); if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 url=" + urlOrig) + "\n")); DEBUGFIELD.appendText("CUniteScoreAS3 gameParams=\n"); for (_local5 in gameParams) { DEBUGFIELD.appendText(((((" " + _local5) + "=") + gameParams[_local5]) + "\n")); }; }; } private function onConnStatus(_arg1:StatusEvent):void{ switch (_arg1.level){ case "status": if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 LocalConnection.send() succeeded\n"); }; break; case "error": if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 LocalConnection.send() failed\n"); }; break; }; } public function isScorePoweredByGUI():Boolean{ var _local1:int; while (_local1 < scoreParams.length) { if (url.indexOf(scoreParams[_local1].domain) > -1){ return (scoreParams[_local1].GUI); }; _local1++; }; if (ipb_compatible){ return (true); }; if (((!((mochiadsGameID == null))) && (!((mochiadsBoardID == null))))){ return (true); }; return (false); } private function init():void{ var j:int; var basedir:String; var ipb_gname:String; var fname:String; var urlRequest:URLRequest; var urlLoader:URLLoader; var loader:Loader = new Loader(); var i:int; while (i < scoreParams.length) { if (url.indexOf(scoreParams[i].domain) > -1){ if (scoreParams[i].needUrlVars.length > 0){ j = 0; while (j < scoreParams[i].needUrlVars.length) { if (gameParams[scoreParams[i].needUrlVars[j]] == null){ topGameParams(); if (gameParams[scoreParams[i].needUrlVars[j]] == null){ delayedInit(); return; }; }; j = (j + 1); }; }; break; }; i = (i + 1); }; if (url.indexOf("mindjolt.com") > -1){ loader.contentLoaderInfo.addEventListener(Event.COMPLETE, mindJoltComplete); loader.load(new URLRequest(gameParams.mjPath)); theroot.addChild(loader); } else { if (url.indexOf("kongregate.com") > -1){ loader.contentLoaderInfo.addEventListener(Event.COMPLETE, kongregateComplete); loader.load(new URLRequest(gameParams.api_path)); theroot.addChild(loader); } else { if ((((urlOrig.indexOf("/arcade/") > -1)) || ((urlOrig.indexOf("/Games/") > -1)))){ basedir = "arcade"; ipb_gname = getIPBgname(); fname = (((("arcade/gamedata/" + ipb_gname) + "/") + ipb_gname) + ".txt"); urlRequest = new URLRequest(fname); urlLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, IPBArcadeComplete); urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); if (DEBUGFIELD){ DEBUGFIELD.appendText((((("CUniteScoreAS3 IPB init, ipb_gname=" + ipb_gname) + " loading ") + fname) + "\n")); }; try { urlLoader.load(urlRequest); } catch(e:Error) { if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 IPB init, Error " + e) + "\n")); }; }; }; }; }; } private function logoLoop(_arg1:Event):void{ var ev = _arg1; if ((getTimer() - logoStartStamp) > logoDuration){ logo_mc.removeEventListener(Event.ENTER_FRAME, logoLoop); try { theroot.removeChild(logo_mc); } catch(e:Error) { trace(("Logo remove error : " + e)); }; } else { if (!logoSet){ try { if ((((((logoLayout == TOP_LEFT)) || ((logoLayout == TOP)))) || ((logoLayout == TOP_RIGHT)))){ logo_mc.y = 10; } else { if ((((((logoLayout == BOTTOM_LEFT)) || ((logoLayout == BOTTOM)))) || ((logoLayout == BOTTOM_RIGHT)))){ logo_mc.y = ((theroot.loaderInfo.height - logo_mc.height) - 10); } else { if (logoLayout == CENTER){ logo_mc.y = ((theroot.loaderInfo.height / 2) - (logo_mc.height / 2)); }; }; }; if ((((((logoLayout == TOP_LEFT)) || ((logoLayout == LEFT)))) || ((logoLayout == BOTTOM_LEFT)))){ logo_mc.x = 10; } else { if ((((((logoLayout == TOP_RIGHT)) || ((logoLayout == RIGHT)))) || ((logoLayout == BOTTOM_RIGHT)))){ logo_mc.x = ((theroot.loaderInfo.width - logo_mc.width) - 10); } else { if (logoLayout == CENTER){ logo_mc.x = ((theroot.loaderInfo.width / 2) - (logo_mc.width / 2)); }; }; }; theroot.addChild(logo_mc); logoSet = true; logoStartStamp = getTimer(); } catch(e:Error) { trace(("Logo position failed : " + e)); }; } else { if ((getTimer() - logoStartStamp) > (logoDuration - 1000)){ if (logo_mc.alpha > 0){ logo_mc.alpha = (((logoStartStamp + logoDuration) - getTimer()) / 1000); if (logo_mc.alpha <= 0){ logo_mc.alpha = 0; }; }; } else { if (logo_mc.alpha < 1){ logo_mc.alpha = ((getTimer() - logoStartStamp) / 1000); if (logo_mc.alpha >= 1){ logo_mc.alpha = 1; }; }; }; }; }; } private function delayedInit():void{ if (DEBUGFIELD){ DEBUGFIELD.appendText("delayedInit()\n"); }; initTimer = new Timer(1000); initTimer.addEventListener("timer", onDelayedInit); initTimer.start(); } private function showScoreGUI():void{ if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 showScoreGUI\n"); }; try { theroot.removeChild(apiGUI); } catch(e:Error) { }; theroot.addChild(apiGUI); apiGUI.x = ((theroot.loaderInfo.width / 2) - (apiGUIParams.w / 2)); apiGUI.y = ((theroot.loaderInfo.height / 2) - (apiGUIParams.h / 2)); } private function IPBArcadeCheatComplete(_arg1:Event):void{ var _local4:URLRequest; var _local5:URLVariables; var _local2:URLLoader = URLLoader(_arg1.target); var _local3:URLVars = new URLVars(_local2.data); if (DEBUGFIELD){ DEBUGFIELD.appendText((((((("CUniteScoreAS3 IPBArcadeCheatComplete, urlVars.savescore=" + _local3.savescore) + " urlVars.randchar=") + _local3.randchar) + " urlVars.randchar2=") + _local3.randchar2) + "\n")); }; if (_local3.savescore == 1){ _local4 = new URLRequest("index.php?autocom=arcade&do=savescore"); _local4.method = URLRequestMethod.POST; _local5 = new URLVariables(); if (gameParams.ibpro_gameid){ _local5.arcadegid = gameParams.ibpro_gameid; }; _local5.gscore = pendingScore; _local5.gname = getIPBgname(); _local5.enscore = ((pendingScore * _local3.randchar) ^ _local3.randchar2); if (DEBUGFIELD){ DEBUGFIELD.appendText((((((((("CUniteScoreAS3 IPBArcadeCheatComplete, urlVars2.arcadegid=" + _local5.arcadegid) + " urlVars2.gscore=") + _local5.gscore) + " urlVars2.gname=") + _local5.gname) + " urlVars2.enscore=") + _local5.enscore) + "\n")); }; _local4.data = _local5; navigateToURL(_local4, (DEBUGFIELD) ? "_blank" : "_self"); }; } private function securityErrorHandler(_arg1:SecurityErrorEvent):void{ if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 securityErrorHandler : " + _arg1) + "\n")); }; } private function getIPBgname():String{ var _local4:String; var _local1 = ""; var _local2 = ""; var _local3:Number = urlOrig.indexOf(".swf"); if (_local3 > -1){ _local4 = urlOrig.substr(0, (_local3 + 4)); } else { _local4 = urlOrig; }; var _local5:Number = (_local4.lastIndexOf("\\") + 1); if ((((_local5 == -1)) || ((_local5 == 0)))){ _local5 = (_local4.lastIndexOf("/") + 1); }; var _local6:Number = _local5; var _local7:Number = _local4.length; while (_local6 < _local7) { _local2 = _local4.charAt(_local6); if (_local2 == "."){ break; }; _local1 = (_local1 + _local2); _local6++; }; return (_local1); } private function kongregateComplete(_arg1:Event):void{ kongregateAPI = _arg1.target.content; kongregateAPI.services.connect(); } public function setMainScoreCategory(_arg1:String):void{ mainScoreCategory = _arg1; } private function onDelayedInit(_arg1:Event):void{ initTimer.stop(); initTimer.removeEventListener("timer", onDelayedInit); initTimer = null; init(); } private function IPBArcadeComplete(_arg1:Event):void{ var _local2:URLLoader = URLLoader(_arg1.target); var _local3:URLVars = new URLVars(_local2.data); ipb_compatible = true; if (DEBUGFIELD){ DEBUGFIELD.appendText((((("CUniteScoreAS3 IPBArcadeComplete, success! scoreVar=" + _local3.scoreVar) + " urlVars=") + _local3) + "\n")); }; } private function bubbleboxComplete(_arg1:Event):void{ var e = _arg1; if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 bubbleboxComplete\n"); }; showScoreGUI(); try { sendLocalConnection.send(("bubbleboxRcvApi" + gameParams.bubbleboxGameID), "sendScore", pendingScore); } catch(error:ArgumentError) { }; } public function showLogo(_arg1:int=3, _arg2:int=5000):void{ var logoClass:Class; var i:int; var layout = _arg1; var duration = _arg2; if (logo_mc != null){ return; }; if (duration < 2000){ duration = 2000; }; if (theroot.loaderInfo.bytesLoaded < theroot.loaderInfo.bytesTotal){ logoLayout = layout; logoDuration = duration; theroot.loaderInfo.addEventListener(Event.COMPLETE, showLogoDelayed); return; }; i = (logoClasses.length - 1); while (i >= 0) { if (url.indexOf(logoClasses[i].domain) > -1){ try { logoClass = Class(getDefinitionByName(("unitescore." + logoClasses[i].mcclass))); } catch(e:Error) { break; }; }; i = (i - 1); }; if (logoClass){ try { logo_mc = MovieClip(new (logoClass)); logoDuration = duration; logoLayout = layout; logoSet = false; logoStartStamp = getTimer(); logo_mc.alpha = 0; logo_mc.addEventListener(Event.ENTER_FRAME, logoLoop); } catch(e:Error) { logo_mc = null; trace(("Logo instance creation failed : " + e)); }; }; } private function topGameParams():void{ var topLoader:Object; if (DEBUGFIELD){ DEBUGFIELD.appendText("topGameParams()\n"); }; try { topLoader = LoaderInfo(theroot.loaderInfo).loader; gameParams = LoaderInfo(topLoader.loaderInfo).parameters; } catch(e:Error) { if (DEBUGFIELD){ DEBUGFIELD.appendText((("topGameParams Error " + e) + "\n")); }; }; } private function loadScoreGUI(_arg1:String, _arg2:URLVariables, _arg3:Function):void{ var _local4:Loader = new Loader(); _local4.contentLoaderInfo.addEventListener(Event.COMPLETE, _arg3); if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 loadScoreGUI apiPath=" + _arg1) + "\n")); }; var _local5:URLRequest = new URLRequest(_arg1); _local5.method = URLRequestMethod.GET; _local5.data = _arg2; _local4.load(_local5); apiGUI = _local4; } private function httpStatusHandler(_arg1:HTTPStatusEvent):void{ if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 httpStatusHandler : " + _arg1) + "\n")); }; } private function mindJoltComplete(_arg1:Event):void{ mindJoltAPI = _arg1.target.content; mindJoltAPI.service.connect(); } public function initMochiAdsLeaderboard(_arg1:String, _arg2:String):void{ mochiadsGameID = _arg1; mochiadsBoardID = _arg2; var _local3:MovieClip = new MovieClip(); theroot.addChild(_local3); MochiServices.connect(mochiadsGameID, _local3); } private function ioErrorHandler(_arg1:IOErrorEvent):void{ if (DEBUGFIELD){ DEBUGFIELD.appendText((("CUniteScoreAS3 ioErrorHandler : " + _arg1) + "\n")); }; } public function sendScore(_arg1:int, _arg2:String=""):void{ var urlRequest:URLRequest; var urlVars:URLVariables; var urlLoader:URLLoader; var loader:Loader; var res:Object; var nonoba_key:String; var score = _arg1; var category = _arg2; if (DEBUGFIELD){ DEBUGFIELD.appendText((((("sendScore score=" + score) + " category=") + category) + "\n")); }; try { if (url.indexOf("pepere.org") > -1){ if (category == mainScoreCategory){ try { sendLocalConnection.send(("pepereRcvApi" + gameParams.pepereGameID), "sendScore", score); } catch(error:ArgumentError) { }; }; } else { if (url.indexOf("jeuxgratuits.net") > -1){ res = ExternalInterface.call("flashScoreService", score, category); if (DEBUGFIELD){ DEBUGFIELD.appendText((("sendScore ExternalInterface.call res=" + res) + "\n")); }; } else { if (url.indexOf("mindjolt.com") > -1){ if (!mindJoltAPI){ return; }; if (category == mainScoreCategory){ mindJoltAPI.service.submitScore(score); } else { mindJoltAPI.service.submitScore(score, category); }; } else { if (url.indexOf("kongregate.com") > -1){ if (!kongregateAPI){ return; }; if (category == mainScoreCategory){ kongregateAPI.scores.submit(score); } else { kongregateAPI.scores.submit(score, category); }; } else { if (url.indexOf("nonoba.com") > -1){ if (category == mainScoreCategory){ nonoba_key = "totalscores"; } else { nonoba_key = category.split(" ").join("").split("-").join("").toLowerCase(); }; NonobaAPI.SubmitScore(theroot.stage, nonoba_key, score, function (_arg1:String):void{ switch (_arg1){ case NonobaAPI.SUCCESS: trace("The Nonoba score was submitted successfully"); break; case NonobaAPI.NOT_LOGGED_IN: trace("The Nonoba user is not logged in"); break; case NonobaAPI.ERROR: trace("A Nonoba error occurred."); break; }; }); } else { if (url.indexOf("gamebrew.com") > -1){ if (category == mainScoreCategory){ try { sendLocalConnection.send("gbapi", "scoreSubmit", score); } catch(error:ArgumentError) { }; }; } else { if ((((url.indexOf("gr8games.eu") > -1)) || ((url.indexOf("e-gierki.com") > -1)))){ if (category == mainScoreCategory){ try { sendLocalConnection.send(gameParams.gr8games_api, "submitScore", score); } catch(error:ArgumentError) { }; } else { try { sendLocalConnection.send(gameParams.gr8games_api, "submitScore", score, category); } catch(error:ArgumentError) { }; }; } else { if (url.indexOf("bubblebox.com") > -1){ if (category == mainScoreCategory){ if (apiGUI != null){ showScoreGUI(); try { sendLocalConnection.send(("bubbleboxRcvApi" + gameParams.bubbleboxGameID), "sendScore", pendingScore); } catch(error:ArgumentError) { }; } else { apiGUIParams = {w:400, h:200}; pendingScore = score; urlVars = new URLVariables(); urlVars.bubbleboxGameID = gameParams.bubbleboxGameID; loadScoreGUI(gameParams.bubbleboxApiPath, urlVars, bubbleboxComplete); }; }; } else { if (url.indexOf("gamegarage.co.uk") > -1){ if (category == mainScoreCategory){ if (apiGUI != null){ showScoreGUI(); try { sendLocalConnection.send(("gamegarageRcvApi" + gameParams.game_id), "sendScore", pendingScore); } catch(error:ArgumentError) { }; } else { trace(((((("gameParams.gamegarageApiPath=" + gameParams.gamegarageApiPath) + " gameParams.game_id=") + gameParams.game_id) + " gameParams.user_id=") + gameParams.user_id)); apiGUIParams = {w:550, h:400}; pendingScore = score; urlVars = new URLVariables(); urlVars.game_id = gameParams.game_id; if (gameParams.user_id){ urlVars.user_id = gameParams.user_id; }; loadScoreGUI(gameParams.gamegarageApiPath, urlVars, gamegarageComplete); }; }; } else { if ((((((url.indexOf("games-garden.com") > -1)) && ((gameParams.isUser == "1")))) && (gameParams.gname))){ if (category == mainScoreCategory){ urlRequest = new URLRequest("http://www.games-garden.com/index.php?act=Arcade&do=newscore"); urlVars = new URLVariables(); urlVars.gname = gameParams.gname; urlVars.gscore = score; if (DEBUGFIELD){ DEBUGFIELD.appendText((((("http://www.games-garden.com/index.php?act=Arcade&do=newscore POST gname=" + urlVars.gname) + " gscore=") + urlVars.gscore) + "\n")); }; urlRequest.method = URLRequestMethod.POST; urlRequest.data = urlVars; navigateToURL(urlRequest, (DEBUGFIELD) ? "_blank" : "_self"); }; } else { if (ipb_compatible){ if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 IPB score submit\n"); }; pendingScore = score; urlRequest = new URLRequest("index.php?autocom=arcade&do=verifyscore"); urlRequest.method = URLRequestMethod.POST; urlLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, IPBArcadeCheatComplete); urlLoader.load(urlRequest); } else { if (((!((mochiadsGameID == null))) && (!((mochiadsBoardID == null))))){ if (category == mainScoreCategory){ MochiScores.showLeaderboard({boardID:mochiadsBoardID, score:score}); }; }; }; }; }; }; }; }; }; }; }; }; }; } catch(e:Error) { if (DEBUGFIELD){ DEBUGFIELD.appendText((("An exception occured during sendScore : " + e) + "\n")); }; }; } private function gamegarageComplete(_arg1:Event):void{ var e = _arg1; if (DEBUGFIELD){ DEBUGFIELD.appendText("CUniteScoreAS3 gamegarageComplete\n"); }; showScoreGUI(); try { sendLocalConnection.send(("gamegarageRcvApi" + gameParams.game_id), "sendScore", pendingScore); } catch(error:ArgumentError) { }; } private function showLogoDelayed(_arg1:Event):void{ showLogo(logoLayout, logoDuration); } } }//package unitescore
Section 16
//engine (engine) package { import flash.display.*; import flash.text.*; import flash.geom.*; public class engine extends Sprite { public var bd:BitmapData; public var maxBox:int;// = 30 public var boxs:Array; public var xCenter:int;// = 250 public var tf:TextField; public var ySpeed:Number;// = 3.5 public var lives:int;// = 3 public var score:int; public var yCenter:int;// = 150 public function engine(){ boxs = new Array(); super(); bd = new BitmapData(500, 300, false, 0); var _local1:int; var _local2:int; var _local3:int; while (_local3 < maxBox) { _local1 = (Math.random() * 1300); _local2 = (Math.random() * 100); boxs[_local3] = new Point(_local1, _local2); _local3++; }; tf = new TextField(); tf.textColor = 0xFFFFFF; tf.text = "0"; tf.selectable = false; tf.autoSize = TextFieldAutoSize.LEFT; addChild(new Bitmap(bd)); addChild(tf); score = 0; lives = 3; } public function drawScene(_arg1:Number):void{ bd.fillRect(bd.rect, 0); var _local2:Number = (-500 + _arg1); this.line(xCenter, yCenter, _local2, 0); var _local3:Number = ((800 + _arg1) + 2); this.line(xCenter, yCenter, _local3, 0); while (_local2 <= _local3) { this.line(xCenter, yCenter, _local2, 300); _local2 = (_local2 + 50); }; var _local4:int; var _local5:int; var _local6:int; _local2 = 0; while (_local2 < maxBox) { _local4 = ((4.3346 * boxs[_local2].y) + 9.0397); boxs[_local2].y = (boxs[_local2].y + ((ySpeed * _local4) / 500)); _local5 = (xCenter + ((((boxs[_local2].x + _arg1) - 750) / 1300) * _local4)); _local6 = (yCenter + ((boxs[_local2].y * 140) / 300)); if (_local6 > 310){ _local5 = (Math.random() * 1300); _local6 = (Math.random() * 50); boxs[_local2] = new Point(_local5, _local6); _local4 = ((4.3346 * boxs[_local2].y) + 9.0397); _local5 = (xCenter + ((((boxs[_local2].x + _arg1) - 750) / 1300) * _local4)); _local6 = (yCenter + ((boxs[_local2].y * 140) / 300)); }; if ((((_local5 > 230)) && ((_local5 < 270)))){ if ((((_local6 > 270)) && ((_local6 < 290)))){ lives--; _local5 = (Math.random() * 1300); _local6 = (Math.random() * 50); boxs[_local2] = new Point(_local5, _local6); _local4 = ((4.3346 * boxs[_local2].y) + 9.0397); _local5 = (xCenter + ((((boxs[_local2].x + _arg1) - 750) / 1300) * _local4)); _local6 = (yCenter + ((boxs[_local2].y * 140) / 300)); }; }; drawBox(_local5, _local6, (boxs[_local2].y / 10)); _local2++; }; line(250, 270, 240, 290, 0xFFFF); line(250, 270, 260, 290, 0xFFFF); line(240, 290, 260, 290, 0xFFFF); ySpeed = (ySpeed + 0.00085); score++; tf.text = score.toString(); if (lives == 3){ line(400, 10, 390, 40, 0xFFFF); line(400, 10, 410, 40, 0xFFFF); line(409, 40, 389, 40, 0xFFFF); }; if (lives >= 2){ line(430, 10, 420, 40, 0xFFFF); line(430, 10, 440, 40, 0xFFFF); line(439, 40, 419, 40, 0xFFFF); }; if (lives >= 1){ line(460, 10, 450, 40, 0xFFFF); line(460, 10, 470, 40, 0xFFFF); line(469, 40, 449, 40, 0xFFFF); }; } public function line(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:uint=0xFFFFFF):void{ var _local12:Boolean; var _local13:int; var _local6:int = (_arg4 - _arg2); var _local7:int = (_arg3 - _arg1); if (((_local6 ^ (_local6 >> 31)) - (_local6 >> 31)) > ((_local7 ^ (_local7 >> 31)) - (_local7 >> 31))){ _local6 = (_local6 ^ _local7); _local7 = (_local7 ^ _local6); _local6 = (_local6 ^ _local7); _local12 = true; } else { _local12 = false; }; var _local8:int = ((_local7 < 0)) ? -1 : 1; var _local9:Number = ((_local7 == 0)) ? _local6 : (_local6 / _local7); var _local10:Number = 0; var _local11:int; if (_local12){ _local10 = _arg1; _local13 = 0; while (((((!((_local13 == _local7))) && ((_local13 > -500)))) && ((_local13 < 500)))) { _local11 = _local10; bd.setPixel(_local11, (_arg2 + _local13), _arg5); _local10 = (_local10 + (_local9 * _local8)); _local13 = (_local13 + _local8); }; } else { _local10 = _arg2; _local13 = 0; while (((((!((_local13 == _local7))) && ((_local13 > -500)))) && ((_local13 < 500)))) { _local11 = _local10; bd.setPixel((_arg1 + _local13), _local11, _arg5); _local10 = (_local10 + (_local9 * _local8)); _local13 = (_local13 + _local8); }; }; } public function drawBox(_arg1:int, _arg2:int, _arg3:int):void{ _arg1 = (_arg1 - (_arg3 / 2)); _arg2 = (_arg2 - _arg3); bd.setPixel(_arg1, _arg2, 0xFF00); var _local4 = 1; while (_local4 < _arg3) { bd.setPixel(_arg1, (_arg2 + _local4), 0xFF00); bd.setPixel((_arg1 + _local4), _arg2, 0xFF00); _local4++; }; _local4--; _arg3--; while (_arg3 > 0) { bd.setPixel((_arg1 + _arg3), (_arg2 + _local4), 0xFF00); bd.setPixel((_arg1 + _local4), (_arg2 + _arg3), 0xFF00); _arg3--; }; } } }//package
Section 17
//Main (Main) package { import flash.events.*; import flash.display.*; import flash.text.*; import mochi.as3.*; import unitescore.*; public class Main extends MovieClip { private var keyDown:Array; public var ad:Boolean;// = true public var frame:Sprite; public var clickAwayAdMC:MovieClip; public static var theEngine:engine; public static var scoreSubmitter:CUniteScoreAS3; public static var sceneX:Number = 0; public static var xSpeed:Number = 0; public function Main():void{ keyDown = new Array(); super(); if (stage){ init(); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } public function tryagain(_arg1:MouseEvent):void{ frame.removeChild(clickAwayAdMC); sceneX = 0; theEngine = new engine(); frame.addChild(theEngine); addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onKeyDown(_arg1:KeyboardEvent):void{ keyDown[_arg1.keyCode] = true; } private function init(_arg1:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); frame = new Sprite(); theEngine = new engine(); frame.addChild(theEngine); addChild(frame); addEventListener(Event.ENTER_FRAME, onEnterFrame); stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); scoreSubmitter = new CUniteScoreAS3(this); scoreSubmitter.initMochiAdsLeaderboard("3454eac1cb0d7147", "7324a7c3c4203b24"); } private function onEnterFrame(_arg1:Event):void{ var _local2:TextFormat; var _local3:TextField; var _local4:BitmapData; var _local5:Bitmap; var _local6:Sprite; var _local7:Object; if (keyDown[39]){ xSpeed = (xSpeed - 0.5); } else { if (keyDown[37]){ xSpeed = (xSpeed + 0.5); } else { xSpeed = (xSpeed / 1.07); }; }; if (((((sceneX + xSpeed) < -550)) || (((sceneX + xSpeed) > 750)))){ xSpeed = -(xSpeed); }; sceneX = (sceneX + xSpeed); theEngine.drawScene(sceneX); if (theEngine.lives < 0){ removeEventListener(Event.ENTER_FRAME, onEnterFrame); clickAwayAdMC = new MovieClip(); frame.addChild(clickAwayAdMC); if (ad){ clickAwayAdMC; clickAwayAdMC.x = 190; clickAwayAdMC.y = 12; _local7 = {id:"3454eac1cb0d7147", clip:clickAwayAdMC}; MochiAd.showClickAwayAd(_local7); }; _local2 = new TextFormat(); _local2.size = 50; theEngine.tf.defaultTextFormat = _local2; theEngine.tf.text = theEngine.score.toString(); if (ad){ theEngine.tf.x = ((190 - theEngine.tf.textWidth) / 2); } else { theEngine.tf.x = ((500 - theEngine.tf.textWidth) / 2); }; theEngine.tf.y = 40; _local3 = new TextField(); _local3.textColor = 0; _local3.text = "Try again"; _local3.selectable = false; _local3.autoSize = TextFieldAutoSize.LEFT; _local3.x = 25; _local3.y = 0; _local4 = new BitmapData(100, 20, false, 0xFFFFFF); _local5 = new Bitmap(_local4); _local5.x = 0; _local5.y = 0; _local6 = new Sprite(); _local6.addChild(_local5); _local6.addChild(_local3); if (ad){ _local6.x = 45; } else { _local6.x = 200; }; _local6.y = 120; _local6.addEventListener(MouseEvent.MOUSE_UP, tryagain); frame.addChild(_local6); scoreSubmitter.sendScore(theEngine.score); }; } private function onKeyUp(_arg1:KeyboardEvent):void{ keyDown[_arg1.keyCode] = false; } } }//package
Section 18
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 19
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import flash.text.*; import mochi.as3.*; import flash.geom.*; public class Preloader extends MovieClip { public static var ad:Boolean = true; public static var adLoaded:Boolean = false; public static var background:BitmapData; public static var bitmap:Bitmap; public static var tf:TextField; public static var progRect:Rectangle; public function Preloader(){ super(); MochiBot.track(this, "f88248d4"); addEventListener(Event.ENTER_FRAME, checkFrame); loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress); var clickAwayAdMC:MovieClip = new MovieClip(); clickAwayAdMC.x = 100; clickAwayAdMC.y = 12; addChild(clickAwayAdMC); var opts:Object = {id:"3454eac1cb0d7147", clip:clickAwayAdMC, ad_loaded:function ():void{ adLoaded = true; }, ad_skipped:disableAd}; MochiAd.showClickAwayAd(opts); progRect = new Rectangle(1, 1, 478, 8); background = new BitmapData(480, 10, false, 0xFFFFFF); background.fillRect(progRect, 0); progRect = new Rectangle(2, 2, 0, 6); bitmap = new Bitmap(background); bitmap.x = 10; bitmap.y = 275; addChild(bitmap); } public function disableAd():void{ ad = false; } private function checkFrame(_arg1:Event):void{ if ((((currentFrame == totalFrames)) && (((adLoaded) || (!(ad)))))){ removeChild(bitmap); removeEventListener(Event.ENTER_FRAME, checkFrame); startup(); }; } private function progress(_arg1:ProgressEvent):void{ progRect.width = ((_arg1.bytesLoaded / _arg1.bytesTotal) * 476); background.fillRect(progRect, 0xFFFFFF); } private function startup():void{ tf = new TextField(); tf.textColor = 0; tf.text = "Play"; tf.selectable = false; tf.autoSize = TextFieldAutoSize.LEFT; tf.x = 235; tf.y = 270; background = new BitmapData(100, 20, false, 0xFFFFFF); bitmap = new Bitmap(background); bitmap.x = 200; bitmap.y = 270; var _local1:Sprite = new Sprite(); _local1.addChild(bitmap); _local1.addChild(tf); _local1.addEventListener(MouseEvent.MOUSE_UP, mouse); addChild(_local1); stop(); loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress); } public function mouse(_arg1:MouseEvent):void{ var _local2:MovieClip = new Main(); _local2.ad = ad; addChild(_local2); } } }//package

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 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
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"start"Frame 2




http://swfchan.com/28/135067/info.shtml
Created: 10/8 -2019 02:21:31 Last modified: 10/8 -2019 02:21:31 Server time: 22/12 -2024 12:33:21