Section 1
//actve_178 (gangnamstyle_fla.actve_178)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class actve_178 extends MovieClip {
public function actve_178(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
gotoAndStop(1);
}
}
}//package gangnamstyle_fla
Section 2
//cfghx_189 (gangnamstyle_fla.cfghx_189)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class cfghx_189 extends MovieClip {
public var hitMc:MovieClip;
public function cfghx_189(){
addFrameScript(2, frame3, 6, frame7);
}
function frame3(){
MovieClip(root).checkHit(hitMc);
}
function frame7(){
MovieClip(parent).gotoAndStop(4);
}
}
}//package gangnamstyle_fla
Section 3
//countdownmc_200 (gangnamstyle_fla.countdownmc_200)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class countdownmc_200 extends MovieClip {
public function countdownmc_200(){
addFrameScript(88, frame89);
}
function frame89(){
MovieClip(root).startFighting();
stop();
}
}
}//package gangnamstyle_fla
Section 4
//countdownmccopy_203 (gangnamstyle_fla.countdownmccopy_203)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class countdownmccopy_203 extends MovieClip {
public function countdownmccopy_203(){
addFrameScript(88, frame89);
}
function frame89(){
MovieClip(root).startFighting();
stop();
}
}
}//package gangnamstyle_fla
Section 5
//countdownmccopy2_204 (gangnamstyle_fla.countdownmccopy2_204)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class countdownmccopy2_204 extends MovieClip {
public function countdownmccopy2_204(){
addFrameScript(88, frame89);
}
function frame89(){
MovieClip(root).startFighting();
stop();
}
}
}//package gangnamstyle_fla
Section 6
//dan_146 (gangnamstyle_fla.dan_146)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class dan_146 extends MovieClip {
public var health1:MovieClip;
public var health2:MovieClip;
public var health3:MovieClip;
public var health4:MovieClip;
public function dan_146(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 7
//dtrecopy2_176 (gangnamstyle_fla.dtrecopy2_176)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class dtrecopy2_176 extends MovieClip {
public function dtrecopy2_176(){
addFrameScript(37, frame38);
}
function frame38(){
stop();
MovieClip(root).levelOver();
}
}
}//package gangnamstyle_fla
Section 8
//ftcy_152 (gangnamstyle_fla.ftcy_152)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class ftcy_152 extends MovieClip {
public var health1:MovieClip;
public var health2:MovieClip;
public var health3:MovieClip;
public var health4:MovieClip;
public function ftcy_152(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 9
//fyud_164 (gangnamstyle_fla.fyud_164)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class fyud_164 extends MovieClip {
public var health1:MovieClip;
public var health2:MovieClip;
public var health3:MovieClip;
public var health4:MovieClip;
public function fyud_164(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 10
//gyuif_147 (gangnamstyle_fla.gyuif_147)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class gyuif_147 extends MovieClip {
public function gyuif_147(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 11
//gyuif1_153 (gangnamstyle_fla.gyuif1_153)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif1_153 extends MovieClip {
public function gyuif1_153(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 12
//gyuif3_165 (gangnamstyle_fla.gyuif3_165)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif3_165 extends MovieClip {
public function gyuif3_165(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 13
//gyuif3copy2_167 (gangnamstyle_fla.gyuif3copy2_167)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif3copy2_167 extends MovieClip {
public function gyuif3copy2_167(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 14
//gyuif3copy3_168 (gangnamstyle_fla.gyuif3copy3_168)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif3copy3_168 extends MovieClip {
public function gyuif3copy3_168(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 15
//gyuif3copy4_169 (gangnamstyle_fla.gyuif3copy4_169)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif3copy4_169 extends MovieClip {
public function gyuif3copy4_169(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 16
//gyuif3copy7_158 (gangnamstyle_fla.gyuif3copy7_158)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class gyuif3copy7_158 extends MovieClip {
public function gyuif3copy7_158(){
addFrameScript(1, frame2, 14, frame15);
}
function frame2(){
MovieClip(root).PlaySound(powerup);
}
function frame15(){
stop();
}
}
}//package gangnamstyle_fla
Section 17
//handsholder_179 (gangnamstyle_fla.handsholder_179)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class handsholder_179 extends MovieClip {
public var leftArm:MovieClip;
public var rightArm:MovieClip;
public function handsholder_179(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package gangnamstyle_fla
Section 18
//huyiog_201 (gangnamstyle_fla.huyiog_201)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class huyiog_201 extends MovieClip {
public function huyiog_201(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 19
//huyiogcopy_202 (gangnamstyle_fla.huyiogcopy_202)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class huyiogcopy_202 extends MovieClip {
public function huyiogcopy_202(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 20
//powerloader_177 (gangnamstyle_fla.powerloader_177)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class powerloader_177 extends MovieClip {
public var txt:MovieClip;
public function powerloader_177(){
addFrameScript(0, frame1, 100, frame101);
}
function frame1(){
stop();
MovieClip(root).DeactivatePower();
}
function frame101(){
trace("Actiiiiiii");
MovieClip(root).ActivatePowerup();
}
}
}//package gangnamstyle_fla
Section 21
//Sprite140_31 (gangnamstyle_fla.Sprite140_31)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class Sprite140_31 extends MovieClip {
public var startGameBtn:SimpleButton;
public function Sprite140_31(){
addFrameScript(131, frame132);
}
function frame132(){
stop();
}
}
}//package gangnamstyle_fla
Section 22
//Sprite144_182 (gangnamstyle_fla.Sprite144_182)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class Sprite144_182 extends MovieClip {
public function Sprite144_182(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 23
//Sprite147_183 (gangnamstyle_fla.Sprite147_183)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class Sprite147_183 extends MovieClip {
public function Sprite147_183(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 24
//Sprite152_180 (gangnamstyle_fla.Sprite152_180)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class Sprite152_180 extends MovieClip {
public var hitMc1:MovieClip;
public var hitMc:MovieClip;
public var leftBlock:MovieClip;
public function Sprite152_180(){
addFrameScript(0, frame1, 8, frame9, 10, frame11, 16, frame17, 25, frame26, 32, frame33);
}
function frame1(){
stop();
}
function frame9(){
gotoAndStop(1);
}
function frame11(){
MovieClip(root).checkHit(hitMc);
}
function frame17(){
gotoAndStop(1);
}
function frame26(){
MovieClip(root).checkHit(hitMc1);
}
function frame33(){
stop();
gotoAndStop(1);
}
}
}//package gangnamstyle_fla
Section 25
//Sprite156_187 (gangnamstyle_fla.Sprite156_187)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class Sprite156_187 extends MovieClip {
public function Sprite156_187(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 26
//Sprite157_185 (gangnamstyle_fla.Sprite157_185)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class Sprite157_185 extends MovieClip {
public var hitMc1:MovieClip;
public var rightBlock:MovieClip;
public var hitMc:MovieClip;
public function Sprite157_185(){
addFrameScript(0, frame1, 8, frame9, 10, frame11, 16, frame17, 26, frame27, 32, frame33);
}
function frame1(){
stop();
}
function frame9(){
gotoAndStop(1);
}
function frame11(){
MovieClip(root).checkHit(hitMc);
}
function frame17(){
gotoAndStop(1);
}
function frame27(){
MovieClip(root).checkHit(hitMc1);
}
function frame33(){
stop();
gotoAndStop(1);
}
}
}//package gangnamstyle_fla
Section 27
//Symbol1_209 (gangnamstyle_fla.Symbol1_209)
package gangnamstyle_fla {
import flash.display.*;
public dynamic class Symbol1_209 extends MovieClip {
public function Symbol1_209(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gangnamstyle_fla
Section 28
//weqwe_155 (gangnamstyle_fla.weqwe_155)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class weqwe_155 extends MovieClip {
public function weqwe_155(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 29
//weqwecopy_156 (gangnamstyle_fla.weqwecopy_156)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class weqwecopy_156 extends MovieClip {
public function weqwecopy_156(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 30
//weqwecopy2_157 (gangnamstyle_fla.weqwecopy2_157)
package gangnamstyle_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class weqwecopy2_157 extends MovieClip {
public function weqwecopy2_157(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
try {
MovieClip(root).setOpponentWarmup();
} catch(e) {
};
}
}
}//package gangnamstyle_fla
Section 31
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
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);
}
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 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);
};
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 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);
};
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 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 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 _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 load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _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;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
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 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 _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 _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
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 _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 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 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 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 adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
}
}//package mochi.as3
Section 32
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
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 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);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.addEventListener(_arg1, _arg2);
}
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);
}
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 33
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
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 reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 34
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_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 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);
};
}
}
}//package mochi.as3
Section 35
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
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 addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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 startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 36
//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 _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
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();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
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));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
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 putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
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 getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
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);
}
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 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++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 37
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
public static var onCloseHandler:Object;
public static var onErrorHandler:Object;
private static var boardID:String;
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
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);
}
}
}//package mochi.as3
Section 38
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
public static var servicesSync:MochiSync = new MochiSync();
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.8 as3");
}
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 isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
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 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 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 stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
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);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
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 loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
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");
};
}
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...");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
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 _callbacks[cb];
}
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;
};
}
public static function updateCopy(_arg1:Object):void{
MochiServices.send("coins_updateCopy", _arg1, null, null);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
if (_arg1 != null){
if (_arg1.onError != null){
_arg1.onError.apply(null, ["NotConnected"]);
};
if (((!((_arg1.options == null))) && (!((_arg1.options.onError == null))))){
_arg1.options.onError.apply(null, ["NotConnected"]);
};
};
if (_arg3 != null){
_arg1 = {};
_arg1.error = true;
_arg1.errorCode = "NotConnected";
if (((!((_arg2 == null))) && ((_arg3 is String)))){
try {
var _local4 = _arg2;
_local4[_arg3](_arg1);
} catch(error:Error) {
};
} else {
if (_arg3 != null){
try {
_arg3.apply(_arg1);
} catch(error:Error) {
};
};
};
};
}
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:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
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 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);
};
}
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);
}
}
}//package mochi.as3
Section 39
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
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 IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
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 getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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 removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
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 40
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_REQUEST:String = "SyncRequest";
public static var SYNC_PROPERTY:String = "UpdateProperty";
public function MochiSync():void{
_syncContainer = {};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
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});
}
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 41
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = 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 deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
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 errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
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 function getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
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 42
//bg_music (bg_music)
package {
import flash.media.*;
public dynamic class bg_music extends Sound {
}
}//package
Section 43
//Boxer (Boxer)
package {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
public dynamic class Boxer extends MovieClip {
public var Instruction:SimpleButton;
public var score_txt:TextField;
public var submit_btn1:SimpleButton;
public var player_health_mc:MovieClip;
public var bg:MovieClip;
public var count_down_mc:MovieClip;
public var logo_btn:SimpleButton;
public var char:MovieClip;
public var continueBtn:SimpleButton;
public var opponent_health_mc:MovieClip;
public var startGameBtn:SimpleButton;
public var _mochiads_game_id:String;
public var o:Object;
public var boardID:String;
public var localConnection:LocalConnection;
public var localDomainName:String;
public var gameWin:Boolean;// = false
var power_used:Boolean;// = false
var power_delay;
var power_up_counter;// = 0
var hitPower;// = 0
var bg_channel:SoundChannel;
public var gameoverDelay;
var shakeBG:Boolean;// = false
var counter:Number;// = 0
var mainC:Number;// = 0
var shakeCounter:Number;// = 0
var decrementCount:Number;// = 5
var playerHealth:Number;// = 100
var opponentHealth:Number;// = 100
public var boxerMode:String;// = "wait"
public var currentOpponentHealth:Number;// = 1
public var FinishBoxer:Boolean;// = false
var levelDelay;
public var score:Number;// = 0
var level:Number;// = 1
var powerMode:Boolean;// = false
var sound_channel:SoundChannel;
var begindelay;
public function Boxer(){
bg_channel = new SoundChannel();
sound_channel = new SoundChannel();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 8, frame9);
this.addEventListener(MouseEvent.MOUSE_UP, mouseUpOnStage);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onkeydown);
}
public function loadContextMenu():void{
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
var _local2:ContextMenuItem = new ContextMenuItem("666gamer");
_local1.customItems.push(_local2);
contextMenu = _local1;
_local2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visitSite);
}
public function visitSite(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://www.666gamer.com/"), "_blank");
}
public function submit2(_arg1:MouseEvent){
MochiScores.showLeaderboard({boardID:boardID, score:score});
}
function onkeydown(_arg1){
trace(_arg1.keyCode);
if (power_up_counter >= 100){
if (_arg1.keyCode == 32){
bg.power_mc.txt.play();
trace("pwer mode");
powerMode = true;
};
};
if (_arg1.keyCode == 88){
trace((boxerMode + "hihi"));
if ((((((boxerMode == "powerUp")) || ((boxerMode == "normal")))) && (!(FinishBoxer)))){
bg.hands.gotoAndStop(1);
if (bg.hands.leftArm != null){
bg.hands.leftArm.gotoAndPlay("block");
};
if (bg.hands.rightArm != null){
bg.hands.rightArm.gotoAndPlay("block");
};
};
};
}
public function DeactivatePower(){
powerMode = false;
}
public function ActivatePowerup(){
trace("Activate power up");
}
public function startFighting(){
boxerMode = "normal";
count_down_mc.visible = false;
}
function mouseUpOnStage(_arg1){
switch (_arg1.target.name){
case "continueBtn":
gotoAndStop(level);
break;
case "logo_btn":
navigateToURL(new URLRequest("http://www.666gamer.com/"));
break;
case "startGameBtn":
gotoAndStop(1, "instruction");
break;
case "Instruction":
gotoAndStop(1, "game");
break;
case "playBtn":
gotoAndStop(6);
break;
case "fightBtn":
gotoAndStop(2);
break;
case "fighterHitBtn":
if (((!((boxerMode == "normal"))) || ((boxerMode == "powerUp")))){
return;
};
if (power_up_counter >= 100){
power_up_counter = 100;
};
if (powerMode){
bg.hands.gotoAndStop("power");
if (bg.fighterHitBtn.mouseX < 0){
bg.hands.x = bg.fighterHitBtn.mouseX;
bg.hands.gotoAndStop("left_hit");
power_up_counter = (power_up_counter - 20);
} else {
bg.hands.x = bg.fighterHitBtn.mouseX;
bg.hands.gotoAndStop("right_hit");
power_up_counter = (power_up_counter - 20);
};
} else {
bg.hands.gotoAndStop(1);
};
if (power_up_counter < 0){
power_up_counter = 0;
};
if (power_up_counter == 0){
bg.power_mc.gotoAndStop(1);
powerMode = false;
} else {
bg.power_mc.gotoAndStop(power_up_counter);
};
if (power_up_counter == 100){
bg.power_mc.txt.visible = true;
} else {
bg.power_mc.txt.visible = false;
};
if (!powerMode){
bg.hands.gotoAndStop(1);
if ((((bg.fighterHitBtn.mouseX < 0)) && ((bg.fighterHitBtn.mouseX > -50)))){
bg.hands.x = bg.fighterHitBtn.mouseX;
if (bg.hands.leftArm != null){
bg.hands.leftArm.gotoAndPlay("straight_punch");
};
} else {
if (bg.fighterHitBtn.mouseX < -51){
bg.hands.x = bg.fighterHitBtn.mouseX;
if (bg.hands.leftArm != null){
bg.hands.leftArm.gotoAndPlay("cross_punch");
};
} else {
if ((((bg.fighterHitBtn.mouseX > 0)) && ((bg.fighterHitBtn.mouseX < 50)))){
bg.hands.x = bg.fighterHitBtn.mouseX;
if (bg.hands.leftArm != null){
bg.hands.rightArm.gotoAndPlay("straight_punch");
};
} else {
if (bg.fighterHitBtn.mouseX > 50){
bg.hands.x = bg.fighterHitBtn.mouseX;
if (bg.hands.leftArm != null){
bg.hands.rightArm.gotoAndPlay("cross_punch");
};
};
};
};
};
};
break;
case "playAgainBtn":
bg_channel.stop();
gotoAndStop(1, "Intro");
break;
case "submitBtn":
break;
};
}
function InitGameBgMusic(){
bg_channel.stop();
var _local1:* = new bg_music();
bg_channel = _local1.play(1, 20000);
}
function initializeGame(){
gameWin = false;
bg.power_mc.txt.visible = false;
shakeBG = false;
counter = 0;
mainC = 0;
score = 0;
level = 1;
shakeCounter = 0;
decrementCount = 5;
playerHealth = 100;
opponentHealth = 100;
currentOpponentHealth = 1;
FinishBoxer = false;
this.addEventListener(Event.ENTER_FRAME, bg_control);
count_down_mc.visible = true;
count_down_mc.play();
trace("played");
}
public function checkHit(_arg1){
var _local2:*;
var _local3:*;
if ((((bg.boxer.currentFrame >= 6)) || ((boxerMode == "powerUp")))){
return;
};
if (_arg1.hitTestObject(bg.boxer.hitMc)){
boxerMode = "wait";
if (bg.boxer.currentLabel == "finish"){
playHitSound();
boxerMode = "wait";
bg.boxer.gotoAndStop("felldown");
PlaySound(fall_down);
return;
};
bg.boxer.gotoAndStop("hit");
power_up_counter = (power_up_counter + 10);
shakeCounter = 5;
playHitSound();
_local2 = (1 + Math.floor((Math.random() * 3)));
_local3 = getDefinitionByName(("boxer_hit" + _local2));
PlaySound(_local3);
shakeBG = true;
score = (score + 100);
score_txt.text = (score + "");
reduceOpponentHealth();
} else {
PlaySound(notHit);
};
if (boxerMode == "powerUp"){
bg.boxer.gotoAndStop("power_up");
begindelay = setInterval(beginPowerUp, 800);
};
}
public function beginPowerUp(){
clearInterval(begindelay);
trace("cleed per");
power_delay = setInterval(callPower, 800);
}
function callPower(){
trace("----------------------------->nice");
hitPower++;
if (hitPower < 8){
if (bg.boxer != null){
bg.boxer.punchPlayer();
};
} else {
clearInterval(power_delay);
boxerMode = "normal";
};
}
function playHitSound(){
var _local1:* = (1 + Math.floor((Math.random() * 4)));
var _local2:* = getDefinitionByName(("punch" + _local1));
PlaySound(_local2);
}
public function PlaySound(_arg1){
var _local2:* = new (_arg1);
sound_channel = _local2.play();
}
function SetUpGameOverScene(){
bg_channel.stop();
var _local1:* = new GameOver();
bg_channel = _local1.play(1, 20000);
score_txt.text = (score + "");
if (playerHealth > 0){
};
}
public function reduceOpponentHealth(){
opponentHealth = (opponentHealth - decrementCount);
opponent_health_mc.gotoAndStop((100 - opponentHealth));
var _local1:* = (100 - opponentHealth);
if ((((_local1 > 25)) && ((_local1 <= 50)))){
currentOpponentHealth = 2;
};
if ((((_local1 > 50)) && ((_local1 <= 75)))){
currentOpponentHealth = 3;
if (!power_used){
trace("first");
boxerMode = "powerUp";
power_used = true;
bg.boxer.gotoAndStop("power_up");
};
} else {
if (_local1 > 75){
currentOpponentHealth = 4;
};
};
if ((((opponentHealth <= 0)) && (!(FinishBoxer)))){
FinishBoxer = true;
bg.boxer.gotoAndStop("finish");
};
}
public function MoveStageAtLevelEnd(){
shakeCounter = 15;
shakeBG = true;
}
public function setOpponentWarmup(){
if (!FinishBoxer){
bg.boxer.gotoAndStop(1);
};
}
public function setBoxerState(){
}
public function levelOver(){
level++;
powerMode = false;
power_up_counter = 0;
bg.power_mc.txt.visible = false;
if (level > 3){
boxerMode = "wait";
bg.removeChild(bg.boxer);
this.removeEventListener(Event.ENTER_FRAME, bg_control);
gameWin = true;
gotoAndStop(1, "game over");
} else {
boxerMode = "wait";
if (level == 2){
decrementCount = 3;
} else {
decrementCount = 2;
};
gotoAndStop("level_up");
};
}
function nextLevel(){
clearInterval(levelDelay);
gotoAndStop(level);
player_health_mc.gotoAndStop((100 - playerHealth));
}
function InitializeLevel(){
count_down_mc.visible = true;
count_down_mc.play();
currentOpponentHealth = 1;
FinishBoxer = false;
opponentHealth = 100;
opponent_health_mc.gotoAndStop(1);
counter = 0;
shakeBG = false;
bg.rotation = 0;
hitPower = 0;
power_used = false;
setBoxerState();
player_health_mc.gotoAndStop((100 - playerHealth));
}
function checkLevelEnd(){
if (FinishBoxer){
bg.boxer.gotoAndStop("fellDown");
PlaySound(fall_down);
};
}
public function moveStage(_arg1){
if (boxerMode != "powerUp"){
boxerMode = "wait";
};
shakeBG = true;
shakeCounter = 10;
}
public function reducePlayerHealth(){
playerHealth = (playerHealth - 3);
playHitSound();
PlaySound(playerHa);
player_health_mc.gotoAndStop((100 - playerHealth));
if (score <= 0){
score = 0;
};
score_txt.text = (score + "");
if (playerHealth < 0){
boxerMode = "wait";
this.removeEventListener(Event.ENTER_FRAME, bg_control);
gameoverDelay = setInterval(gameEnd, 2000);
};
}
function gameEnd(){
clearInterval(gameoverDelay);
if (bg != null){
bg.removeChild(bg.boxer);
};
gotoAndStop(1, "game over");
}
function bg_control(_arg1){
if (shakeBG){
counter++;
if ((counter % 2) == 0){
mainC++;
if ((mainC % 2) == 0){
bg.rotation = -(Math.floor((Math.random() * 5)));
} else {
bg.rotation = Math.floor((Math.random() * 5));
};
};
if (counter > shakeCounter){
counter = 0;
if (boxerMode != "powerUp"){
boxerMode = "normal";
};
shakeBG = false;
bg.rotation = 0;
};
};
}
function frame1(){
stop();
stage.scaleMode = "exactFit";
_mochiads_game_id = "356c04a9d3211a33";
MochiAd.showPreGameAd({clip:root, id:"356c04a9d3211a33", res:"600x500"});
MochiServices.connect("356c04a9d3211a33", root);
o = {n:[10, 2, 6, 12, 7, 13, 3, 14, 1, 1, 6, 1, 11, 6, 2, 11], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "2213c247c51d5340");
loadContextMenu();
localConnection = new LocalConnection();
localDomainName = localConnection.domain;
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
InitGameBgMusic();
initializeGame();
}
function frame6(){
InitializeLevel();
}
function frame7(){
InitializeLevel();
}
function frame9(){
score_txt.text = (score + "");
if (MovieClip(root).gameWin){
char.gotoAndStop(1);
} else {
char.gotoAndStop(2);
};
clearInterval(gameoverDelay);
submit_btn1.addEventListener(MouseEvent.CLICK, submit2);
}
}
}//package
Section 44
//boxer_fall (boxer_fall)
package {
import flash.media.*;
public dynamic class boxer_fall extends Sound {
}
}//package
Section 45
//boxer_hit1 (boxer_hit1)
package {
import flash.media.*;
public dynamic class boxer_hit1 extends Sound {
}
}//package
Section 46
//boxer_hit2 (boxer_hit2)
package {
import flash.media.*;
public dynamic class boxer_hit2 extends Sound {
}
}//package
Section 47
//boxer_hit3 (boxer_hit3)
package {
import flash.media.*;
public dynamic class boxer_hit3 extends Sound {
}
}//package
Section 48
//boxer_hit4 (boxer_hit4)
package {
import flash.media.*;
public dynamic class boxer_hit4 extends Sound {
}
}//package
Section 49
//fall_down (fall_down)
package {
import flash.media.*;
public dynamic class fall_down extends Sound {
}
}//package
Section 50
//fight_start (fight_start)
package {
import flash.media.*;
public dynamic class fight_start extends Sound {
}
}//package
Section 51
//GameOver (GameOver)
package {
import flash.media.*;
public dynamic class GameOver extends Sound {
}
}//package
Section 52
//gangam_hit1 (gangam_hit1)
package {
import flash.media.*;
public dynamic class gangam_hit1 extends Sound {
}
}//package
Section 53
//gangam_hit2 (gangam_hit2)
package {
import flash.media.*;
public dynamic class gangam_hit2 extends Sound {
}
}//package
Section 54
//gangam_hit3 (gangam_hit3)
package {
import flash.media.*;
public dynamic class gangam_hit3 extends Sound {
}
}//package
Section 55
//gangam_hit4 (gangam_hit4)
package {
import flash.media.*;
public dynamic class gangam_hit4 extends Sound {
}
}//package
Section 56
//notHit (notHit)
package {
import flash.media.*;
public dynamic class notHit extends Sound {
}
}//package
Section 57
//Opponent (Opponent)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class Opponent extends OpponentBoxer {
public function Opponent(){
addFrameScript(0, frame1, 1, frame2, 3, frame4, 4, frame5, 5, frame6);
}
function frame1(){
stop();
MovieClip(root).setBoxerState();
}
function frame2(){
try {
MovieClip(root).setBoxerState();
} catch(e) {
};
}
function frame4(){
MovieClip(root).setBoxerState();
}
function frame5(){
try {
MovieClip(root).setBoxerState();
} catch(e) {
};
}
function frame6(){
try {
MovieClip(root).setBoxerState();
} catch(e) {
};
}
}
}//package
Section 58
//OpponentBoxer (OpponentBoxer)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class OpponentBoxer extends MovieClip {
public var hitMc:MovieClip;
public var state:MovieClip;
var moveDelay;
var Speed:Number;// = 15
var leftHit:Boolean;// = true
var punchDelay;
var yMove;// = 0
var startX:Number;
var startY:Number;
var speakDelay;
var counter;// = 0
var moodCount;// = 0
var hit_count;// = 0
public function OpponentBoxer(){
this.addEventListener(Event.ADDED_TO_STAGE, added);
this.addEventListener(Event.ENTER_FRAME, moveBoxer);
this.addEventListener(Event.REMOVED_FROM_STAGE, removeMe);
}
function added(_arg1){
this.removeEventListener(Event.ADDED_TO_STAGE, added);
initBoxer();
}
function initBoxer(){
switch (MovieClip(root).level){
case 1:
startX = 22;
startY = 10;
Speed = 15;
punchDelay = setInterval(punchPlayer, 5000);
break;
case 2:
startX = 22;
startY = 10;
Speed = 16;
punchDelay = setInterval(punchPlayer, 2500);
break;
case 3:
startX = 24;
startY = 10;
Speed = 20;
punchDelay = setInterval(punchPlayer, 1500);
break;
};
moveDelay = setInterval(changeMoods, 1000);
}
function PlaySpeaksounds(){
if (MovieClip(root).FinishBoxer){
return;
};
if (MovieClip(root).boxerMode == "wait"){
return;
};
var _local1:* = (Math.floor((Math.random() * 8)) + 1);
var _local2:* = getDefinitionByName(("OpponentSpeak" + _local1));
MovieClip(root).PlaySound(_local2);
}
public function punchPlayer(){
if (MovieClip(root).FinishBoxer){
return;
};
if (MovieClip(root).boxerMode == "wait"){
return;
};
this.gotoAndStop("punch");
MovieClip(root).moveStage("opponentPunch");
if (MovieClip(root).bg.hands.leftArm != null){
if (MovieClip(root).bg.hands.leftArm.currentFrame > 33){
return;
};
};
hit_count++;
var _local1:* = getDefinitionByName(("gangam_hit" + hit_count));
if (hit_count >= 4){
hit_count = 0;
};
MovieClip(root).PlaySound(_local1);
MovieClip(root).reducePlayerHealth();
}
function changeMoods(){
if (MovieClip(root).boxerMode == "wait"){
return;
};
if (MovieClip(root).FinishBoxer){
return;
};
this.state.gotoAndStop(MovieClip(root).currentOpponentHealth);
moodCount++;
}
function moveBoxer(_arg1){
var _local2:*;
if (MovieClip(root).FinishBoxer){
return;
};
if (MovieClip(root).boxerMode == "wait"){
return;
};
counter++;
if ((counter % 20) == 0){
this.y = (this.y + (Math.floor((Math.random() * 5)) + 1));
if (this.y > (startY + 9)){
this.y = startY;
};
} else {
if ((counter % 24) == 0){
this.y = (this.y - (Math.floor((Math.random() * 5)) + 1));
if (this.y < (startY - 9)){
this.y = startY;
};
};
};
if (leftHit){
this.x = (this.x + Speed);
} else {
this.x = (this.x - Speed);
};
if (this.hitTestObject(MovieClip(parent).rightHitMc)){
leftHit = false;
_local2 = (Math.floor((Math.random() * 5)) + 5);
this.rotation = _local2;
};
if (this.hitTestObject(MovieClip(parent).leftHitMc)){
leftHit = true;
_local2 = (Math.floor((Math.random() * 5)) + 5);
this.rotation = -(_local2);
};
}
function removeMe(_arg1){
clearInterval(punchDelay);
clearInterval(moveDelay);
clearInterval(speakDelay);
trace("REMOVED");
this.removeEventListener(Event.ENTER_FRAME, moveBoxer);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removeMe);
}
}
}//package
Section 59
//playerHa (playerHa)
package {
import flash.media.*;
public dynamic class playerHa extends Sound {
}
}//package
Section 60
//powerup (powerup)
package {
import flash.media.*;
public dynamic class powerup extends Sound {
}
}//package
Section 61
//punch1 (punch1)
package {
import flash.media.*;
public dynamic class punch1 extends Sound {
}
}//package
Section 62
//punch2 (punch2)
package {
import flash.media.*;
public dynamic class punch2 extends Sound {
}
}//package
Section 63
//punch3 (punch3)
package {
import flash.media.*;
public dynamic class punch3 extends Sound {
}
}//package
Section 64
//punch4 (punch4)
package {
import flash.media.*;
public dynamic class punch4 extends Sound {
}
}//package
Section 65
//textMoving (textMoving)
package {
import flash.media.*;
public dynamic class textMoving extends Sound {
}
}//package
Section 66
//victory (victory)
package {
import flash.media.*;
public dynamic class victory extends Sound {
}
}//package