Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.services.*;
import flash.utils.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.net.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//MochiBot (com.mochi.MochiBot)
package com.mochi {
import flash.display.*;
import flash.system.*;
import flash.net.*;
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 com.mochi
Section 14
//fillerBoard (com.simianlogic.fillerBoard)
package com.simianlogic {
import flash.events.*;
import flash.display.*;
import org.cove.ape.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
public class fillerBoard extends MovieClip {
public var slowLevel:int;// = 0
public var CHALLENGETYPE:int;// = 0
public var percentFilled:Number;// = 0
public var activeBall:growthSprite;
public var sizeSprite:Sprite;
public var birthTime:int;
public var playerScore:int;// = 0
public var CHALLENGE:Boolean;// = false
public var bg:Sprite;
public var sizeRad:Number;
public var maxTime:Number;// = 1000
public var levelTime:int;// = 0
public var timeLeft:Number;// = 0
public var ballsLeft:Number;// = 0
public var boardWidth:int;
public var ballsPopped:int;// = 0
public var sizeGoal:int;// = 0
public var fillerBalls:Group;
private var thudSound:Sound;
public var LASTUPDATE:int;
public var player:Group;
public var totalFreeze:int;// = 0
public var redCount:int;// = 0
public var maxFreeze;
private var musicChannel:SoundChannel;
private var alert24Sound:Sound;
public var isSelfDestructing:Boolean;// = false
private var alert05Sound:Sound;
public var bouncyBalls:Group;
public var CHALLENGERESOLVED:Boolean;// = false
public var freezeLeft;
private var _GAMEPAUSED:Boolean;// = false
public var SOUNDENABLED:Boolean;// = true
public var biggestBall:int;// = 0
public var bgFill:BitmapData;
private var _ballSkin:Class;
public var timeGoal:int;// = 0
public var world:levelBounds;
public var quickLevel:int;// = 0
public var frozenBalls:Array;
public var firstDeath:int;// = 0
public var CAF:Number;// = 0.05
public var boardHeight:int;
public var ballsPlaced:int;// = 0
public var CURRENTLEVEL:int;// = 1
public var DIFFICULTY:int;// = 1
public var MAXAREA:int;// = 1
public var BALLSFROZEN:Boolean;// = false
private var musicSound:Sound;
public function fillerBoard(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
MAXAREA = 1;
CURRENTLEVEL = 1;
_GAMEPAUSED = false;
DIFFICULTY = 1;
SOUNDENABLED = true;
playerScore = 0;
ballsLeft = 0;
percentFilled = 0;
timeLeft = 0;
maxTime = 1000;
_ballSkin = blueBallArt;
CAF = 0.05;
ballsPlaced = 0;
ballsPopped = 0;
totalFreeze = 0;
quickLevel = 0;
slowLevel = 0;
biggestBall = 0;
firstDeath = 0;
levelTime = 0;
isSelfDestructing = false;
redCount = 0;
CHALLENGE = false;
CHALLENGETYPE = 0;
CHALLENGERESOLVED = false;
timeGoal = 0;
sizeGoal = 0;
BALLSFROZEN = false;
super();
x = _arg1;
y = _arg2;
trace("Creating fillerBoard");
birthTime = getTimer();
boardWidth = _arg3;
boardHeight = _arg4;
graphics.clear();
graphics.beginFill(0x555555, 0.01);
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
addEventListener(Event.ENTER_FRAME, run);
alert05Sound = new modAlert05Mp3();
alert24Sound = new modAlert24Mp3();
thudSound = new thudMp3();
APEngine.init((1 / 4));
APEngine.damping = 1;
APEngine.container = this;
world = new levelBounds(0, 0, _arg3, _arg4);
MAXAREA = world.MAXAREA;
player = new Group();
bouncyBalls = new Group();
fillerBalls = new Group();
player.addCollidable(world);
player.addCollidable(bouncyBalls);
player.addCollidable(fillerBalls);
bouncyBalls.addCollidable(world);
fillerBalls.addCollidable(world);
bouncyBalls.addCollidable(fillerBalls);
bouncyBalls.collideInternal = true;
fillerBalls.collideInternal = true;
APEngine.addGroup(world);
APEngine.addGroup(player);
APEngine.addGroup(bouncyBalls);
APEngine.addGroup(fillerBalls);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
addEventListener(MouseEvent.MOUSE_UP, mouseUp);
startLevel(CURRENTLEVEL);
}
public function freezeBalls(_arg1:Event=null):void{
var _local2:Array;
var _local3:int;
_local2 = bouncyBalls.getAll();
_local3 = 0;
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].fixed = true;
_local3++;
};
_local2 = fillerBalls.getAll();
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].fixed = true;
_local3++;
};
BALLSFROZEN = true;
frozenBalls = [];
}
private function redTimerHandlerDone(_arg1:TimerEvent):void{
graphics.clear();
graphics.beginFill(0x555555, 0.01);
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
}
public function get ballSkin():Class{
return (_ballSkin);
}
public function startSizeChallenge(_arg1:int, _arg2:int, _arg3:Number):void{
newGame();
CHALLENGETYPE = 0;
CHALLENGE = true;
CHALLENGERESOLVED = false;
CURRENTLEVEL = _arg1;
DIFFICULTY = _arg2;
startLevel(_arg1);
sizeGoal = _arg3;
ballsLeft = 1;
sizeSprite = new Sprite();
sizeSprite.visible = false;
sizeSprite.graphics.clear();
sizeSprite.graphics.beginFill(0, 0.5);
sizeRad = Math.sqrt((((MAXAREA * sizeGoal) / 100) / 3.1415));
sizeSprite.graphics.drawCircle(0, 0, sizeRad);
addChild(sizeSprite);
sizeSprite.addEventListener("mouseDown", mouseDown);
dispatchEvent(new Event("change"));
dispatchEvent(new Event("challengeStarted"));
}
private function freezeActiveBall():void{
var _local1:Array;
var _local2:growthSprite;
var _local3:Number;
_local1 = player.getAll();
if ((((_local1.length > 0)) && ((_local1[0] == activeBall)))){
player.removeParticle(activeBall);
activeBall.sprite.removeEventListener("collision", playerCollision);
activeBall.sprite.removeEventListener("mouseUp", mouseUp);
};
_local2 = new growthSprite(activeBall.position.x, activeBall.position.y, activeBall.radius, _ballSkin);
fillerBalls.addParticle(_local2);
if (BALLSFROZEN){
_local2.fixed = true;
};
if (((BALLSFROZEN) && ((freezeLeft <= 0)))){
unfreezeBalls();
};
playerScore = (playerScore + Math.round((((3.1415 * activeBall.radius) * activeBall.radius) / 100)));
ballsPlaced++;
_local3 = ((((3.1415 * activeBall.radius) * activeBall.radius) / MAXAREA) * 100);
if (_local3 > biggestBall){
biggestBall = _local3;
};
if (((CHALLENGE) && ((CHALLENGETYPE == 0)))){
trace(("Only got " + _local3));
if (((((3.1415 * activeBall.radius) * activeBall.radius) / MAXAREA) * 100) > sizeGoal){
setTimeout(challengeComplete, 250);
};
};
tallyPercent();
ballsLeft--;
activeBall = null;
if ((((ballsLeft <= 0)) && ((percentFilled < 66.555)))){
gameOver();
};
ballsLeft = Math.max(ballsLeft, 0);
dispatchEvent(new Event("change"));
}
private function mouseUp(_arg1:Event):void{
var _local2:Array;
_local2 = player.getAll();
if ((((_local2.length > 0)) && ((_local2[0] == activeBall)))){
freezeActiveBall();
};
}
public function set ballSkin(_arg1:Class):void{
_ballSkin = _arg1;
dispatchEvent(new Event("ballSkinChange", true));
}
private function startLevel(_arg1:int):void{
var _local2:int;
var _local3:Array;
var _local4:int;
var _local5:constantVSprite;
if (!CHALLENGE){
dispatchEvent(new Event("levelStarted"));
};
maxTime = ((10 + (_arg1 * 10)) * 1000);
timeLeft = ((10 + (_arg1 * 10)) * 1000);
levelTime = 0;
maxFreeze = (_arg1 * 250);
freezeLeft = (_arg1 * 250);
if (DIFFICULTY == 2){
freezeLeft = 0;
};
ballsLeft = (8 + (2 * _arg1));
percentFilled = 0;
_local2 = (4.5 + Math.max(0, ((_arg1 - 25) * CAF)));
_local3 = [new Vector(-(_local2), -(_local2)), new Vector(_local2, -(_local2)), new Vector(_local2, _local2), new Vector(-(_local2), _local2)];
bouncyBalls.clearAll();
fillerBalls.clearAll();
_local4 = 0;
while (_local4 < (_arg1 + 1)) {
_local5 = new constantVSprite(((Math.random() * (boardWidth - 100)) + 50), ((Math.random() * (boardHeight - 50)) + 25));
_local5.setVelocity(_local3[int((Math.random() * 3.9999))]);
bouncyBalls.addParticle(_local5);
_local4++;
};
LASTUPDATE = getTimer();
dispatchEvent(new Event("change"));
}
public function findEmptySpot():Vector{
var _local1:Boolean;
var _local2:Vector;
var _local3:Array;
var _local4:Array;
var _local5:int;
var _local6:Boolean;
var _local7:Number;
var _local8:Number;
_local1 = false;
_local2 = new Vector(0, 0);
_local3 = fillerBalls.getAll();
_local4 = bouncyBalls.getAll();
while (!(_local1)) {
_local2.x = ((Math.random() * (boardWidth - 100)) + 50);
_local2.y = ((Math.random() * (boardHeight - 50)) + 25);
_local6 = false;
_local5 = 0;
while (_local5 < _local3.length) {
_local7 = _local3[_local5].position.distance(_local2);
if (_local7 < (10 + _local3[_local5].radius)){
_local6 = true;
};
_local5++;
};
_local5 = 0;
while (_local5 < _local4.length) {
_local8 = _local4[_local5].position.distance(_local2);
if (_local8 < (10 + _local4[_local5].radius)){
_local6 = true;
};
_local5++;
};
if (!_local6){
_local1 = true;
};
};
return (_local2);
}
public function nextLevel(_arg1:Event=null):void{
if (CHALLENGE){
setTimeout(challengeFailed, 250);
return;
};
CURRENTLEVEL++;
startLevel(CURRENTLEVEL);
}
public function decimalize(_arg1:String):String{
var _local2:String;
var _local3:Array;
_local3 = _arg1.split(".");
if (_local3.length == 2){
_local2 = ((_local3[0] + ".") + _local3[1].charAt(0));
} else {
_local2 = (_local3[0] + ".0");
};
return (_local2);
}
public function challengeFailed():void{
var _local1:SoundTransform;
if (CHALLENGERESOLVED){
return;
};
CHALLENGERESOLVED = true;
_local1 = new SoundTransform(0.5);
if (SOUNDENABLED){
alert05Sound.play(0, 0, _local1);
};
dispatchEvent(new Event("challengeFailed"));
}
public function getAverageSize():int{
var _local1:Array;
var _local2:Number;
var _local3:int;
_local1 = fillerBalls.getAll();
_local2 = 0;
_local3 = 0;
while (_local3 < _local1.length) {
_local2 = (_local2 + _local1[_local3].radius);
_local3++;
};
return (Math.round((_local2 / _local1.length)));
}
public function flashRed():void{
var _local1:Timer;
graphics.clear();
graphics.beginFill(0x555555, 0.01);
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
graphics.beginFill(0xFF0000, 0.5);
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
_local1 = new Timer(5, 20);
_local1.addEventListener("timer", redTimerHandler);
_local1.addEventListener("timerComplete", redTimerHandlerDone);
redCount = 0;
_local1.start();
}
private function run(_arg1:Event):void{
var _local2:Array;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:constantVSprite;
var _local7:constantVSprite;
var _local8:int;
var _local9:int;
if (GAMEPAUSED){
return;
};
APEngine.step();
APEngine.paint();
timeLeft = (timeLeft - (getTimer() - LASTUPDATE));
levelTime = (levelTime + (getTimer() - LASTUPDATE));
timeLeft = Math.max(0, timeLeft);
if (((CHALLENGE) && ((CHALLENGETYPE == 1)))){
timeGoal = (timeGoal - (getTimer() - LASTUPDATE));
if (timeGoal < 0){
timeGoal = 0;
challengeFailed();
};
};
if (BALLSFROZEN){
freezeLeft = (freezeLeft - (getTimer() - LASTUPDATE));
totalFreeze = (totalFreeze + (getTimer() - LASTUPDATE));
freezeLeft = Math.max(0, freezeLeft);
if ((((freezeLeft <= 0)) && ((activeBall == null)))){
unfreezeBalls();
};
};
if (((CHALLENGE) && ((CHALLENGETYPE == 0)))){
sizeSprite.x = Math.max((10 + sizeRad), mouseX);
sizeSprite.y = Math.max((12 + sizeRad), mouseY);
sizeSprite.x = Math.min(sizeSprite.x, ((boardWidth - sizeRad) - 10));
sizeSprite.y = Math.min(sizeSprite.y, ((boardHeight - sizeRad) - 10));
if ((((((((mouseX > 10)) && ((mouseY > 10)))) && ((mouseX < (10 + boardWidth))))) && ((mouseY < (10 + boardHeight))))){
sizeSprite.visible = true;
} else {
sizeSprite.visible = false;
};
};
LASTUPDATE = getTimer();
dispatchEvent(new Event("change"));
_local2 = bouncyBalls.getAll();
_local3 = 0;
while (_local3 < _local2.length) {
if ((((((((_local2[_local3].position.x < 0)) || ((_local2[_local3].position.x > boardWidth)))) || ((_local2[_local3].position.y > boardHeight)))) || ((_local2[_local3].position.y < 0)))){
_local5 = (4.5 + Math.max(0, ((CURRENTLEVEL - 25) * CAF)));
if (mouseX < (boardWidth / 2)){
_local6 = new constantVSprite((boardWidth - 30), 30);
_local6.setVelocity(new Vector(-(_local5), _local5));
bouncyBalls.addParticle(_local6);
bouncyBalls.removeParticle(_local2[_local3]);
} else {
_local7 = new constantVSprite(30, 30);
_local7.setVelocity(new Vector(_local5, _local5));
bouncyBalls.addParticle(_local7);
bouncyBalls.removeParticle(_local2[_local3]);
};
};
_local3++;
};
_local4 = player.getAll();
if (_local4.length > 0){
if ((((((((activeBall.position.x < (x + 5))) || ((activeBall.position.x > (boardWidth - 5))))) || ((activeBall.position.y > (boardHeight - 5))))) || ((activeBall.position.y < 5)))){
outOfBounds();
};
_local8 = Math.min(mouseX, ((boardWidth - 5) - (activeBall.radius / 2)));
_local8 = Math.max((5 + (activeBall.radius / 2)), _local8);
_local9 = Math.min(mouseY, ((height - (activeBall.radius / 2)) - 5));
_local9 = Math.max((5 + (activeBall.radius / 2)), mouseY);
activeBall.follow(new Vector(_local8, _local9));
if ((((activeBall.radius > ((boardHeight / 2) - 10))) || ((activeBall.radius > ((boardWidth / 2) - 10))))){
activeBall.radius = Math.min(((boardHeight / 2) - 10), ((boardWidth / 2) - 10));
activeBall.dirty = true;
freezeActiveBall();
return;
};
};
}
public function statReport():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + (ballsPlaced + "\n"));
_local1 = (_local1 + (ballsPopped + "\n"));
_local1 = (_local1 + (decimalize((totalFreeze / 1000).toString()) + "s\n"));
_local1 = (_local1 + (decimalize((quickLevel / 1000).toString()) + "s\n"));
_local1 = (_local1 + (decimalize((slowLevel / 1000).toString()) + "s\n"));
_local1 = (_local1 + (biggestBall + "%\n"));
return (_local1);
}
public function challengeComplete():void{
var _local1:SoundTransform;
if (CHALLENGERESOLVED){
return;
};
CHALLENGERESOLVED = true;
_local1 = new SoundTransform(0.5);
if (SOUNDENABLED){
alert24Sound.play(0, 0, _local1);
};
dispatchEvent(new Event("challengeComplete"));
}
private function ouch():void{
var _local1:Vector;
var _local2:Array;
var _local3:int;
var _local4:Number;
var _local5:Vector;
flashRed();
ballsLeft--;
ballsPopped++;
if (firstDeath == 0){
firstDeath = CURRENTLEVEL;
};
trace(("firstDeath: " + firstDeath));
if (((CHALLENGE) && ((CHALLENGETYPE == 3)))){
challengeFailed();
};
_local1 = new Vector(mouseX, mouseY);
_local2 = bouncyBalls.getAll();
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = _local2[_local3].position.distance(_local1);
_local5 = _local2[_local3].position.minus(_local1).normalize();
_local2[_local3].addMasslessForce(_local5.mult((activeBall.radius * (250 / _local4))));
_local2[_local3].normalize();
_local3++;
};
dispatchEvent(new Event("change"));
if (ballsLeft <= 0){
gameOver();
};
}
public function startTimeChallenge(_arg1:int, _arg2:int, _arg3:int):void{
newGame();
CHALLENGETYPE = 1;
CHALLENGE = true;
CHALLENGERESOLVED = false;
CURRENTLEVEL = _arg1;
DIFFICULTY = 1;
startLevel(_arg1);
timeGoal = _arg3;
dispatchEvent(new Event("change"));
dispatchEvent(new Event("challengeStarted"));
}
public function outOfBounds():void{
var _local1:SoundTransform;
player.removeParticle(activeBall);
if (SOUNDENABLED){
_local1 = new SoundTransform(1.5);
thudSound.play(0, 0, _local1);
};
ouch();
}
public function startGolfChallenge(_arg1:int, _arg2:int, _arg3:int):void{
newGame();
CHALLENGETYPE = 2;
CHALLENGE = true;
CHALLENGERESOLVED = false;
CURRENTLEVEL = _arg1;
DIFFICULTY = _arg2;
startLevel(_arg1);
ballsLeft = _arg3;
dispatchEvent(new Event("change"));
dispatchEvent(new Event("challengeStarted"));
}
private function mouseDown(_arg1:Event):void{
var _local2:Array;
if (GAMEPAUSED){
return;
};
if (isSelfDestructing){
return;
};
if (_arg1.target == sizeSprite){
trace("Clicked on the size sprite!");
} else {
if (_arg1.target.constructor != fillerBoard){
return;
};
};
_local2 = player.getAll();
if ((((_local2.length > 0)) && ((_local2[0] == activeBall)))){
player.removeParticle(activeBall);
};
if ((((((((mouseX < (x + 10))) || ((mouseX > (boardWidth - 10))))) || ((mouseY > (boardHeight - 10))))) || ((mouseY < 10)))){
return;
};
activeBall = new growthSprite(mouseX, mouseY, 10, _ballSkin, true);
activeBall.sprite.addEventListener("collision", playerCollision);
activeBall.sprite.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
player.addParticle(activeBall);
}
public function initiateSelfDestructSequence():void{
var _local1:Timer;
if ((((ballsLeft == 0)) || (isSelfDestructing))){
return;
};
isSelfDestructing = true;
_local1 = new Timer(50, ballsLeft);
_local1.addEventListener("timer", selfDestructHandler);
_local1.addEventListener("timerComplete", endSelfDestruct);
_local1.start();
}
public function tallyPercent():Number{
var _local1:Array;
var _local2:Number;
var _local3:int;
var _local4:SoundTransform;
_local1 = fillerBalls.getAll();
_local2 = 0;
_local3 = 0;
while (_local3 < _local1.length) {
_local2 = (_local2 + ((3.1415 * _local1[_local3].radius) * _local1[_local3].radius));
_local3++;
};
percentFilled = ((_local2 / MAXAREA) * 100);
dispatchEvent(new Event("change"));
if (((_local2 / MAXAREA) * 100) >= 66.555){
if (((CHALLENGE) && ((((((CHALLENGETYPE == 1)) || ((CHALLENGETYPE == 2)))) || ((CHALLENGETYPE == 3)))))){
challengeComplete();
return (0);
};
dispatchEvent(new Event("levelComplete"));
_local4 = new SoundTransform(0.5);
if (SOUNDENABLED){
alert24Sound.play(0, 0, _local4);
};
if ((((quickLevel == 0)) || ((levelTime < quickLevel)))){
quickLevel = levelTime;
};
if ((((slowLevel == 0)) || ((levelTime > slowLevel)))){
slowLevel = levelTime;
};
};
return (percentFilled);
}
public function set GAMEPAUSED(_arg1:Boolean):void{
_GAMEPAUSED = _arg1;
if (!_arg1){
LASTUPDATE = getTimer();
};
}
public function startPerfectChallenge(_arg1:int, _arg2:int):void{
newGame();
CHALLENGETYPE = 3;
CHALLENGE = true;
CHALLENGERESOLVED = false;
CURRENTLEVEL = _arg1;
DIFFICULTY = _arg2;
startLevel(_arg1);
dispatchEvent(new Event("change"));
dispatchEvent(new Event("challengeStarted"));
}
private function keyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.charCode == 32)) && (BALLSFROZEN))){
unfreezeBalls();
};
}
public function playerCollision(_arg1:CollisionEvent):void{
var _local2:Number;
var _local3:SoundTransform;
if ((_arg1.hitItem is constantVSprite)){
if (((BALLSFROZEN) || ((DIFFICULTY == 0)))){
_local2 = constantVSprite(_arg1.hitItem).position.distance(activeBall.position);
activeBall.radius = (_local2 - 10);
freezeActiveBall();
} else {
player.removeParticle(activeBall);
if (SOUNDENABLED){
_local3 = new SoundTransform(1.5);
thudSound.play(0, 0, _local3);
};
ouch();
};
return;
};
if ((_arg1.hitItem is growthSprite)){
freezeActiveBall();
return;
};
}
private function endSelfDestruct(_arg1:Event):void{
isSelfDestructing = false;
}
private function redTimerHandler(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:int;
var _local4:uint;
var _local5:uint;
var _local6:uint;
graphics.clear();
graphics.beginFill(0x555555, 0.01);
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
redCount++;
_local2 = (redCount / 20);
_local3 = (_local2 * 85);
_local4 = (85 << 16);
_local5 = (_local3 << 8);
_local6 = _local3;
graphics.beginFill(((_local4 + _local5) + _local6), (1 - _local2));
graphics.drawRoundRect(10, 10, (boardWidth - 20), (boardHeight - 20), 20);
graphics.endFill();
}
public function get GAMEPAUSED():Boolean{
return (_GAMEPAUSED);
}
private function keyDown(_arg1:KeyboardEvent):void{
if ((((_arg1.charCode == 32)) && ((freezeLeft > 0)))){
freezeBalls();
};
}
public function newGame(_arg1:Event=null):void{
playerScore = 0;
percentFilled = 0;
CURRENTLEVEL = 1;
startLevel(CURRENTLEVEL);
CHALLENGE = false;
ballsPlaced = 0;
ballsPopped = 0;
totalFreeze = 0;
quickLevel = 0;
slowLevel = 0;
biggestBall = 0;
firstDeath = 0;
levelTime = 0;
trace(("Starting new game with difficulty = " + DIFFICULTY));
if (((sizeSprite) && (contains(sizeSprite)))){
removeChild(sizeSprite);
};
if (!stage.hasEventListener(KeyboardEvent.KEY_UP)){
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
};
if (!stage.hasEventListener(KeyboardEvent.KEY_DOWN)){
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
};
if (!stage.hasEventListener(MouseEvent.MOUSE_UP)){
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
};
}
public function unfreezeBalls(_arg1:Event=null):void{
var _local2:Array;
var _local3:int;
_local2 = bouncyBalls.getAll();
_local3 = 0;
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].fixed = false;
_local3++;
};
_local2 = fillerBalls.getAll();
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].fixed = false;
_local3++;
};
_local3 = 0;
while (_local3 < frozenBalls.length) {
frozenBalls[_local3].velocity = new Vector(0, 0);
_local3++;
};
BALLSFROZEN = false;
}
private function gameOver():void{
var _local1:SoundTransform;
if (CHALLENGE){
setTimeout(challengeFailed, 250);
return;
};
dispatchEvent(new Event("gameOver"));
trace("PLAYING GAME OVER SOUND!");
_local1 = new SoundTransform(0.5);
if (SOUNDENABLED){
alert05Sound.play(0, 0, _local1);
};
}
private function selfDestructHandler(_arg1:TimerEvent):void{
var _local2:Vector;
_local2 = findEmptySpot();
activeBall = new growthSprite(_local2.x, _local2.y, 10, _ballSkin, true);
player.addParticle(activeBall);
freezeActiveBall();
if (percentFilled >= 66.555){
_arg1.target.stop();
isSelfDestructing = false;
};
}
}
}//package com.simianlogic
Section 15
//growthSprite (com.simianlogic.growthSprite)
package com.simianlogic {
import flash.display.*;
import org.cove.ape.*;
import flash.utils.*;
import flash.geom.*;
public class growthSprite extends CircleParticle {
public var freezeTime:int;// = 0
public var myColor:uint;// = 0xFFFFFF
public var GROWTHRATE:Number;// = 0.5
public var birthTime:int;// = 0
private var fill:BitmapData;
public var lastVelocity:Vector;
public var dirty:Boolean;// = true
public var lastPosition:Vector;
public var growing:Boolean;
private var _freezing:Boolean;
public function growthSprite(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Class, _arg5:Boolean=false){
var _local6:Number;
dirty = true;
birthTime = 0;
freezeTime = 0;
myColor = 0xFFFFFF;
GROWTHRATE = 0.5;
_local6 = 100;
growing = _arg5;
if (_arg5){
_local6 = 1;
};
freezing = !(growing);
super(_arg1, _arg2, _arg3, false, _local6, 0.25);
birthTime = getTimer();
freezeTime = getTimer();
fill = new _arg4(427, 427);
lastPosition = new Vector(position.x, position.y);
paint();
}
override public function init():void{
dirty = true;
super.init();
}
public function grow():void{
radius = (radius + (GROWTHRATE + Math.sqrt(((getTimer() - birthTime) / 1000))));
dirty = true;
}
public function set freezing(_arg1:Boolean):void{
if (_freezing == _arg1){
return;
};
_freezing = _arg1;
if (_arg1){
freezeTime = getTimer();
};
}
override public function paint():void{
var _local1:Matrix;
var _local2:Number;
super.paint();
if (dirty){
_local1 = new Matrix();
_local2 = ((radius * 2) / 427);
_local1.scale(_local2, _local2);
_local1.translate(-(radius), -(radius));
sprite.graphics.clear();
sprite.graphics.beginBitmapFill(fill, _local1, false);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
dirty = false;
};
}
public function freeze():void{
var _local1:Number;
var _local2:int;
var _local3:uint;
var _local4:uint;
var _local5:uint;
if (position.distance(lastPosition) < 0.25){
if ((getTimer() - freezeTime) > 1000){
_local1 = (((getTimer() - freezeTime) - 1000) / 3000);
_local2 = (0xFF - (128 * _local1));
_local3 = (_local2 << 16);
_local4 = (_local2 << 8);
_local5 = 0xFF;
myColor = ((_local3 + _local4) + _local5);
dirty = true;
};
if ((getTimer() - freezeTime) > 4000){
trace("I'm frozen!");
myColor = 8947967;
freezing = false;
fixed = true;
};
} else {
freezeTime = getTimer();
myColor = 0xFFFFFF;
};
lastPosition.x = position.x;
lastPosition.y = position.y;
}
public function get freezing():Boolean{
return (_freezing);
}
public function follow(_arg1:Vector):void{
var _local2:Vector;
var _local3:Number;
_local2 = _arg1.minus(position);
_local3 = _local2.magnitude();
velocity = _local2.mult((1 / 5));
}
override public function update(_arg1:Number):void{
if (growing){
grow();
} else {
addMasslessForce(new Vector(0, 2));
};
super.update(_arg1);
}
}
}//package com.simianlogic
Section 16
//levelBounds (com.simianlogic.levelBounds)
package com.simianlogic {
import org.cove.ape.*;
import flash.filters.*;
public class levelBounds extends Group {
public var MAXAREA:int;// = 1
public function levelBounds(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:DropShadowFilter;
var _local6:RectangleParticle;
var _local7:RectangleParticle;
var _local8:RectangleParticle;
var _local9:RectangleParticle;
MAXAREA = 1;
super();
_local5 = new DropShadowFilter(7, 45, 0, 0.6, 4, 4, 1, 1, true);
_local6 = new RectangleParticle(((_arg1 + _arg3) - 5), (_arg2 + (_arg4 / 2)), 10, _arg4, 0, true, 1, 0.25);
_local7 = new RectangleParticle((_arg1 + (_arg3 / 2)), ((_arg2 + _arg4) - 5), _arg3, 10, 0, true, 1, 0.25);
_local8 = new RectangleParticle((_arg1 + (_arg3 / 2)), (_arg2 + 5), _arg3, 10, 0, true, 1, 0.25);
_local9 = new RectangleParticle((_arg1 + 5), (_arg2 + (_arg4 / 2)), 10, _arg4, 0, true, 1, 0.25);
_local6.sprite.visible = false;
_local7.sprite.visible = false;
_local8.sprite.visible = false;
_local9.sprite.visible = false;
addParticle(_local6);
addParticle(_local9);
addParticle(_local8);
addParticle(_local7);
MAXAREA = ((_arg3 - 10) * (_arg4 - 10));
}
}
}//package com.simianlogic
Section 17
//menuButton (com.simianlogic.menuButton)
package com.simianlogic {
import flash.display.*;
public class menuButton extends SimpleButton {
public function menuButton(){
var _local1:Bitmap;
var _local2:Bitmap;
_local1 = new Bitmap(new buttonOverlay(240, 60));
_local2 = new Bitmap(new buttonHighlight(240, 60));
super(_local1, _local2, _local2);
}
}
}//package com.simianlogic
Section 18
//progressBar (com.simianlogic.progressBar)
package com.simianlogic {
import flash.events.*;
import flash.display.*;
public class progressBar extends MovieClip {
public var fgFill:Class;
public var bgFill:Class;
private var _progress:Number;// = 0
private var _goal:Number;// = 0
public function progressBar(){
bgFill = progressEmpty;
fgFill = progressFill;
_progress = 0;
_goal = 0;
super();
paint();
}
public function get progress():Number{
return (_goal);
}
public function set progress(_arg1:Number):void{
_goal = Math.min(1, _arg1);
addEventListener("enterFrame", animate);
}
public function paint():void{
var _local1:int;
_local1 = 0;
while (_local1 < numChildren) {
removeChildAt(0);
_local1++;
};
graphics.clear();
graphics.beginBitmapFill(new bgFill(26, 286));
graphics.drawRect(0, 0, 26, 286);
graphics.endFill();
graphics.beginBitmapFill(new fgFill(26, 286));
graphics.drawRect(0, (286 * (1 - _progress)), 26, (286 * _progress));
graphics.endFill();
}
public function finish():void{
_progress = _goal;
paint();
}
public function animate(_arg1:Event):void{
var _local2:Number;
_local2 = (_goal - _progress);
_progress = (_progress + (_local2 / 6));
if (_local2 < 0.01){
_progress = _goal;
removeEventListener("enterFrame", animate);
};
paint();
}
}
}//package com.simianlogic
Section 19
//simpleToggle (com.simianlogic.simpleToggle)
package com.simianlogic {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class simpleToggle extends MovieClip {
public var _trueState:Class;
public var _STATE:Boolean;// = true
public var btnHeight:Number;// = 25
public var btnWidth:Number;// = 25
public var _falseState:Class;
public function simpleToggle(_arg1:Number=25, _arg2:Number=25, _arg3:Boolean=true){
_trueState = soundOnArt;
_falseState = soundOffArt;
_STATE = true;
btnWidth = 25;
btnHeight = 25;
super();
if (_arg3){
addEventListener("click", toggle);
};
btnWidth = _arg1;
btnHeight = _arg1;
paint();
}
public function get falseState():Class{
return (_falseState);
}
public function toggle(_arg1:Event=null):void{
STATE = !(STATE);
paint();
}
public function set falseState(_arg1:Class){
_falseState = _arg1;
paint();
}
public function paint():void{
var _local1:int;
var _local2:Matrix;
var _local3:BitmapData;
_local1 = 0;
while (_local1 < numChildren) {
removeChildAt(0);
_local1++;
};
_local2 = new Matrix();
_local3 = (STATE) ? new trueState(btnWidth, btnHeight) : new falseState(btnWidth, btnHeight);
graphics.clear();
graphics.beginBitmapFill(_local3, _local2, false);
graphics.drawRect(0, 0, btnWidth, btnHeight);
graphics.endFill();
}
public function get STATE():Boolean{
return (_STATE);
}
public function set trueState(_arg1:Class){
_trueState = _arg1;
paint();
}
public function get trueState():Class{
return (_trueState);
}
public function set STATE(_arg1:Boolean):void{
_STATE = _arg1;
paint();
}
}
}//package com.simianlogic
Section 20
//challengeMenu_31 (filler2_kong_fla.challengeMenu_31)
package filler2_kong_fla {
import flash.display.*;
import flash.text.*;
public dynamic class challengeMenu_31 extends MovieClip {
public var cPerfectToggle:MovieClip;
public var cTimeText:TextField;
public var cGolfToggle:MovieClip;
public var cTimeToggle:MovieClip;
public var cGolfText:TextField;
public var cSizeText:TextField;
public var cMetaText:TextField;
public var cPerfectText:TextField;
public var cMetaToggle:MovieClip;
public var cSizeToggle:MovieClip;
}
}//package filler2_kong_fla
Section 21
//CreditButton_25 (filler2_kong_fla.CreditButton_25)
package filler2_kong_fla {
import flash.display.*;
import flash.text.*;
public dynamic class CreditButton_25 extends MovieClip {
public var menuCredit:TextField;
}
}//package filler2_kong_fla
Section 22
//gameUI_43 (filler2_kong_fla.gameUI_43)
package filler2_kong_fla {
import flash.display.*;
import flash.text.*;
public dynamic class gameUI_43 extends MovieClip {
public var gameToMenu:SimpleButton;
public var soundToggle:soundSymbol;
public var ballCount:MovieClip;
public var pauseSprite:SimpleButton;
public var bonusTimer:MovieClip;
public var ballText:TextField;
public var levelText:TextField;
public var fillerProgress:progressSprite;
public var musicToggle:soundSymbol;
public var sd_button:SimpleButton;
public var scoreText:TextField;
}
}//package filler2_kong_fla
Section 23
//LevelComplete_41 (filler2_kong_fla.LevelComplete_41)
package filler2_kong_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelComplete_41 extends MovieClip {
public var nextLevelButton:SimpleButton;
public var bonusRoundup:TextField;
public var newScoreBox:TextField;
public var levelCompleteText:TextField;
public var ballsLeftRoundup:TextField;
}
}//package filler2_kong_fla
Section 24
//mainMenu_17 (filler2_kong_fla.mainMenu_17)
package filler2_kong_fla {
import flash.display.*;
public dynamic class mainMenu_17 extends MovieClip {
public var instrButton:flashMenuButton;
public var optionsButton:flashMenuButton;
public var playButton:flashMenuButton;
public var challengesButton:flashMenuButton;
}
}//package filler2_kong_fla
Section 25
//QualityControl_20 (filler2_kong_fla.QualityControl_20)
package filler2_kong_fla {
import flash.display.*;
public dynamic class QualityControl_20 extends MovieClip {
public var q1:SimpleButton;
public var q2:SimpleButton;
public var selector:MovieClip;
public var q3:SimpleButton;
}
}//package filler2_kong_fla
Section 26
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.geom.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [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];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
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;
vars = 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);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 27
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
public function AbstractCollection(){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
}
function get isParented():Boolean{
return (_isParented);
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function cleanup():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
trace("I don't have one of those!");
return;
};
particles.splice(_local2, 1);
_arg1.cleanup();
}
function checkInternalCollisions():void{
var _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:AbstractParticle;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if (!_local3.collidable){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _particles[_local4];
if (_local5.collidable){
CollisionDetector.test(_local3, _local5);
};
_local4++;
};
};
_local2++;
};
}
public function get particles():Array{
return (_particles);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function clearAll():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
_particles = new Array();
}
public function getAll():Array{
return (particles);
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
var _local5:int;
var _local6:int;
var _local7:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
if (!_local4.collidable){
} else {
_local5 = _arg1.particles.length;
_local6 = 0;
while (_local6 < _local5) {
_local7 = _arg1.particles[_local6];
if (_local7.collidable){
CollisionDetector.test(_local4, _local7);
};
_local6++;
};
};
_local3++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:int;
var _local3:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _particles[_local3];
if (((!(_local1.fixed)) || (_local1.alwaysRepaint))){
_local1.paint();
};
_local3++;
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
}
}//package org.cove.ape
Section 28
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.display.*;
public class AbstractItem {
var lineAlpha:Number;
var lineColor:uint;
var displayObjectOffset:Vector;
var lineThickness:Number;
var displayObject:DisplayObject;
var fillAlpha:Number;
private var _sprite:Sprite;
var fillColor:uint;
private var _visible:Boolean;
private var _alwaysRepaint:Boolean;
var displayObjectRotation:Number;
public function AbstractItem(){
_visible = true;
_alwaysRepaint = false;
}
public function setLine(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1):void{
lineThickness = _arg1;
lineColor = _arg2;
lineAlpha = _arg3;
}
public function set visible(_arg1:Boolean):void{
_visible = _arg1;
sprite.visible = _arg1;
}
public function setFill(_arg1:uint=0xFFFFFF, _arg2:Number=1):void{
fillColor = _arg1;
fillAlpha = _arg2;
}
public function init():void{
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function paint():void{
}
public function cleanup():void{
var _local1:int;
sprite.graphics.clear();
_local1 = 0;
while (_local1 < sprite.numChildren) {
sprite.removeChildAt(_local1);
_local1++;
};
}
public function setStyle(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1, _arg4:uint=0xFFFFFF, _arg5:Number=1):void{
setLine(_arg1, _arg2, _arg3);
setFill(_arg4, _arg5);
}
public function get visible():Boolean{
return (_visible);
}
final public function set alwaysRepaint(_arg1:Boolean):void{
_alwaysRepaint = _arg1;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 29
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractParticle extends AbstractItem {
private var _collidable:Boolean;
private var _multisample:int;
private var collision:Collision;
var prev:Vector;
private var _kfr:Number;
var curr:Vector;
private var _invMass:Number;
var interval:Interval;
private var _mass:Number;
public var temp:Vector;
private var _friction:Number;
public var forces:Vector;
var samp:Vector;
private var _center:Vector;
private var _fixed:Boolean;
public function AbstractParticle(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(_arg1, _arg2);
prev = new Vector(_arg1, _arg2);
samp = new Vector();
temp = new Vector();
fixed = _arg3;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = _arg4;
this.elasticity = _arg5;
this.friction = _arg6;
setStyle();
_center = new Vector();
_multisample = 0;
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
function getComponents(_arg1:Vector):Collision{
var _local2:Vector;
var _local3:Number;
_local2 = velocity;
_local3 = _arg1.dot(_local2);
collision.vn = _arg1.mult(_local3);
collision.vt = _local2.minus(collision.vn);
return (collision);
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function get fixed():Boolean{
return (_fixed);
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
public function get multisample():int{
return (_multisample);
}
function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
curr.plusEquals(_arg1);
velocity = _arg2;
sprite.dispatchEvent(new CollisionEvent(this, _arg6));
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
public function addMasslessForce(_arg1:Vector):void{
forces.plusEquals(_arg1);
}
public function set velocity(_arg1:Vector):void{
prev = curr.minus(_arg1);
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function get elasticity():Number{
return (_kfr);
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1));
curr.plusEquals(_local2.multEquals(APEngine.damping));
prev.copy(temp);
forces.setTo(0, 0);
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function get collidable():Boolean{
return (_collidable);
}
public function addForce(_arg1:Vector):void{
forces.plusEquals(_arg1.mult(invMass));
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get friction():Number{
return (_friction);
}
public function get mass():Number{
return (_mass);
}
}
}//package org.cove.ape
Section 30
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var _damping:Number;
private static var _container:DisplayObjectContainer;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
static var force:Vector;
private static var timeStep:Number;
private static var numGroups:int;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCollisionCycles) {
checkCollisions();
_local1++;
};
}
public static function init(_arg1:Number=0.25):void{
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCollisionCycles = 1;
}
public static function addForce(_arg1:Vector):void{
force.plusEquals(_arg1);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
_arg1.cleanup();
}
public static function get damping():Number{
return (_damping);
}
public static function addGroup(_arg1:Group):void{
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
public static function addMasslessForce(_arg1:Vector):void{
masslessForce.plusEquals(_arg1);
}
}
}//package org.cove.ape
Section 31
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_radius = _arg3;
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
};
paint();
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
public function get radius():Number{
return (_radius);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
}
}//package org.cove.ape
Section 32
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package org.cove.ape
Section 33
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:Array;
var _local6:int;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Vector;
var _local11:Number;
_local4 = Number.POSITIVE_INFINITY;
_local5 = new Array(2);
_local6 = 0;
while (_local6 < 2) {
_local8 = _arg1.axes[_local6];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
if (Math.abs(_local9) < Math.abs(_local4)){
_local3 = _local8;
_local4 = _local9;
};
_local5[_local6] = _local9;
_local6++;
};
_local7 = _arg2.radius;
if ((((Math.abs(_local5[0]) < _local7)) && ((Math.abs(_local5[1]) < _local7)))){
_local10 = closestVertexOnOBB(_arg2.samp, _arg1);
_local3 = _local10.minus(_arg2.samp);
_local11 = _local3.magnitude();
_local4 = (_local7 - _local11);
if (_local4 > 0){
_local3.divEquals(_local11);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
testTypes(_arg1, _arg2);
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Vector;
var _local6:Number;
var _local7:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
_local5 = _arg1.samp.minus(_arg2.samp);
_local6 = _local5.magnitude();
_local7 = ((_arg1.radius + _arg2.radius) - _local6);
if (_local7 > 0){
_local5.divEquals(_local6);
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local5, _local7);
return (true);
};
return (false);
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
return (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
return (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_arg2.samp.copy(_arg2.curr);
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local4.plusEquals(_arg2.axes[_local5].mult(_local6));
_local5++;
};
return (_local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:int;
var _local6:Vector;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Boolean;
_local4 = Number.POSITIVE_INFINITY;
_local5 = 0;
while (_local5 < 2) {
_local6 = _arg1.axes[_local5];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
_local8 = _arg2.axes[_local5];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
_local10 = Math.abs(_local7);
_local11 = Math.abs(_local9);
if ((((_local10 < Math.abs(_local4))) || ((_local11 < Math.abs(_local4))))){
_local12 = (_local10 < _local11);
_local3 = (_local12) ? _local6 : _local8;
_local4 = (_local12) ? _local7 : _local9;
};
_local5++;
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
}
}//package org.cove.ape
Section 34
//CollisionEvent (org.cove.ape.CollisionEvent)
package org.cove.ape {
import flash.events.*;
public class CollisionEvent extends Event {
public var hitItem:AbstractItem;
public var parentItem:AbstractItem;
public static const COLLIDE:String = "collision";
public function CollisionEvent(_arg1:AbstractItem, _arg2:AbstractItem, _arg3:String="collision", _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg3, _arg4, _arg5);
parentItem = _arg1;
hitItem = _arg2;
}
}
}//package org.cove.ape
Section 35
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionResolver {
static function resolveParticleParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Vector;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Collision;
var _local11:Vector;
var _local12:Vector;
var _local13:Vector;
var _local14:Vector;
_arg1.curr.copy(_arg1.samp);
_arg2.curr.copy(_arg2.samp);
_local5 = _arg3.mult(_arg4);
_local6 = (_arg1.elasticity + _arg2.elasticity);
_local7 = (_arg1.invMass + _arg2.invMass);
_local8 = clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local9 = _arg1.getComponents(_arg3);
_local10 = _arg2.getComponents(_arg3);
_local11 = _local10.vn.mult(((_local6 + 1) * _arg1.invMass)).plus(_local9.vn.mult((_arg2.invMass - (_local6 * _arg1.invMass)))).divEquals(_local7);
_local12 = _local9.vn.mult(((_local6 + 1) * _arg2.invMass)).plus(_local10.vn.mult((_arg1.invMass - (_local6 * _arg2.invMass)))).divEquals(_local7);
_local9.vt.multEquals(_local8);
_local10.vt.multEquals(_local8);
_local13 = _local5.mult((_arg1.invMass / _local7));
_local14 = _local5.mult((-(_arg2.invMass) / _local7));
_local11.plusEquals(_local9.vt);
_local12.plusEquals(_local10.vt);
if (!_arg1.fixed){
_arg1.resolveCollision(_local13, _local11, _arg3, _arg4, -1, _arg2);
};
if (!_arg2.fixed){
_arg2.resolveCollision(_local14, _local12, _arg3, _arg4, 1, _arg1);
};
}
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > _arg3){
return (_arg3);
};
if (_arg1 < _arg2){
return (_arg2);
};
return (_arg1);
}
}
}//package org.cove.ape
Section 36
//constantVSprite (org.cove.ape.constantVSprite)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class constantVSprite extends CircleParticle {
public var fill:BitmapData;
public var myColor:uint;// = 0x990000
public var birth:int;// = 0
public var dirty:Boolean;// = true
public var VELOCITY:Number;
public function constantVSprite(_arg1:Number, _arg2:Number){
VELOCITY = Math.sqrt(18);
dirty = true;
birth = 0;
myColor = 0x990000;
super(_arg1, _arg2, 10, false, 1, 0.7);
fill = new bouncy(64, 64);
birth = getTimer();
paint();
}
override public function init():void{
dirty = true;
super.init();
}
public function normalize():void{
var _local1:Vector;
_local1 = velocity.normalize();
velocity = _local1.mult(VELOCITY);
}
override public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
normalize();
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1)).multEquals(APEngine.damping);
velocity = _local2;
normalize();
curr.plusEquals(velocity);
prev.copy(temp);
forces.setTo(0, 0);
}
override public function paint():void{
var _local1:Matrix;
var _local2:Number;
super.paint();
if (dirty){
_local1 = new Matrix();
_local2 = ((radius * 2) / 64);
_local1.scale(_local2, _local2);
_local1.translate(-(radius), -(radius));
sprite.graphics.clear();
sprite.graphics.beginBitmapFill(fill, _local1);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
dirty = false;
};
}
public function setVelocity(_arg1:Vector):void{
velocity = _arg1;
VELOCITY = _arg1.magnitude();
}
}
}//package org.cove.ape
Section 37
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _collideInternal:Boolean;
private var _collisionList:Array;
public function Group(_arg1:Boolean=false){
_collisionList = new Array();
this.collideInternal = _arg1;
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
checkCollisionVsGroup(_local3);
_local2++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
private function checkCollisionVsGroup(_arg1:Group):void{
checkCollisionsVsCollection(_arg1);
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function addCollidableList(_arg1:Array):void{
var _local2:int;
var _local3:Group;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
collisionList.push(_local3);
_local2++;
};
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
public function get collisionList():Array{
return (_collisionList);
}
private function checkCollisionGroupInternal():void{
checkInternalCollisions();
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
}
}//package org.cove.ape
Section 38
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 39
//MathUtil (org.cove.ape.MathUtil)
package org.cove.ape {
final class MathUtil {
static var ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static var PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 40
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
_extents = new Array((_arg3 / 2), (_arg4 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg5;
}
override public function init():void{
var _local1:Number;
var _local2:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
_local1 = (extents[0] * 2);
_local2 = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(_local1) / 2), (-(_local2) / 2), _local1, _local2);
sprite.graphics.endFill();
};
paint();
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
function get extents():Array{
return (_extents);
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get radian():Number{
return (_radian);
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
}
}//package org.cove.ape
Section 41
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function normalize():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (mult((1 / _local1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function distance(_arg1:Vector):Number{
var _local2:Vector;
_local2 = this.minus(_arg1);
return (_local2.magnitude());
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
}
}//package org.cove.ape
Section 42
//beachBG (beachBG)
package {
import flash.display.*;
public dynamic class beachBG extends BitmapData {
public function beachBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 43
//blackBallArt (blackBallArt)
package {
import flash.display.*;
public dynamic class blackBallArt extends BitmapData {
public function blackBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 44
//blueBallArt (blueBallArt)
package {
import flash.display.*;
public dynamic class blueBallArt extends BitmapData {
public function blueBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 45
//boardOverlay (boardOverlay)
package {
import flash.display.*;
public dynamic class boardOverlay extends MovieClip {
}
}//package
Section 46
//bonusBlack (bonusBlack)
package {
import flash.display.*;
public dynamic class bonusBlack extends BitmapData {
public function bonusBlack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 47
//bonusWhite (bonusWhite)
package {
import flash.display.*;
public dynamic class bonusWhite extends BitmapData {
public function bonusWhite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 48
//bouncy (bouncy)
package {
import flash.display.*;
public dynamic class bouncy extends BitmapData {
public function bouncy(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 49
//brownBallArt (brownBallArt)
package {
import flash.display.*;
public dynamic class brownBallArt extends BitmapData {
public function brownBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 50
//brownBG (brownBG)
package {
import flash.display.*;
public dynamic class brownBG extends BitmapData {
public function brownBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 51
//buttonHighlight (buttonHighlight)
package {
import flash.display.*;
public dynamic class buttonHighlight extends BitmapData {
public function buttonHighlight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 52
//buttonOverlay (buttonOverlay)
package {
import flash.display.*;
public dynamic class buttonOverlay extends BitmapData {
public function buttonOverlay(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 53
//challengeClosedIcon (challengeClosedIcon)
package {
import flash.display.*;
public dynamic class challengeClosedIcon extends BitmapData {
public function challengeClosedIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 54
//challengeOpen (challengeOpen)
package {
import flash.display.*;
public dynamic class challengeOpen extends BitmapData {
public function challengeOpen(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 55
//cOpenButton (cOpenButton)
package {
import com.simianlogic.*;
public dynamic class cOpenButton extends simpleToggle {
}
}//package
Section 56
//diffSymbol (diffSymbol)
package {
import com.simianlogic.*;
public dynamic class diffSymbol extends simpleToggle {
}
}//package
Section 57
//diffToggleOff (diffToggleOff)
package {
import flash.display.*;
public dynamic class diffToggleOff extends BitmapData {
public function diffToggleOff(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 58
//diffToggleOn (diffToggleOn)
package {
import flash.display.*;
public dynamic class diffToggleOn extends BitmapData {
public function diffToggleOn(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 59
//filler_ad (filler_ad)
package {
import flash.display.*;
public dynamic class filler_ad extends SimpleButton {
}
}//package
Section 60
//filler2_kong (filler2_kong)
package {
import flash.events.*;
import flash.display.*;
import org.cove.ape.*;
import com.kongregate.as3.client.*;
import com.mochi.*;
import flash.utils.*;
import flash.text.*;
import mochi.as3.*;
import com.simianlogic.*;
import flash.media.*;
import flash.net.*;
import flash.geom.*;
import flash.ui.*;
public class filler2_kong extends MovieClip {
public var infoHolder:placholderGraphic;
public var fillerUI:MovieClip;
public var cBack:SimpleButton;
public var bgImage:MovieClip;
public var hardToggle:diffSymbol;
public var selectedBG:MovieClip;
public var clearStatsButton:SimpleButton;
public var chooseBlack:MovieClip;
public var menuPopBG:MovieClip;
public var timeBests:Array;
public var pauseText:TextField;
public var chooseWhite:MovieClip;
public var highestScore:int;// = 0
public var noButton:SimpleButton;
public var metaChallenges:Array;
public var perfectChallenges:Array;
public var currentTip:MovieClip;
public var cSizeCount:int;// = 0
public var CLEARSTATSENABLED:Boolean;// = false
public var hoverText:TextField;
public var ballsPopped:int;// = 0
public var clickAway:placholderGraphic;
private var stats:SharedObject;
private var rollOverSound:Sound;
public var nextTip:Class;// = null
public var CHALLENGEID:int;// = 0
public var choosePurple:MovieClip;
public var cGolfCount:int;// = 0
public var menuPopText:TextField;
public var adRotation;
public var highestHardPerfectLevel:int;// = 0
public var QUALITY:int;// = 2
public var cDescText:TextField;
public var cMetaCount:int;// = 0
public var disabledToggle:diffSymbol;
public var yesButton:SimpleButton;
public var cPerfectCount:int;// = 0
public var cStatusText:TextField;
private var playerName:String;// = "<your name>"
public var highestHardLevel:int;// = 0
public var statList:TextField;
public var cTimeCount:int;// = 0
public var gamesPlayed:int;// = 0
public var chooseOcean:MovieClip;
public var tipRotation;
private var _GAMEPAUSED:Boolean;// = false
public var highestLevel:int;// = 0
public var bgSkins:Array;
public var _DIFFICULTY:int;// = 1
public var bStats:flashMenuButton;
public var chooseBrown:MovieClip;
public var chooseYellow:MovieClip;
public var wasPaused:Boolean;// = false
public var MUSICENABLED:Boolean;// = true
public var prevInfo:SimpleButton;
public var backToOpt:SimpleButton;
public var chooseBeach:MovieClip;
public var cButtons:MovieClip;
private var body:MovieClip;
public var challengeButtons:Array;
var currentInfoClip:MovieClip;
var currentInfo:int;// = 0
public var highestNormalPerfectLevel:int;// = 0
var kongregate:KongregateAPI;
private var musicSound:Sound;
public var CHALLENGESTATUS:String;// = ""
public var easyToggle:diffSymbol;
public var enabledToggle:diffSymbol;
public var CHALLENGETYPE:int;// = 0
public var quality_controls:MovieClip;
public var glossyBG:boardOverlay;
public var backToMenu:SimpleButton;
public var nextInfo:SimpleButton;
public var averageScore:int;// = 0
public var golfChallenges:Array;
public var goStatText:TextField;
public var roundupAd:placholderGraphic;
public var mainMenu:MovieClip;
public var goScoreText:TextField;
public var sponsorButton:MovieClip;
public var board:fillerBoard;
public var chooseBlue:MovieClip;
public var normalToggle:diffSymbol;
private var musicChannel:SoundChannel;
private var _fillerBG:Class;
public var timeChallenges:Array;
public var chooseOrange:MovieClip;
public var cSizeGoals:Array;
public var chooseGreen:MovieClip;
public var selectedBall:MovieClip;
public var chooseFlower:MovieClip;
public var sizeChallenges:Array;
public var cGolfGoals:Array;
public var roundupOverlay:MovieClip;
public var SOUNDENABLED:Boolean;// = true
public var statLabels:TextField;
public var goNewGameButton:flashMenuButton;
public var averageLevel:int;// = 0
public var diffIndicator:TextField;
public var creditButton:MovieClip;
public var sizeBests:Array;
public var cSelectedCount:TextField;
public var highestNormalLevel:int;// = 0
public var ballsPlaced:int;// = 0
public var challengeLevels:Array;
public var golfBests:Array;
public var cTimeGoals:Array;
public var ballSkins:Array;
public static var GAME_OPTIONS:Object = {id:"74eaa3b8c08bf451", res:"640x480"};
public function filler2_kong(){
var _local1:ContextMenu;
adRotation = [];
tipRotation = [info01, info02, info03, info04, info05, info06, info07, info08, info09, info10, info11, info12, info13, info14, info18, info15];
nextTip = null;
ballSkins = [blueBallArt, greenBallArt, orangeBallArt, purpleBallArt, brownBallArt, yellowBallArt, whiteBallArt, blackBallArt];
bgSkins = [oceanBG, brownBG, flowerBG, purpleBG, orangeBG, beachBG];
_GAMEPAUSED = false;
MUSICENABLED = true;
SOUNDENABLED = true;
QUALITY = 2;
_DIFFICULTY = 1;
playerName = "<your name>";
sizeChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
timeChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
golfChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
perfectChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
metaChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
sizeBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
timeBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
golfBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
gamesPlayed = 0;
averageLevel = 0;
averageScore = 0;
highestLevel = 0;
highestScore = 0;
ballsPlaced = 0;
ballsPopped = 0;
highestNormalLevel = 0;
highestHardLevel = 0;
highestNormalPerfectLevel = 0;
highestHardPerfectLevel = 0;
currentInfo = 0;
CHALLENGETYPE = 0;
CHALLENGEID = 0;
CHALLENGESTATUS = "";
challengeLevels = [1, 3, 5, 8, 10, 12, 15, 18, 20, 25];
cSizeGoals = [50, 40, 30, 25, 20, 15, 12, 10, 8, 5];
cTimeGoals = [15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 65000];
cGolfGoals = [4, 6, 8, 10, 12, 15, 20, 25, 30, 35];
cSizeCount = 0;
cTimeCount = 0;
cGolfCount = 0;
cPerfectCount = 0;
cMetaCount = 0;
challengeButtons = [];
CLEARSTATSENABLED = false;
wasPaused = false;
super();
addFrameScript(0, frame1, 1, frame2, 4, frame5, 9, frame10, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25, 29, frame30, 34, frame35, 44, frame45, 45, frame46);
kongregate = KongregateAPI.getInstance();
MochiBot.track(this, "75816a82");
rollOverSound = new rollOverMp3();
addEventListener("sound_rollover", buttonSound);
trace("Creating Board...");
board = new fillerBoard(0, 0, 540, 427);
trace("Board created...");
board.addEventListener("change", updateUI);
board.addEventListener("levelStarted", levelStarted);
board.addEventListener("levelComplete", interLevel);
board.addEventListener("challengeStarted", challengeStarted);
board.addEventListener("challengeComplete", challengeComplete);
board.addEventListener("challengeFailed", challengeFailed);
board.addEventListener("gameOver", recapScreen);
addChild(board);
board.visible = false;
musicSound = new musicMp3();
init();
loadStats();
loadPreferences();
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
this.contextMenu = _local1;
}
public function testPlayChallenges():void{
var _local1:int;
if (highestNormalLevel >= 25){
metaChallenges[6] = true;
};
if (highestNormalLevel >= 50){
metaChallenges[7] = true;
};
if (highestHardLevel >= 25){
metaChallenges[8] = true;
};
if (highestHardLevel >= 50){
metaChallenges[9] = true;
};
_local1 = 0;
while (_local1 < 5) {
if (highestNormalPerfectLevel >= (5 * (_local1 + 1))){
metaChallenges[(10 + _local1)] = true;
};
if (highestHardPerfectLevel >= (5 * (_local1 + 1))){
metaChallenges[(15 + _local1)] = true;
};
_local1++;
};
}
public function statsFrame():void{
var _local1:Array;
var _local2:int;
if (!backToMenu.hasEventListener("click")){
backToMenu.addEventListener("click", menu);
};
if (!backToOpt.hasEventListener("click")){
backToOpt.addEventListener("click", showOptions);
};
_local1 = [disabledToggle, enabledToggle];
_local2 = 0;
while (_local2 < 2) {
_local1[_local2].btnWidth = 100;
_local1[_local2].btnHeight = 30;
_local1[_local2].trueState = diffToggleOn;
_local1[_local2].falseState = diffToggleOff;
_local1[_local2].addEventListener("click", toggleClearStats);
_local2++;
};
disabledToggle.STATE = true;
enabledToggle.STATE = false;
statList.text = ((((((((((((gamesPlayed + "\n") + highestLevel) + "\n") + highestScore) + "\n") + averageLevel) + "\n") + averageScore) + "\n") + ballsPlaced) + "\n") + ballsPopped);
clearStatsButton.addEventListener("click", clearStats);
}
public function interLevel(_arg1:Event=null):void{
if (board.CURRENTLEVEL == 25){
nextTip = info16;
} else {
if (board.CURRENTLEVEL == 50){
board.CURRENTLEVEL = 51;
nextTip = info17;
recapScreen();
return;
};
};
GAMEPAUSED = true;
roundupOverlay.visible = true;
setTimeout(showInterLevel, 250);
}
public function tallyFunStats():void{
var _local1:int;
var _local2:int;
_local1 = (gamesPlayed * averageScore);
_local2 = (gamesPlayed * averageLevel);
gamesPlayed++;
_local1 = (_local1 + board.playerScore);
_local2 = (_local2 + board.CURRENTLEVEL);
averageScore = Math.round((_local1 / gamesPlayed));
averageLevel = Math.round((_local2 / gamesPlayed));
highestLevel = Math.max(highestLevel, board.CURRENTLEVEL);
ballsPlaced = (ballsPlaced + board.ballsPlaced);
ballsPopped = (ballsPopped + board.ballsPopped);
}
public function chooseMenu(_arg1:Event):void{
clearBoard();
menu();
}
public function setColor(_arg1:Event):void{
var _local2:Array;
var _local3:int;
_local2 = [chooseBlue, chooseGreen, chooseOrange, choosePurple, chooseBrown, chooseYellow, chooseWhite, chooseBlack];
_local3 = _local2.indexOf(_arg1.target);
board.ballSkin = ballSkins[_local3];
if (stats != null){
stats.data.ballSkin = _local3;
};
gotoAndStop(21);
}
public function setBG(_arg1:Event):void{
var _local2:Array;
var _local3:int;
_local2 = [chooseOcean, chooseBrown, chooseFlower, choosePurple, chooseOrange, chooseBeach];
_local3 = _local2.indexOf(_arg1.target);
fillerBG = bgSkins[_local3];
if (stats != null){
stats.data.bgSkin = _local3;
};
gotoAndStop(21);
}
public function setTimeHover(_arg1:Event):void{
hoverText.text = "How quickly can you beat a level?";
}
public function cMetaStart(_arg1:Event):void{
var _local2:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
if ((((_local2 == 4)) || ((_local2 == 5)))){
return;
};
clearChallengeButtons();
switch (_local2){
case 0:
gotoAndStop(16);
return;
case 1:
gotoAndStop(17);
return;
case 2:
gotoAndStop(18);
return;
case 3:
gotoAndStop(19);
return;
case 6:
case 7:
case 10:
case 11:
case 12:
case 13:
case 14:
DIFFICULTY = 1;
break;
case 8:
case 9:
case 15:
case 16:
case 17:
case 18:
case 19:
DIFFICULTY = 2;
break;
};
startGame();
}
function frame10(){
instrFrame();
}
public function nextLevel(_arg1:Event=null):void{
board.nextLevel();
}
public function cPerfectStart(_arg1:Event):void{
var _local2:int;
var _local3:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
clearChallengeButtons();
_local3 = 1;
CHALLENGEID = _local2;
CHALLENGETYPE = 3;
if (_local2 > 9){
_local2 = (_local2 - 10);
_local3 = 2;
};
board.startPerfectChallenge(challengeLevels[_local2], _local3);
board.visible = true;
unpauseGame();
gotoAndStop(25);
}
function frame16(){
cSizeFrame();
}
function frame18(){
cGolfFrame();
}
function frame15(){
challengeFrame();
}
private function levelStarted(_arg1:Event):void{
if (GAMEPAUSED){
pause();
};
}
public function showNextInfo(_arg1:Event):void{
currentInfo = Math.min((currentInfo + 1), (tipRotation.length - 1));
showInfo();
}
public function moreGames(_arg1:Event):void{
trace(("DFFICULTY = " + DIFFICULTY));
if (DIFFICULTY == 0){
} else {
if (DIFFICULTY == 1){
} else {
if (DIFFICULTY == 2){
} else {
trace("ERROR IN moreGames");
};
};
};
}
function frame19(){
cPerfectFrame();
}
function frame25(){
gameFrame();
}
public function bgOptionFrame():void{
var _local1:Array;
var _local2:Matrix;
var _local3:int;
if (!backToOpt.hasEventListener("click")){
backToOpt.addEventListener("click", showOptions);
};
_local1 = [chooseOcean, chooseBrown, chooseFlower, choosePurple, chooseOrange, chooseBeach];
_local2 = new Matrix();
_local3 = 0;
while (_local3 < _local1.length) {
_local1[_local3].addEventListener("click", setBG);
_local1[_local3].buttonMode = true;
_local1[_local3].graphics.clear();
_local1[_local3].graphics.beginBitmapFill(new bgSkins[_local3](640, 427), _local2, false);
_local1[_local3].graphics.drawRect(0, 0, 640, 427);
_local1[_local3].graphics.endFill();
while (_local1[_local3].numChildren > 0) {
_local1[_local3].removeChildAt(0);
};
_local3++;
};
}
public function pauseHandler(_arg1:Event=null):void{
if (GAMEPAUSED){
swapChildren(board, glossyBG);
pauseText.x = -520;
pauseText.visible = false;
unpauseGame();
} else {
swapChildren(glossyBG, board);
setChildIndex(pauseText, (numChildren - 1));
pauseText.x = 10;
pauseText.visible = true;
pauseGame();
};
}
function frame17(){
cTimeFrame();
}
function frame24(){
statsFrame();
}
function frame5(){
menuFrame();
}
function frame21(){
optionsFrame();
}
function frame1(){
splashFrame();
}
function frame2(){
sponsorFrame();
}
function frame20(){
cMetaFrame();
}
public function cTimeStart(_arg1:Event):void{
var _local2:int;
var _local3:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
clearChallengeButtons();
_local3 = 1;
CHALLENGEID = _local2;
CHALLENGETYPE = 1;
if (_local2 > 9){
_local2 = (_local2 - 10);
_local3 = 2;
};
board.startTimeChallenge(challengeLevels[_local2], _local3, cTimeGoals[_local2]);
board.visible = true;
unpauseGame();
gotoAndStop(25);
}
public function unpauseGame(_arg1:Event=null):void{
GAMEPAUSED = false;
startMusic();
}
public function dismissSelector(_arg1:Event=null):void{
if (wasPaused){
pauseText.visible = true;
} else {
swapChildren(board, glossyBG);
unpauseGame();
};
hideMenuConfirmation();
if (noButton.hasEventListener("click")){
noButton.removeEventListener("click", dismissSelector);
};
if (noButton.hasEventListener("click")){
noButton.removeEventListener("click", gameToChallenges);
};
if (yesButton.hasEventListener("click")){
yesButton.removeEventListener("click", chooseMenu);
};
if (yesButton.hasEventListener("click")){
yesButton.removeEventListener("click", chooseSelfDestruct);
};
if (yesButton.hasEventListener("click")){
yesButton.removeEventListener("click", restartChallenge);
};
}
public function cSizeHover(_arg1:Event):void{
var _local2:int;
var _local3:String;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
CHALLENGEID = _local2;
_local3 = "normal";
if (_local2 > 9){
_local3 = "hard";
_local2 = (_local2 - 10);
};
cDescText.text = (((((("On " + _local3) + ", make a ball that fills ") + cSizeGoals[_local2]) + "% of the screen on Level ") + challengeLevels[_local2]) + ".");
if (sizeBests[CHALLENGEID] > 0){
cDescText.appendText((("\n\nBest: " + sizeBests[CHALLENGEID]) + "%"));
};
}
public function clearBoard():void{
if (contains(glossyBG)){
removeChild(glossyBG);
};
if (contains(pauseText)){
removeChild(pauseText);
};
if (contains(menuPopBG)){
removeChild(menuPopBG);
};
if (contains(menuPopText)){
removeChild(menuPopText);
};
if (contains(yesButton)){
removeChild(yesButton);
};
if (contains(noButton)){
removeChild(noButton);
};
}
public function gameOverToScores(_arg1:Event):void{
trace(("DFFICULTY = " + DIFFICULTY));
switch (DIFFICULTY){
case 0:
trace("EASY");
break;
case 1:
trace("MED");
break;
case 2:
trace("HARD");
break;
default:
trace("ERROR IN gameOverToScores");
break;
};
}
public function gameFrame():void{
if (!fillerUI.gameToMenu.hasEventListener("click")){
fillerUI.gameToMenu.addEventListener("click", confirmExit);
};
if (!fillerUI.sd_button.hasEventListener("click")){
fillerUI.sd_button.addEventListener("click", confirmSelfDestruct);
};
if (!fillerUI.pauseSprite.hasEventListener("click")){
fillerUI.pauseSprite.addEventListener("click", pauseHandler);
};
fillerUI.musicToggle.trueState = musicOnArt;
fillerUI.musicToggle.falseState = musicOffArt;
fillerUI.soundToggle.addEventListener("click", toggleSFX);
fillerUI.musicToggle.addEventListener("click", toggleMusic);
fillerUI.musicToggle.STATE = MUSICENABLED;
fillerUI.soundToggle.STATE = SOUNDENABLED;
hideMenuConfirmation();
roundupOverlay.visible = false;
if (board.CHALLENGE){
};
updateUI();
setChildIndex(board, (numChildren - 1));
board.visible = true;
pauseText.visible = false;
paintBall(fillerUI.ballCount);
if (board.ballSkin == whiteBallArt){
fillerUI.ballText.textColor = 0x353535;
} else {
fillerUI.ballText.textColor = 0xFFFFFF;
};
startMusic();
}
public function hideMenuConfirmation():void{
menuPopBG.visible = false;
menuPopText.visible = false;
noButton.visible = false;
yesButton.visible = false;
}
public function testLevels():void{
var _local1:Array;
var _local2:int;
_local1 = [24, 25, 30, 35, 40, 45, 49, 50];
_local2 = 0;
while (_local2 < _local1.length) {
if (board.CURRENTLEVEL <= _local1[_local2]){
board.CURRENTLEVEL = _local1[_local2];
interLevel();
return;
};
_local2++;
};
}
function frame23(){
bgOptionFrame();
}
private function toggleSFX(_arg1:Event=null):void{
if (SOUNDENABLED){
SOUNDENABLED = false;
} else {
SOUNDENABLED = true;
};
board.SOUNDENABLED = SOUNDENABLED;
if (stats != null){
stats.data.soundEnabled = SOUNDENABLED;
};
}
public function chooseBG(_arg1:Event):void{
gotoAndStop(23);
}
function frame30(){
newAd();
}
function frame45(){
interLevelEnd();
}
function frame46(){
newAd();
gameOverFrame();
}
function frame35(){
interLevelFrame();
}
public function challengeToMenu(_arg1:Event):void{
clearChallengeButtons();
gotoAndStop(5);
}
public function chooseBall(_arg1:Event):void{
gotoAndStop(22);
}
public function cSizeFrame():void{
var _local1:int;
var _local2:int;
var _local3:simpleToggle;
if (!cBack.hasEventListener("click")){
cBack.addEventListener("click", backToChallenges);
};
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
cResetDesc();
setChallengeStatus();
_local2 = 0;
_local1 = 0;
while (_local1 < 20) {
if (sizeChallenges[_local1]){
_local2++;
};
_local1++;
};
cSizeCount = _local2;
cSelectedCount.text = (_local2 + "/20");
_local1 = 0;
while (_local1 < 4) {
_local2 = 0;
while (_local2 < 5) {
_local3 = new simpleToggle(48, 48, false);
challengeButtons.push(_local3);
_local3.buttonMode = true;
_local3.trueState = challengeClosedIcon;
_local3.falseState = challengeOpen;
_local3.STATE = sizeChallenges[((_local1 * 5) + _local2)];
_local3.x = (135 + (_local2 * 50));
_local3.y = (100 + (_local1 * 50));
_local3.addEventListener("mouseOver", cSizeHover);
_local3.addEventListener("mouseOut", cResetDesc);
_local3.addEventListener("click", cSizeStart);
addChild(_local3);
_local2++;
};
_local1++;
};
}
public function toggleClearStats(_arg1:Event):void{
if (_arg1.target == disabledToggle){
CLEARSTATSENABLED = false;
disabledToggle.STATE = true;
enabledToggle.STATE = false;
clearStatsButton.alpha = 0.4;
} else {
disabledToggle.STATE = false;
enabledToggle.STATE = true;
CLEARSTATSENABLED = true;
clearStatsButton.alpha = 1;
};
}
function frame22(){
ballOptionFrame();
}
public function backToGame(_arg1:Event):void{
board.nextLevel();
glossyBG.visible = true;
fillerUI.visible = true;
play();
}
public function cGolfHover(_arg1:Event):void{
var _local2:int;
var _local3:String;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
_local3 = "normal";
CHALLENGEID = _local2;
if (_local2 > 9){
_local3 = "hard";
_local2 = (_local2 - 10);
};
cDescText.text = (((((("Beat Level " + challengeLevels[_local2]) + " on ") + _local3) + " with only ") + cGolfGoals[_local2]) + " balls.");
if (golfBests[CHALLENGEID] > 0){
cDescText.appendText((("\n\nBest: " + golfBests[CHALLENGEID]) + " balls."));
};
}
public function gameOverToNew(_arg1:Event=null):void{
cleanupGameOver();
startGame();
}
public function showOptions(_arg1:Event):void{
gotoAndStop(21);
exitMenu();
}
public function gotoStats(_arg1:Event):void{
gotoAndStop(24);
}
public function buttonSound(_arg1:Event):void{
var _local2:SoundTransform;
if (!SOUNDENABLED){
return;
};
_local2 = new SoundTransform(0.1);
rollOverSound.play(0, 0, _local2);
}
public function sizeChallengeDisplay(_arg1:Event):void{
gotoAndStop(16);
}
public function cGolfFrame():void{
var _local1:int;
var _local2:int;
var _local3:simpleToggle;
if (!cBack.hasEventListener("click")){
cBack.addEventListener("click", backToChallenges);
};
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
cResetDesc();
setChallengeStatus();
_local2 = 0;
_local1 = 0;
while (_local1 < 20) {
if (golfChallenges[_local1]){
_local2++;
};
_local1++;
};
cGolfCount = _local2;
cSelectedCount.text = (_local2 + "/20");
_local1 = 0;
while (_local1 < 4) {
_local2 = 0;
while (_local2 < 5) {
_local3 = new simpleToggle(48, 48, false);
challengeButtons.push(_local3);
_local3.buttonMode = true;
_local3.trueState = challengeClosedIcon;
_local3.falseState = challengeOpen;
_local3.STATE = golfChallenges[((_local1 * 5) + _local2)];
_local3.x = (135 + (_local2 * 50));
_local3.y = (100 + (_local1 * 50));
_local3.addEventListener("mouseOver", cGolfHover);
_local3.addEventListener("mouseOut", cResetDesc);
_local3.addEventListener("click", cGolfStart);
addChild(_local3);
_local2++;
};
_local1++;
};
}
public function cMetaHover(_arg1:Event):void{
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
_local3 = "normal";
_local4 = "";
_local5 = ((((cPerfectCount + cTimeCount) + cSizeCount) + cGolfCount) + cMetaCount);
switch (_local2){
case 1:
_local4 = "Complete All Time Challenges";
if (cTimeCount < 20){
_local4 = (_local4 + (("\n\nCurrent: " + cTimeCount) + "/20"));
};
break;
case 3:
_local4 = "Complete All Perfection Challenges";
if (cPerfectCount < 20){
_local4 = (_local4 + (("\n\nCurrent: " + cPerfectCount) + "/20"));
};
break;
case 0:
_local4 = "Complete All Size Challenges";
if (cSizeCount < 20){
_local4 = (_local4 + (("\n\nCurrent: " + cSizeCount) + "/20"));
};
break;
case 2:
_local4 = "Complete All Golf Challenges";
if (cGolfCount < 20){
_local4 = (_local4 + (("\n\nCurrent: " + cGolfCount) + "/20"));
};
break;
case 4:
_local4 = "Complete 50 Challenges";
if (_local5 < 50){
_local4 = (_local4 + (("\n\nCurrent: " + _local5) + "/50"));
};
break;
case 5:
_local4 = "Complete All Challenges";
if (_local5 < 100){
_local4 = (_local4 + (("\n\nCurrent: " + _local5) + "/100"));
};
break;
case 6:
_local4 = "Play Through (and Finish) Level 25 on Normal";
if (highestNormalLevel < 25){
_local4 = (_local4 + ("\n\nBest: Level " + highestNormalLevel));
};
break;
case 7:
_local4 = "Play Through (and Finish) Level 50 on Normal";
if (highestNormalLevel < 50){
_local4 = (_local4 + ("\n\nBest: Level " + highestNormalLevel));
};
break;
case 8:
_local4 = "Play Through (and Finish) Level 25 on Hard";
if (highestHardLevel < 25){
_local4 = (_local4 + ("\n\nBest: Level " + highestHardLevel));
};
break;
case 9:
_local4 = "Play Through (and Finish) Level 50 on Hard";
if (highestHardLevel < 50){
_local4 = (_local4 + ("\n\nBest: Level " + highestHardLevel));
};
break;
case 10:
case 11:
case 12:
case 13:
case 14:
_local4 = (("Play Through Level " + ((_local2 - 9) * 5)) + " Without Dying on Normal");
if (highestNormalPerfectLevel < ((_local2 - 9) * 5)){
_local4 = (_local4 + ("\n\nBest: Level " + highestNormalPerfectLevel));
};
break;
case 15:
case 16:
case 17:
case 18:
case 19:
_local4 = (("Play Through Level " + ((_local2 - 14) * 5)) + " Without Dying on Hard");
if (highestHardPerfectLevel < ((_local2 - 14) * 5)){
_local4 = (_local4 + ("\n\nBest: Level " + highestHardPerfectLevel));
};
break;
};
cDescText.text = _local4;
}
public function perfectChallengeDisplay(_arg1:Event):void{
gotoAndStop(19);
}
private function saveStats():void{
if (stats == null){
return;
};
stats.data.sizeChallenges = compressBooleanArray(sizeChallenges);
stats.data.timeChallenges = compressBooleanArray(timeChallenges);
stats.data.golfChallenges = compressBooleanArray(golfChallenges);
stats.data.perfectChallenges = compressBooleanArray(perfectChallenges);
stats.data.metaChallenges = compressBooleanArray(metaChallenges);
stats.data.sizeBests = sizeBests;
stats.data.timeBests = timeBests;
stats.data.golfBests = golfBests;
stats.data.gamesPlayed = gamesPlayed;
stats.data.highestLevel = highestLevel;
stats.data.highestScore = highestScore;
stats.data.averageLevel = averageLevel;
stats.data.averageScore = averageScore;
stats.data.ballsPlaced = ballsPlaced;
stats.data.ballsPopped = ballsPopped;
stats.data.highestNormalPerfectLevel = highestNormalPerfectLevel;
stats.data.highestHardPerfectLevel = highestHardPerfectLevel;
}
public function paintBG(_arg1:Event=null):void{
if (bgImage){
paintBGItem(bgImage);
};
if (selectedBG){
paintBGItem(selectedBG);
};
}
public function cPerfectHover(_arg1:Event):void{
var _local2:int;
var _local3:String;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
_local3 = "normal";
CHALLENGEID = _local2;
if (_local2 > 9){
_local3 = "hard";
_local2 = (_local2 - 10);
};
cDescText.text = (((("Beat Level " + challengeLevels[_local2]) + " on ") + _local3) + " without popping any balls.");
}
public function resetHover(_arg1:Event):void{
if (hoverText){
hoverText.text = "";
};
}
public function updateUI(_arg1:Event=null):void{
if (((fillerUI) && (fillerUI.levelText))){
fillerUI.levelText.text = ("Level " + board.CURRENTLEVEL);
fillerUI.scoreText.text = ("" + board.playerScore);
fillerUI.ballText.text = ("" + board.ballsLeft);
fillerUI.fillerProgress.progress = ((board.percentFilled / 100) / 0.6666);
paintBonus();
if (board.CHALLENGE){
fillerUI.levelText.text = "Challenge";
fillerUI.scoreText.text = "";
if (CHALLENGETYPE == 1){
fillerUI.scoreText.text = board.decimalize((board.timeGoal / 1000).toString());
};
};
};
}
public function gameOverFrame():void{
pauseGame();
board.visible = false;
updateUI();
if (fillerUI.gameToMenu.hasEventListener("click")){
fillerUI.gameToMenu.removeEventListener("click", confirmExit);
};
if (fillerUI.sd_button.hasEventListener("click")){
fillerUI.sd_button.removeEventListener("click", confirmSelfDestruct);
};
if (fillerUI.pauseSprite.hasEventListener("click")){
fillerUI.pauseSprite.removeEventListener("click", pauseHandler);
};
fillerUI.gameToMenu.addEventListener("click", gameOverToMenu);
fillerUI.pauseSprite.alpha = 0.5;
fillerUI.sd_button.alpha = 0.5;
fillerUI.bonusTimer.alpha = 0.5;
fillerUI.fillerProgress.finish();
fillerUI.musicToggle.trueState = musicOnArt;
fillerUI.musicToggle.falseState = musicOffArt;
fillerUI.soundToggle.addEventListener("click", toggleSFX);
fillerUI.musicToggle.addEventListener("click", toggleMusic);
fillerUI.musicToggle.STATE = MUSICENABLED;
fillerUI.soundToggle.STATE = SOUNDENABLED;
goNewGameButton.addEventListener("click", gameOverToNew);
goScoreText.text = ("Final Score: " + board.playerScore);
goStatText.text = board.statReport();
if (DIFFICULTY == 0){
kongregate.stats.submit("score_easy", board.playerScore);
};
if (DIFFICULTY == 1){
highestNormalLevel = Math.max(highestNormalLevel, (board.CURRENTLEVEL - 1));
highestNormalPerfectLevel = Math.max(highestNormalPerfectLevel, (board.firstDeath - 1));
kongregate.stats.submit("high_med", (board.CURRENTLEVEL - 1));
kongregate.stats.submit("perfect_med", (board.firstDeath - 1));
kongregate.stats.submit("score_med", board.playerScore);
};
if (DIFFICULTY == 2){
highestHardLevel = Math.max(highestHardLevel, (board.CURRENTLEVEL - 1));
highestHardPerfectLevel = Math.max(highestHardPerfectLevel, (board.firstDeath - 1));
kongregate.stats.submit("high_hard", (board.CURRENTLEVEL - 1));
kongregate.stats.submit("perfect_hard", (board.firstDeath - 1));
kongregate.stats.submit("score_hard", board.playerScore);
};
if ((((highestScore > 0)) && ((board.playerScore > highestScore)))){
highestScore = board.playerScore;
} else {
highestScore = board.playerScore;
};
testPlayChallenges();
checkMeta();
tallyFunStats();
saveStats();
}
private function checkSponsorLock():void{
var _local1:Sprite;
var _local2:TextField;
var _local3:Date;
var _local4:Date;
var _local5:TextField;
if (((testURL("simianlogic3d.com")) || (testURL("kongregate.com")))){
return;
};
GAMEPAUSED = true;
if (((body) && (contains(body)))){
removeChild(body);
};
body = new MovieClip();
body.x = 0;
body.y = 0;
addChild(body);
_local1 = new Sprite();
_local1.graphics.beginFill(0, 0.8);
_local1.graphics.drawRect(0, 0, 640, 480);
_local1.graphics.endFill();
body.addChild(_local1);
_local2 = new_tf("center");
_local2.text = "This version of Filler 2 was built for Kongregate. \n";
_local2.appendText("If you would like a version for your site, a freely distributible version \n is available at http://www.simianlogic3d.com/blog.");
_local2.width = 450;
_local2.x = 100;
_local2.y = 200;
body.addChild(_local2);
_local3 = new Date(2009, 4, 20);
_local4 = new Date();
if (_local4.valueOf() < _local3.valueOf()){
_local5 = new_tf("center");
_local5.text = "The message above will not appear on the agreed-upon domains. If you\n need to test locally, you may click to dismiss this warning up until\nMay 20, 2009. If you need more time or are getting this message\nmistakenly, please contact the provider of this SWF.";
_local5.width = 500;
_local5.x = 50;
_local5.y = 300;
body.addChild(_local5);
body.addEventListener("click", dismissSL);
};
}
public function cMetaFrame():void{
var _local1:int;
var _local2:int;
var _local3:simpleToggle;
if (!cBack.hasEventListener("click")){
cBack.addEventListener("click", backToChallenges);
};
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
cResetDesc();
setChallengeStatus();
_local2 = 0;
_local1 = 0;
while (_local1 < 20) {
if (metaChallenges[_local1]){
_local2++;
};
_local1++;
};
cMetaCount = _local2;
cSelectedCount.text = (_local2 + "/20");
_local1 = 0;
while (_local1 < 4) {
_local2 = 0;
while (_local2 < 5) {
_local3 = new simpleToggle(48, 48, false);
challengeButtons.push(_local3);
_local3.buttonMode = true;
_local3.trueState = challengeClosedIcon;
_local3.falseState = challengeOpen;
_local3.STATE = metaChallenges[((_local1 * 5) + _local2)];
_local3.x = (135 + (_local2 * 50));
_local3.y = (100 + (_local1 * 50));
_local3.addEventListener("mouseOver", cMetaHover);
_local3.addEventListener("mouseOut", cResetDesc);
_local3.addEventListener("click", cMetaStart);
addChild(_local3);
_local2++;
};
_local1++;
};
}
public function cTimeHover(_arg1:Event):void{
var _local2:int;
var _local3:String;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
CHALLENGEID = _local2;
_local3 = "normal";
if (_local2 > 9){
_local3 = "hard";
_local2 = (_local2 - 10);
};
cDescText.text = (((((("Beat Level " + challengeLevels[_local2]) + " on ") + _local3) + " in under ") + (cTimeGoals[_local2] / 1000)) + " seconds.");
if (timeBests[CHALLENGEID] > 0){
cDescText.appendText((("\n\nBest: " + board.decimalize((timeBests[CHALLENGEID] / 1000).toString())) + "s"));
};
}
public function showInfo():void{
if (((currentInfoClip) && (infoHolder.contains(currentInfoClip)))){
infoHolder.removeChild(currentInfoClip);
};
currentInfoClip = new (tipRotation[currentInfo]);
infoHolder.addChild(currentInfoClip);
prevInfo.visible = !((currentInfo == 0));
nextInfo.visible = !((currentInfo == (tipRotation.length - 1)));
}
public function cPerfectFrame():void{
var _local1:int;
var _local2:int;
var _local3:simpleToggle;
if (!cBack.hasEventListener("click")){
cBack.addEventListener("click", backToChallenges);
};
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
cResetDesc();
setChallengeStatus();
_local2 = 0;
_local1 = 0;
while (_local1 < 20) {
if (perfectChallenges[_local1]){
_local2++;
};
_local1++;
};
cPerfectCount = _local2;
cSelectedCount.text = (_local2 + "/20");
_local1 = 0;
while (_local1 < 4) {
_local2 = 0;
while (_local2 < 5) {
_local3 = new simpleToggle(48, 48, false);
challengeButtons.push(_local3);
_local3.buttonMode = true;
_local3.trueState = challengeClosedIcon;
_local3.falseState = challengeOpen;
_local3.STATE = perfectChallenges[((_local1 * 5) + _local2)];
_local3.x = (135 + (_local2 * 50));
_local3.y = (100 + (_local1 * 50));
_local3.addEventListener("mouseOver", cPerfectHover);
_local3.addEventListener("mouseOut", cResetDesc);
_local3.addEventListener("click", cPerfectStart);
addChild(_local3);
_local2++;
};
_local1++;
};
}
public function menu(_arg1:Event=null):void{
pauseGame();
board.visible = false;
gotoAndStop(5);
}
public function optionsFrame():void{
var _local1:Array;
var _local2:int;
if (!backToMenu.hasEventListener("click")){
backToMenu.addEventListener("click", menu);
};
selectedBall.buttonMode = true;
selectedBall.useHandCursor = true;
selectedBG.buttonMode = true;
selectedBG.useHandCursor = true;
if (board.ballSkin == null){
board.ballSkin = blueBallArt;
};
paintBall(selectedBall);
paintBGItem(selectedBG);
selectedBall.addEventListener("click", chooseBall);
selectedBG.addEventListener("click", chooseBG);
_local1 = [easyToggle, normalToggle, hardToggle];
_local2 = 0;
while (_local2 < 3) {
_local1[_local2].btnWidth = 100;
_local1[_local2].btnHeight = 30;
_local1[_local2].STATE = (_local2 == DIFFICULTY);
_local1[_local2].trueState = diffToggleOn;
_local1[_local2].falseState = diffToggleOff;
_local1[_local2].addEventListener("click", setDifficulty);
_local2++;
};
bStats.addEventListener("click", gotoStats);
}
public function new_tf(_arg1:String):TextField{
var _local2:TextField;
_local2 = new TextField();
_local2.defaultTextFormat = scoreTextFormat(_arg1);
_local2.selectable = false;
return (_local2);
}
public function setChallengeStatus():void{
cStatusText.text = CHALLENGESTATUS;
CHALLENGESTATUS = "";
}
public function cTimeFrame():void{
var _local1:int;
var _local2:int;
var _local3:simpleToggle;
if (!cBack.hasEventListener("click")){
cBack.addEventListener("click", backToChallenges);
};
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
cResetDesc();
setChallengeStatus();
_local2 = 0;
_local1 = 0;
while (_local1 < 20) {
if (timeChallenges[_local1]){
_local2++;
};
_local1++;
};
cTimeCount = _local2;
cSelectedCount.text = (_local2 + "/20");
_local1 = 0;
while (_local1 < 4) {
_local2 = 0;
while (_local2 < 5) {
_local3 = new simpleToggle(48, 48, false);
challengeButtons.push(_local3);
_local3.buttonMode = true;
_local3.trueState = challengeClosedIcon;
_local3.falseState = challengeOpen;
_local3.STATE = timeChallenges[((_local1 * 5) + _local2)];
_local3.x = (135 + (_local2 * 50));
_local3.y = (100 + (_local1 * 50));
_local3.addEventListener("mouseOver", cTimeHover);
_local3.addEventListener("mouseOut", cResetDesc);
_local3.addEventListener("click", cTimeStart);
addChild(_local3);
_local2++;
};
_local1++;
};
}
public function childReport(_arg1:Event):void{
trace(("clickAway.numChildren = " + clickAway.numChildren));
}
public function newGame(_arg1:Event=null):void{
if (GAMEPAUSED){
pause();
};
startMusic();
board.newGame();
}
public function get fillerBG():Class{
return (_fillerBG);
}
public function setDifficulty(_arg1:Event):void{
var _local2:Array;
var _local3:int;
_local2 = [easyToggle, normalToggle, hardToggle];
DIFFICULTY = _local2.indexOf(_arg1.target);
_local3 = 0;
while (_local3 < 3) {
_local2[_local3].STATE = (_local3 == DIFFICULTY);
_local2[_local3].paint();
_local3++;
};
if (stats != null){
stats.data.lastDifficulty = DIFFICULTY;
};
}
public function instrFrame():void{
if (!backToMenu.hasEventListener("click")){
backToMenu.addEventListener("click", menu);
};
showInfo();
nextInfo.addEventListener("click", showNextInfo);
prevInfo.addEventListener("click", showPrevInfo);
}
public function confirmSelfDestruct(_arg1:Event):void{
showConfirmation();
menuPopText.text = "Initiate self-destruct sequence?";
noButton.addEventListener("click", dismissSelector);
yesButton.addEventListener("click", chooseSelfDestruct);
}
public function newAd():void{
var _local1:int;
var _local2:Class;
trace("Grabbing a new ad!");
if (((currentTip) && (clickAway.contains(currentTip)))){
clickAway.removeChild(currentTip);
};
if (nextTip == null){
trace("Selecting a random tip!");
_local1 = Math.floor((Math.random() * tipRotation.length));
if (_local1 == tipRotation.length){
_local1--;
};
trace(("Selected spot #" + _local1));
_local2 = tipRotation[_local1];
currentTip = new (_local2);
clickAway.addChild(currentTip);
} else {
trace("already had one selected!");
currentTip = new nextTip();
clickAway.addChild(currentTip);
if (nextTip == itunes_upsell){
currentTip.addEventListener("click", iTunesLink);
};
nextTip = null;
};
if (Math.random() > 0.75){
nextTip = itunes_upsell;
};
}
public function gameOverToMenu(_arg1:Event):void{
board.visible = false;
cleanupGameOver();
menu();
}
public function recapScreen(_arg1:Event=null):void{
gotoAndStop(46);
}
private function pause(_arg1:Event=null):void{
if (GAMEPAUSED){
unpauseGame();
} else {
pauseGame();
};
}
public function clearChallengeButtons():void{
var _local1:int;
backToMenu.removeEventListener("click", challengeToMenu);
_local1 = 0;
while (_local1 < challengeButtons.length) {
if (contains(challengeButtons[_local1])){
removeChild(challengeButtons[_local1]);
};
_local1++;
};
challengeButtons = new Array();
}
public function sponsorSplash():void{
gotoAndStop(2);
}
private function loadPreferences():void{
if (stats == null){
return;
};
SOUNDENABLED = stats.data.soundEnabled;
MUSICENABLED = stats.data.musicEnabled;
trace("STATS.DATA.QUALITY...");
trace(stats.data.quality);
if (stats.data.quality != null){
QUALITY = stats.data.quality;
};
if (QUALITY == 0){
stage.quality = StageQuality.LOW;
};
if (QUALITY == 1){
stage.quality = StageQuality.MEDIUM;
};
if (QUALITY == 2){
stage.quality = StageQuality.HIGH;
};
board.SOUNDENABLED = SOUNDENABLED;
DIFFICULTY = stats.data.lastDifficulty;
if (stats.data.ballSkin != 0){
board.ballSkin = ballSkins[stats.data.ballSkin];
};
if (stats.data.bgSkin != 0){
fillerBG = bgSkins[stats.data.bgSkin];
};
}
public function setQuality(_arg1:Event):void{
var _local2:*;
var _local3:int;
_local2 = [quality_controls.q1, quality_controls.q2, quality_controls.q3];
_local3 = _local2.indexOf(_arg1.target);
trace(("setQuality: " + _local3));
if (_local3 < 0){
return;
};
if (_local3 == 0){
stage.quality = StageQuality.LOW;
};
if (_local3 == 1){
stage.quality = StageQuality.MEDIUM;
};
if (_local3 == 2){
stage.quality = StageQuality.HIGH;
};
QUALITY = _local3;
quality_controls.selector.x = _local2[QUALITY].x;
if (stats != null){
stats.data.quality = QUALITY;
};
}
public function interLevelFrame():void{
var _local1:int;
stop();
board.visible = false;
glossyBG.visible = false;
fillerUI.visible = false;
pauseText.visible = false;
hideMenuConfirmation();
stopMusic();
_local1 = (board.ballsLeft * 100);
roundupOverlay.levelCompleteText.text = (("Level " + board.CURRENTLEVEL) + " Complete!");
roundupOverlay.newScoreBox.text = ("New Score:\n" + (board.playerScore + _local1));
roundupOverlay.ballsLeftRoundup.text = ("" + board.ballsLeft);
roundupOverlay.bonusRoundup.text = ("" + (board.ballsLeft * 100));
board.playerScore = (board.playerScore + _local1);
if (!roundupOverlay.nextLevelButton.hasEventListener("click")){
roundupOverlay.nextLevelButton.addEventListener("click", backToGame);
};
}
public function clearStats(_arg1:Event):void{
if (!CLEARSTATSENABLED){
return;
};
if (stats == null){
return;
};
stats.clear();
sizeChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
timeChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
golfChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
perfectChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
metaChallenges = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
sizeBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
timeBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
golfBests = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
gamesPlayed = 0;
averageLevel = 0;
averageScore = 0;
highestLevel = 0;
highestScore = 0;
ballsPlaced = 0;
ballsPopped = 0;
highestNormalLevel = 0;
highestHardLevel = 0;
highestNormalPerfectLevel = 0;
highestHardPerfectLevel = 0;
statList.text = "0\n0\n0\n0\n0\n0\n0";
}
private function gameToChallenges(_arg1:Event):void{
board.visible = false;
clearBoard();
CHALLENGESTATUS = "Failed!";
if (CHALLENGETYPE == 0){
gotoAndStop(16);
};
if (CHALLENGETYPE == 1){
gotoAndStop(17);
};
if (CHALLENGETYPE == 2){
gotoAndStop(18);
};
if (CHALLENGETYPE == 3){
gotoAndStop(19);
};
}
public function paintBonus():void{
var _local1:Matrix;
var _local2:Number;
var _local3:int;
_local1 = new Matrix();
_local2 = (board.freezeLeft / board.maxFreeze);
_local1.scale((90 / 65), (90 / 65));
fillerUI.bonusTimer.graphics.clear();
fillerUI.bonusTimer.graphics.beginBitmapFill(new freezeWhite(65, 65), _local1, false);
fillerUI.bonusTimer.graphics.drawCircle(45, 45, 45);
fillerUI.bonusTimer.graphics.endFill();
if (_local2 <= 0){
return;
};
fillerUI.bonusTimer.graphics.beginBitmapFill(new freezeBlack(65, 65), _local1, false);
fillerUI.bonusTimer.graphics.drawCircle(45, 45, (45 * _local2));
fillerUI.bonusTimer.graphics.endFill();
_local3 = 0;
while (_local3 < fillerUI.bonusTimer.numChildren) {
fillerUI.bonusTimer.removeChildAt(0);
_local3++;
};
}
private function dismissSL(_arg1:Event):void{
removeChild(body);
}
public function sponsorFrame():void{
setTimeout(menu, 4500);
}
public function challengeFailed(_arg1:Event):void{
saveStats();
stopMusic();
showConfirmation();
menuPopText.text = "Challenge Failed! Try again?";
noButton.addEventListener("click", gameToChallenges);
yesButton.addEventListener("click", restartChallenge);
}
public function ballOptionFrame():void{
var _local1:Array;
var _local2:Matrix;
var _local3:int;
var _local4:int;
if (!backToOpt.hasEventListener("click")){
backToOpt.addEventListener("click", showOptions);
};
_local1 = [chooseBlue, chooseGreen, chooseOrange, choosePurple, chooseBrown, chooseYellow, chooseWhite, chooseBlack];
_local2 = new Matrix();
_local2.scale((90 / 427), (90 / 427));
_local3 = 0;
while (_local3 < _local1.length) {
_local1[_local3].buttonMode = true;
_local1[_local3].graphics.clear();
_local1[_local3].graphics.beginBitmapFill(new ballSkins[_local3](427, 427), _local2, false);
_local1[_local3].graphics.drawCircle(45, 45, 45);
_local1[_local3].graphics.endFill();
_local1[_local3].addEventListener("click", setColor);
_local4 = 0;
while (_local4 < _local1[_local3].numChildren) {
_local1[_local3].removeChildAt(0);
_local4++;
};
_local3++;
};
}
private function challengeStarted(_arg1:Event):void{
if (GAMEPAUSED){
pause();
};
}
public function cleanupGameOver():void{
var _local1:int;
var _local2:DisplayObject;
if (((glossyBG) && (contains(glossyBG)))){
removeChild(glossyBG);
};
_local1 = 0;
for (;_local1 < numChildren;_local1++) {
_local2 = getChildAt(_local1);
if ((((((_local2 == bgImage)) || ((_local2 == clickAway)))) || ((_local2 == board)))){
continue;
} else {
if (getChildAt(_local1) != kongregate){
removeChildAt(_local1);
_local1--;
};
};
};
}
public function chooseSelfDestruct(_arg1:Event):void{
dismissSelector();
if (GAMEPAUSED){
pauseHandler();
};
board.initiateSelfDestructSequence();
}
private function challengeComplete(_arg1:Event):void{
var _local2:int;
stopMusic();
GAMEPAUSED = true;
board.visible = false;
CHALLENGESTATUS = "Success!";
if (contains(glossyBG)){
removeChild(glossyBG);
};
switch (CHALLENGETYPE){
case 0:
sizeChallenges[CHALLENGEID] = true;
sizeBests[CHALLENGEID] = Math.max(board.biggestBall, sizeBests[CHALLENGEID]);
checkMeta();
saveStats();
gotoAndStop(16);
break;
case 1:
timeChallenges[CHALLENGEID] = true;
if (timeBests[CHALLENGEID] == 0){
timeBests[CHALLENGEID] = board.levelTime;
} else {
timeBests[CHALLENGEID] = Math.min(board.levelTime, timeBests[CHALLENGEID]);
};
checkMeta();
saveStats();
gotoAndStop(17);
break;
case 2:
golfChallenges[CHALLENGEID] = true;
_local2 = CHALLENGEID;
if (_local2 > 9){
_local2 = (_local2 - 10);
};
if (golfBests[CHALLENGEID] == 0){
golfBests[CHALLENGEID] = ((cGolfGoals[_local2] - board.ballsLeft) + 1);
} else {
golfBests[CHALLENGEID] = Math.min(((cGolfGoals[_local2] - board.ballsLeft) + 1), golfBests[CHALLENGEID]);
};
checkMeta();
saveStats();
gotoAndStop(18);
break;
case 3:
perfectChallenges[CHALLENGEID] = true;
checkMeta();
saveStats();
gotoAndStop(19);
break;
default:
gotoAndStop(15);
break;
};
}
public function setPerfectHover(_arg1:Event):void{
hoverText.text = "The pursuit of perfection awaits.";
}
public function challengeFrame():void{
var _local1:int;
if (backToMenu.hasEventListener("click")){
backToMenu.removeEventListener("click", menu);
};
backToMenu.addEventListener("click", challengeToMenu);
if (((((((((cButtons.cSizeToggle) && (cButtons.cTimeToggle))) && (cButtons.cGolfToggle))) && (cButtons.cPerfectToggle))) && (cButtons.cMetaToggle))){
trace("EVERYTHING IS FINE!");
};
if (cButtons.cSizeToggle){
cButtons.cSizeToggle.buttonMode = true;
};
if (cButtons.cTimeToggle){
cButtons.cTimeToggle.buttonMode = true;
};
if (cButtons.cGolfToggle){
cButtons.cGolfToggle.buttonMode = true;
};
if (cButtons.cPerfectToggle){
cButtons.cPerfectToggle.buttonMode = true;
};
if (cButtons.cMetaToggle){
cButtons.cMetaToggle.buttonMode = true;
};
cSizeCount = 0;
cTimeCount = 0;
cGolfCount = 0;
cPerfectCount = 0;
cMetaCount = 0;
_local1 = 0;
while (_local1 < 20) {
if (sizeChallenges[_local1]){
cSizeCount++;
};
if (timeChallenges[_local1]){
cTimeCount++;
};
if (golfChallenges[_local1]){
cGolfCount++;
};
if (perfectChallenges[_local1]){
cPerfectCount++;
};
if (metaChallenges[_local1]){
cMetaCount++;
};
_local1++;
};
cButtons.cSizeText.text = (cSizeCount + "/20");
cButtons.cTimeText.text = (cTimeCount + "/20");
cButtons.cGolfText.text = (cGolfCount + "/20");
cButtons.cPerfectText.text = (cPerfectCount + "/20");
cButtons.cMetaText.text = (cMetaCount + "/20");
hoverText.text = "";
cButtons.cSizeToggle.addEventListener("mouseOver", setSizeHover);
cButtons.cSizeToggle.addEventListener("click", sizeChallengeDisplay);
cButtons.cSizeToggle.addEventListener("mouseOut", resetHover);
cButtons.cTimeToggle.addEventListener("mouseOver", setTimeHover);
cButtons.cTimeToggle.addEventListener("click", timeChallengeDisplay);
cButtons.cTimeToggle.addEventListener("mouseOut", resetHover);
cButtons.cGolfToggle.addEventListener("mouseOver", setGolfHover);
cButtons.cGolfToggle.addEventListener("click", golfChallengeDisplay);
cButtons.cGolfToggle.addEventListener("mouseOut", resetHover);
cButtons.cPerfectToggle.addEventListener("mouseOver", setPerfectHover);
cButtons.cPerfectToggle.addEventListener("click", perfectChallengeDisplay);
cButtons.cPerfectToggle.addEventListener("mouseOut", resetHover);
cButtons.cMetaToggle.addEventListener("mouseOver", setMetaHover);
cButtons.cMetaToggle.addEventListener("click", metaChallengeDisplay);
cButtons.cMetaToggle.addEventListener("mouseOut", resetHover);
}
private function expandBooleanArray(_arg1:ByteArray):Array{
var _local2:Array;
var _local3:int;
if (_arg1 == null){
return (null);
};
_local2 = new Array(_arg1.length);
while (_local3 < _arg1.length) {
_local2[_local3] = _arg1.readBoolean();
_local3++;
};
return (_local2);
}
public function paintBGItem(_arg1:MovieClip):void{
var _local2:Matrix;
var _local3:int;
_local2 = new Matrix();
_arg1.graphics.clear();
_arg1.graphics.beginBitmapFill(new fillerBG(640, 427), _local2, false);
_arg1.graphics.drawRect(0, 0, 640, 427);
_arg1.graphics.endFill();
_local3 = 0;
while (_local3 < _arg1.numChildren) {
_arg1.removeChildAt(0);
_local3++;
};
}
public function showInterLevel():void{
board.visible = false;
play();
}
public function startMusic():void{
var _local1:SoundTransform;
if (musicChannel){
musicChannel.stop();
};
if (!MUSICENABLED){
return;
};
_local1 = new SoundTransform(0.25);
musicChannel = musicSound.play(0, 100, _local1);
}
public function instr(_arg1:Event):void{
gotoAndStop(10);
exitMenu();
}
public function metaChallengeDisplay(_arg1:Event):void{
gotoAndStop(20);
}
public function pauseGame(_arg1:Event=null):void{
GAMEPAUSED = true;
stopMusic();
}
public function doFreeze(_arg1:Event):void{
board.freezeBalls();
}
public function checkMeta():void{
var _local1:int;
var _local2:int;
_local1 = 0;
cSizeCount = 0;
cTimeCount = 0;
cGolfCount = 0;
cPerfectCount = 0;
cMetaCount = 0;
_local1 = 0;
while (_local1 < 20) {
if (sizeChallenges[_local1]){
cSizeCount++;
};
if (timeChallenges[_local1]){
cTimeCount++;
};
if (golfChallenges[_local1]){
cGolfCount++;
};
if (perfectChallenges[_local1]){
cPerfectCount++;
};
_local1++;
};
metaChallenges[3] = (cPerfectCount == 20);
metaChallenges[2] = (cGolfCount == 20);
metaChallenges[1] = (cTimeCount == 20);
metaChallenges[0] = (cSizeCount == 20);
_local1 = 0;
while (_local1 < 20) {
if (metaChallenges[_local1]){
cMetaCount++;
};
_local1++;
};
_local2 = ((((cSizeCount + cTimeCount) + cGolfCount) + cPerfectCount) + cMetaCount);
if ((((_local2 >= 50)) && (!(metaChallenges[4])))){
metaChallenges[4] = true;
cMetaCount++;
_local2++;
};
if ((((_local2 >= 99)) && (!(metaChallenges[5])))){
metaChallenges[5] = true;
cMetaCount++;
_local2++;
};
trace(("Total Count: " + _local2));
kongregate.stats.submit("challenges", _local2);
}
public function doStartGame(_arg1:Event):void{
startGame();
exitMenu();
}
public function menuInit(_arg1:Event=null):void{
var _local2:SimpleButton;
var _local3:SimpleButton;
var _local4:SimpleButton;
var _local5:SimpleButton;
var _local6:Array;
_local2 = mainMenu.playButton;
_local3 = mainMenu.instrButton;
_local4 = mainMenu.challengesButton;
_local5 = mainMenu.optionsButton;
if (_local2){
_local2.addEventListener("click", doStartGame);
};
if (_local3){
_local3.addEventListener("click", instr);
};
if (_local4){
_local4.addEventListener("click", showChallenges);
};
if (_local5){
_local5.addEventListener("click", showOptions);
};
_local6 = ["Easy", "Normal", "Hard"];
if (diffIndicator){
diffIndicator.text = ("Difficulty: " + _local6[DIFFICULTY]);
};
removeEventListener("enterFrame", menuInit);
if (((((((!(_local2)) || (!(_local3)))) || (!(_local4)))) || (!(_local5)))){
gotoAndStop(5);
};
}
private function restartChallenge(_arg1:Event):void{
var _local2:int;
var _local3:int;
dismissSelector();
_local2 = CHALLENGEID;
_local3 = 1;
if (_local2 > 9){
_local2 = (_local2 - 10);
_local3 = 2;
};
switch (CHALLENGETYPE){
case 0:
board.startSizeChallenge(challengeLevels[_local2], _local3, cSizeGoals[_local2]);
break;
case 1:
board.startTimeChallenge(challengeLevels[_local2], _local3, cTimeGoals[_local2]);
break;
case 2:
board.startGolfChallenge(challengeLevels[_local2], _local3, cGolfGoals[_local2]);
break;
case 3:
board.startPerfectChallenge(challengeLevels[_local2], _local3);
break;
default:
trace("Something's messed up in filler.restartChallenge()");
break;
};
unpauseGame();
}
private function toggleMusic(_arg1:Event=null):void{
if (MUSICENABLED){
MUSICENABLED = false;
stopMusic();
} else {
MUSICENABLED = true;
startMusic();
};
if (stats != null){
stats.data.musicEnabled = MUSICENABLED;
};
}
public function set GAMEPAUSED(_arg1:Boolean):void{
_GAMEPAUSED = _arg1;
if (board){
board.GAMEPAUSED = GAMEPAUSED;
};
}
public function splashFrame():void{
this.stop();
setTimeout(sponsorSplash, 2000);
}
public function menuFrame():void{
var _local1:Array;
newAd();
if (!hasEventListener("bgChange")){
addEventListener("bgChange", paintBG);
};
if (fillerBG == null){
if (stats == null){
fillerBG = oceanBG;
} else {
fillerBG = ((bgSkins[stats.data.bgSkin]) || (oceanBG));
};
} else {
dispatchEvent(new Event("bgChange", true));
};
if (!creditButton.hasEventListener("click")){
MochiServices.addLinkEvent("http://x.mochiads.com/link/287ad7a2f2e6bdb0", "http://www.simianlogic3d.com/blog/?utm_source=filler_2&utm_medium=credit_link&utm_campaign=Filler2", creditButton);
};
if (!quality_controls.q1.hasEventListener("click")){
quality_controls.q1.addEventListener("click", setQuality);
quality_controls.q2.addEventListener("click", setQuality);
quality_controls.q3.addEventListener("click", setQuality);
};
_local1 = [quality_controls.q1, quality_controls.q2, quality_controls.q3];
trace(("Quality: " + QUALITY));
trace(((("Current: " + quality_controls.selector.x) + " ") + quality_controls.selector.y));
quality_controls.selector.x = _local1[QUALITY].x;
trace(((("Current: " + quality_controls.selector.x) + " ") + quality_controls.selector.y));
addEventListener("enterFrame", menuInit);
checkSponsorLock();
}
public function showChallenges(_arg1:Event):void{
gotoAndStop(15);
exitMenu();
}
private function loadStats():void{
stats = SharedObject.getLocal("fillerStats");
if (stats.size == 0){
stats.data.soundEnabled = true;
stats.data.musicEnabled = true;
stats.data.lastDifficulty = 1;
stats.data.ballSkin = 0;
stats.data.bgSkin = 0;
nextTip = info15;
} else {
if (stats.data.sizeChallenges != null){
sizeChallenges = expandBooleanArray(stats.data.sizeChallenges);
};
if (stats.data.timeChallenges != null){
timeChallenges = expandBooleanArray(stats.data.timeChallenges);
};
if (stats.data.golfChallenges != null){
golfChallenges = expandBooleanArray(stats.data.golfChallenges);
};
if (stats.data.perfectChallenges != null){
perfectChallenges = expandBooleanArray(stats.data.perfectChallenges);
};
if (stats.data.metaChallenges != null){
metaChallenges = expandBooleanArray(stats.data.metaChallenges);
};
if (stats.data.sizeBests != null){
sizeBests = stats.data.sizeBests;
};
if (stats.data.timeBests != null){
timeBests = stats.data.timeBests;
};
if (stats.data.golfBests != null){
golfBests = stats.data.golfBests;
};
if (stats.data.gamesPlayed != null){
gamesPlayed = stats.data.gamesPlayed;
};
if (stats.data.highestLevel != null){
highestLevel = stats.data.highestLevel;
};
if (stats.data.highestScore != null){
highestScore = stats.data.highestScore;
};
if (stats.data.averageLevel != null){
averageLevel = stats.data.averageLevel;
};
if (stats.data.averageScore != null){
averageScore = stats.data.averageScore;
};
if (stats.data.ballsPlaced != null){
ballsPlaced = stats.data.ballsPlaced;
};
if (stats.data.ballsPopped != null){
ballsPopped = stats.data.ballsPopped;
};
if (stats.data.highestNormalPerfectLevel != null){
highestNormalPerfectLevel = stats.data.highestNormalPerfectLevel;
};
if (stats.data.highestHardPerfectLevel != null){
highestHardPerfectLevel = stats.data.highestHardPerfectLevel;
};
};
}
public function cResetDesc(_arg1:Event=null):void{
if (cDescText){
cDescText.text = "";
};
}
public function stopMusic():void{
if (musicChannel){
musicChannel.stop();
};
}
public function golfChallengeDisplay(_arg1:Event):void{
gotoAndStop(18);
}
public function set fillerBG(_arg1:Class):void{
_fillerBG = _arg1;
dispatchEvent(new Event("bgChange", true));
}
public function set DIFFICULTY(_arg1:int){
var _local2:Array;
_DIFFICULTY = _arg1;
board.DIFFICULTY = _arg1;
_local2 = ["Easy", "Normal", "Hard"];
if (diffIndicator){
diffIndicator.text = ("Difficulty: " + _local2[_arg1]);
};
}
public function setSizeHover(_arg1:Event):void{
hoverText.text = "How big of a ball can you make?";
}
public function startGame(_arg1:Event=null):void{
DIFFICULTY = DIFFICULTY;
board.newGame();
board.visible = true;
unpauseGame();
gotoAndStop(25);
}
private function testURL(_arg1:String):Boolean{
var _local2:String;
_local2 = this.root.loaderInfo.url.split("/")[2];
if (_local2.indexOf(_arg1) == (_local2.length - _arg1.length)){
return (true);
};
return (false);
}
private function compressBooleanArray(_arg1:Array):ByteArray{
var _local2:ByteArray;
var _local3:int;
_local2 = new ByteArray();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.writeBoolean(_arg1[_local3]);
_local3++;
};
return (_local2);
}
override public function gotoAndStop(_arg1:Object, _arg2:String=null):void{
super.gotoAndStop(_arg1, _arg2);
stage.invalidate();
}
public function exitMenu():void{
if (((glossyBG) && (contains(glossyBG)))){
removeChild(glossyBG);
};
if (((diffIndicator) && (contains(diffIndicator)))){
removeChild(diffIndicator);
};
}
public function showPrevInfo(_arg1:Event):void{
currentInfo = Math.max(0, (currentInfo - 1));
showInfo();
}
public function paintBall(_arg1:MovieClip):void{
var _local2:Matrix;
var _local3:Number;
var _local4:int;
_local2 = new Matrix();
_local3 = (90 / 427);
_local2.scale(_local3, _local3);
_arg1.graphics.clear();
_arg1.graphics.beginBitmapFill(new board.ballSkin(427, 427), _local2, false);
_arg1.graphics.drawCircle(45, 45, 45);
_arg1.graphics.endFill();
_local4 = 0;
while (_local4 < _arg1.numChildren) {
_arg1.removeChildAt(0);
_local4++;
};
}
public function get GAMEPAUSED():Boolean{
return (_GAMEPAUSED);
}
public function iTunesLink(_arg1:Event=null):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.simianlogic3d.com/filler");
navigateToURL(_local2, "_blank");
}
public function interLevelEnd():void{
hideMenuConfirmation();
roundupOverlay.visible = false;
stop();
gotoAndStop(25);
}
public function get DIFFICULTY():int{
return (_DIFFICULTY);
}
private function scoreTextFormat(_arg1:String):TextFormat{
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.font = "_sans";
_local2.color = 0xCCCCCC;
_local2.size = 14;
if (_arg1 == "left"){
_local2.align = TextFormatAlign.LEFT;
} else {
if (_arg1 == "right"){
_local2.align = TextFormatAlign.RIGHT;
} else {
if (_arg1 == "center"){
_local2.align = TextFormatAlign.CENTER;
} else {
if (_arg1 == "title"){
_local2.align = TextFormatAlign.CENTER;
_local2.color = 0xFFFFFF;
_local2.size = 32;
} else {
throw (new Error(("Invalid text format " + _arg1)));
};
};
};
};
return (_local2);
}
public function cSizeStart(_arg1:Event):void{
var _local2:int;
var _local3:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
clearChallengeButtons();
_local3 = 1;
CHALLENGEID = _local2;
CHALLENGETYPE = 0;
if (_local2 > 9){
_local2 = (_local2 - 10);
_local3 = 2;
};
board.startSizeChallenge(challengeLevels[_local2], _local3, cSizeGoals[_local2]);
board.visible = true;
unpauseGame();
gotoAndStop(25);
}
public function setGolfHover(_arg1:Event):void{
hoverText.text = "Can you succeed with limited balls?";
}
public function timeChallengeDisplay(_arg1:Event):void{
gotoAndStop(17);
}
public function backToChallenges(_arg1:Event):void{
clearChallengeButtons();
gotoAndStop(15);
}
public function showConfirmation():void{
if (GAMEPAUSED){
wasPaused = true;
pauseText.visible = false;
} else {
wasPaused = false;
swapChildren(board, glossyBG);
pauseGame();
};
menuPopBG.visible = true;
menuPopText.visible = true;
noButton.visible = true;
yesButton.visible = true;
menuPopBG.alpha = 0.4;
noButton.alpha = 1;
yesButton.alpha = 1;
setChildIndex(menuPopBG, (numChildren - 1));
setChildIndex(menuPopText, (numChildren - 1));
setChildIndex(noButton, (numChildren - 1));
setChildIndex(yesButton, (numChildren - 1));
}
public function setMetaHover(_arg1:Event):void{
hoverText.text = "meta: everything is a challenge";
}
public function cGolfStart(_arg1:Event):void{
var _local2:int;
var _local3:int;
_local2 = challengeButtons.indexOf(_arg1.target);
if (_local2 < 0){
return;
};
clearChallengeButtons();
_local3 = 1;
CHALLENGEID = _local2;
CHALLENGETYPE = 2;
if (_local2 > 9){
_local2 = (_local2 - 10);
_local3 = 2;
};
board.startGolfChallenge(challengeLevels[_local2], _local3, cGolfGoals[_local2]);
board.visible = true;
unpauseGame();
gotoAndStop(25);
}
public function confirmExit(_arg1:Event):void{
showConfirmation();
menuPopText.text = "Returning to the menu will end your game. Continue?";
noButton.addEventListener("click", dismissSelector);
yesButton.addEventListener("click", chooseMenu);
}
}
}//package
Section 61
//flashMenuButton (flashMenuButton)
package {
import com.simianlogic.*;
public dynamic class flashMenuButton extends menuButton {
}
}//package
Section 62
//flowerBG (flowerBG)
package {
import flash.display.*;
public dynamic class flowerBG extends BitmapData {
public function flowerBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 63
//freezeBlack (freezeBlack)
package {
import flash.display.*;
public dynamic class freezeBlack extends BitmapData {
public function freezeBlack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 64
//freezeWhite (freezeWhite)
package {
import flash.display.*;
public dynamic class freezeWhite extends BitmapData {
public function freezeWhite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 65
//greenBallArt (greenBallArt)
package {
import flash.display.*;
public dynamic class greenBallArt extends BitmapData {
public function greenBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 66
//info01 (info01)
package {
import flash.display.*;
public dynamic class info01 extends MovieClip {
}
}//package
Section 67
//info02 (info02)
package {
import flash.display.*;
public dynamic class info02 extends MovieClip {
}
}//package
Section 68
//info03 (info03)
package {
import flash.display.*;
public dynamic class info03 extends MovieClip {
}
}//package
Section 69
//info04 (info04)
package {
import flash.display.*;
public dynamic class info04 extends MovieClip {
}
}//package
Section 70
//info05 (info05)
package {
import flash.display.*;
public dynamic class info05 extends MovieClip {
}
}//package
Section 71
//info06 (info06)
package {
import flash.display.*;
public dynamic class info06 extends MovieClip {
}
}//package
Section 72
//info07 (info07)
package {
import flash.display.*;
public dynamic class info07 extends MovieClip {
}
}//package
Section 73
//info08 (info08)
package {
import flash.display.*;
public dynamic class info08 extends MovieClip {
}
}//package
Section 74
//info09 (info09)
package {
import flash.display.*;
public dynamic class info09 extends MovieClip {
}
}//package
Section 75
//info10 (info10)
package {
import flash.display.*;
public dynamic class info10 extends MovieClip {
public var cPerfectToggle:MovieClip;
public var cTimeToggle:MovieClip;
public var cSizeToggle:MovieClip;
}
}//package
Section 76
//info11 (info11)
package {
import flash.display.*;
public dynamic class info11 extends MovieClip {
}
}//package
Section 77
//info12 (info12)
package {
import flash.display.*;
public dynamic class info12 extends MovieClip {
}
}//package
Section 78
//info13 (info13)
package {
import flash.display.*;
public dynamic class info13 extends MovieClip {
}
}//package
Section 79
//info14 (info14)
package {
import flash.display.*;
public dynamic class info14 extends MovieClip {
}
}//package
Section 80
//info15 (info15)
package {
import flash.display.*;
public dynamic class info15 extends MovieClip {
}
}//package
Section 81
//info16 (info16)
package {
import flash.display.*;
public dynamic class info16 extends MovieClip {
}
}//package
Section 82
//info17 (info17)
package {
import flash.display.*;
public dynamic class info17 extends MovieClip {
}
}//package
Section 83
//info18 (info18)
package {
import flash.display.*;
public dynamic class info18 extends MovieClip {
}
}//package
Section 84
//itunes_upsell (itunes_upsell)
package {
import flash.display.*;
public dynamic class itunes_upsell extends MovieClip {
public var upsell_button:filler_ad;
}
}//package
Section 85
//mgButtonSymbol (mgButtonSymbol)
package {
import flash.display.*;
public dynamic class mgButtonSymbol extends SimpleButton {
}
}//package
Section 86
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
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 = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._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{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
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 = MochiAd._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 (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._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 {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_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{
MochiAd.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();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _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 = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
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);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.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":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
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 fn:Function;
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 = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._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 {
MochiAd.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){
MochiAd.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){
MochiAd.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{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _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();
MochiAd.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");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var 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 87
//modAlert05Mp3 (modAlert05Mp3)
package {
import flash.media.*;
public dynamic class modAlert05Mp3 extends Sound {
}
}//package
Section 88
//modAlert24Mp3 (modAlert24Mp3)
package {
import flash.media.*;
public dynamic class modAlert24Mp3 extends Sound {
}
}//package
Section 89
//musicMp3 (musicMp3)
package {
import flash.media.*;
public dynamic class musicMp3 extends Sound {
}
}//package
Section 90
//musicOffArt (musicOffArt)
package {
import flash.display.*;
public dynamic class musicOffArt extends BitmapData {
public function musicOffArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 91
//musicOnArt (musicOnArt)
package {
import flash.display.*;
public dynamic class musicOnArt extends BitmapData {
public function musicOnArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 92
//oceanBG (oceanBG)
package {
import flash.display.*;
public dynamic class oceanBG extends BitmapData {
public function oceanBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 93
//orangeBallArt (orangeBallArt)
package {
import flash.display.*;
public dynamic class orangeBallArt extends BitmapData {
public function orangeBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 94
//orangeBG (orangeBG)
package {
import flash.display.*;
public dynamic class orangeBG extends BitmapData {
public function orangeBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 95
//placholderGraphic (placholderGraphic)
package {
import flash.display.*;
public dynamic class placholderGraphic extends MovieClip {
}
}//package
Section 96
//progressEmpty (progressEmpty)
package {
import flash.display.*;
public dynamic class progressEmpty extends BitmapData {
public function progressEmpty(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 97
//progressFill (progressFill)
package {
import flash.display.*;
public dynamic class progressFill extends BitmapData {
public function progressFill(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 98
//progressSprite (progressSprite)
package {
import com.simianlogic.*;
public dynamic class progressSprite extends progressBar {
}
}//package
Section 99
//purpleBallArt (purpleBallArt)
package {
import flash.display.*;
public dynamic class purpleBallArt extends BitmapData {
public function purpleBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 100
//purpleBG (purpleBG)
package {
import flash.display.*;
public dynamic class purpleBG extends BitmapData {
public function purpleBG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 101
//redBallArt (redBallArt)
package {
import flash.display.*;
public dynamic class redBallArt extends BitmapData {
public function redBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 102
//rollOverMp3 (rollOverMp3)
package {
import flash.media.*;
public dynamic class rollOverMp3 extends Sound {
}
}//package
Section 103
//soundOffArt (soundOffArt)
package {
import flash.display.*;
public dynamic class soundOffArt extends BitmapData {
public function soundOffArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 104
//soundOnArt (soundOnArt)
package {
import flash.display.*;
public dynamic class soundOnArt extends BitmapData {
public function soundOnArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 105
//soundSymbol (soundSymbol)
package {
import com.simianlogic.*;
public dynamic class soundSymbol extends simpleToggle {
}
}//package
Section 106
//sponsor_link (sponsor_link)
package {
import flash.display.*;
public dynamic class sponsor_link extends SimpleButton {
}
}//package
Section 107
//thudMp3 (thudMp3)
package {
import flash.media.*;
public dynamic class thudMp3 extends Sound {
}
}//package
Section 108
//whiteBallArt (whiteBallArt)
package {
import flash.display.*;
public dynamic class whiteBallArt extends BitmapData {
public function whiteBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 109
//yellowBallArt (yellowBallArt)
package {
import flash.display.*;
public dynamic class yellowBallArt extends BitmapData {
public function yellowBallArt(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package