Section 1
//AGameIntroLogo (AGameIntroLogo)
package {
import flash.display.*;
import flash.events.*;
public class AGameIntroLogo extends MovieClip {
public function AGameIntroLogo(){
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
if (MovieClip(root).subBuild == "Mochi"){
addEventListener(Event.ENTER_FRAME, update);
};
}
function update(_arg1:Event){
MovieClip(parent).setChildIndex(this, (MovieClip(parent).numChildren - 1));
alpha = 1;
}
}
}//package
Section 2
//AGameLoader (AGameLoader)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class AGameLoader extends MovieClip {
const FADE_OUT:int = 3;
const LOADING:int = 2;
const DONE:int = 4;
const FADE_IN:int = 1;
var mState:int;// = 1
var mTotalFrameL:int;
var mPreloader:Boolean;// = false
var mStartFrameL:int;
public function AGameLoader(_arg1:int, _arg2:int, _arg3:Boolean){
mState = 1;
mPreloader = false;
super();
mStartFrameL = _arg1;
mTotalFrameL = (_arg2 - _arg1);
mPreloader = _arg3;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, update);
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(GameState(MovieClip(root)).moreGamesLink);
navigateToURL(_local2, "_blank");
}
private function update(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:*;
if (mState == FADE_IN){
nextFrame();
if (currentFrame == mStartFrameL){
mState = LOADING;
};
};
if (mState == LOADING){
if (mPreloader){
_local2 = MovieClip(root).loaderInfo.bytesTotal;
_local3 = MovieClip(root).loaderInfo.bytesLoaded;
_local4 = (mStartFrameL + Math.floor(((_local3 / _local2) * mTotalFrameL)));
gotoAndStop(_local4);
if (_local3 >= _local2){
mState = FADE_OUT;
gotoAndStop((mStartFrameL + mTotalFrameL));
};
};
};
if (mState == FADE_OUT){
nextFrame();
if (currentFrame >= totalFrames){
mState = DONE;
};
};
if (mState == DONE){
removeEventListener(Event.ENTER_FRAME, update);
MovieClip(parent).play();
MovieClip(parent).removeChild(this);
};
}
}
}//package
Section 3
//AGameLogo (AGameLogo)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class AGameLogo extends MovieClip {
public function AGameLogo(){
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(GameState(MovieClip(root)).moreGamesLink);
navigateToURL(_local2, "_blank");
}
}
}//package
Section 4
//Atom (Atom)
package {
import flash.display.*;
import flash.events.*;
public class Atom extends MovieClip {
private const growthRadius:Number = 21;
private const maxSpeed:int = 25;
private const normalRadius:Number = 17;
private const shrinkRadius:Number = 13;
public var points:int;
private var velocityY:Number;
private var velocityX:Number;
private var shootingAngles:Array;
public var collisionRadius;
public var direction:int;
public var type:String;
private var lManager:Level;
public var particle:Particle;// = null
public function Atom(_arg1:String, _arg2:int){
particle = null;
super();
type = _arg1;
direction = (_arg2 * 45);
switch (type){
case "Eight":
shootingAngles = [0, 45, 90, 135, 180, 225, 270, 315];
points = 25;
break;
case "SixH":
shootingAngles = [0, 60, 120, 180, 240, 300];
points = 30;
break;
case "SixV":
shootingAngles = [30, 90, 150, 210, 270, 330];
points = 30;
break;
case "FourC":
shootingAngles = [0, 90, 180, 270];
points = 50;
break;
case "FourX":
shootingAngles = [45, 135, 225, 315];
points = 50;
break;
case "TwoH":
shootingAngles = [0, 180];
points = 100;
break;
case "TwoV":
shootingAngles = [90, 270];
points = 100;
break;
};
addEventListener(Event.ADDED_TO_STAGE, init);
addEventListener(MouseEvent.CLICK, click);
}
public function shrink(){
if (collisionRadius == normalRadius){
gotoAndStop((type + "Shrink"));
collisionRadius = shrinkRadius;
} else {
if (collisionRadius == growthRadius){
gotoAndStop(type);
collisionRadius = normalRadius;
};
};
}
private function init(_arg1:Event){
var _local2:Number;
lManager = Level(MovieClip(parent));
_local2 = vgsMath.deg2rad((direction * 45));
collisionRadius = normalRadius;
velocityX = (Math.cos(_local2) * maxSpeed);
velocityY = (Math.sin(_local2) * maxSpeed);
x = ((Math.random() * 594) + 23);
y = ((Math.random() * 434) + 23);
gotoAndStop(type);
}
public function grow(){
if (collisionRadius == normalRadius){
gotoAndStop((type + "Growth"));
collisionRadius = growthRadius;
} else {
if (collisionRadius == shrinkRadius){
gotoAndStop(type);
collisionRadius = normalRadius;
};
};
}
public function fire(){
var _local1:*;
var _local2:Particle;
for (_local1 in shootingAngles) {
_local2 = new Particle(shootingAngles[_local1], this, 0, null);
_local2.x = x;
_local2.y = y;
_local2.gotoAndStop(type);
lManager.addChild(_local2);
lManager.prtsList.push(_local2);
};
if (particle != null){
particle.looseTarget();
};
lManager.deleteAtom(this);
}
private function click(_arg1:MouseEvent){
if (lManager.currentState == 1){
fire();
lManager.currentState = 2;
lManager.levelClicks++;
};
}
public function update(_arg1:int){
var _local2:Number;
var _local3:Number;
_local2 = (x + ((velocityX * _arg1) * 0.001));
_local3 = (y + ((velocityY * _arg1) * 0.001));
if ((((_local2 > (640 - collisionRadius))) || ((_local2 < collisionRadius)))){
_local2 = x;
velocityX = (velocityX * -1);
};
if ((((_local3 > (480 - collisionRadius))) || ((_local3 < collisionRadius)))){
_local3 = y;
velocityY = (velocityY * -1);
};
x = _local2;
y = _local3;
}
}
}//package
Section 5
//AtomEight (AtomEight)
package {
import flash.display.*;
public dynamic class AtomEight extends BitmapData {
public function AtomEight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 6
//AtomEightGrowth (AtomEightGrowth)
package {
import flash.display.*;
public dynamic class AtomEightGrowth extends BitmapData {
public function AtomEightGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 7
//AtomEightShrink (AtomEightShrink)
package {
import flash.display.*;
public dynamic class AtomEightShrink extends BitmapData {
public function AtomEightShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 8
//AtomFourC (AtomFourC)
package {
import flash.display.*;
public dynamic class AtomFourC extends BitmapData {
public function AtomFourC(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 9
//AtomFourCGrowth (AtomFourCGrowth)
package {
import flash.display.*;
public dynamic class AtomFourCGrowth extends BitmapData {
public function AtomFourCGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 10
//AtomFourCShrink (AtomFourCShrink)
package {
import flash.display.*;
public dynamic class AtomFourCShrink extends BitmapData {
public function AtomFourCShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 11
//AtomFourX (AtomFourX)
package {
import flash.display.*;
public dynamic class AtomFourX extends BitmapData {
public function AtomFourX(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 12
//AtomFourXGrowth (AtomFourXGrowth)
package {
import flash.display.*;
public dynamic class AtomFourXGrowth extends BitmapData {
public function AtomFourXGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 13
//AtomFourXShrink (AtomFourXShrink)
package {
import flash.display.*;
public dynamic class AtomFourXShrink extends BitmapData {
public function AtomFourXShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 14
//AtomikKaosAGame (AtomikKaosAGame)
package {
public dynamic class AtomikKaosAGame extends GameState {
public function AtomikKaosAGame(){
var _local1:Object;
var _local2:String;
var _local3:String;
super();
addFrameScript(0, frame1, 3, frame4, 5, frame6, 6, frame7, 7, frame8, 8, frame9);
build = "AGame";
moreGamesLink = "http://moregames.agame.com";
freeGamesLink = "http://freegames.agame.com";
_local2 = this.root.loaderInfo.url.split("/")[2];
_local3 = "www8.agame.com";
if (_local2.indexOf(_local3) == (_local2.length - _local3.length)){
_local1 = {mochiBotID:"c88d1b53", preloaderAdsProvider:"AGame", preloaderAdsObject:{startFrame:10, finalFrame:75}, statSystem:"Local", statSystemObject:{name:"AtomikKaos", keys:["normalLevel", "endlessScore"], values:[0, 0]}};
} else {
subBuild = "Mochi";
_local1 = {mochiBotID:"c88d1b53", preloaderAdsProvider:"Mochi", preloaderAdsObject:{id:"bd1367f1febadb18", color:0x333333, background:0x666666, outline:0}, statSystem:"Local", statSystemObject:{name:"AtomikKaos", keys:["normalLevel", "endlessScore"], values:[0, 0]}};
};
globalService = new vgsService(this, _local1);
}
function frame6(){
stop();
}
function frame7(){
gotoAndStop("menu");
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame9(){
gotoAndStop("game");
}
function frame8(){
stop();
}
}
}//package
Section 15
//AtomSixH (AtomSixH)
package {
import flash.display.*;
public dynamic class AtomSixH extends BitmapData {
public function AtomSixH(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 16
//AtomSixHGrowth (AtomSixHGrowth)
package {
import flash.display.*;
public dynamic class AtomSixHGrowth extends BitmapData {
public function AtomSixHGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 17
//AtomSixHShrink (AtomSixHShrink)
package {
import flash.display.*;
public dynamic class AtomSixHShrink extends BitmapData {
public function AtomSixHShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 18
//AtomSixV (AtomSixV)
package {
import flash.display.*;
public dynamic class AtomSixV extends BitmapData {
public function AtomSixV(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 19
//AtomSixVGrowth (AtomSixVGrowth)
package {
import flash.display.*;
public dynamic class AtomSixVGrowth extends BitmapData {
public function AtomSixVGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 20
//AtomSixVShrink (AtomSixVShrink)
package {
import flash.display.*;
public dynamic class AtomSixVShrink extends BitmapData {
public function AtomSixVShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 21
//AtomTwoH (AtomTwoH)
package {
import flash.display.*;
public dynamic class AtomTwoH extends BitmapData {
public function AtomTwoH(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 22
//AtomTwoHGrowth (AtomTwoHGrowth)
package {
import flash.display.*;
public dynamic class AtomTwoHGrowth extends BitmapData {
public function AtomTwoHGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 23
//AtomTwoHShrink (AtomTwoHShrink)
package {
import flash.display.*;
public dynamic class AtomTwoHShrink extends BitmapData {
public function AtomTwoHShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 24
//AtomTwoV (AtomTwoV)
package {
import flash.display.*;
public dynamic class AtomTwoV extends BitmapData {
public function AtomTwoV(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 25
//AtomTwoVGrowth (AtomTwoVGrowth)
package {
import flash.display.*;
public dynamic class AtomTwoVGrowth extends BitmapData {
public function AtomTwoVGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 26
//AtomTwoVShrink (AtomTwoVShrink)
package {
import flash.display.*;
public dynamic class AtomTwoVShrink extends BitmapData {
public function AtomTwoVShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 27
//Background (Background)
package {
import flash.display.*;
public dynamic class Background extends BitmapData {
public function Background(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 28
//Bacteria (Bacteria)
package {
import flash.display.*;
import flash.events.*;
public class Bacteria extends MovieClip {
private const maxSpeed:int = 25;
private var velocityX:Number;
private var velocityY:Number;
private var customRotation:Number;
public function Bacteria(){
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
x = (Math.random() * 640);
y = (Math.random() * 480);
velocityX = (((Math.random() * 2) - 1) * maxSpeed);
velocityY = (((Math.random() * 2) - 1) * maxSpeed);
scaleX = (scaleY = (Math.random() * 2));
customRotation = vgsMath.deg2rad(((Math.random() * 90) - 180));
gotoAndStop(Math.ceil((Math.random() * totalFrames)));
}
public function update(_arg1:int){
x = (x + ((velocityX * _arg1) * 0.001));
y = (y + ((velocityY * _arg1) * 0.001));
if ((((x > (640 + (width * 0.5)))) && ((velocityX > 0)))){
x = (-(width) * 0.5);
};
if ((((x < (-(width) * 0.5))) && ((velocityX < 0)))){
x = (640 + (width * 0.5));
};
if ((((y > (480 + (width * 0.5)))) && ((velocityY > 0)))){
y = (-(width) * 0.5);
};
if ((((y < (-(width) * 0.5))) && ((velocityY < 0)))){
y = (480 + (width * 0.5));
};
rotation = (rotation + ((customRotation * _arg1) * 0.001));
}
}
}//package
Section 29
//Bacteria1 (Bacteria1)
package {
import flash.display.*;
public dynamic class Bacteria1 extends BitmapData {
public function Bacteria1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 30
//Bacteria10 (Bacteria10)
package {
import flash.display.*;
public dynamic class Bacteria10 extends BitmapData {
public function Bacteria10(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 31
//Bacteria11 (Bacteria11)
package {
import flash.display.*;
public dynamic class Bacteria11 extends BitmapData {
public function Bacteria11(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 32
//Bacteria2 (Bacteria2)
package {
import flash.display.*;
public dynamic class Bacteria2 extends BitmapData {
public function Bacteria2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 33
//Bacteria3 (Bacteria3)
package {
import flash.display.*;
public dynamic class Bacteria3 extends BitmapData {
public function Bacteria3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 34
//Bacteria4 (Bacteria4)
package {
import flash.display.*;
public dynamic class Bacteria4 extends BitmapData {
public function Bacteria4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 35
//Bacteria5 (Bacteria5)
package {
import flash.display.*;
public dynamic class Bacteria5 extends BitmapData {
public function Bacteria5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 36
//Bacteria6 (Bacteria6)
package {
import flash.display.*;
public dynamic class Bacteria6 extends BitmapData {
public function Bacteria6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 37
//Bacteria7 (Bacteria7)
package {
import flash.display.*;
public dynamic class Bacteria7 extends BitmapData {
public function Bacteria7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 38
//Bacteria8 (Bacteria8)
package {
import flash.display.*;
public dynamic class Bacteria8 extends BitmapData {
public function Bacteria8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 39
//Bacteria9 (Bacteria9)
package {
import flash.display.*;
public dynamic class Bacteria9 extends BitmapData {
public function Bacteria9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 40
//BlackCanvas (BlackCanvas)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class BlackCanvas extends MovieClip {
private const nOfBacterias:int = 20;
private var lstTime:int;
private var bacteriaList:Array;
public function BlackCanvas(){
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
var _local2:*;
var _local3:Bacteria;
bacteriaList = new Array();
_local2 = 1;
while (_local2 <= nOfBacterias) {
_local3 = new Bacteria();
addChild(_local3);
bacteriaList.push(_local3);
_local2++;
};
lstTime = getTimer();
addEventListener(Event.ENTER_FRAME, update);
}
private function update(_arg1:Event){
var _local2:int;
var _local3:*;
_local2 = (getTimer() - lstTime);
lstTime = (lstTime + _local2);
for (_local3 in bacteriaList) {
bacteriaList[_local3].update(_local2);
};
}
}
}//package
Section 41
//BroughtToYou (BroughtToYou)
package {
import flash.display.*;
import flash.events.*;
public class BroughtToYou extends SimpleButton {
public function BroughtToYou(){
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
MovieClip(root).play();
}
}
}//package
Section 42
//DialogHelp (DialogHelp)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DialogHelp extends MovieClip {
public var clipText:TextField;
}
}//package
Section 43
//DialogLevelComplete (DialogLevelComplete)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DialogLevelComplete extends MovieClip {
public var clipText:TextField;
}
}//package
Section 44
//DialogLevelFailed (DialogLevelFailed)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DialogLevelFailed extends MovieClip {
public var clipText:TextField;
}
}//package
Section 45
//DialogObjective (DialogObjective)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class DialogObjective extends MovieClip {
public var gState:GameState;
public var lManager:Level;
private var tutorialArray:Array;
public var levelNumber:TextField;
public function DialogObjective(){
addEventListener(Event.ADDED_TO_STAGE, init);
tutorialArray = new Array();
tutorialArray = [1, 4, 5, 7, 8, 10, 12, 14, 21];
}
public function loadObjective(){
gotoAndStop(gState.currentLevel);
if (gState.currentLevel != 21){
levelNumber.text = ("Level " + gState.currentLevel);
} else {
levelNumber.text = "The final frontier";
};
}
private function init(_arg1:Event){
var _local2:*;
lManager = Level(MovieClip(parent));
gState = lManager.gState;
if (((!(gState.levelRetry)) || ((gState.currentLevel == 21)))){
for (_local2 in tutorialArray) {
if (tutorialArray[_local2] == gState.currentLevel){
loadTutorial();
return;
};
};
};
loadObjective();
}
private function loadTutorial(){
gotoAndStop((gState.currentLevel + 50));
levelNumber.text = "";
}
}
}//package
Section 46
//Enigma (Enigma)
package {
import flash.media.*;
public dynamic class Enigma extends Sound {
}
}//package
Section 47
//ErmSure (ErmSure)
package {
import flash.display.*;
import flash.events.*;
public class ErmSure extends SimpleButton {
public function ErmSure(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).gotoAndStop("menu");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Submit high score and return to the main menu.";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 48
//Explosion (Explosion)
package {
import flash.display.*;
public dynamic class Explosion extends MovieClip {
}
}//package
Section 49
//ExplosionBubble (ExplosionBubble)
package {
import flash.display.*;
public dynamic class ExplosionBubble extends BitmapData {
public function ExplosionBubble(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 50
//FreeGames (FreeGames)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class FreeGames extends SimpleButton {
public function FreeGames(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(GameState(MovieClip(root)).freeGamesLink);
navigateToURL(_local2, "_blank");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Get free games for your site.";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 51
//GameOver (GameOver)
package {
public class GameOver {
public static function test(_arg1:Level):int{
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
trace("Testing Game Over condition...");
if (_arg1.levelClicks < _arg1.maxClck){
_local2 = true;
} else {
_local2 = false;
};
_local4 = false;
_local5 = false;
switch (_arg1.winType){
case 1:
_local3 = testZeroValue(_arg1.currentTkns);
break;
case 2:
_local3 = testPercentage(_arg1.totalTkns, _arg1.currentTkns, _arg1.winCost);
break;
case 3:
_local3 = testZeroValue(_arg1.currentAtms);
break;
case 4:
_local3 = testZeroValue(_arg1.currentSpcs);
break;
case 5:
_local3 = testMinimum(_arg1.totalTkns, _arg1.currentTkns, _arg1.winCost);
_local4 = true;
break;
case 6:
_local3 = testAvoid(_arg1.totalSpcs, _arg1.currentSpcs);
if (_local3){
_local3 = testZeroValue((_arg1.currentTkns - _arg1.currentSpcs));
} else {
_local4 = true;
};
_local5 = true;
break;
case 7:
_local3 = testAvoid(_arg1.total8s, _arg1.current8s);
if (_local3){
_local3 = testZeroValue((_arg1.currentTkns - _arg1.current8s));
} else {
_local4 = true;
};
_local5 = true;
break;
case 10:
_local3 = testZeroValue(_arg1.current4x);
break;
case 11:
_local3 = testZeroValue((_arg1.current6h + _arg1.current6v));
break;
};
if (((_local4) && (!(_local3)))){
return (5);
};
if (((((_local4) && (_local3))) && (_local2))){
return (1);
};
if (((((_local4) && (_local3))) && (!(_local2)))){
return (4);
};
if (_local3){
return (4);
};
if (((!(_local3)) && (_local2))){
return (1);
};
if (((!(_local3)) && (!(_local2)))){
return (5);
};
return (99);
}
private static function testMinimum(_arg1:int, _arg2:int, _arg3:int):Boolean{
if ((_arg1 - _arg2) > _arg3){
return (false);
};
return (true);
}
private static function testPercentage(_arg1:int, _arg2:int, _arg3:Number):Boolean{
if ((1 - (_arg2 / _arg1)) >= _arg3){
return (true);
};
return (false);
}
private static function testAvoid(_arg1:int, _arg2:int):Boolean{
if (_arg1 == _arg2){
return (true);
};
return (false);
}
private static function testZeroValue(_arg1:int):Boolean{
if (_arg1 == 0){
return (true);
};
return (false);
}
}
}//package
Section 52
//GameState (GameState)
package {
import flash.display.*;
import flash.events.*;
public dynamic class GameState extends MovieClip {
public var subBuild:String;
public var soundSystem:vgsSoundSystem;
public var siteLocked:Boolean;
private var levelData:Array;
public var freeGamesLink:String;
public var build:String;
public var levelRetry:Boolean;// = false
public var sponsorSite:String;
public var moreGamesLink:String;
public var globalService:vgsService;
public var currentLevel:int;
public var featureLocked:Boolean;
public function GameState(){
levelRetry = false;
super();
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
loadLevelData();
currentLevel = 1;
}
private function loadLevelData(){
var _local1:int;
_local1 = 0;
levelData = new Array();
levelData[_local1] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1];
_local1++;
levelData[_local1] = [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2];
_local1++;
levelData[_local1] = [4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 2];
_local1++;
levelData[_local1] = [0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0.5, 1];
_local1++;
levelData[_local1] = [2, 0, 0, 4, 4, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3, 0, 2];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1];
_local1++;
levelData[_local1] = [0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1];
_local1++;
levelData[_local1] = [2, 0, 0, 0, 0, 4, 4, 4, 4, 0, 1, 0, 0, 0, 2, 0.7, 1];
_local1++;
levelData[_local1] = [0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 5, 2, 2];
_local1++;
levelData[_local1] = [16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 2, 0.25, 1];
_local1++;
levelData[_local1] = [0, 8, 8, 0, 0, 0, 0, 0, 0, 4, 0, 0, 1, 0, 11, 0, 2];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 0, 8, 8, 0, 0, 8, 0, 0, 0, 0, 5, 10, 5];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 8, 2, 0.5, 2];
_local1++;
levelData[_local1] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 0, 1];
_local1++;
levelData[_local1] = [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 1, 0, 1];
_local1++;
levelData[_local1] = [0, 0, 0, 6, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1, 0, 5];
_local1++;
levelData[_local1] = [0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4, 5, 8, 4];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 4];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0, 0, 0, 1, 0, 8];
_local1++;
levelData[_local1] = [0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 3, 0, 8];
_local1++;
levelData[_local1] = [1, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 7, 0, 4];
_local1++;
levelData[_local1] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1];
_local1++;
}
public function startUpSoundSystem(){
soundSystem = new vgsSoundSystem();
soundSystem.registerSound(Normal, 1, 0);
soundSystem.registerSound(Growth, 1, 0);
soundSystem.registerSound(Shrink, 1, 0);
soundSystem.registerSound(SmartBomb, 1, 0);
soundSystem.registerSound(Super, 0.5, 0);
soundSystem.registerSound(Nuke, 1, 0);
soundSystem.registerSound(Enigma, 1, 0);
soundSystem.registerMusic(Music, 0.25, 0);
}
private function keyUp(_arg1:KeyboardEvent){
if (currentFrame >= 5){
if (_arg1.charCode == 115){
soundSystem.toggleSound();
};
if (_arg1.charCode == 109){
soundSystem.toggleMusic();
};
};
}
public function getLevelData(){
return (levelData[currentLevel]);
}
}
}//package
Section 53
//Gotcha (Gotcha)
package {
import flash.display.*;
import flash.events.*;
public class Gotcha extends SimpleButton {
public function Gotcha(){
addEventListener(MouseEvent.CLICK, action);
}
public function action(_arg1:MouseEvent){
if ((((((((MovieClip(parent).currentFrame == 51)) || ((MovieClip(parent).currentFrame == 52)))) || ((MovieClip(parent).currentFrame == 71)))) || ((MovieClip(parent).currentFrame == 72)))){
MovieClip(parent).nextFrame();
} else {
MovieClip(parent).loadObjective();
};
}
}
}//package
Section 54
//Growth (Growth)
package {
import flash.media.*;
public dynamic class Growth extends Sound {
}
}//package
Section 55
//Level (Level)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public class Level extends MovieClip {
public var maxClck:int;// = 0
public var current6h:int;// = 0
private var endlessChain:int;// = 0
public var currentAtms:int;// = 0
public var prtsList:Array;
public var current6v:int;// = 0
private var lstTime:int;
public var gState:GameState;
public var current8s:int;// = 0
public var statsText:TextField;
public var totalAtms:int;// = 0
private var sSystem:vgsSoundSystem;
public var levelClicks:int;// = 0
public var currentState:int;
public var currentSpcs:int;// = 0
public var total2h:int;// = 0
private var endlessNewTokens:int;// = 1
public var total2v:int;// = 0
public var fpsCounter:TextField;
public var totalSpcs:int;// = 0
public var total4c:int;// = 0
public var total4x:int;// = 0
public var tempText:String;// = null
public var total6h:int;// = 0
public var winType:int;// = 0
public var total6v:int;// = 0
public var atmsList:Array;
public var total8s:int;// = 0
private var eManager:vgsParticleExplosion;
public var currentTkns:int;// = 0
public var current2h:int;// = 0
public var current2v:int;// = 0
public var winCost:Number;// = 0
public var spcsList:Array;
private var dltTime:int;
private var endlessRoundScore:int;// = 0
public var totalTkns:int;// = 0
public var current4c:int;// = 0
private var helpDialog:DialogHelp;
public var current4x:int;// = 0
private var endlessScore:int;// = 0
public function Level(){
totalTkns = 0;
totalAtms = 0;
totalSpcs = 0;
total8s = 0;
total6h = 0;
total6v = 0;
total4c = 0;
total4x = 0;
total2h = 0;
total2v = 0;
currentTkns = 0;
currentAtms = 0;
currentSpcs = 0;
current8s = 0;
current6h = 0;
current6v = 0;
current4c = 0;
current4x = 0;
current2h = 0;
current2v = 0;
endlessNewTokens = 1;
endlessChain = 0;
endlessRoundScore = 0;
endlessScore = 0;
tempText = null;
levelClicks = 0;
winType = 0;
winCost = 0;
maxClck = 0;
super();
addFrameScript(0, frame1);
addEventListener(Event.ADDED_TO_STAGE, init);
addEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
}
private function createTokensNormal(){
var _local1:Array;
var _local2:MovieClip;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:String;
_local1 = new Array();
_local1 = gState.getLevelData();
_local5 = 0;
_local3 = 0;
while (_local3 <= 6) {
switch (_local3){
case 0:
_local6 = "Eight";
total8s = (current8s = _local1[_local3]);
break;
case 1:
_local6 = "SixH";
total6h = (current6h = _local1[_local3]);
break;
case 2:
_local6 = "SixV";
total6v = (current6v = _local1[_local3]);
break;
case 3:
_local6 = "FourC";
total4c = (current4c = _local1[_local3]);
break;
case 4:
_local6 = "FourX";
total4x = (current4x = _local1[_local3]);
break;
case 5:
_local6 = "TwoH";
total2h = (current2h = _local1[_local3]);
break;
case 6:
_local6 = "TwoV";
total2v = (current2v = _local1[_local3]);
break;
};
_local4 = 1;
while (_local4 <= _local1[_local3]) {
_local2 = new Atom(_local6, _local5);
atmsList.push(_local2);
addChild(_local2);
if ((_local5 == 7)){
_local5 = 0;
} else {
_local5++;
};
_local4++;
};
totalAtms = (totalAtms + _local1[_local3]);
totalTkns = (totalTkns + _local1[_local3]);
currentAtms = (currentAtms + _local1[_local3]);
currentTkns = (currentTkns + _local1[_local3]);
_local3++;
};
_local3 = 7;
while (_local3 <= 13) {
switch (_local3){
case 7:
_local6 = "Growth";
break;
case 8:
_local6 = "Shrink";
break;
case 9:
_local6 = "Super";
break;
case 10:
_local6 = "SmartBomb";
break;
case 11:
_local6 = "Enigma";
break;
case 12:
_local6 = "BlackHole";
break;
case 13:
_local6 = "Nuke";
break;
};
_local4 = 1;
while (_local4 <= _local1[_local3]) {
_local2 = new Special(_local6, _local5);
spcsList.push(_local2);
addChild(_local2);
if ((_local5 == 7)){
_local5 = 0;
} else {
_local5++;
};
_local4++;
};
if (_local3 != 12){
totalSpcs = (totalSpcs + _local1[_local3]);
totalTkns = (totalTkns + _local1[_local3]);
currentSpcs = (currentSpcs + _local1[_local3]);
currentTkns = (currentTkns + _local1[_local3]);
};
_local3++;
};
winType = _local1[14];
winCost = _local1[15];
maxClck = _local1[16];
}
private function createTokensEndless(_arg1:int){
var _local2:MovieClip;
var _local3:Number;
var _local4:String;
var _local5:int;
if (_arg1 == 0){
_local2 = new Special("BlackHole", Math.floor((Math.random() * 8)));
spcsList.push(_local2);
addChild(_local2);
currentTkns++;
return;
};
_local5 = 1;
while (_local5 <= _arg1) {
_local3 = Math.random();
if (_local3 <= 0.8){
_local3 = Math.floor((Math.random() * 7));
switch (_local3){
case 0:
_local4 = "Eight";
break;
case 1:
_local4 = "SixH";
break;
case 2:
_local4 = "SixV";
break;
case 3:
_local4 = "FourC";
break;
case 4:
_local4 = "FourX";
break;
case 5:
_local4 = "TwoH";
break;
case 6:
_local4 = "TwoV";
break;
};
_local2 = new Atom(_local4, Math.floor((Math.random() * 8)));
atmsList.push(_local2);
addChild(_local2);
currentTkns++;
} else {
_local3 = Math.floor((Math.random() * 6));
switch (_local3){
case 0:
_local4 = "Growth";
break;
case 1:
_local4 = "Shrink";
break;
case 2:
_local4 = "Super";
break;
case 3:
_local4 = "SmartBomb";
break;
case 4:
_local4 = "Enigma";
break;
case 5:
_local4 = "Nuke";
break;
};
_local2 = new Special(_local4, Math.floor((Math.random() * 8)));
spcsList.push(_local2);
addChild(_local2);
currentTkns++;
};
_local5++;
};
}
function frame1(){
stop();
}
public function startEndlessFactory(){
var _local1:Timer;
if (gState.currentLevel == 21){
_local1 = new Timer(1000, 9999);
_local1.addEventListener(TimerEvent.TIMER, updateEndlessFactory);
_local1.start();
};
}
public function deleteSpecial(_arg1:MovieClip){
var _local2:int;
sSystem.playSound(_arg1.type);
_local2 = spcsList.indexOf(_arg1);
currentSpcs--;
currentTkns--;
spcsList.splice(_local2, 1);
removeChild(_arg1);
endlessChain++;
eManager.createExplosion(_arg1.x, _arg1.y, 25, 1, 25);
eManager.createExplosion(_arg1.x, _arg1.y, 40, 1, 25);
eManager.createExplosion(_arg1.x, _arg1.y, 55, 1, 25);
}
private function updateEndlessFactory(_arg1:TimerEvent){
if (currentState == 1){
createTokensEndless(endlessNewTokens);
};
}
private function cleanUp(_arg1:Event){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, showHelpDialog);
stage.removeEventListener(KeyboardEvent.KEY_UP, hideHelpDialog);
}
private function update(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:*;
stage.focus = stage;
dltTime = (getTimer() - lstTime);
lstTime = getTimer();
updateTextFields();
dltTime = (dltTime * 1.5);
for (_local2 in atmsList) {
atmsList[_local2].update(dltTime);
};
for (_local3 in spcsList) {
spcsList[_local3].update(dltTime);
};
for (_local4 in prtsList) {
prtsList[_local4].update(dltTime);
};
if (gState.currentLevel < 21){
normalStateMachine();
};
if (gState.currentLevel == 21){
endlessStateMachine();
};
}
private function hideHelpDialog(_arg1:KeyboardEvent){
if (_arg1.charCode == 104){
removeChild(helpDialog);
helpDialog = null;
};
}
private function showHelpDialog(_arg1:KeyboardEvent){
if ((((_arg1.charCode == 104)) && ((helpDialog == null)))){
helpDialog = new DialogHelp();
addChild(helpDialog);
};
}
private function normalStateMachine(){
var _local1:DialogLevelComplete;
var _local2:DialogLevelFailed;
if ((((currentState == 2)) && ((prtsList.length == 0)))){
currentState = GameOver.test(this);
};
if ((((currentState == 1)) && ((atmsList.length == 0)))){
currentState = 5;
};
if (currentState == 4){
gState.globalService.setStat("normalLevel", gState.currentLevel);
_local1 = new DialogLevelComplete();
_local1.gotoAndStop(gState.currentLevel);
addChild(_local1);
currentState = 6;
};
if (currentState == 5){
_local2 = new DialogLevelFailed();
addChild(_local2);
currentState = 6;
gState.levelRetry = true;
};
}
private function init(_arg1:Event){
var _local2:DialogObjective;
gState = GameState(MovieClip(parent));
sSystem = gState.soundSystem;
atmsList = new Array();
prtsList = new Array();
spcsList = new Array();
lstTime = getTimer();
currentState = 0;
eManager = new vgsParticleExplosion(Explosion, this, 1);
if (gState.currentLevel <= 20){
createTokensNormal();
} else {
createTokensEndless(5);
};
addEventListener(Event.ENTER_FRAME, update);
addEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, showHelpDialog);
stage.addEventListener(KeyboardEvent.KEY_UP, hideHelpDialog);
_local2 = new DialogObjective();
addChild(_local2);
gState.levelRetry = false;
}
public function deleteParticle(_arg1:MovieClip){
var _local2:int;
if ((((((((((_arg1.type == 3)) && ((_arg1.x > 0)))) && ((_arg1.x < 640)))) && ((_arg1.y > 0)))) && ((_arg1.y < 480)))){
sSystem.playSound("Super");
};
_local2 = prtsList.indexOf(_arg1);
if (_arg1 == prtsList[_local2]){
prtsList.splice(_local2, 1);
removeChild(_arg1);
};
}
private function endlessStateMachine(){
var _local1:int;
var _local2:DialogLevelFailed;
if ((((currentState == 2)) && ((prtsList.length == 0)))){
_local1 = 1;
if (endlessChain <= 2){
endlessNewTokens++;
};
switch (endlessChain){
case 1:
createTokensEndless(0);
break;
case 3:
_local1 = 2;
break;
case 6:
_local1 = 3;
break;
case 10:
_local1 = 10;
break;
};
endlessScore = (endlessScore + (endlessRoundScore * _local1));
endlessChain = 0;
currentState = 1;
};
if ((((currentState == 1)) && ((currentTkns >= 20)))){
gState.globalService.setStat("endlessScore", endlessScore);
_local2 = new DialogLevelFailed();
addChild(_local2);
currentState = 6;
};
}
public function deleteAtom(_arg1:Atom){
var _local2:int;
_local2 = atmsList.indexOf(_arg1);
switch (_arg1.type){
case "Eight":
current8s--;
break;
case "SixH":
current6h--;
break;
case "SixV":
current6v--;
break;
case "FourC":
current4c--;
break;
case "FourX":
current4x--;
break;
case "TwoH":
current2h--;
break;
case "TwoV":
current2v--;
break;
};
currentAtms--;
currentTkns--;
atmsList.splice(_local2, 1);
removeChild(_arg1);
endlessChain++;
endlessRoundScore = (endlessRoundScore + _arg1.points);
eManager.createExplosion(_arg1.x, _arg1.y, 0, 1, 50);
sSystem.playSound("Normal");
}
private function updateTextFields(){
if (gState.currentLevel == 21){
fpsCounter.text = ("Endless Mode - Current Score: " + endlessScore);
} else {
if (levelClicks != maxClck){
fpsCounter.text = ((((("Level " + gState.currentLevel) + " of 20 - Experiment ") + String((levelClicks + 1))) + " of ") + maxClck);
} else {
fpsCounter.text = (("Level " + gState.currentLevel) + " of 20");
};
};
switch (currentState){
case 0:
statsText.text = "Waiting for Professor...";
break;
case 1:
if (gState.currentLevel == 21){
statsText.text = "Please initiate next experiment.";
} else {
switch (gState.currentLevel){
case 1:
statsText.text = "Destroy all atoms in 2 experiments.";
break;
case 2:
statsText.text = "Destroy all 4 particle atoms in 2 experiments.";
break;
case 3:
statsText.text = "Destroy 50% of the atoms in 1 experiment.";
break;
case 4:
statsText.text = "Destroy all normal atoms in 2 experiments.";
break;
case 5:
statsText.text = "Destroy all atoms in 1 experiment.";
break;
case 6:
statsText.text = "Destroy all atoms in 1 experiment.";
break;
case 7:
statsText.text = "Destroy 70% of all atoms in 1 experiment.";
break;
case 8:
statsText.text = "Destroy no more than 2 atoms in 2 experiments.";
break;
case 9:
statsText.text = "Destroy 25% of the atoms in 1 experiment.";
break;
case 10:
statsText.text = "Destroy all 6 particle atoms in 2 experiments.";
break;
case 11:
statsText.text = "Destroy no more than 10 atoms in 5 experiments.";
break;
case 12:
statsText.text = "Destroy 50% of the atoms in 2 experiments.";
break;
case 13:
statsText.text = "Destroy all special atoms in 1 experiment.";
break;
case 14:
statsText.text = "Destroy all 8 particle and Enigma atoms in 1 experiment.";
break;
case 15:
statsText.text = "Destroy all atoms in 5 experiments.";
break;
case 16:
statsText.text = "Destroy no more than 8 atoms in 4 experiments.";
break;
case 17:
statsText.text = "Destroy all atoms except Enigma in 4 experiments.";
break;
case 18:
statsText.text = "Destroy all atoms in 8 experiments.";
break;
case 19:
statsText.text = "Destroy all 4 particle atoms in 8 experiments.";
break;
case 20:
statsText.text = "Destroy all atoms except 8 particle atoms in 4 experiments.";
break;
};
};
break;
case 2:
statsText.text = "Processing experiment...";
break;
case 4:
statsText.text = "Experiment successful!";
break;
case 5:
statsText.text = "Experiment failed!";
break;
case 6:
statsText.text = "Experiment completed!";
break;
};
}
}
}//package
Section 56
//LoaderHolder (LoaderHolder)
package {
import flash.display.*;
public class LoaderHolder extends MovieClip {
public function LoaderHolder(){
var _local1:MovieClip;
var _local2:SimpleButton;
super();
addFrameScript(0, frame1);
if (MovieClip(parent).subBuild == "Mochi"){
MovieClip(parent).stop();
_local1 = new AGameLoader(10, 75, false);
_local1.x = (width / 2);
_local1.y = (height / 2);
addChild(_local1);
_local2 = new BroughtToYou();
addChild(_local2);
_local2.x = ((width / 2) - 75);
_local2.y = ((height / 2) - 45);
};
}
function frame1(){
stop();
}
}
}//package
Section 57
//MainMenu (MainMenu)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class MainMenu extends MovieClip {
public var clipText:TextField;
public var scoreText:TextField;
public function MainMenu(){
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
if (MovieClip(root).siteLocked){
gotoAndStop(2);
} else {
gotoAndStop(1);
};
}
}
}//package
Section 58
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {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 = _slot1._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
_slot1._cleanup(mc);
options.ad_finished();
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = 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{
_slot1.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
_slot1.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
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;
_local2 = _arg1.split("/")[2].split(":")[0];
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 DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {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 = _slot1._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
_slot1._cleanup(mc);
options.ad_finished();
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = 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{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_slot1.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
_slot1.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = 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{
_slot1.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
_slot1.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 _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
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 idx:Number;
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);
};
idx = 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 DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
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;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _slot1._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = _slot1.getVersion();
clip = options.clip;
if (!_slot1._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."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = _slot1._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;
};
lv = 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);
_slot1.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
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;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 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;
_local4 = 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 _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 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;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 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":
_slot1.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = _slot1.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = _slot1.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;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 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 DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {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{
}};
options = _slot1._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
_slot1._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = 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);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 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;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_slot1.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
_slot1.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
_slot1.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = 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{
_slot1.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 _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
_slot1.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
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");
_slot1.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
_slot1.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = 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
Section 59
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 60
//MoreGames (MoreGames)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class MoreGames extends SimpleButton {
public function MoreGames(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(GameState(MovieClip(root)).moreGamesLink);
navigateToURL(_local2, "_blank");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Play more games from our sponsor.";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 61
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 62
//NextLevel (NextLevel)
package {
import flash.display.*;
import flash.events.*;
public class NextLevel extends SimpleButton {
public function NextLevel(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).currentLevel++;
MovieClip(root).gotoAndStop("retry");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Ready for more?!";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 63
//Normal (Normal)
package {
import flash.media.*;
public dynamic class Normal extends Sound {
}
}//package
Section 64
//Nuke (Nuke)
package {
import flash.media.*;
public dynamic class Nuke extends Sound {
}
}//package
Section 65
//Ok (Ok)
package {
import flash.display.*;
import flash.events.*;
public class Ok extends SimpleButton {
public function Ok(){
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
MovieClip(parent).nextFrame();
}
}
}//package
Section 66
//Options (Options)
package {
import flash.display.*;
public dynamic class Options extends MovieClip {
}
}//package
Section 67
//OptionsNo (OptionsNo)
package {
import flash.display.*;
import flash.events.*;
public class OptionsNo extends SimpleButton {
public function OptionsNo(){
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
MovieClip(root).soundSystem.playMusic("Music");
MovieClip(root).soundSystem.toggleSound();
MovieClip(root).soundSystem.toggleMusic();
MovieClip(root).gotoAndStop("menu");
}
}
}//package
Section 68
//OptionsYes (OptionsYes)
package {
import flash.display.*;
import flash.events.*;
public class OptionsYes extends SimpleButton {
public function OptionsYes(){
GameState(MovieClip(root)).startUpSoundSystem();
addEventListener(MouseEvent.CLICK, click);
}
private function click(_arg1:MouseEvent){
MovieClip(root).soundSystem.playMusic("Music");
MovieClip(root).gotoAndStop("menu");
}
}
}//package
Section 69
//Particle (Particle)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
public class Particle extends MovieClip {
private const maxSpeed:int = 250;
private const maxLife:int = 1000;
private var trail:vgsParticleExplosion;
private var velocityX:Number;
private var velocityY:Number;
private var creator:MovieClip;
private var sumDelta:int;
private var shootingAngle:Array;
private var collisionRadius:Number;
private var originalWidth:Number;
public var target:Atom;
public var type:int;
private var lManager:Level;
private var angle:Number;
public function Particle(_arg1:Number, _arg2:MovieClip, _arg3:int, _arg4:Atom){
if (_arg3 == 2){
shootingAngle = new Array();
shootingAngle = [0, 90, 180, 270];
} else {
if (_arg3 == 1){
shootingAngle = new Array();
shootingAngle = [45, 135, 225, 315];
};
};
type = _arg3;
target = _arg4;
angle = vgsMath.deg2rad(_arg1);
creator = _arg2;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
lManager = Level(MovieClip(parent));
originalWidth = width;
collisionRadius = (width * 0.5);
velocityX = (Math.cos(angle) * maxSpeed);
velocityY = (Math.sin(angle) * maxSpeed);
if (type != 0){
trail = new vgsParticleExplosion(Explosion, lManager, 1);
};
}
public function update(_arg1:int){
var _local2:Number;
var _local3:Number;
var _local4:Point;
var _local5:Point;
var _local6:Number;
var _local7:Number;
var _local8:*;
var _local9:*;
var _local10:Atom;
var _local11:Special;
var _local12:Number;
var _local13:Number;
sumDelta = (sumDelta + _arg1);
if ((((type == 1)) || ((type == 2)))){
trail.createExplosion(x, y, 5, 1, 5);
if (sumDelta >= maxLife){
superExplosion();
lManager.deleteParticle(this);
return;
};
};
if (type == 3){
_local12 = Math.atan2((target.y - y), (target.x - x));
velocityX = (Math.cos(_local12) * maxSpeed);
velocityY = (Math.sin(_local12) * maxSpeed);
};
if (type == 4){
trail.createExplosion(x, y, 5, 1, 2);
if (sumDelta >= (maxLife * 0.5)){
lManager.deleteParticle(this);
return;
};
};
_local2 = (x + ((velocityX * _arg1) * 0.001));
_local3 = (y + ((velocityY * _arg1) * 0.001));
if ((((((((_local2 > (640 + (width / 2)))) || ((_local2 < (-(width) / 2))))) || ((_local3 > (480 + (width / 2)))))) || ((_local3 < (-(width) / 2))))){
lManager.deleteParticle(this);
return;
};
x = _local2;
y = _local3;
for (_local8 in lManager.atmsList) {
_local10 = lManager.atmsList[_local8];
if (_local10 != creator){
_local4 = new Point(x, y);
_local5 = new Point(_local10.x, _local10.y);
_local6 = collisionRadius;
_local7 = _local10.collisionRadius;
if (vgsCollision.getCircularCollision(_local4, _local6, _local5, _local7)){
_local10.fire();
lManager.deleteParticle(this);
return;
};
};
};
for (_local9 in lManager.spcsList) {
_local11 = lManager.spcsList[_local9];
_local4 = new Point(x, y);
_local5 = new Point(_local11.x, _local11.y);
_local6 = collisionRadius;
_local7 = _local11.collisionRadius;
if (_local11.type == "BlackHole"){
_local7 = (_local11.width * 2);
if (vgsCollision.getCircularCollision(_local4, _local6, _local5, _local7)){
_local12 = Math.atan2((_local11.y - y), (_local11.x - x));
_local13 = Point.distance(_local4, _local5);
scaleX = (scaleY = (alpha = ((_local13 / (_local11.width * 2)) * 0.75)));
velocityX = ((Math.cos(_local12) * maxSpeed) * (_local13 / (_local11.width * 2)));
velocityY = ((Math.sin(_local12) * maxSpeed) * (_local13 / (_local11.width * 2)));
_local7 = (_local11.width / 2);
if (vgsCollision.getCircularCollision(_local4, _local6, _local5, _local7)){
lManager.deleteParticle(this);
return;
};
};
};
if (vgsCollision.getCircularCollision(_local4, _local6, _local5, _local7)){
_local11.fire();
lManager.deleteParticle(this);
return;
};
};
}
public function looseTarget(){
type = 0;
}
private function superExplosion(){
var _local1:*;
var _local2:Particle;
type++;
if (type == 3){
return;
};
for (_local1 in shootingAngle) {
_local2 = new Particle(shootingAngle[_local1], creator, type, null);
_local2.x = x;
_local2.y = y;
_local2.gotoAndStop("Super");
lManager.addChild(_local2);
lManager.prtsList.push(_local2);
};
}
}
}//package
Section 70
//ParticleEight (ParticleEight)
package {
import flash.display.*;
public dynamic class ParticleEight extends BitmapData {
public function ParticleEight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 71
//ParticleFourC (ParticleFourC)
package {
import flash.display.*;
public dynamic class ParticleFourC extends BitmapData {
public function ParticleFourC(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 72
//ParticleFourX (ParticleFourX)
package {
import flash.display.*;
public dynamic class ParticleFourX extends BitmapData {
public function ParticleFourX(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 73
//ParticleNuke (ParticleNuke)
package {
import flash.display.*;
public dynamic class ParticleNuke extends BitmapData {
public function ParticleNuke(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 74
//ParticleSixH (ParticleSixH)
package {
import flash.display.*;
public dynamic class ParticleSixH extends BitmapData {
public function ParticleSixH(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 75
//ParticleSixV (ParticleSixV)
package {
import flash.display.*;
public dynamic class ParticleSixV extends BitmapData {
public function ParticleSixV(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 76
//ParticleSmartBomb (ParticleSmartBomb)
package {
import flash.display.*;
public dynamic class ParticleSmartBomb extends BitmapData {
public function ParticleSmartBomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 77
//ParticleSuper (ParticleSuper)
package {
import flash.display.*;
public dynamic class ParticleSuper extends BitmapData {
public function ParticleSuper(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 78
//ParticleTwoH (ParticleTwoH)
package {
import flash.display.*;
public dynamic class ParticleTwoH extends BitmapData {
public function ParticleTwoH(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 79
//ParticleTwoV (ParticleTwoV)
package {
import flash.display.*;
public dynamic class ParticleTwoV extends BitmapData {
public function ParticleTwoV(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 80
//PlayEndless (PlayEndless)
package {
import flash.display.*;
import flash.events.*;
public class PlayEndless extends SimpleButton {
public function PlayEndless(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).currentLevel = 21;
MovieClip(root).gotoAndPlay("game");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Discover time travel by playing forever!";
if (GameState(MovieClip(root)).globalService.statSystem == "Local"){
MovieClip(parent).scoreText.text = (("Your personal best: " + GameState(MovieClip(root)).globalService.getStat("endlessScore")) + " points");
};
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
MovieClip(parent).scoreText.text = "";
}
}
}//package
Section 81
//PlayNormal (PlayNormal)
package {
import flash.display.*;
import flash.events.*;
public class PlayNormal extends SimpleButton {
public function PlayNormal(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).currentLevel = 1;
MovieClip(root).gotoAndPlay("game");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Learn all about chaotic atoms in 20 puzzling levels!";
if (GameState(MovieClip(root)).globalService.statSystem == "Local"){
MovieClip(parent).scoreText.text = ("Your personal best: Level " + GameState(MovieClip(root)).globalService.getStat("normalLevel"));
};
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
MovieClip(parent).scoreText.text = "";
}
}
}//package
Section 82
//Quit (Quit)
package {
import flash.display.*;
import flash.events.*;
public class Quit extends SimpleButton {
public function Quit(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).gotoAndStop("menu");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "Submit high score and return to the main menu.";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 83
//Retry (Retry)
package {
import flash.display.*;
import flash.events.*;
public class Retry extends SimpleButton {
public function Retry(){
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.MOUSE_OVER, writeText);
addEventListener(MouseEvent.MOUSE_OUT, eraseText);
}
private function click(_arg1:MouseEvent){
MovieClip(root).gotoAndStop("retry");
}
private function writeText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "One more try... just one more!...";
}
private function eraseText(_arg1:MouseEvent){
MovieClip(parent).clipText.text = "";
}
}
}//package
Section 84
//Shrink (Shrink)
package {
import flash.media.*;
public dynamic class Shrink extends Sound {
}
}//package
Section 85
//SmartBomb (SmartBomb)
package {
import flash.media.*;
public dynamic class SmartBomb extends Sound {
}
}//package
Section 86
//Special (Special)
package {
import flash.display.*;
import flash.events.*;
public class Special extends MovieClip {
private const maxSpeed:int = 25;
public const collisionRadius:Number = 16.5;
private var velocityX:Number;
private var velocityY:Number;
private var direction:int;
public var type:String;
private var lManager:Level;
public function Special(_arg1:String, _arg2:int){
type = _arg1;
direction = _arg2;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event){
var _local2:Number;
lManager = Level(MovieClip(parent));
_local2 = vgsMath.deg2rad((direction * 45));
velocityX = (Math.cos(_local2) * maxSpeed);
velocityY = (Math.sin(_local2) * maxSpeed);
x = ((Math.random() * 594) + 23);
y = ((Math.random() * 434) + 23);
gotoAndStop(type);
}
private function startNuke(){
var _local1:int;
var _local2:*;
var _local3:Particle;
_local1 = 16;
_local2 = 1;
while (_local2 <= _local1) {
_local3 = new Particle(((360 / _local1) * _local2), this, 4, null);
_local3.x = x;
_local3.y = y;
_local3.gotoAndStop(type);
lManager.addChild(_local3);
lManager.prtsList.push(_local3);
_local2++;
};
}
public function fire(){
switch (type){
case "Growth":
growAtoms();
break;
case "Shrink":
shrinkAtoms();
break;
case "Super":
startSuper();
break;
case "SmartBomb":
startSmartBomb();
break;
case "Nuke":
startNuke();
break;
case "Enigma":
pickOne();
break;
};
lManager.deleteSpecial(this);
}
private function startSuper(){
var _local1:Array;
var _local2:*;
var _local3:Particle;
_local1 = new Array();
_local1 = [0, 90, 180, 270];
for (_local2 in _local1) {
_local3 = new Particle(_local1[_local2], this, 1, null);
_local3.x = x;
_local3.y = y;
_local3.gotoAndStop("Super");
lManager.addChild(_local3);
lManager.prtsList.push(_local3);
};
}
private function pickOne(){
var _local1:int;
_local1 = Math.ceil((Math.random() * 5));
switch (_local1){
case 1:
startNuke();
break;
case 2:
startSmartBomb();
break;
case 3:
startSuper();
break;
case 4:
growAtoms();
break;
case 5:
shrinkAtoms();
break;
};
}
private function shrinkAtoms(){
var _local1:*;
for (_local1 in lManager.atmsList) {
lManager.atmsList[_local1].shrink();
};
}
public function update(_arg1:int){
var _local2:Number;
var _local3:Number;
_local2 = (x + ((velocityX * _arg1) * 0.001));
_local3 = (y + ((velocityY * _arg1) * 0.001));
if ((((_local2 > (640 - collisionRadius))) || ((_local2 < collisionRadius)))){
_local2 = x;
velocityX = (velocityX * -1);
};
if ((((_local3 > (480 - collisionRadius))) || ((_local3 < collisionRadius)))){
_local3 = y;
velocityY = (velocityY * -1);
};
x = _local2;
y = _local3;
}
private function startSmartBomb(){
var _local1:int;
var _local2:*;
var _local3:Atom;
var _local4:Particle;
_local1 = 4;
for (_local2 in lManager.atmsList) {
_local3 = lManager.atmsList[_local2];
if (_local3.particle == null){
_local4 = new Particle(0, this, 3, _local3);
_local4.x = x;
_local4.y = y;
_local4.gotoAndStop("SmartBomb");
_local3.particle = _local4;
lManager.addChild(_local4);
lManager.prtsList.push(_local4);
_local1--;
};
if (_local1 == 0){
break;
};
};
}
private function growAtoms(){
var _local1:*;
for (_local1 in lManager.atmsList) {
lManager.atmsList[_local1].grow();
};
}
}
}//package
Section 87
//SpecialBlackHole (SpecialBlackHole)
package {
import flash.display.*;
public dynamic class SpecialBlackHole extends BitmapData {
public function SpecialBlackHole(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 88
//SpecialEnigma (SpecialEnigma)
package {
import flash.display.*;
public dynamic class SpecialEnigma extends BitmapData {
public function SpecialEnigma(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 89
//SpecialGrowth (SpecialGrowth)
package {
import flash.display.*;
public dynamic class SpecialGrowth extends BitmapData {
public function SpecialGrowth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 90
//SpecialNuke (SpecialNuke)
package {
import flash.display.*;
public dynamic class SpecialNuke extends BitmapData {
public function SpecialNuke(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 91
//SpecialShrink (SpecialShrink)
package {
import flash.display.*;
public dynamic class SpecialShrink extends BitmapData {
public function SpecialShrink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 92
//SpecialSmartBomb (SpecialSmartBomb)
package {
import flash.display.*;
public dynamic class SpecialSmartBomb extends BitmapData {
public function SpecialSmartBomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 93
//SpecialSuper (SpecialSuper)
package {
import flash.display.*;
public dynamic class SpecialSuper extends BitmapData {
public function SpecialSuper(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 94
//Start (Start)
package {
import flash.display.*;
import flash.events.*;
public class Start extends SimpleButton {
public var lManager:Level;
public function Start(){
addEventListener(Event.ADDED_TO_STAGE, init);
addEventListener(MouseEvent.CLICK, click);
}
private function init(_arg1:Event){
lManager = MovieClip(parent).lManager;
}
private function click(_arg1:MouseEvent){
lManager.currentState = 1;
lManager.startEndlessFactory();
lManager.removeChild(MovieClip(parent));
}
}
}//package
Section 95
//Super (Super)
package {
import flash.media.*;
public dynamic class Super extends Sound {
}
}//package
Section 96
//vgsCollision (vgsCollision)
package {
import flash.geom.*;
public class vgsCollision {
public static function getCircularCollision(_arg1:Point, _arg2:Number, _arg3:Point, _arg4:Number){
var _local5:Number;
_local5 = Point.distance(_arg1, _arg3);
if (_local5 <= (_arg2 + _arg4)){
return (true);
};
return (false);
}
public static function getSegmentCollision(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):Boolean{
var _local5:Boolean;
var _local6:Number;
var _local7:Number;
_local5 = true;
_local6 = (((_arg1.x - _arg2.x) * (_arg3.y - _arg4.y)) - ((_arg1.y - _arg2.y) * (_arg3.x - _arg4.x)));
if (_local6 == 0){
_local5 = false;
};
_local7 = ((((_arg3.x - _arg4.x) * ((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))) - ((_arg1.x - _arg2.x) * ((_arg3.x * _arg4.y) - (_arg3.y * _arg4.x)))) / _local6);
if ((((_local7 < Math.min(_arg1.x, _arg2.x))) || ((_local7 > Math.max(_arg1.x, _arg2.x))))){
_local5 = false;
};
if ((((_local7 < Math.min(_arg3.x, _arg4.x))) || ((_local7 > Math.max(_arg3.x, _arg4.x))))){
_local5 = false;
};
return (_local5);
}
}
}//package
Section 97
//vgsMath (vgsMath)
package {
public class vgsMath {
public static function rad2deg(_arg1:Number):Number{
return ((_arg1 * (180 / Math.PI)));
}
public static function deg2rad(_arg1:Number):Number{
return ((_arg1 * (Math.PI / 180)));
}
}
}//package
Section 98
//vgsParticleExplosion (vgsParticleExplosion)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class vgsParticleExplosion extends MovieClip {
public var parentMovieClip:MovieClip;
public var lastTime:int;
public var particle:Array;
public var framesMovieClip:int;
public var sourceMovieClip:Class;
public function vgsParticleExplosion(_arg1:Class, _arg2:MovieClip, _arg3:int){
sourceMovieClip = _arg1;
parentMovieClip = _arg2;
framesMovieClip = _arg3;
particle = new Array();
lastTime = getTimer();
addEventListener(Event.ENTER_FRAME, update);
}
public function createExplosion(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int){
var _local6:int;
var _local7:Object;
_local6 = 1;
while (_local6 <= _arg5) {
_local7 = new Object();
_local7.mc = new sourceMovieClip();
_local7.angle = ((Math.random() * 2) * Math.PI);
_local7.mc.x = _arg1;
_local7.mc.y = _arg2;
if (_arg3 != 0){
_local7.life = _arg3;
} else {
_local7.life = int(((Math.random() * 20) + 20));
};
if (_arg4 != 0){
_local7.mc.gotoAndStop(_arg4);
} else {
_local7.mc.gotoAndPlay(((Math.random() * framesMovieClip) + 1));
};
parentMovieClip.addChild(_local7.mc);
particle.push(_local7);
_local6++;
};
}
public function update(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:*;
_local2 = (getTimer() - lastTime);
lastTime = (lastTime + _local2);
_local3 = (particle.length - 1);
while (_local3 >= 0) {
_local4 = particle[_local3];
_local4.life--;
if (_local4.life == 0){
parentMovieClip.removeChild(_local4.mc);
particle.splice(_local3, 1);
} else {
_local4.mc.x = (_local4.mc.x + (((Math.cos(_local4.angle) * _local4.life) * _local2) / 200));
_local4.mc.y = (_local4.mc.y + (((Math.sin(_local4.angle) * _local4.life) * _local2) / 200));
_local4.mc.scaleX = (_local4.mc.scaleY = Math.random());
_local4.mc.alpha = Math.random();
};
_local3--;
};
}
}
}//package
Section 99
//vgsService (vgsService)
package {
import flash.display.*;
import flash.net.*;
public class vgsService {
private var root:MovieClip;
public var statSystem:String;
private var statSystemLocalData:SharedObject;
public function vgsService(_arg1:MovieClip, _arg2:Object){
root = _arg1;
startMochiBot(_arg2.mochiBotID);
startPreLoader(_arg2.preloaderAdsProvider, _arg2.preloaderAdsObject);
root.siteLocked = checkSiteLock(_arg2.siteLockList);
startStatSystem(_arg2.statSystem, _arg2.statSystemObject);
}
private function startStatSystem(_arg1:String, _arg2:Object){
if (_arg1 == ""){
trace("No stat system configured");
};
if (_arg1 == "Local"){
startLocalStatSystem(_arg2);
};
}
private function getLocalStat(_arg1:String):int{
var _local2:int;
_local2 = statSystemLocalData.data.keys.indexOf(_arg1);
return (statSystemLocalData.data.values[_local2]);
}
public function deleteLocalStatSystem(){
statSystemLocalData.clear();
}
private function startLocalStatSystem(_arg1:Object){
statSystem = "Local";
statSystemLocalData = SharedObject.getLocal(_arg1.name);
if (statSystemLocalData.data.name == undefined){
statSystemLocalData.data.name = _arg1.name;
statSystemLocalData.data.keys = _arg1.keys;
statSystemLocalData.data.values = _arg1.values;
statSystemLocalData.flush();
trace("New Local Object created for Stat System");
} else {
trace("Local Object for Stat System Found!");
};
}
private function startMochiBot(_arg1:String){
if (_arg1 != ""){
MochiBot.track(root, _arg1);
trace(("MochiBot started with the ID " + _arg1));
} else {
trace("MochiBotID not present. No track record was sent to servers.");
};
}
private function startMochiAds(_arg1:Object){
if (_arg1.id == ""){
trace("MochiAds started but no ID was found.");
} else {
_arg1.clip = root;
_arg1.res = "640x480";
_arg1.no_bg = true;
MochiAd.showPreGameAd(_arg1);
};
}
public function getStat(_arg1:String):int{
if (statSystem == "Local"){
return (getLocalStat(_arg1));
};
return (-1);
}
private function startPreLoader(_arg1:String, _arg2:Object){
if (_arg1 == "Mochi"){
startMochiAds(_arg2);
};
if (_arg1 == "AGame"){
startAGameLoader(_arg2);
};
}
public function setStat(_arg1:String, _arg2:int){
if (statSystem == "Local"){
setLocalStat(_arg1, _arg2);
};
}
private function checkSiteLock(_arg1:Array):Boolean{
var _local2:*;
var _local3:String;
var _local4:String;
if (_arg1 == null){
return (false);
};
for (_local2 in _arg1) {
_local3 = _arg1[_local2];
_local4 = this.root.loaderInfo.url.split("/")[2];
if (_local4.indexOf(_local3) == (_local4.length - _local3.length)){
return (false);
};
};
return (true);
}
private function startAGameLoader(_arg1:Object){
var _local2:MovieClip;
_local2 = new AGameLoader(_arg1.startFrame, _arg1.finalFrame, true);
_local2.x = (root.stage.width / 2);
_local2.y = (root.stage.height / 2);
root.addChild(_local2);
}
private function setLocalStat(_arg1:String, _arg2:int){
var _local3:int;
_local3 = statSystemLocalData.data.keys.indexOf(_arg1);
if (statSystemLocalData.data.values[_local3] < _arg2){
statSystemLocalData.data.values[_local3] = _arg2;
statSystemLocalData.flush();
};
trace(((statSystemLocalData.data.keys[0] + " = ") + statSystemLocalData.data.values[0]));
trace(((statSystemLocalData.data.keys[1] + " = ") + statSystemLocalData.data.values[1]));
}
}
}//package
Section 100
//vgsSoundSystem (vgsSoundSystem)
package {
import flash.media.*;
public class vgsSoundSystem {
private var sMute:Boolean;
private var mTrfm:Array;
private var mClss:Array;
private var sClss:Array;
private var sName:Array;
private var sTrfm:Array;
private var mMute:Boolean;
private var currentMusic:int;// = -1
private var sChnl:Array;
private var mChnl:Array;
private var mName:Array;
public function vgsSoundSystem(){
currentMusic = -1;
super();
sMute = false;
mMute = false;
sName = new Array();
sChnl = new Array();
sClss = new Array();
sTrfm = new Array();
mName = new Array();
mChnl = new Array();
mClss = new Array();
mTrfm = new Array();
}
public function stopMusic(){
if (currentMusic != -1){
mChnl[currentMusic].stop();
};
}
public function registerMusic(_arg1:Class, _arg2:Number, _arg3:Number){
var _local4:SoundChannel;
var _local5:Sound;
var _local6:SoundTransform;
_local4 = new SoundChannel();
_local5 = new (_arg1);
_local6 = new SoundTransform(_arg2, _arg3);
mName.push(String(_arg1));
mChnl.push(_local4);
mClss.push(_local5);
mTrfm.push(_local6);
}
public function playSound(_arg1:String){
var _local2:int;
if (!sMute){
_local2 = sName.indexOf((("[class " + _arg1) + "]"));
sChnl[_local2] = sClss[_local2].play();
sChnl[_local2].soundTransform = sTrfm[_local2];
};
}
private function playMusicByName(_arg1:String){
var _local2:int;
if (!mMute){
_local2 = mName.indexOf((("[class " + _arg1) + "]"));
if (_local2 == currentMusic){
return;
};
};
playMusicByIndex(_local2);
}
public function registerSound(_arg1:Class, _arg2:Number, _arg3:Number){
var _local4:SoundChannel;
var _local5:Sound;
var _local6:SoundTransform;
_local4 = new SoundChannel();
_local5 = new (_arg1);
_local6 = new SoundTransform(_arg2, _arg3);
sName.push(String(_arg1));
sChnl.push(_local4);
sClss.push(_local5);
sTrfm.push(_local6);
}
public function playMusic(_arg1:String){
playMusicByName(_arg1);
}
public function toggleSound(){
sMute = !(sMute);
}
private function playMusicByIndex(_arg1:int){
if (((!((_arg1 == -1))) && (!(mMute)))){
mChnl[_arg1] = mClss[_arg1].play(0, 9999);
mChnl[_arg1].soundTransform = mTrfm[_arg1];
};
currentMusic = _arg1;
}
public function toggleMusic(){
mMute = !(mMute);
if (mMute){
stopMusic();
} else {
playMusicByIndex(currentMusic);
};
}
}
}//package