Section 1
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public static function LoadAd(_arg1:int, _arg2:int):DisplayObject{
Security.allowDomain("server.cpmstar.com");
var _local3 = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((_local3 + "?poolid=") + _arg1) + "&subpoolid=") + _arg2)));
return (cpmstarLoader);
}
}
}//package CPMStar
Section 2
//bg101_2_1_5 (JellyJam_640x480_CPMstar_fla.bg101_2_1_5)
package JellyJam_640x480_CPMstar_fla {
import flash.display.*;
public dynamic class bg101_2_1_5 extends MovieClip {
public function bg101_2_1_5(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 3
//bg101_2_6 (JellyJam_640x480_CPMstar_fla.bg101_2_6)
package JellyJam_640x480_CPMstar_fla {
import flash.display.*;
public dynamic class bg101_2_6 extends MovieClip {
public function bg101_2_6(){
addFrameScript(0, frame1);
}
function frame1(){
this.cacheAsBitmap = true;
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 4
//jamSPRTmc1_8 (JellyJam_640x480_CPMstar_fla.jamSPRTmc1_8)
package JellyJam_640x480_CPMstar_fla {
import flash.display.*;
public dynamic class jamSPRTmc1_8 extends MovieClip {
public var bck:MovieClip;
public var sprt:MovieClip;
public var kol:MovieClip;
public function jamSPRTmc1_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 5
//KoblackeFade_22 (JellyJam_640x480_CPMstar_fla.KoblackeFade_22)
package JellyJam_640x480_CPMstar_fla {
import flash.media.*;
import flash.display.*;
import flash.events.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class KoblackeFade_22 extends MovieClip {
public var t;
public function KoblackeFade_22(){
addFrameScript(18, frame19);
}
function frame19(){
stop();
t = this;
t.parent.removeChild(t);
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 6
//kol_9 (JellyJam_640x480_CPMstar_fla.kol_9)
package JellyJam_640x480_CPMstar_fla {
import flash.display.*;
public dynamic class kol_9 extends MovieClip {
public function kol_9(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 7
//musicPanel_12 (JellyJam_640x480_CPMstar_fla.musicPanel_12)
package JellyJam_640x480_CPMstar_fla {
import flash.media.*;
import flash.display.*;
import flash.events.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
import Plugs.*;
public dynamic class musicPanel_12 extends MovieClip {
public var mu:MovieClip;
public var fx:muteFX;
public var t;
public function musicPanel_12(){
addFrameScript(0, frame1);
}
public function mutoggle(_arg1){
if (Music.volMU){
Music.volMU = 0;
Music.changeVol(0);
mu.gotoAndStop("off");
} else {
Music.volMU = 1;
Music.changeVol(0);
mu.gotoAndStop("on");
};
}
public function fxtoggle(_arg1){
if (Music.volFX){
Music.volFX = 0;
Music.loopMod(1.2);
fx.gotoAndStop("off");
} else {
Music.volFX = 1;
Music.loopMod(1.2);
fx.gotoAndStop("on");
};
}
function frame1(){
mu.buttonMode = true;
fx.buttonMode = true;
if (Music.volFX == 0){
fx.gotoAndStop("off");
};
if (Music.volMU == 0){
mu.gotoAndStop("off");
};
mu.addEventListener(MouseEvent.CLICK, mutoggle);
fx.addEventListener(MouseEvent.CLICK, fxtoggle);
t = this;
t.alpha = 0.3;
t.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1){
t.alpha = 1;
});
t.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1){
t.alpha = 0.3;
});
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 8
//muteMus_14 (JellyJam_640x480_CPMstar_fla.muteMus_14)
package JellyJam_640x480_CPMstar_fla {
import flash.display.*;
public dynamic class muteMus_14 extends MovieClip {
public function muteMus_14(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 9
//whiteFade_15 (JellyJam_640x480_CPMstar_fla.whiteFade_15)
package JellyJam_640x480_CPMstar_fla {
import flash.media.*;
import flash.display.*;
import flash.events.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class whiteFade_15 extends MovieClip {
public var t;
public function whiteFade_15(){
addFrameScript(18, frame19);
}
function frame19(){
stop();
t = this;
t.parent.removeChild(t);
}
}
}//package JellyJam_640x480_CPMstar_fla
Section 10
//Level01 (Levels.Level01)
package Levels {
import flash.display.*;
import Plugs.*;
import flash.geom.*;
import flash.filters.*;
public class Level01 {
var lmc:MovieClip;
var isprt:MovieClip;
var sprt:MovieClip;
var plat:MovieClip;
var bub:Array;
var treas:Array;
var obst:int;// = 0
var obstMax;// = 0
var dsp:MovieClip;
var tpts;// = 0
var obMax;// = 1
var gct;// = 0
var rod:Array;
var rodMax;// = 0
var bg:MovieClip;
var bgCol:Array;
var star:Array;
var shark:Array;
var sharkMax;// = 0
var bomb:int;// = 0
var bombct;// = 80
var expl:Object;
var clock:MovieClip;// = null
var freez;// = 0
var heart;// = 0
var glasses;// = 0
var glasMC:MovieClip;// = null
var tut:MovieClip;
var dd;// = 0
public function Level01(){
lmc = Main.sprt;
bub = new Array();
treas = new Array();
rod = new Array();
bg = new MovieClip();
bgCol = new Array();
star = new Array();
shark = new Array();
expl = new Object();
tut = new tut1();
super();
var _local1:* = (100 + Main.levl);
_local1 = ("level" + _local1);
isprt = Tools.getObjectByName(_local1);
if (!isprt){
Main.levl = 1;
isprt = new level101();
};
isprt.rotX = 0;
lmc.rotX = 0;
lmc.addChild(isprt);
plat = isprt.plat;
sprt = isprt.sprt;
sprt.xx = 0;
sprt.yy = 0;
sprt.grav = 0;
sprt.ddct = 0;
lmc.filters = [new DropShadowFilter(4, 45, 0, 0.5, 4, 4, 1)];
bg.cacheAsBitmap = false;
dsp = isprt.dsp;
lmc.addChild(dsp);
dsp.rotX = 0;
dsp.lf.gotoAndStop(4);
lmc.parent.addChildAt(bg, 1);
bg.filters = [new BlurFilter(2, 2, 3)];
bg.cacheAsBitmap = false;
bg.alo = 0.3;
bg.alpha = 2;
bg.yo = 0;
sprt.addChild(tut);
}
function roti(_arg1, _arg2){
}
public function update(){
if (isprt.ddd){
return;
};
if (((!(isprt.paus)) && (Input.kkode[32]))){
};
if (dd){
ddCode();
return;
};
bubbleCode();
controls();
sprt.kol.rotation = -(sprt.rotation);
yyCode();
oosCode();
treascode();
ddctCode();
gctCode();
starCode();
sharkCode();
exploCode();
bubCode();
bgCode();
spawnCenter();
if (clock){
clockCode();
};
dsp.pts.text = int((tpts + (gct / 4)));
if (tut){
tutCode();
};
}
function ddCode(){
sprt.visible = true;
sprt.rotation = 0;
sprt.x = (sprt.x + sprt.ddxx);
sprt.ddxx = (sprt.ddxx * 0.99);
sprt.y = (sprt.y + sprt.ddyy);
sprt.ddyy++;
if (sprt.ddyy > 8){
sprt.scaleY = -1;
};
if (sprt.y > 700){
isprt.ddd = 1;
bg.parent.removeChild(bg);
Main.subScores(Number(dsp.pts.text));
};
}
function clockCode(){
clock.x = sprt.x;
if (sprt.y > 320){
clock.y = (sprt.y - 80);
} else {
clock.y = (sprt.y + 80);
};
if (clock.dd){
lmc.removeChild(clock);
clock = null;
isprt.paus = null;
};
}
function spawnCenter(){
rodCode();
if ((((treas.length < obMax)) && (!(isprt.paus)))){
treasSpawn();
};
if ((((obst < obstMax)) && ((Math.random() < 0.005)))){
obstSpawn();
};
if ((((shark.length < sharkMax)) && ((Math.random() < 0.015)))){
spawnShark();
};
bombct--;
if ((((((bombct <= 0)) && ((bomb < 1)))) && ((Math.random() < ((gct / 1000) - 0.3))))){
bombct = 450;
spawnBomb();
};
}
function freeze(){
isprt.paus = true;
clock = new clockMC();
lmc.addChild(clock);
}
function exploCode(){
var _local1:*;
if (expl.ct > 0){
_local1 = new exploMC();
_local1.gotoAndPlay((int(((Math.random() * _local1.totalFrames) * 0.8)) + 1));
_local1.x = (expl.x + rndPM(80));
_local1.y = (expl.y + rndPM(80));
isprt.addChild(_local1);
expl.ct--;
};
}
function spawnBomb(){
bomb++;
var _local1:* = new bombMC();
_local1.gotoAndStop((int((Math.random() * _local1.totalFrames)) + 1));
_local1.xo = (_local1.x = (int((Math.random() * 600)) + 20));
_local1.si = 0;
_local1.yy = ((Math.random() * 3) + 2);
_local1.xx = Math.random();
isprt.addChild(_local1);
_local1.ob = "obst";
_local1.ob2 = "bomb";
treas.push(_local1);
}
function spawnShark(){
var _local1:* = new sharkMC();
isprt.addChildAt(_local1, isprt.getChildIndex(sprt));
_local1.y = (_local1.yo = 480);
_local1.x = ((Math.random() * 440) + 100);
if (((shark[0]) && (shark[0].hitTestObject(_local1)))){
isprt.removeChild(_local1);
return;
};
_local1.si = -1.5;
shark.push(_local1);
}
function sharkCode(){
var _local2:*;
var _local1:* = 0;
while (_local1 < shark.length) {
_local2 = shark[_local1];
if (!isprt.paus){
_local2.y = ((_local2.yo - (Math.sin(_local2.si) * 150)) - 130);
_local2.si = (_local2.si + 0.02);
};
if ((((sprt.ddct <= 0)) && (_local2.kol.hitTestObject(sprt.kol)))){
obHitCode();
};
if (_local2.si > 5){
isprt.removeChild(_local2);
shark.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
function starCode(){
var _local2:*;
var _local1:* = 0;
while (_local1 < star.length) {
_local2 = star[_local1];
_local2.x = (_local2.x + _local2.xx);
_local2.y = (_local2.y + _local2.yy);
_local2.yy = (_local2.yy + 1);
if (_local2.y > 460){
isprt.removeChild(_local2);
star.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
function bubCode(){
var _local1:* = new bubMC();
_local1.x = (Math.round(((getBack().x + rndPM(40)) / 4)) * 4);
_local1.y = (Math.round(((getBack().y + rndPM(40)) / 4)) * 4);
isprt.addChildAt(_local1, isprt.getChildIndex(sprt));
}
function getBack(){
return (sprt.localToGlobal(new Point(sprt.bck.x, sprt.bck.y)));
}
function gctCode(){
if (!isprt.paus){
gct = (gct + 0.1);
};
obMax = ((gct / 100) + 1);
if (obMax > 9){
obMax = 9;
};
obstMax = ((gct / 300) - 0.2);
rodMax = ((gct / 150) - 0.6);
sharkMax = ((gct / 200) - 0.7);
if (sharkMax > 2){
sharkMax = 2;
};
if (rodMax > 6){
rodMax = 6;
};
}
function obstSpawn(){
var _local1:* = new obstMC();
_local1.gotoAndStop((int((Math.random() * _local1.totalFrames)) + 1));
_local1.pts = ((int((Math.random() * 9)) * 10) + 10);
_local1.x = (int((Math.random() * 600)) + 20);
_local1.si = 0;
_local1.yy = ((Math.random() * 3) + 2);
_local1.xx = Math.random();
_local1.xo = _local1.x;
isprt.addChild(_local1);
_local1.ob = "obst";
treas.push(_local1);
obst++;
}
function extras(_arg1){
if (((((!(isprt.paus)) && ((freez <= 0)))) && ((Math.random() < 0.02)))){
_arg1 = new freezMC();
_arg1.ob2 = "freez";
freez++;
_arg1.pts = 0;
return (_arg1);
};
if ((((((heart <= 0)) && ((dsp.lf.currentFrame < 6)))) && (((Math.random() * dsp.lf.currentFrame) < 0.2)))){
_arg1 = new heartMC();
_arg1.ob2 = "heart";
heart++;
_arg1.pts = 0;
return (_arg1);
};
if ((((glasses <= 0)) && ((Math.random() < (gct / 10000))))){
_arg1 = new glassesMC();
_arg1.ob2 = "glasses";
glasses++;
_arg1.pts = 0;
return (_arg1);
};
return (_arg1);
}
function treasSpawn(){
var _local1:* = new treasMC();
_local1.pts = ((int((Math.random() * 9)) * 10) + 10);
_local1 = extras(_local1);
_local1.gotoAndStop((int((Math.random() * _local1.totalFrames)) + 1));
_local1.x = (int((Math.random() * 600)) + 20);
_local1.si = 0;
_local1.yy = ((Math.random() * 3) + 2);
_local1.xx = Math.random();
_local1.xo = _local1.x;
isprt.addChild(_local1);
_local1.ob = "treas";
treas.push(_local1);
}
function treascode(){
var _local2:MovieClip;
var _local1:* = 0;
while (_local1 < treas.length) {
_local2 = treas[_local1];
if (!isprt.paus){
_local2.y = (_local2.y + _local2.yy);
_local2.xo = (_local2.xo - (sprt.xx * _local2.xx));
_local2.x = (_local2.xo + (Math.sin(_local2.si) * 10));
_local2.si = (_local2.si + 0.1);
};
if (((sprt.kol) && (_local2.hitTestObject(sprt.kol)))){
if (_local2.ob == "treas"){
_local2.dd = true;
spawnPTS(_local2);
};
if ((((sprt.ddct <= 1)) && ((_local2.ob == "obst")))){
if (_local2.ob2 == "bomb"){
Music.snd("fxExplo", 1);
expl.x = _local2.x;
expl.y = _local2.y;
expl.ct = 20;
};
_local2.dd = true;
obHitCode();
};
if (_local2.ob2 == "freez"){
freeze();
};
if (_local2.ob2 == "glasses"){
sprt.ddct = 200;
if (glasMC){
dropGlasses();
};
if (!glasMC){
glasMC = new glassesMC();
};
Music.snd("fxGlassOn", 1);
glasMC.x = (glasMC.y = 0);
sprt.addChild(glasMC);
};
if (_local2.ob2 == "heart"){
Music.snd("fxLife", 1);
dsp.lf.nextFrame();
};
};
if (((_local2.dd) || ((_local2.y > 450)))){
if (_local2.ob == "obst"){
obst--;
};
if (_local2.ob2 == "bomb"){
bomb--;
};
if (_local2.ob2 == "freez"){
freez--;
};
if (_local2.ob2 == "heart"){
heart--;
};
if (_local2.ob2 == "glasses"){
glasses--;
};
isprt.removeChild(_local2);
treas.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
function obHitCode(){
Music.snd("fxOuch", 1);
var _local1:* = new ouchMC();
_local1.x = sprt.x;
_local1.y = sprt.y;
lmc.addChild(_local1);
bg.alpha = 2;
if (dsp.lf.currentFrame > 1){
dsp.lf.prevFrame();
sprt.gotoAndStop(2);
} else {
ddit();
};
sprt.ddct = 40;
}
function ddit(){
sprt.visible = true;
sprt.gotoAndStop(3);
sprt.ddxx = ((320 - sprt.x) / 24);
sprt.ddyy = -(((sprt.y / 18) + 5));
isprt.setChildIndex(sprt, (isprt.numChildren - 1));
dd = 1;
Music.mus("fxExplo", 0);
}
function ddctCode(){
if (sprt.ddct > 0){
if (sprt.visible){
sprt.visible = false;
} else {
sprt.visible = true;
};
sprt.ddct--;
if (((glasMC) && ((sprt.ddct <= 30)))){
Music.snd("fxGlassOff", 1.5);
dropGlasses();
};
if (sprt.ddct <= 0){
sprt.gotoAndStop(1);
sprt.visible = true;
};
};
}
function spawnPTS(_arg1){
var _local2:*;
Music.snd("fxCollect", 0.6);
spawnStar(_arg1, -20, -20);
spawnStar(_arg1, 20, -20);
spawnStar(_arg1, -20, 20);
spawnStar(_arg1, 20, 20);
spawnStar(_arg1, 0, -30);
spawnStar(_arg1, 0, 30);
spawnStar(_arg1, -30, 0);
spawnStar(_arg1, 30, 0);
bg.alpha = 0;
if (_arg1.pts > 0){
_local2 = new ptsMC();
_local2.x = _arg1.x;
_local2.y = _arg1.y;
_local2.pt = _arg1.pts;
tpts = (tpts + _arg1.pts);
lmc.addChild(_local2);
lmc.setChildIndex(dsp, (lmc.numChildren - 1));
};
}
function spawnStar(_arg1, _arg2, _arg3){
var _local4:* = new starMC();
_local4.x = (_arg1.x + _arg2);
_local4.y = (_arg1.y + _arg3);
_local4.xx = ((_local4.x - _arg1.x) / 3);
_local4.yy = ((_local4.y - _arg1.y) / 3);
isprt.addChild(_local4);
star.push(_local4);
}
function dropGlasses(){
glasMC.x = sprt.x;
glasMC.y = sprt.y;
glasMC.xx = 0;
glasMC.yy = -10;
isprt.addChild(glasMC);
star.push(glasMC);
glasMC = null;
}
function spawnRod(){
var _local1:* = new rodMC();
_local1.x = (int((Math.random() * 600)) + 20);
_local1.yt = (int((Math.random() * 350)) + 50);
_local1.ct = ((Math.random() * 100) + 10);
isprt.addChild(_local1);
rod.push(_local1);
}
function rodCode(){
var _local2:MovieClip;
if (rod.length <= rodMax){
spawnRod();
};
var _local1:* = 0;
while (_local1 < rod.length) {
_local2 = rod[_local1];
if (!isprt.paus){
if (!_local2.rodup){
if (_local2.y < _local2.yt){
_local2.y = (_local2.y + 2);
} else {
_local2.ct--;
if (_local2.ct < 0){
_local2.rodup = 1;
};
};
} else {
_local2.y = (_local2.y - 3);
};
};
_local2.rope.height = _local2.y;
if ((((sprt.ddct <= 0)) && (_local2.kol.hitTestObject(sprt.kol)))){
obHitCode();
};
if (_local2.y < 0){
isprt.removeChild(_local2);
rod.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
function oosCode(){
if (sprt.x < 20){
sprt.x = 620;
};
if (sprt.x > 620){
sprt.x = 20;
};
if (sprt.y < 20){
sprt.y = 460;
};
if (sprt.y > 460){
sprt.y = 20;
};
}
function bubbleCode(){
var _local2:*;
if (isprt.paus){
return;
};
if (bub.length < 16){
_local2 = new bubbl();
_local2.y = 440;
_local2.x = (int((Math.random() * 600)) + 20);
_local2.gotoAndStop((int((Math.random() * _local2.totalFrames)) + 1));
isprt.addChildAt(_local2, 0);
_local2.yy = -(((Math.random() * 5) + 2));
_local2.xx = Math.random();
_local2.alpha = 0.5;
bub.push(_local2);
};
var _local1:* = 0;
while (_local1 < bub.length) {
_local2 = bub[_local1];
_local2.y = (_local2.y + _local2.yy);
_local2.x = (_local2.x - (sprt.xx * _local2.xx));
if (_local2.y < 40){
isprt.removeChild(_local2);
bub.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
function gravCode(){
sprt.grav++;
if (sprt.grav > 14){
sprt.grav = 14;
};
sprt.y = (sprt.y + sprt.grav);
if (sprt.grav < 0){
while (((((plat.hitTestPoint((isprt.x + sprt.x), ((isprt.y + sprt.y) - 30), true)) || (plat.hitTestPoint(((isprt.x + sprt.x) - 10), ((isprt.y + sprt.y) - 30), true)))) || (plat.hitTestPoint(((isprt.x + sprt.x) + 10), ((isprt.y + sprt.y) - 30), true)))) {
sprt.y++;
sprt.grav = 0;
};
};
if (sprt.grav > 0){
while (((((plat.hitTestPoint((isprt.x + sprt.x), (isprt.y + sprt.y), true)) || (plat.hitTestPoint(((isprt.x + sprt.x) - 10), (isprt.y + sprt.y), true)))) || (plat.hitTestPoint(((isprt.x + sprt.x) + 10), (isprt.y + sprt.y), true)))) {
sprt.y--;
sprt.grav = -12;
sprt.gotoAndPlay(2);
sprt.fly = null;
};
};
}
function controls(){
if (Input.kkode[37]){
sprt.rotation = (sprt.rotation - 5);
};
if (Input.kkode[39]){
sprt.rotation = (sprt.rotation + 5);
};
sprt.xx = (sprt.rotation * 0.1);
var _local1:* = 1;
if (sprt.rotation < 0){
_local1 = -1;
};
if (Math.abs(sprt.rotation) < 90){
sprt.yy = (sprt.yy - 0.5);
};
if (Math.abs(sprt.rotation) > 90){
sprt.yy = (sprt.yy + 0.5);
sprt.xx = (((180 * _local1) - sprt.rotation) * 0.1);
};
if (sprt.xx > 5){
sprt.xx = 5;
};
if (sprt.xx < -5){
sprt.xx = -5;
};
if (Math.abs(sprt.xx) < 0.1){
sprt.xx = 0;
};
sprt.x = (sprt.x + sprt.xx);
sprt.xx = (sprt.xx * 0.8);
}
function yyCode(){
sprt.yy = (sprt.yy / 1.1);
sprt.y = (sprt.y + sprt.yy);
}
function ini(){
var _local2:*;
var _local3:*;
var _local1:* = 0;
while (_local1 < isprt.numChildren) {
_local2 = isprt.getChildAt(_local1);
_local3 = _local2.name.split("_");
if (_local3[0] == "namehere"){
};
_local1++;
};
}
function bgCode(){
var _local4:*;
bg.alpha = (bg.alpha + ((bg.alo - bg.alpha) / 16));
bg.graphics.clear();
var _local1:* = -1;
var _local2:* = 0;
var _local3:* = 0;
while (_local1 < 8) {
if (_local3 > 9){
_local1++;
_local3 = 0;
if (_local1 > 7){
break;
};
};
if (!bgCol[_local2]){
bgCol[_local2] = [int(((Math.random() * 0) + 0)), int((Math.random() + 0xFF)), int((Math.random() + 0xFF))];
};
coloCode(bgCol[_local2]);
_local4 = ((("0x" + getHEX(bgCol[_local2][0])) + getHEX(bgCol[_local2][1])) + getHEX(bgCol[_local2][2]));
bg.graphics.beginFill(_local4, 1);
bg.graphics.drawRect((_local3 * 64), ((_local1 * 60) + bg.yo), 64, 60);
bg.graphics.endFill();
_local2++;
_local3++;
};
if (!isprt.paus){
bg.yo = (bg.yo + 1);
};
if (bg.yo > 60){
bg.yo = 0;
bgCol.unshift(null, null, null, null, null, null, null, null, null, null);
bgCol.length = 90;
};
}
function coloCode(_arg1){
var _local2:* = 0;
while (_local2 < 3) {
_arg1[_local2] = (_arg1[_local2] + rndPM(30));
if (_arg1[_local2] < 0){
_arg1[_local2] = 0;
};
if (_arg1[_local2] > 0xFF){
_arg1[_local2] = 0xFF;
};
_local2++;
};
}
function getHEX(_arg1){
var _local2:* = _arg1.toString(16);
if (_local2.length < 2){
_local2 = ("0" + _local2);
};
return (_local2);
}
function rndPM(_arg1){
return (((Math.random() * _arg1) - (_arg1 / 2)));
}
function tutCode(){
tut.rotation = -(sprt.rotation);
if (gct > 12){
if (!tut.n2){
sprt.removeChild(tut);
tut = new tut2();
tut.n2 = true;
lmc.addChild(tut);
};
if (tut.n2){
tut.rotation = 0;
if (gct > 24){
lmc.removeChild(tut);
tut = null;
};
};
};
}
}
}//package Levels
Section 11
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
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.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 12
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 13
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
}
}//package mochi.as3
Section 14
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
public class MochiEvents {
public static const ACHIEVEMENTS_OWNED:String = "AchievementOwned";
public static const ACHIEVEMENT_NEW:String = "AchievementReceived";
public static const GAME_ACHIEVEMENTS:String = "GameAchievements";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const IO_PENDING:String = "IOPending";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
public static const FORMAT_NONE:String = "NoForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAchievements(_arg1:Object=null):void{
MochiServices.send("events_getAchievements", _arg1);
}
public static function unlockAchievement(_arg1:Object):void{
MochiServices.send("events_unlockAchievement", _arg1);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function showAwards(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.stayOnTop();
MochiServices.send("events_showAwards", _arg1);
}
public static function setNotifications(_arg1:Object):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("events_setNotifications", _arg1, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 15
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 16
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
public static var onCloseHandler:Object;
public static var onErrorHandler:Object;
private static var boardID:String;
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
}
}//package mochi.as3
Section 17
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.geom.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.4 as3");
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
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.");
};
}
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();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
MochiServices.onError("NotConnected");
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
if (_arg1 != null){
if (_arg1.onError != null){
_arg1.onError("NotConnected");
};
if (((!((_arg1.options == null))) && (!((_arg1.options.onError == null))))){
_arg1.options.onError("NotConnected");
};
};
if (_arg3 != null){
_arg1 = {};
_arg1.error = true;
_arg1.errorCode = "NotConnected";
if (((!((_arg2 == null))) && ((_arg3 is String)))){
try {
var _local4 = _arg2;
_local4[_arg3](_arg1);
} catch(error:Error) {
};
} else {
if (_arg3 != null){
try {
_arg3.apply(_arg1);
} catch(error:Error) {
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 18
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_CANCELED:String = "onCancel";
public static const ACTION_COMPLETE:String = "onComplete";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function showProfile(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.stayOnTop();
MochiServices.send("social_showProfile", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 19
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 20
//Input (Plugs.Input)
package Plugs {
import flash.display.*;
import flash.events.*;
public class Input {
public static var kkode = null;
public static var mclick = null;
public static var mdown = null;
public function Input(_arg1){
ini();
_arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, kpress);
_arg1.stage.addEventListener(KeyboardEvent.KEY_UP, krelease);
_arg1.stage.addEventListener(MouseEvent.CLICK, miw);
_arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, md);
_arg1.stage.addEventListener(MouseEvent.MOUSE_UP, mu);
}
public function kpress(_arg1){
kkode[_arg1.keyCode] = 1;
}
public function krelease(_arg1){
kkode[_arg1.keyCode] = 0;
}
public function miw(_arg1){
if (_arg1.target.name){
Main.mclick(_arg1.target);
};
}
public function md(_arg1){
if (_arg1.target.name){
mclick = _arg1.target;
mdown = _arg1.target;
};
}
public function mu(_arg1){
mdown = null;
}
public static function ini(){
kkode = new Array();
mclick = null;
mdown = null;
}
}
}//package Plugs
Section 21
//Music (Plugs.Music)
package Plugs {
import flash.utils.*;
import flash.media.*;
public class Music {
static var music:Sound = new Sound();
static var sfx:Sound = new Sound();
static var musicChannel = new Array();
static var musicChannelCrowd = null;
public static var vol = 1;
public static var volG = 1;
public static var st = "off";
public static var currN = 0;
public static var chargeVol = 0;
public static var musicNR = null;
public static var volFX = 1;
public static var volMU = 1;
public static var curvolMU = 1;
public static var panel = null;
public static var ln = null;
public static function mus(... _args){
var _local2:* = _args[0];
var _local3:* = Tools.getObjectByName(_args[0]);
if (_local3){
if (musicNR != _local2){
if (musicChannel["music"]){
musicChannel["music"].stop();
};
curvolMU = _args[1];
musicChannel["music"] = _local3.play(0, 99999, new SoundTransform((curvolMU * volMU)));
musicNR = _local2;
};
};
}
public static function changeVol(... _args){
if (musicChannel["music"]){
curvolMU = (curvolMU + _args[0]);
if (curvolMU < 0){
curvolMU = 0;
};
musicChannel["music"].soundTransform = new SoundTransform((curvolMU * volMU));
};
}
public static function loopMod(... _args){
if (musicChannel["fxShip"]){
musicChannel["fxShip"].soundTransform = new SoundTransform((_args[0] * volFX));
};
}
public static function musip(){
}
public static function musVol(){
if (volG){
volG = 0;
} else {
volG = 1;
};
musicChannel.soundTransform = new SoundTransform(volG);
}
public static function snd(_arg1:String, _arg2:Number){
var _local5:*;
var _local3:* = (getDefinitionByName(_arg1) as Class);
_local3 = new (_local3);
_local3.play(0, 0, new SoundTransform((_arg2 * volFX)));
var _local4:* = (((_arg2 - 320) / 320) * 1.2);
if (_arg1 == "snip"){
_local5 = (getDefinitionByName("snip") as Class);
_local3 = new (_local5);
_local3.play(0, 0, new SoundTransform(1));
};
if (_arg1 == "fail"){
_local5 = (getDefinitionByName("fail") as Class);
_local3 = new (_local5);
_local3.play(0, 0, new SoundTransform(1));
};
}
}
}//package Plugs
Section 22
//Tools (Plugs.Tools)
package Plugs {
import flash.utils.*;
public class Tools {
public static function getObjectByName(_arg1){
var _local2:* = null;
try {
_local2 = (getDefinitionByName(_arg1) as Class);
_local2 = new (_local2);
} catch(e) {
};
return (_local2);
}
}
}//package Plugs
Section 23
//blackMC (blackMC)
package {
import flash.display.*;
public dynamic class blackMC extends MovieClip {
public function blackMC(){
addFrameScript(16, frame17);
}
function frame17(){
stop();
}
}
}//package
Section 24
//blackMC2 (blackMC2)
package {
import flash.display.*;
public dynamic class blackMC2 extends MovieClip {
}
}//package
Section 25
//bombMC (bombMC)
package {
import flash.display.*;
public dynamic class bombMC extends MovieClip {
}
}//package
Section 26
//bubbl (bubbl)
package {
import flash.display.*;
public dynamic class bubbl extends MovieClip {
}
}//package
Section 27
//bubMC (bubMC)
package {
import flash.display.*;
public dynamic class bubMC extends MovieClip {
public function bubMC(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
parent.removeChild(this);
}
}
}//package
Section 28
//bubMC2 (bubMC2)
package {
import flash.display.*;
public dynamic class bubMC2 extends MovieClip {
}
}//package
Section 29
//clockMC (clockMC)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.text.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class clockMC extends MovieClip {
public var t;
public function clockMC(){
addFrameScript(145, frame146);
}
function frame146(){
t = this;
t.dd = true;
stop();
}
}
}//package
Section 30
//exploMC (exploMC)
package {
import flash.display.*;
public dynamic class exploMC extends MovieClip {
public function exploMC(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
parent.removeChild(this);
}
}
}//package
Section 31
//freezMC (freezMC)
package {
import flash.display.*;
public dynamic class freezMC extends MovieClip {
}
}//package
Section 32
//fxCollect (fxCollect)
package {
import flash.media.*;
public dynamic class fxCollect extends Sound {
}
}//package
Section 33
//fxExplo (fxExplo)
package {
import flash.media.*;
public dynamic class fxExplo extends Sound {
}
}//package
Section 34
//fxGlassOff (fxGlassOff)
package {
import flash.media.*;
public dynamic class fxGlassOff extends Sound {
}
}//package
Section 35
//fxGlassOn (fxGlassOn)
package {
import flash.media.*;
public dynamic class fxGlassOn extends Sound {
}
}//package
Section 36
//fxLife (fxLife)
package {
import flash.media.*;
public dynamic class fxLife extends Sound {
}
}//package
Section 37
//fxOuch (fxOuch)
package {
import flash.media.*;
public dynamic class fxOuch extends Sound {
}
}//package
Section 38
//glassesMC (glassesMC)
package {
import flash.display.*;
public dynamic class glassesMC extends MovieClip {
}
}//package
Section 39
//heartMC (heartMC)
package {
import flash.display.*;
public dynamic class heartMC extends MovieClip {
}
}//package
Section 40
//level101 (level101)
package {
import flash.display.*;
public dynamic class level101 extends MovieClip {
public var sprt:MovieClip;
public var dsp:MovieClip;
}
}//package
Section 41
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import Plugs.*;
import Levels.*;
import CPMStar.*;
import flash.net.*;
import flash.ui.*;
import flash.media.*;
import flash.geom.*;
public class Main extends MovieClip {
public var loadi:MovieClip;
public var eddy:MovieClip;
public var CPMStarPoolID:int;
public var CPMStarSubPoolID:int;
public var adcpm:DisplayObject;
public var pct;
public var mc1:MovieClip;
public var _mochiads_game_id:String;
public var my_cMenu:ContextMenu;
public var curr_levl;
public static var levl:int = 0;
public static var dd:uint = 1;
public static var sprt:MovieClip = null;
public static var acc:Object = new Object();
public function Main(){
addFrameScript(0, frame1, 4, frame5);
addEventListener(Event.ENTER_FRAME, loada);
}
public function cl(_arg1:Event){
if (_arg1.target.name == "btnLaunch"){
removeEventListener(Event.ENTER_FRAME, ef);
removeEventListener(MouseEvent.CLICK, cl);
SoundMixer.stopAll();
play();
};
}
public function ef(_arg1:Event){
var _local2:* = ((stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal) * 100);
if (_local2 > pct){
pct++;
};
var _local3:* = int(((pct / 20) + 0.9));
if (_local3 > loadi.currentFrame){
loadi.gotoAndStop(_local3);
};
}
function loada(_arg1:Event){
var _local2:*;
if (currentLabel == "game"){
acc.xx = 0;
scrollRect = new Rectangle(0, 0, 640, 480);
stage.scaleMode = "noScale";
stage.quality = "low";
stage.frameRate = 29;
stage.tabChildren = false;
stage.stageFocusRect = false;
_local2 = new Input(stage);
removeEventListener(Event.ENTER_FRAME, loada);
addEventListener(Event.ENTER_FRAME, mcode);
};
}
function mcode(_arg1:Event){
if (dd == 1){
if (sprt){
removeChild(sprt);
sprt = null;
};
curr_levl = null;
if (levl == 0){
Music.mus("musTitle", 1);
sprt = new titleMC();
addChild(sprt);
};
if (levl > 0){
Music.mus("musIngame", 1);
sprt = new MovieClip();
addChild(sprt);
curr_levl = new Level01();
};
sprt.scrollRect = new Rectangle(0, 0, 640, 480);
dd = 0;
stage.focus = stage;
};
if (curr_levl){
curr_levl.update();
};
}
function frame1(){
CPMStarPoolID = 7496;
CPMStarSubPoolID = 10;
adcpm = AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID);
eddy.addChild(adcpm);
stop();
pct = 0;
loadi.gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, ef);
addEventListener(MouseEvent.CLICK, cl);
mc1 = new MovieClip();
stage.addChild(mc1);
MochiServices.connect("b0d4e9406a777b95", mc1);
_mochiads_game_id = "b0d4e9406a777b95";
my_cMenu = new ContextMenu();
my_cMenu.hideBuiltInItems();
contextMenu = my_cMenu;
}
function frame5(){
stop();
}
public static function showScores(){
sprt.addChild(new blackMC2());
var o:Object = {n:[10, 6, 1, 15, 4, 8, 1, 4, 4, 12, 14, 4, 5, 1, 5, 1], 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:gotoTitle, res:"640x480"});
}
public static function subScores(_arg1){
var subP = _arg1;
sprt.addChild(new blackMC2());
var o:Object = {n:[10, 6, 1, 15, 4, 8, 1, 4, 4, 12, 14, 4, 5, 1, 5, 1], 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:subP, onClose:gotoTitle, res:"640x480"});
}
public static function voidCode(){
}
public static function gotoTitle(){
Main.levl = 0;
Main.dd = 1;
}
public static function cache(_arg1:MovieClip){
_arg1.cacheAsBitmapMatrix = new Matrix();
_arg1.cacheAsBitmap = true;
}
public static function cacheBmp(_arg1:MovieClip){
_arg1.cacheAsBitmap = true;
}
public static function mclick(_arg1){
if (_arg1.name == "butPlay"){
levl = 1;
dd = 1;
};
if (_arg1.name == "butShowScores"){
showScores();
};
if (_arg1.name == "redirMOGA"){
navigateToURL(new URLRequest("http://www.gameshot.org"), "_blank");
};
if (_arg1.name == "redirMAF"){
navigateToURL(new URLRequest("http://www.maf464.com/"), "_blank");
};
}
}
}//package
Section 42
//musIngame (musIngame)
package {
import flash.media.*;
public dynamic class musIngame extends Sound {
}
}//package
Section 43
//musTitle (musTitle)
package {
import flash.media.*;
public dynamic class musTitle extends Sound {
}
}//package
Section 44
//muteFX (muteFX)
package {
import flash.display.*;
public dynamic class muteFX extends MovieClip {
public function muteFX(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 45
//obstMC (obstMC)
package {
import flash.display.*;
public dynamic class obstMC extends MovieClip {
}
}//package
Section 46
//ouchMC (ouchMC)
package {
import flash.display.*;
public dynamic class ouchMC extends MovieClip {
public function ouchMC(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
parent.removeChild(this);
}
}
}//package
Section 47
//ptsMC (ptsMC)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.text.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class ptsMC extends MovieClip {
public var txt:TextField;
public var t;
public function ptsMC(){
addFrameScript(0, frame1, 9, frame10, 15, frame16, 20, frame21, 22, frame23);
}
function frame1(){
t = this;
txt.text = t.pt;
}
function frame10(){
txt.text = t.pt;
}
function frame16(){
txt.text = t.pt;
}
function frame21(){
txt.text = t.pt;
}
function frame23(){
stop();
t.parent.removeChild(t);
}
}
}//package
Section 48
//rodMC (rodMC)
package {
import flash.display.*;
public dynamic class rodMC extends MovieClip {
public var rope:MovieClip;
public var kol:MovieClip;
}
}//package
Section 49
//sharkMC (sharkMC)
package {
import flash.display.*;
public dynamic class sharkMC extends MovieClip {
public var kol:MovieClip;
}
}//package
Section 50
//starMC (starMC)
package {
import flash.display.*;
public dynamic class starMC extends MovieClip {
}
}//package
Section 51
//titleMC (titleMC)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.text.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class titleMC extends MovieClip {
public var butShowScores:SimpleButton;
public var butPlay:SimpleButton;
public var sprt:MovieClip;
public var redirMAF:SimpleButton;
public var redirMOGA:SimpleButton;
public var isprt;
public var bub:Array;
public function titleMC(){
addFrameScript(0, frame1);
}
public function ef(_arg1:Event){
if (sprt.currentFrame == 9){
sprt.yy = -8;
sprt.y = sprt.yo;
};
sprt.y = (sprt.y + sprt.yy);
sprt.yy++;
bubCode();
bubbleCode();
if (!isprt.root){
trace("remove");
removeEventListener(Event.ENTER_FRAME, ef);
};
}
public function bubCode(){
}
public function bubbleCode(){
var _local2:*;
if (bub.length < 20){
_local2 = new bubbl();
_local2.y = 20;
_local2.x = (int((Math.random() * 600)) + 20);
_local2.gotoAndStop((int((Math.random() * _local2.totalFrames)) + 1));
isprt.addChildAt(_local2, 0);
_local2.yy = -(((Math.random() * 5) + 2));
_local2.xx = Math.random();
_local2.alpha = 0.5;
bub.push(_local2);
};
var _local1:* = 0;
while (_local1 < bub.length) {
_local2 = bub[_local1];
_local2.y = (_local2.y - _local2.yy);
if (_local2.y > 460){
isprt.removeChild(_local2);
bub.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function getBack(){
return (sprt.localToGlobal(new Point(sprt.bck.x, sprt.bck.y)));
}
public function rndPM(_arg1){
return (((Math.random() * _arg1) - (_arg1 / 2)));
}
function frame1(){
addEventListener(Event.ENTER_FRAME, ef);
isprt = this;
sprt.si = 0;
sprt.yo = sprt.y;
sprt.yy = 0;
bub = new Array();
bubbleCode();
}
}
}//package
Section 52
//treasMC (treasMC)
package {
import flash.display.*;
public dynamic class treasMC extends MovieClip {
}
}//package
Section 53
//tut1 (tut1)
package {
import flash.display.*;
public dynamic class tut1 extends MovieClip {
}
}//package
Section 54
//tut2 (tut2)
package {
import flash.display.*;
public dynamic class tut2 extends MovieClip {
}
}//package