Section 1
//AdjustColor (fl.motion.AdjustColor)
package fl.motion {
public class AdjustColor {
private var m_brightnessMatrix:ColorMatrix;
private var m_saturationMatrix:ColorMatrix;
private var m_hueMatrix:ColorMatrix;
private var m_finalMatrix:ColorMatrix;
private var m_contrastMatrix:ColorMatrix;
private static var s_arrayOfDeltaIndex:Array = [0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.2, 0.21, 0.22, 0.24, 0.25, 0.27, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, 1, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2, 2.12, 2.25, 2.37, 2.5, 2.62, 2.75, 2.87, 3, 3.2, 3.4, 3.6, 3.8, 4, 4.3, 4.7, 4.9, 5, 5.5, 6, 6.5, 6.8, 7, 7.3, 7.5, 7.8, 8, 8.4, 8.7, 9, 9.4, 9.6, 9.8, 10];
private function CalculateFinalMatrix():Boolean{
if (!this.AllValuesAreSet()){
return (false);
};
this.m_finalMatrix = new ColorMatrix();
this.m_finalMatrix.Multiply(this.m_brightnessMatrix);
this.m_finalMatrix.Multiply(this.m_contrastMatrix);
this.m_finalMatrix.Multiply(this.m_saturationMatrix);
this.m_finalMatrix.Multiply(this.m_hueMatrix);
return (true);
}
public function set brightness(_arg1:Number):void{
if (this.m_brightnessMatrix == null){
this.m_brightnessMatrix = new ColorMatrix();
};
if (_arg1 != 0){
this.m_brightnessMatrix.SetBrightnessMatrix(_arg1);
};
}
public function set contrast(_arg1:Number):void{
var _local2:Number = _arg1;
if (_arg1 == 0){
_local2 = 127;
} else {
if (_arg1 > 0){
_local2 = ((s_arrayOfDeltaIndex[int(_arg1)] * 127) + 127);
} else {
_local2 = (((_arg1 / 100) * 127) + 127);
};
};
if (this.m_contrastMatrix == null){
this.m_contrastMatrix = new ColorMatrix();
};
this.m_contrastMatrix.SetContrastMatrix(_local2);
}
public function set hue(_arg1:Number):void{
if (this.m_hueMatrix == null){
this.m_hueMatrix = new ColorMatrix();
};
if (_arg1 != 0){
this.m_hueMatrix.SetHueMatrix(((_arg1 * Math.PI) / 180));
};
}
public function CalculateFinalFlatArray():Array{
if (this.CalculateFinalMatrix()){
return (this.m_finalMatrix.GetFlatArray());
};
return (null);
}
public function AllValuesAreSet():Boolean{
return (((((((this.m_brightnessMatrix) && (this.m_contrastMatrix))) && (this.m_saturationMatrix))) && (this.m_hueMatrix)));
}
public function set saturation(_arg1:Number):void{
var _local2:Number = _arg1;
if (_arg1 == 0){
_local2 = 1;
} else {
if (_arg1 > 0){
_local2 = (1 + ((3 * _arg1) / 100));
} else {
_local2 = ((_arg1 / 100) + 1);
};
};
if (this.m_saturationMatrix == null){
this.m_saturationMatrix = new ColorMatrix();
};
this.m_saturationMatrix.SetSaturationMatrix(_local2);
}
}
}//package fl.motion
Section 2
//ColorMatrix (fl.motion.ColorMatrix)
package fl.motion {
public class ColorMatrix extends DynamicMatrix {
protected static const LUMINANCEB:Number = 0.082;
protected static const LUMINANCER:Number = 0.3086;
protected static const LUMINANCEG:Number = 0.6094;
public function ColorMatrix(){
super(5, 5);
LoadIdentity();
}
public function GetFlatArray():Array{
var _local4:int;
if (!m_matrix){
return (null);
};
var _local1:Array = new Array();
var _local2:int;
var _local3:int;
while (_local3 < 4) {
_local4 = 0;
while (_local4 < 5) {
_local1[_local2] = m_matrix[_local3][_local4];
_local2++;
_local4++;
};
_local3++;
};
return (_local1);
}
public function SetBrightnessMatrix(_arg1:Number):void{
if (!m_matrix){
return;
};
m_matrix[0][4] = _arg1;
m_matrix[1][4] = _arg1;
m_matrix[2][4] = _arg1;
}
public function SetContrastMatrix(_arg1:Number):void{
if (!m_matrix){
return;
};
var _local2:Number = (0.5 * (127 - _arg1));
_arg1 = (_arg1 / 127);
m_matrix[0][0] = _arg1;
m_matrix[1][1] = _arg1;
m_matrix[2][2] = _arg1;
m_matrix[0][4] = _local2;
m_matrix[1][4] = _local2;
m_matrix[2][4] = _local2;
}
public function SetHueMatrix(_arg1:Number):void{
var _local11:int;
if (!m_matrix){
return;
};
LoadIdentity();
var _local2:DynamicMatrix = new DynamicMatrix(3, 3);
var _local3:DynamicMatrix = new DynamicMatrix(3, 3);
var _local4:DynamicMatrix = new DynamicMatrix(3, 3);
var _local5:Number = Math.cos(_arg1);
var _local6:Number = Math.sin(_arg1);
var _local7:Number = 0.213;
var _local8:Number = 0.715;
var _local9:Number = 0.072;
_local2.SetValue(0, 0, _local7);
_local2.SetValue(1, 0, _local7);
_local2.SetValue(2, 0, _local7);
_local2.SetValue(0, 1, _local8);
_local2.SetValue(1, 1, _local8);
_local2.SetValue(2, 1, _local8);
_local2.SetValue(0, 2, _local9);
_local2.SetValue(1, 2, _local9);
_local2.SetValue(2, 2, _local9);
_local3.SetValue(0, 0, (1 - _local7));
_local3.SetValue(1, 0, -(_local7));
_local3.SetValue(2, 0, -(_local7));
_local3.SetValue(0, 1, -(_local8));
_local3.SetValue(1, 1, (1 - _local8));
_local3.SetValue(2, 1, -(_local8));
_local3.SetValue(0, 2, -(_local9));
_local3.SetValue(1, 2, -(_local9));
_local3.SetValue(2, 2, (1 - _local9));
_local3.MultiplyNumber(_local5);
_local4.SetValue(0, 0, -(_local7));
_local4.SetValue(1, 0, 0.143);
_local4.SetValue(2, 0, -((1 - _local7)));
_local4.SetValue(0, 1, -(_local8));
_local4.SetValue(1, 1, 0.14);
_local4.SetValue(2, 1, _local8);
_local4.SetValue(0, 2, (1 - _local9));
_local4.SetValue(1, 2, -0.283);
_local4.SetValue(2, 2, _local9);
_local4.MultiplyNumber(_local6);
_local2.Add(_local3);
_local2.Add(_local4);
var _local10:int;
while (_local10 < 3) {
_local11 = 0;
while (_local11 < 3) {
m_matrix[_local10][_local11] = _local2.GetValue(_local10, _local11);
_local11++;
};
_local10++;
};
}
public function SetSaturationMatrix(_arg1:Number):void{
if (!m_matrix){
return;
};
var _local2:Number = (1 - _arg1);
var _local3:Number = (_local2 * LUMINANCER);
m_matrix[0][0] = (_local3 + _arg1);
m_matrix[1][0] = _local3;
m_matrix[2][0] = _local3;
_local3 = (_local2 * LUMINANCEG);
m_matrix[0][1] = _local3;
m_matrix[1][1] = (_local3 + _arg1);
m_matrix[2][1] = _local3;
_local3 = (_local2 * LUMINANCEB);
m_matrix[0][2] = _local3;
m_matrix[1][2] = _local3;
m_matrix[2][2] = (_local3 + _arg1);
}
}
}//package fl.motion
class XFormData {
public var ox:Number;
public var oy:Number;
public var oz:Number;
private function XFormData(){
}
}
Section 3
//DynamicMatrix (fl.motion.DynamicMatrix)
package fl.motion {
public class DynamicMatrix {
protected var m_matrix:Array;
protected var m_width:int;
protected var m_height:int;
public static const MATRIX_ORDER_APPEND:int = 1;
public static const MATRIX_ORDER_PREPEND:int = 0;
public function DynamicMatrix(_arg1:int, _arg2:int){
this.Create(_arg1, _arg2);
}
public function Add(_arg1:DynamicMatrix):Boolean{
var _local5:int;
var _local6:Number;
if (((!(this.m_matrix)) || (!(_arg1)))){
return (false);
};
var _local2:int = _arg1.GetHeight();
var _local3:int = _arg1.GetWidth();
if (((!((this.m_width == _local3))) || (!((this.m_height == _local2))))){
return (false);
};
var _local4:int;
while (_local4 < this.m_height) {
_local5 = 0;
while (_local5 < this.m_width) {
_local6 = 0;
_local6 = (this.m_matrix[_local4][_local5] + _arg1.GetValue(_local4, _local5));
this.m_matrix[_local4][_local5] = _local6;
_local5++;
};
_local4++;
};
return (true);
}
public function LoadIdentity():void{
var _local1:int;
var _local2:int;
if (this.m_matrix){
_local1 = 0;
while (_local1 < this.m_height) {
_local2 = 0;
while (_local2 < this.m_width) {
if (_local1 == _local2){
this.m_matrix[_local1][_local2] = 1;
} else {
this.m_matrix[_local1][_local2] = 0;
};
_local2++;
};
_local1++;
};
};
}
public function LoadZeros():void{
var _local1:int;
var _local2:int;
if (this.m_matrix){
_local1 = 0;
while (_local1 < this.m_height) {
_local2 = 0;
while (_local2 < this.m_width) {
this.m_matrix[_local1][_local2] = 0;
_local2++;
};
_local1++;
};
};
}
public function Multiply(_arg1:DynamicMatrix, _arg2:int=0):Boolean{
var _local5:DynamicMatrix;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:int;
var _local10:int;
if (((!(this.m_matrix)) || (!(_arg1)))){
return (false);
};
var _local3:int = _arg1.GetHeight();
var _local4:int = _arg1.GetWidth();
if (_arg2 == MATRIX_ORDER_APPEND){
if (this.m_width != _local3){
return (false);
};
_local5 = new DynamicMatrix(_local4, this.m_height);
_local6 = 0;
while (_local6 < this.m_height) {
_local7 = 0;
while (_local7 < _local4) {
_local8 = 0;
_local9 = 0;
_local10 = 0;
while ((((_local9 < Math.max(this.m_height, _local3))) && ((_local10 < Math.max(this.m_width, _local4))))) {
_local8 = (_local8 + (_arg1.GetValue(_local9, _local7) * this.m_matrix[_local6][_local10]));
_local9++;
_local10++;
};
_local5.SetValue(_local6, _local7, _local8);
_local7++;
};
_local6++;
};
this.Destroy();
this.Create(_local4, this.m_height);
_local6 = 0;
while (_local6 < _local3) {
_local7 = 0;
while (_local7 < this.m_width) {
this.m_matrix[_local6][_local7] = _local5.GetValue(_local6, _local7);
_local7++;
};
_local6++;
};
} else {
if (this.m_height != _local4){
return (false);
};
_local5 = new DynamicMatrix(this.m_width, _local3);
_local6 = 0;
while (_local6 < _local3) {
_local7 = 0;
while (_local7 < this.m_width) {
_local8 = 0;
_local9 = 0;
_local10 = 0;
while ((((_local9 < Math.max(_local3, this.m_height))) && ((_local10 < Math.max(_local4, this.m_width))))) {
_local8 = (_local8 + (this.m_matrix[_local9][_local7] * _arg1.GetValue(_local6, _local10)));
_local9++;
_local10++;
};
_local5.SetValue(_local6, _local7, _local8);
_local7++;
};
_local6++;
};
this.Destroy();
this.Create(this.m_width, _local3);
_local6 = 0;
while (_local6 < _local3) {
_local7 = 0;
while (_local7 < this.m_width) {
this.m_matrix[_local6][_local7] = _local5.GetValue(_local6, _local7);
_local7++;
};
_local6++;
};
};
return (true);
}
public function MultiplyNumber(_arg1:Number):Boolean{
var _local3:int;
var _local4:Number;
if (!this.m_matrix){
return (false);
};
var _local2:int;
while (_local2 < this.m_height) {
_local3 = 0;
while (_local3 < this.m_width) {
_local4 = 0;
_local4 = (this.m_matrix[_local2][_local3] * _arg1);
this.m_matrix[_local2][_local3] = _local4;
_local3++;
};
_local2++;
};
return (true);
}
public function SetValue(_arg1:int, _arg2:int, _arg3:Number):void{
if ((((((((_arg1 >= 0)) && ((_arg1 < this.m_height)))) && ((_arg2 >= 0)))) && ((_arg2 <= this.m_width)))){
this.m_matrix[_arg1][_arg2] = _arg3;
};
}
public function GetWidth():Number{
return (this.m_width);
}
protected function Destroy():void{
this.m_matrix = null;
}
public function GetValue(_arg1:int, _arg2:int):Number{
var _local3:Number = 0;
if ((((((((_arg1 >= 0)) && ((_arg1 < this.m_height)))) && ((_arg2 >= 0)))) && ((_arg2 <= this.m_width)))){
_local3 = this.m_matrix[_arg1][_arg2];
};
return (_local3);
}
protected function Create(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
if ((((_arg1 > 0)) && ((_arg2 > 0)))){
this.m_width = _arg1;
this.m_height = _arg2;
this.m_matrix = new Array(_arg2);
_local3 = 0;
while (_local3 < _arg2) {
this.m_matrix[_local3] = new Array(_arg1);
_local4 = 0;
while (_local4 < _arg2) {
this.m_matrix[_local3][_local4] = 0;
_local4++;
};
_local3++;
};
};
}
public function GetHeight():Number{
return (this.m_height);
}
}
}//package fl.motion
Section 4
//Level01 (Levels.Level01)
package Levels {
import flash.display.*;
import flash.utils.*;
import Plugs.*;
public class Level01 {
var isprt:MovieClip;
var lmc;
var ignite;// = false
var pt;
var dd;// = 0
var rocket;
var xx;// = 0
var kd;// = false
var yy;// = 0
var par;
var ew;// = null
var cmb;// = null
var rl;
public function Level01(){
lmc = Main.sprt;
rocket = new Array();
par = new Array();
rl = new Object();
pt = new pts();
super();
rl.spawntime = 5000;
rl.combo = 0;
inirocket();
pt.y = 480;
pt.txt.text = 0;
lmc.addChild(pt);
dd = 0;
}
function rocketcode(){
var _local2:*;
var _local3:*;
rl.combo = 0;
rl.pts = 0;
var _local1:* = 0;
while (_local1 < rocket.length) {
_local2 = rocket[_local1];
if ((((_local2.lok.alpha == 0)) && (_local2.lok.hitTestPoint(lmc.mouseX, lmc.mouseY, false)))){
Music.snd("lock");
_local2.lok.alpha = 1;
_local2.lok.gotoAndStop(3);
};
_local2.rot = (180 + (((Math.atan2(-(_local2.yy), -(_local2.xx)) * 360) / 2) / Math.PI));
_local2.rotisdel = (_local2.rot - _local2.rotis);
if (_local2.rotisdel < -180){
_local2.rotisdel = (_local2.rotisdel + 360);
};
if (_local2.rotisdel > 180){
_local2.rotisdel = (_local2.rotisdel - 360);
};
_local2.rotis = (_local2.rotis + (_local2.rotisdel / 8));
_local2.rotation = _local2.rotis;
_local2.rf.x = (_local2.x / 2);
_local2.rf.y = (_local2.y / 2);
_local2.yy = (_local2.yy + 0.1);
_local2.y = (_local2.y + _local2.yy);
_local2.x = (_local2.x + _local2.xx);
_local2.lok.x = _local2.x;
_local2.lok.y = _local2.y;
_local2.lok.graphics.clear();
_local2.lok.graphics.beginFill(3316223, 0.3);
_local2.lok.graphics.lineStyle(1, 0xFFFFFF, 0.5);
_local2.lok.graphics.drawRect((-(_local2.width) / 2), (-(_local2.height) / 2), _local2.width, _local2.height);
_local2.lok.graphics.endFill();
if (_local2.lok.tl){
_local2.lok.tl.x = (-(_local2.width) / 2);
_local2.lok.tl.y = (-(_local2.height) / 2);
_local2.lok.tr.x = (_local2.width / 2);
_local2.lok.tr.y = (-(_local2.height) / 2);
_local2.lok.bl.x = (-(_local2.width) / 2);
_local2.lok.bl.y = (_local2.height / 2);
_local2.lok.br.x = (_local2.width / 2);
_local2.lok.br.y = (_local2.height / 2);
};
_local3 = 0;
if ((((_local2.lok.alpha == 1)) && (ignite))){
iniParticles(_local2.x, _local2.y);
setTimeout(iniParticless, 300, _local2.x, _local2.y);
if (Math.random() > 0.6){
setTimeout(iniParticless, 500, _local2.x, _local2.y);
};
_local3 = 1;
rl.combo++;
rl.pts = (rl.pts + 20);
if (_local2.x != 320){
rl.pts = (rl.pts + Math.round((100 / Math.abs((320 - _local2.x)))));
};
};
if (_local2.y > 530){
pt.txt.text = (pt.txt.text - 40);
if (pt.txt.text < 0){
pt.txt.text = 0;
};
};
if ((((_local2.y > 530)) || ((_local3 == 1)))){
lmc.removeChild(_local2.lok);
lmc.removeChild(_local2);
Main.eff.removeChild(_local2.rf);
rocket.splice(_local1, 1);
Music.snd("rock");
_local1--;
};
_local1++;
};
if (rl.combo > 1){
if (cmb){
lmc.removeChild(cmb);
cmb = null;
};
cmb = new comb();
cmb.x = 320;
cmb.y = 350;
cmb.alpha = 2;
lmc.addChild(cmb);
cmb.txt.text = ("Combo X " + rl.combo);
};
if (cmb){
cmb.scaleX = (cmb.scaleX + 0.06);
cmb.scaleY = (cmb.scaleY + 0.06);
cmb.alpha = (cmb.alpha - 0.03);
if (cmb.alpha < 0){
lmc.removeChild(cmb);
cmb = null;
};
};
rl.pts = (rl.pts * rl.combo);
pt.txt.text = ((pt.txt.text * 1) + rl.pts);
ignite = false;
}
function iniParticles(_arg1, _arg2){
var _local5:*;
var _local3:* = Math.round((Math.random() * 9));
var _local4:* = 0;
while (_local4 < 30) {
_local5 = par.length;
par[_local5] = new par01();
if (_local3 > 1){
par[_local5].gotoAndStop(_local3);
};
if (_local3 > 8){
par[_local5].gotoAndStop(Math.ceil((Math.random() * 8)));
};
Main.eff.addChild(par[_local5]);
par[_local5].x = (_arg1 / 2);
par[_local5].y = (_arg2 / 2);
par[_local5].xx = ((Math.random() * 2) - 1);
par[_local5].yy = ((Math.random() * 2.5) - 2);
par[_local5].alpha = ((Math.random() * 0.5) + 0.5);
par[_local5].scaleX = 0.5;
par[_local5].scaleY = 0.5;
_local4++;
};
}
function iniParticless(){
iniParticles(arguments[0], arguments[1]);
}
public function update(){
rocketcode();
updateParticles();
if (Input.mclick){
ignite = true;
Input.mclick = null;
};
if ((((dd == 1)) && ((rocket.length == 0)))){
dd = 2;
ew = new endwin();
ew.x = 320;
ew.y = 1240;
ew.pts.text = (pt.txt.text * 1);
lmc.addChild(ew);
pt.visible = false;
};
if (ew){
Music.mad(1);
ew.y = (ew.y + Math.round(((240 - ew.y) / 16)));
};
}
function updateParticles(){
var _local1:* = 0;
while (_local1 < par.length) {
par[_local1].x = (par[_local1].x + par[_local1].xx);
par[_local1].y = (par[_local1].y + par[_local1].yy);
par[_local1].yy = (par[_local1].yy + 0.01);
par[_local1].alpha = (par[_local1].alpha - 0.0005);
if (par[_local1].alpha <= 0){
Main.eff.removeChild(par[_local1]);
par.splice(_local1, 1);
};
_local1++;
};
}
function inirocket(){
var _local1:*;
if (rocket.length < 6){
Music.snd("launch");
_local1 = new arw();
_local1.gotoAndStop(Math.round(((Math.random() * 4) + 1)));
_local1.x = ((Math.random() * 600) + 20);
_local1.y = 530;
_local1.rotation = -50;
_local1.xx = ((Math.random() * (320 - _local1.x)) / 50);
_local1.yy = ((Math.random() * -3) - 7);
_local1.rotis = -50;
_local1.lok = new lokk();
_local1.lok.alpha = 0;
lmc.addChild(_local1.lok);
lmc.addChild(_local1);
rocket.push(_local1);
_local1.rf = new rockfire();
_local1.rf.x = -100;
Main.eff.addChild(_local1.rf);
rl.spawntime = (rl.spawntime - ((Math.random() * 20) + 40));
if (rl.spawntime < 200){
rl.spawntime = 200;
dd = 1;
};
};
if (!dd){
setTimeout(inirocket, ((Math.random() * rl.spawntime) + 100));
};
}
}
}//package Levels
Section 5
//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 showClickAwayAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
var sendHostProgress:Boolean;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var clip:Object;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array = _arg2.split(".");
var _local4:Number = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
var f:Function = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 6
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
MochiSocial.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 7
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 8
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 9
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function endGame():void{
var _local1:Number = (new Date().time - gameStart);
trigger("end_game", {time:_local1});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(_arg1:String, _arg2:Object=null):void{
if (_arg2 == null){
_arg2 = {};
} else {
if (_arg2["kind"] != undefined){
trace("WARNING: optional arguments package contains key 'id', it will be overwritten");
_arg2["kind"] = _arg1;
};
};
MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var _local1:Number = (new Date().time - levelStart);
trigger("end_level", {time:_local1});
}
}
}//package mochi.as3
Section 10
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _syncID:Number;
private var _consumableProperties:Object;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (_arg1.privateProperties.consumable){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[_local2]);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 11
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public 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 requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_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 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});
}
}
}//package mochi.as3
Section 12
//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 _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _clip._callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _clip._callbacks[cb];
}
public static function get childClip():Object{
return (_clip);
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.7 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var clip = _arg1;
loader = new Loader();
var mochiLCURL:String = (_servURL + _mochiLC);
var req:URLRequest = new URLRequest(mochiLCURL);
var complete:Function = function (_arg1:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var _local3:String = ("_mochiservices_com_" + _arg1);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local4:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local4 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local4);
_clip = createEmptyMovieClip(_arg2, _local3, 10336, false);
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local5:URLRequest = new URLRequest(_local4);
var _local6:URLVariables = new URLVariables();
_local6.listenLC = _listenChannelName;
_local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local6.api_version = getVersion();
if (widget){
_local6.widget = true;
};
_local5.data = _local6;
_loader.load(_local5);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
var mc:MovieClip = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 13
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const LOGIN_HIDE:String = "LoginHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 14
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
if (_syncContainer[_arg1] == _arg2){
return;
};
var _local3:String = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
}
}//package mochi.as3
Section 15
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var operation:String;// = null
public var error:Event;// = null
public var data;// = null
public var _loader:URLLoader;
public var key:String;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 16
//Effect (Plugs.Effect)
package Plugs {
import flash.display.*;
import flash.events.*;
import fl.motion.*;
import flash.geom.*;
import flash.filters.*;
public class Effect {
var bmp;
var myBitmapData:BitmapData;
public function Effect(){
myBitmapData = new BitmapData((640 / 2), (480 / 2), true, 0xFFFFFF);
bmp = new Bitmap(myBitmapData);
super();
Main.sprt.addChild(bmp);
bmp.scaleX = 2;
bmp.scaleY = 2;
}
public function update(){
var t:* = Main.eff;
myBitmapData.draw(t, null, null, null);
Main.sprt.alpha = 1;
bmp = new Bitmap(myBitmapData);
var adjustHue:AdjustColor = new AdjustColor();
adjustHue.brightness = -99;
var _local2 = adjustHue;
with (_local2) {
brightness = 0;
contrast = 0;
hue = 1;
saturation = 1;
};
var matrix:Array = new Array();
matrix = adjustHue.CalculateFinalFlatArray();
var bf:BlurFilter = new BlurFilter(1.5, 1.5, 2);
myBitmapData.applyFilter(myBitmapData, myBitmapData.rect, new Point(), bf);
}
}
}//package Plugs
Section 17
//Input (Plugs.Input)
package Plugs {
import flash.display.*;
import flash.events.*;
public class Input {
public static var kkode = new Array();
public static var smc:MovieClip;
public static var mclick = null;
public function Input(_arg1){
_arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, kpress);
_arg1.stage.addEventListener(KeyboardEvent.KEY_UP, krelease);
_arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, miw);
_arg1.stage.addEventListener(MouseEvent.CLICK, mcl);
}
public function kpress(_arg1){
kkode[_arg1.keyCode] = 1;
}
public function miw(_arg1){
mclick = _arg1.target.name;
}
public function krelease(_arg1){
kkode[_arg1.keyCode] = 0;
}
public function mcl(_arg1){
Main.mclic(_arg1);
}
}
}//package Plugs
Section 18
//Music (Plugs.Music)
package Plugs {
import flash.utils.*;
import flash.media.*;
public class Music {
public static var st = "off";
static var sfx = new Sound();
static var music = new Sound();
static var musicChannel = null;
static var musicChannelCrowd = null;
public static var vol = 1;
static var volG = 0;
public static function mad(_arg1){
if (vol != _arg1){
if (vol < _arg1){
vol = (vol + 0.05);
};
if (vol > _arg1){
vol = (vol - 0.05);
};
musicChannel.soundTransform = new SoundTransform(vol);
};
musicChannel.soundTransform = new SoundTransform(_arg1);
}
public static function snd(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
if (1 == 1){
if (_arg1 == "launch"){
_local2 = Math.round(((Math.random() * 7) + 1));
_local3 = (getDefinitionByName(("launch0" + _local2)) as Class);
sfx = new (_local3);
sfx.play(0, 0);
};
if (_arg1 == "rock"){
_local2 = Math.round((Math.random() * 9));
_local4 = (getDefinitionByName(("bom0" + _local2)) as Class);
sfx = new (_local4);
sfx.play(0, 0);
};
if (_arg1 == "lock"){
_local2 = Math.round(((Math.random() * 4) + 1));
_local5 = (getDefinitionByName(("lock0" + _local2)) as Class);
sfx = new (_local5);
sfx.play(0, 0);
};
};
}
public static function msc(){
music = new Musi();
musicChannel = music.play(0, 99999);
}
}
}//package Plugs
Section 19
//addo (addo)
package {
import flash.display.*;
public dynamic class addo extends MovieClip {
}
}//package
Section 20
//arw (arw)
package {
import flash.display.*;
public dynamic class arw extends MovieClip {
}
}//package
Section 21
//bom00 (bom00)
package {
import flash.media.*;
public dynamic class bom00 extends Sound {
}
}//package
Section 22
//bom01 (bom01)
package {
import flash.media.*;
public dynamic class bom01 extends Sound {
}
}//package
Section 23
//bom02 (bom02)
package {
import flash.media.*;
public dynamic class bom02 extends Sound {
}
}//package
Section 24
//bom03 (bom03)
package {
import flash.media.*;
public dynamic class bom03 extends Sound {
}
}//package
Section 25
//bom04 (bom04)
package {
import flash.media.*;
public dynamic class bom04 extends Sound {
}
}//package
Section 26
//bom05 (bom05)
package {
import flash.media.*;
public dynamic class bom05 extends Sound {
}
}//package
Section 27
//bom06 (bom06)
package {
import flash.media.*;
public dynamic class bom06 extends Sound {
}
}//package
Section 28
//bom07 (bom07)
package {
import flash.media.*;
public dynamic class bom07 extends Sound {
}
}//package
Section 29
//bom08 (bom08)
package {
import flash.media.*;
public dynamic class bom08 extends Sound {
}
}//package
Section 30
//bom09 (bom09)
package {
import flash.media.*;
public dynamic class bom09 extends Sound {
}
}//package
Section 31
//comb (comb)
package {
import flash.display.*;
import flash.text.*;
public dynamic class comb extends MovieClip {
public var txt:TextField;
}
}//package
Section 32
//endwin (endwin)
package {
import flash.display.*;
import flash.text.*;
public dynamic class endwin extends MovieClip {
public var b_sub:SimpleButton;
public var b_back:SimpleButton;
public var b_moga:SimpleButton;
public var pts:TextField;
}
}//package
Section 33
//launch01 (launch01)
package {
import flash.media.*;
public dynamic class launch01 extends Sound {
}
}//package
Section 34
//launch02 (launch02)
package {
import flash.media.*;
public dynamic class launch02 extends Sound {
}
}//package
Section 35
//launch03 (launch03)
package {
import flash.media.*;
public dynamic class launch03 extends Sound {
}
}//package
Section 36
//launch04 (launch04)
package {
import flash.media.*;
public dynamic class launch04 extends Sound {
}
}//package
Section 37
//launch05 (launch05)
package {
import flash.media.*;
public dynamic class launch05 extends Sound {
}
}//package
Section 38
//launch06 (launch06)
package {
import flash.media.*;
public dynamic class launch06 extends Sound {
}
}//package
Section 39
//launch07 (launch07)
package {
import flash.media.*;
public dynamic class launch07 extends Sound {
}
}//package
Section 40
//launch08 (launch08)
package {
import flash.media.*;
public dynamic class launch08 extends Sound {
}
}//package
Section 41
//lock01 (lock01)
package {
import flash.media.*;
public dynamic class lock01 extends Sound {
}
}//package
Section 42
//lock02 (lock02)
package {
import flash.media.*;
public dynamic class lock02 extends Sound {
}
}//package
Section 43
//lock03 (lock03)
package {
import flash.media.*;
public dynamic class lock03 extends Sound {
}
}//package
Section 44
//lock04 (lock04)
package {
import flash.media.*;
public dynamic class lock04 extends Sound {
}
}//package
Section 45
//lock05 (lock05)
package {
import flash.media.*;
public dynamic class lock05 extends Sound {
}
}//package
Section 46
//lokb (lokb)
package {
import flash.display.*;
public dynamic class lokb extends MovieClip {
public function lokb(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 47
//lokk (lokk)
package {
import flash.display.*;
public dynamic class lokk extends MovieClip {
public var bl:lokb;
public var br:lokb;
public var tl:lokb;
public var tr:lokb;
public function lokk(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
}
}//package
Section 48
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import Plugs.*;
import Levels.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
public dynamic class Main extends MovieClip {
public var prc:TextField;
var lpc;// = 0
public var gs:MovieClip;
public var addi:addo;
var effect;// = null
public var sg:startgame;
public var curr_levl;
public static var dd = 1;
public static var eff:MovieClip;
public static var scoresub = null;
public static var scoreshow = false;
public static var levl = 5;
public static var sprt:MovieClip;
public function Main(){
addFrameScript(3, frame4, 4, frame5);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = "LOW";
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
var _local2:* = new ContextMenuItem("More Games");
_local2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, gogs);
_local1.customItems.push(_local2);
contextMenu = _local1;
MochiServices.connect("03c45f224d074e60", root);
var _local3:* = new Input(root);
addEventListener(Event.ENTER_FRAME, loada);
MochiAd.showClickAwayAd({clip:addi, id:"03c45f224d074e60"});
}
function frame4(){
stop();
}
public function subscore(_arg1){
var score = _arg1;
stage.quality = "HIGH";
trace(score);
var o:Object = {n:[9, 3, 11, 13, 13, 8, 11, 5, 5, 6, 9, 4, 3, 5, 3, 4], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, score:score, onClose:function ():void{
Main.dd = 1;
Main.levl = 0;
}});
}
public function showscore(){
stage.quality = "HIGH";
var o:Object = {n:[9, 3, 11, 13, 13, 8, 11, 5, 5, 6, 9, 4, 3, 5, 3, 4], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, onClose:function ():void{
}});
}
function frame5(){
stop();
}
function mcode(_arg1:Event){
var _local2:*;
if (scoresub){
subscore(scoresub);
scoresub = null;
};
if (scoreshow){
showscore();
scoreshow = null;
};
if (Input.mclick == "b_play"){
dd = 1;
levl = 1;
};
if (dd == 1){
if (sprt){
removeChild(sprt);
sprt = new MovieClip();
addChild(sprt);
effect = new Effect();
eff = new MovieClip();
};
curr_levl = null;
if (levl == 1){
stage.quality = "LOW";
Music.mad(0.4);
curr_levl = new Level01();
};
if (levl == 0){
Music.mad(1);
_local2 = new titl();
sprt.addChild(_local2);
};
dd = 0;
};
if (curr_levl){
curr_levl.update();
effect.update();
};
setChildIndex(gs, (numChildren - 1));
}
function loada(_arg1){
if (sg){
sg.visible = false;
};
if (lpc >= 100){
sg.visible = true;
prc.visible = false;
};
if (prc){
if (lpc < ((stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal) * 100)){
lpc = (lpc + 0.2);
prc.text = String(Math.floor(lpc));
};
};
if (levl == 0){
gotoAndStop("game");
};
if (currentLabel == "game"){
sprt = new MovieClip();
addChild(sprt);
effect = new Effect();
eff = new MovieClip();
Music.msc();
removeEventListener(Event.ENTER_FRAME, loada);
addEventListener(Event.ENTER_FRAME, mcode);
};
}
public static function mclic(_arg1){
var _local2:* = _arg1.target.name;
if (_local2 == "sg"){
levl = 0;
};
if (_local2 == "b_moga"){
gogs(null);
};
if (_local2 == "b_back"){
dd = 1;
levl = 0;
};
if (_local2 == "b_sub"){
scoresub = _arg1.target.parent.pts.text;
_arg1.target.parent.visible = false;
};
if (_local2 == "b_hi"){
scoreshow = true;
};
}
static function gogs(_arg1){
navigateToURL(new URLRequest("http://www.gameshot.org"), "_blank");
}
}
}//package
Section 49
//Musi (Musi)
package {
import flash.media.*;
public dynamic class Musi extends Sound {
}
}//package
Section 50
//par01 (par01)
package {
import flash.display.*;
public dynamic class par01 extends MovieClip {
}
}//package
Section 51
//pts (pts)
package {
import flash.display.*;
import flash.text.*;
public dynamic class pts extends MovieClip {
public var txt:TextField;
}
}//package
Section 52
//rockfire (rockfire)
package {
import flash.display.*;
public dynamic class rockfire extends MovieClip {
}
}//package
Section 53
//startgame (startgame)
package {
import flash.display.*;
public dynamic class startgame extends SimpleButton {
}
}//package
Section 54
//titl (titl)
package {
import flash.display.*;
public dynamic class titl extends MovieClip {
public var b_play:SimpleButton;
public var b_moga:SimpleButton;
public var b_hi:SimpleButton;
public function titl(){
addFrameScript(81, frame82);
}
function frame82(){
stop();
}
}
}//package