Section 1
//Main (Busker.Main)
package Busker {
import flash.display.*;
import hardcircle.*;
import flash.events.*;
import flash.geom.*;
import com.greensock.*;
import mochi.as3.*;
import flash.net.*;
import flash.utils.*;
import com.greensock.easing.*;
import flash.text.*;
import com.greensock.events.*;
import flash.ui.*;
public class Main extends MovieClip {
private var coins:int;
private var backgroundObjects:Sprite;
private var deadObjects:Array;
public var g5g_title:MovieClip;
private var vfx_layer:Sprite;
private var bonus:int;
private var itemDelay:int;
private var collision:Collision;
private var powerTimer:Timer;
private var coinArray:Array;
private var bonus_s:int;
private var numToSpawn:int;
private var lastObjID:uint;// = 0
private var foregroundObject:Sprite;
public var sideObjWarning:MovieClip;
public var coin_score:TextField;
private var PowerUp:Boolean;
public var audio_tog:MovieClip;
public var final_coin_txt:TextField;
private var gameTimer:Timer;
private var powerSpawn:Boolean;
private var seconds:int;
public var sideObjWarninga:MovieClip;
public var sideObjWarningb:MovieClip;
public var final_score:TextField;
private var flyingObjects:Array;
private var fallingObjects:Array;
private var score:int;
public var g5g_logo0:MovieClip;
public var final_time_txt:TextField;
private var gameContainer:Sprite;
public var submit_btn:MovieClip;
private var myMask:GameMask;
public var final_score_txt:TextField;
public var final_coin:TextField;
private var verticalSpawnArray:Array;
public var g5g_gameover:MovieClip;
private var cleanupObjects:Array;
public var guitar_streak:TextField;
private var shadowObjects:Array;
private var busker:Player;
private var audio:String;// = "on"
private var horizontalSpawnArray:Array;
public var playGame_btn:MovieClip;
public var zatt:ZattikkaHiScores;
public var g5g_load:MovieClip;
public var sndMgr:SoundManager;
private var part:ParticleManager;
private var gameOver:Boolean;
public var final_time:TextField;
public var g5g_game:MovieClip;
static const OVERLAP_TOLERANCE:uint = 30;
public function Main(){
addFrameScript(0, frame1, 1, frame2, 9, frame10, 109, frame110, 120, frame121, 209, frame210, 219, frame220, 229, frame230, 239, frame240);
stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, PL_LOADING);
root["audio_tog"].stop();
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
contextMenu = _local1;
}
private function keyPressedDown(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == KeyObject.KEY_A)) || ((_arg1.keyCode == KeyObject.KEY_LEFT)))){
KeyObject.DOWN_Left = true;
} else {
if ((((_arg1.keyCode == KeyObject.KEY_D)) || ((_arg1.keyCode == KeyObject.KEY_RIGHT)))){
KeyObject.DOWN_Right = true;
};
};
}
private function updateObjects():void{
var i:int;
var m:int;
var nub:*;
if (fallingObjects.length > 0){
i = (fallingObjects.length - 1);
while (i > -1) {
if (fallingObjects[i] == null){
break;
};
try {
fallingObjects[i].obj.y = (fallingObjects[i].obj.y + fallingObjects[i].obj.speed);
fallingObjects[i].shad.alpha = (fallingObjects[i].shad.alpha + 0.001);
if (fallingObjects[i].obj.y > 370){
fallingObjects[i].obj.y = 370;
if (gameOver){
break;
};
if (fallingObjects[i].obj.currentLabel == "piano"){
sndMgr.playSound("Piano", 1);
} else {
if (fallingObjects[i].obj.currentLabel == "fatty"){
sndMgr.playSound("Fatty", 1);
} else {
if (fallingObjects[i].obj.currentLabel == "10ton"){
sndMgr.playSound("Anvil", 1);
} else {
if (fallingObjects[i].obj.currentLabel == "rock"){
sndMgr.playSound("Rock", 1);
} else {
if (fallingObjects[i].obj.currentLabel == "10ton"){
sndMgr.playSound("Fishy", 1);
} else {
if ((((fallingObjects[i].obj.currentLabel == "stove")) || ((fallingObjects[i].obj.currentLabel == "fridge")))){
sndMgr.playSound("Metal", 0.75);
} else {
sndMgr.playSound("Drop", 1);
};
};
};
};
};
};
shakeScreen();
fallingObjects[i].obj.timeout = 0;
fallingObjects[i].shad.timeout = 0;
backgroundObjects.addChild(fallingObjects[i].obj);
createDustCloudAt(fallingObjects[i].obj.x, 370, fallingObjects[i].obj.width, fallingObjects[i].obj.height);
cleanupObjects.push(fallingObjects[i].obj);
cleanupObjects.push(fallingObjects[i].shad);
fallingObjects.splice(i, 1);
break;
};
} catch(e:Error) {
};
i = (i - 1);
};
};
if (flyingObjects.length > 0){
i = (flyingObjects.length - 1);
while (i > -1) {
flyingObjects[i].tick++;
flyingObjects[i].x = (flyingObjects[i].x + (flyingObjects[i].speed * flyingObjects[i].scaleX));
if (gameOver){
break;
};
if ((flyingObjects[i].tick % 5) == 0){
flyingObjects[i].rotation = (flyingObjects[i].rotation + flyingObjects[i].rot);
};
if ((((flyingObjects[i].x > 750)) || ((flyingObjects[i].x < -50)))){
flyingObjects[i].timeout = 0;
backgroundObjects.addChild(flyingObjects[i]);
cleanupObjects.push(flyingObjects[i]);
break;
};
i = (i - 1);
};
};
if (coinArray.length > 0){
i = (coinArray.length - 1);
while (i > -1) {
coinArray[i].y = (coinArray[i].y + coinArray[i].ySpeed);
coinArray[i].x = (coinArray[i].x + coinArray[i].xSpeed);
if ((((((coinArray[i].x >= 640)) || ((coinArray[i].x <= 20)))) && (!(coinArray[i].dirXignore)))){
coinArray[i].xSpeed = (coinArray[i].xSpeed * -1);
coinArray[i].dirXignore = true;
};
if (coinArray[i].y > 370){
coinArray[i].y = 370;
coinArray[i].xSpeed = 0;
if (gameOver){
break;
};
if (coinArray[i].timeout == null){
coinArray[i].timeout = 0;
if ((coinArray[i] is Powerup)){
coinArray[i].timeout = 0;
};
cleanupObjects.push(coinArray[i]);
};
};
i = (i - 1);
};
};
i = (cleanupObjects.length - 1);
while (i > -1) {
cleanupObjects[i].timeout = (cleanupObjects[i].timeout + 1);
if ((((cleanupObjects[i] is Coin)) || ((cleanupObjects[i] is Powerup)))){
if (cleanupObjects[i].timeout >= 360){
m = (foregroundObject.numChildren - 1);
while (m > -1) {
nub = foregroundObject.getChildAt(m);
if (nub == cleanupObjects[i]){
foregroundObject.removeChild(nub);
};
m = (m - 1);
};
ArraySplice(coinArray, cleanupObjects[i]);
cleanupObjects.splice(i, 1);
};
} else {
if (cleanupObjects[i].timeout >= 60){
cleanupObjects[i].alpha = (cleanupObjects[i].alpha - 0.1);
};
if (cleanupObjects[i].timeout >= 160){
if (cleanupObjects[i].parent != null){
backgroundObjects.removeChild(cleanupObjects[i]);
};
cleanupObjects.splice(i, 1);
};
};
i = (i - 1);
};
i = (deadObjects.length - 1);
while (i > -1) {
deadObjects[i].tick++;
deadObjects[i].x = (deadObjects[i].x + (deadObjects[i].speed * deadObjects[i].scaleX));
deadObjects[i].y = (deadObjects[i].y + deadObjects[i].speed);
if ((deadObjects[i].tick % 5) == 0){
deadObjects[i].rotation = (deadObjects[i].rotation + deadObjects[i].rot);
};
if (deadObjects[i].y > stage.stageHeight){
ArraySplice(deadObjects, deadObjects[i]);
};
i = (i - 1);
};
}
private function ArraySplice(_arg1:Array, _arg2):void{
var _local3:int = (_arg1.length - 1);
while (_local3 > -1) {
if (_arg1[_local3] == _arg2){
_arg1.splice(_local3, 1);
} else {
if (_arg1[_local3].obj == _arg2){
backgroundObjects.removeChild(_arg1[_local3].shad);
_arg1.splice(_local3, 1);
};
};
_local3--;
};
}
private function updatePlayer():void{
var _local1:Number = busker.x;
busker.newAnim = "idle";
sndMgr.setSoundVolume("Player", 2);
busker.scaleX = 1;
if (KeyObject.DOWN_Left){
_local1 = (_local1 - busker.speed);
busker.newAnim = "walk";
busker.scaleX = 1;
sndMgr.setSoundVolume("Player", 0);
} else {
if (KeyObject.DOWN_Right){
_local1 = (_local1 + busker.speed);
busker.newAnim = "walk";
busker.scaleX = -1;
sndMgr.setSoundVolume("Player", 0);
};
};
if ((((_local1 < 5)) || ((_local1 > 655)))){
_local1 = busker.x;
};
var _local2:Number = _local1;
busker.x = _local2;
if (busker.newAnim == busker.anim){
} else {
busker.anim = busker.newAnim;
busker.gotoAndPlay(busker.anim);
};
}
private function RandomRange(_arg1:Number, _arg2:Number){
var _local3:Number = ((Math.random() * (_arg2 - _arg1)) + _arg1);
return (_local3);
}
private function shakeScreen():void{
var mooCow:Function;
mooCow = function (_arg1:TimerEvent){
gameContainer.x = (gameContainer.x - 1);
gameContainer.y = (gameContainer.y - 2);
};
gameContainer.x = (gameContainer.x + 1);
gameContainer.y = (gameContainer.y + 2);
var t:Timer = new Timer(20, 1);
t.addEventListener(TimerEvent.TIMER_COMPLETE, mooCow);
t.start();
}
public function Init():void{
var _local2:Point;
horizontalSpawnArray = new Array();
verticalSpawnArray = new Array();
collision = new Collision();
part = new ParticleManager();
KeyObject.initAll();
var _local1:int;
while (_local1 < 9) {
_local2 = new Point(Math.floor(((stage.stageWidth / 8) * _local1)), -250);
if ((((_local1 == 0)) || ((_local1 == 8)))){
} else {
horizontalSpawnArray.push(_local2);
};
_local1++;
};
verticalSpawnArray.push(new Point(-60, 340));
verticalSpawnArray.push(new Point(720, 340));
}
private function Mute(_arg1:MouseEvent):void{
if (audio == "on"){
audio = "off";
sndMgr.muteAllSounds();
sndMgr.disableSound();
} else {
if (audio == "off"){
audio = "on";
sndMgr.unmuteAllSounds();
sndMgr.enableSound();
};
};
sndMgr.playSound("Click");
root["audio_tog"].gotoAndStop(audio);
}
private function checkOverlaps():void{
var t:TweenLite;
var txt:HUDText;
var obj:*;
var rect1:Rectangle;
var rect2:Rectangle;
var i:int = (foregroundObject.numChildren - 1);
while (i > -1) {
obj = foregroundObject.getChildAt(i);
if (obj.hitTestObject(busker)){
rect1 = busker.col_box.getBounds(gameContainer);
rect2 = obj.getBounds(foregroundObject);
rect1 = rect1.intersection(rect2);
if ((obj is Coin)){
if (obj.ignore){
break;
};
sndMgr.playSound("Coin");
score = (score + (5 * bonus));
txt = new HUDText(vfx_layer, ("+" + String((5 * bonus))), obj.x, obj.y, "scrollup", 14, 0xFFFF00);
coins++;
obj.ignore = true;
ArraySplice(coinArray, obj);
t = new TweenLite(obj, 0.5, {x:125, y:400, ease:Circ.easeOut, overwrite:0, onComplete:function (){
var m:*;
var nub:*;
try {
foregroundObject.removeChild(t.target);
} catch(e:Error) {
trace(("Error removing " + t.target));
m = (foregroundObject.numChildren - 1);
while (m > -1) {
nub = foregroundObject.getChildAt(m);
if ((((nub.x == 125)) && ((nub.y == 400)))){
foregroundObject.removeChild(nub);
};
m = (m - 1);
};
};
}});
};
if ((obj is Powerup)){
if (obj.ignore){
break;
};
sndMgr.playSound("Powerup", 1);
obj.ignore = true;
ArraySplice(coinArray, obj);
foregroundObject.removeChild(obj);
turnObjectsToCoins();
PowerUp = true;
powerTimer = new Timer(500, 10);
powerTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:TimerEvent){
PowerUp = false;
});
powerTimer.start();
};
if (((rect1.width * rect1.height) * 0.05) > OVERLAP_TOLERANCE){
if ((obj is ThrownObject)){
if (obj.ignore){
break;
};
if ((((obj.scaleX == busker.scaleX)) && ((busker.currentLabel == "walk")))){
if (obj.currentLabel == "baby"){
sndMgr.playSound("Baby", 1);
} else {
if (obj.currentLabel == "fish"){
sndMgr.playSound("Fishy", 1);
} else {
sndMgr.playSound("Dodge", 1);
};
};
score = (score + 10);
txt = new HUDText(vfx_layer, ("+" + String((10 * bonus))), obj.x, obj.y, "scrollup", 14, 0xFFFF00);
ArraySplice(flyingObjects, obj);
obj.ignore = true;
obj.scaleX = (obj.scaleX * -1);
deadObjects.push(obj);
break;
};
};
gameOver = true;
startGameOverSequence();
};
};
i = (i - 1);
};
}
private function keyPressRelease(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == KeyObject.KEY_A)) || ((_arg1.keyCode == KeyObject.KEY_LEFT)))){
KeyObject.DOWN_Left = false;
} else {
if ((((_arg1.keyCode == KeyObject.KEY_D)) || ((_arg1.keyCode == KeyObject.KEY_RIGHT)))){
KeyObject.DOWN_Right = false;
};
};
}
function frame210(){
realizeMainMenu();
g5g_title.buttonMode = true;
g5g_title.addEventListener(MouseEvent.CLICK, g5gTitleClick);
}
private function startGameOverSequence():void{
var box:Shape;
var bcount:int;
var blur:Function;
blur = function (_arg1:Event){
bcount++;
if (bcount == 1){
bcount = 0;
box.alpha = (box.alpha + 0.1);
};
if (box.alpha >= 1){
gameTimer.removeEventListener(TimerEvent.TIMER, GameUpdate);
box.removeEventListener(Event.ENTER_FRAME, blur);
stage.removeChild(gameContainer);
gotoAndPlay("Game Over");
};
};
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyPressRelease);
KeyObject.initAll();
busker.stop();
box = new Shape();
box.graphics.beginFill(0, 1);
box.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
box.graphics.endFill();
box.alpha = 0;
gameContainer.addChild(box);
box.addEventListener(Event.ENTER_FRAME, blur);
bcount = 0;
}
function frame10(){
Connect();
sndMgr.playSound("HC Chime");
}
private function submitScore(_arg1:MouseEvent):void{
var t:ZattikkaHiScores;
var c:scoreCloseButton;
var e = _arg1;
t = new ZattikkaHiScores();
t.x = 189;
t.y = 17;
addChild(t);
c = new scoreCloseButton();
c.x = 228;
c.y = 392;
addChild(c);
c.buttonMode = true;
c.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
removeChild(t);
removeChild(c);
});
t.setDetails(422, 0, "busker-panic", "lMqPCRB1e2WeLn8", false, (score + (seconds * 6)), String((score + (seconds * 6))), "points!", false);
}
function frame2(){
}
public function g5gTitleClick(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gimme5games.com/?ref=busker-panic_TITLE"), "_blank");
}
function frame220(){
startGameplay();
g5g_game.buttonMode = true;
g5g_game.addEventListener(MouseEvent.CLICK, g5g_game_click);
g5g_game.addEventListener(MouseEvent.MOUSE_OVER, g5g_game_over);
g5g_game.addEventListener(MouseEvent.MOUSE_OUT, g5g_game_out);
}
private function updateInterface():void{
root["coin_score"].text = ("Score " + String(score));
if (bonus > 1){
root["guitar_streak"].text = (("x" + String(bonus)) + " GUITAR STREAK!");
} else {
root["guitar_streak"].text = "";
};
}
public function g5g_game_click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gimme5games.com/?ref=busker-panic_INGAMELOGO"), "_blank");
}
private function GameUpdate(_arg1:TimerEvent):void{
var _local2:HUDText;
updatePlayer();
updateObjects();
ParticleManager.updateParticles();
if (!gameOver){
checkOverlaps();
};
if (((((_arg1.target.currentCount % 10) == 0)) && ((busker.anim == "idle")))){
ParticleManager.addDriftParticle(Note, (busker.x + 34), (busker.y - 40), RandomRange(1, 3), RandomRange(-1, -3), RandomRange(20, 50), 0, vfx_layer);
};
if ((_arg1.target.currentCount % itemDelay) == 0){
spawnNewObject();
};
if ((_arg1.target.currentCount % 1200) == 0){
itemDelay = (itemDelay - (50 * 0.1));
numToSpawn = (numToSpawn + 1);
if (numToSpawn > 3){
numToSpawn = 3;
};
if (itemDelay <= 20){
itemDelay = 20;
};
};
if ((_arg1.target.currentCount % 33) == 0){
if (busker.anim == "walk"){
bonus_s = (bonus_s - 2);
if (bonus_s < 0){
bonus_s = 0;
};
} else {
if (bonus_s <= 13){
bonus_s++;
};
};
seconds++;
if (bonus_s >= 10){
if (bonus != 16){
if (bonus < 16){
sndMgr.playSound("Rif", 1);
} else {
sndMgr.playSound("Rif_Fail");
};
bonus = 16;
_local2 = new HUDText(vfx_layer, ("x" + String(bonus)), (busker.x + (busker.width / 2)), (busker.y - busker.height), "scrollup", 16);
};
} else {
if (bonus_s >= 6){
if (bonus != 8){
if (bonus < 8){
sndMgr.playSound("Rif", 1);
} else {
sndMgr.playSound("Rif_Fail");
};
bonus = 8;
_local2 = new HUDText(vfx_layer, ("x" + String(bonus)), (busker.x + (busker.width / 2)), (busker.y - busker.height), "scrollup", 16);
};
} else {
if (bonus_s >= 4){
if (bonus != 4){
if (bonus < 4){
sndMgr.playSound("Rif", 1);
} else {
sndMgr.playSound("Rif_Fail");
};
bonus = 4;
_local2 = new HUDText(vfx_layer, ("x" + String(bonus)), (busker.x + (busker.width / 2)), (busker.y - busker.height), "scrollup", 16);
};
} else {
if (bonus_s >= 2){
if (bonus != 2){
if (bonus < 2){
sndMgr.playSound("Rif", 1);
} else {
sndMgr.playSound("Rif_Fail");
};
bonus = 2;
_local2 = new HUDText(vfx_layer, ("x" + String(bonus)), (busker.x + (busker.width / 2)), (busker.y - busker.height), "scrollup", 16);
};
} else {
if (bonus_s >= 0){
if (bonus != 1){
if (bonus < 1){
sndMgr.playSound("Rif", 1);
} else {
sndMgr.playSound("Rif_Fail");
};
bonus = 1;
_local2 = new HUDText(vfx_layer, ("x" + String(bonus)), (busker.x + (busker.width / 2)), (busker.y - busker.height), "scrollup", 16);
};
};
};
};
};
};
if (busker.anim != "walk"){
score = (score + (5 * bonus));
};
updateInterface();
};
}
function frame110(){
Init();
}
public function g5g_game_out(_arg1:MouseEvent):void{
g5g_game.gotoAndStop(1);
}
private function turnObjectsToCoins():void{
var loopNum:int;
var coin:Coin;
var i:int;
var obj:*;
var pop:vfx_pop;
var j:int;
var pop2:vfx_pop;
if (foregroundObject.numChildren > 0){
i = (foregroundObject.numChildren - 1);
while (i > -1) {
if ((((foregroundObject.getChildAt(i) is DroppedObject)) || ((foregroundObject.getChildAt(i) is ThrownObject)))){
obj = foregroundObject.getChildAt(i);
pop = new vfx_pop();
pop.x = obj.x;
pop.y = obj.y;
vfx_layer.addChild(pop);
if ((((obj.currentLabel == "tv")) || ((obj.currentLabel == "chair")))){
loopNum = 5;
foregroundObject.removeChild(obj);
try {
ArraySplice(fallingObjects, obj);
} catch(e:Error) {
trace("Couldn't splice falling object from array");
};
} else {
if ((((((obj.currentLabel == "stove")) || ((obj.currentLabel == "fridge")))) || ((obj.currentLabel == "table")))){
loopNum = 10;
foregroundObject.removeChild(obj);
try {
ArraySplice(fallingObjects, obj);
} catch(e:Error) {
trace("Couldn't splice falling object from array");
};
} else {
if ((((((((((((((obj.currentLabel == "fish")) || ((obj.currentLabel == "alien")))) || ((obj.currentLabel == "rock")))) || ((obj.currentLabel == "bed")))) || ((obj.currentLabel == "fatty")))) || ((obj.currentLabel == "piano")))) || ((obj.currentLabel == "10ton")))){
loopNum = 15;
foregroundObject.removeChild(obj);
try {
ArraySplice(fallingObjects, obj);
} catch(e:Error) {
trace("Couldn't splice falling object from array");
};
} else {
trace("Couldn't find Object value to coin, using default");
foregroundObject.removeChild(obj);
loopNum = 3;
};
};
};
j = 0;
while (j <= loopNum) {
coin = new Coin();
coin.x = obj.x;
coin.y = obj.y;
coin.dirXignore = false;
coin.ySpeed = RandomRange(8, 10);
coin.xSpeed = RandomRange(-3, 3);
coinArray.push(coin);
foregroundObject.addChild(coin);
j = (j + 1);
};
};
i = (i - 1);
};
};
if (backgroundObjects.numChildren > 0){
i = (backgroundObjects.numChildren - 1);
while (i > -1) {
if ((backgroundObjects.getChildAt(i) is DroppedObject)){
obj = backgroundObjects.getChildAt(i);
pop2 = new vfx_pop();
pop2.x = obj.x;
pop2.y = obj.y;
vfx_layer.addChild(pop2);
if ((((obj.currentLabel == "tv")) || ((obj.currentLabel == "chair")))){
loopNum = 5;
backgroundObjects.removeChild(obj);
} else {
if ((((((obj.currentLabel == "stove")) || ((obj.currentLabel == "fridge")))) || ((obj.currentLabel == "table")))){
loopNum = 10;
backgroundObjects.removeChild(obj);
} else {
if ((((((((((((((obj.currentLabel == "fish")) || ((obj.currentLabel == "alien")))) || ((obj.currentLabel == "rock")))) || ((obj.currentLabel == "bed")))) || ((obj.currentLabel == "fatty")))) || ((obj.currentLabel == "piano")))) || ((obj.currentLabel == "10ton")))){
loopNum = 10;
backgroundObjects.removeChild(obj);
};
};
};
j = 0;
while (j <= loopNum) {
coin = new Coin();
coin.x = obj.x;
coin.y = (obj.y - obj.height);
coin.dirXignore = false;
coin.ySpeed = RandomRange(8, 10);
coin.xSpeed = RandomRange(3, 6);
coinArray.push(coin);
foregroundObject.addChild(coin);
j = (j + 1);
};
};
i = (i - 1);
};
};
}
function frame1(){
MochiBot.track(this, "b4184780");
}
private function createDustCloudAt(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Dust = new Dust();
_local5.x = _arg1;
_local5.y = _arg2;
_local5.width = _arg3;
_local5.height = (_arg4 / 2);
backgroundObjects.addChild(_local5);
}
public function g5g_submit(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gimme5games.com/?ref=busker-panic_HISCORE"), "_blank");
}
function frame240(){
stop();
}
function frame121(){
sndMgr.playSound("BOOGERS", 1);
}
function frame230(){
realizeGameOver();
g5g_gameover.buttonMode = true;
g5g_gameover.addEventListener(MouseEvent.CLICK, g5g_submit);
}
public function startGameplay():void{
sideObjWarning.visible = false;
sideObjWarningb.visible = false;
sideObjWarninga.visible = false;
sndMgr.stopAllSounds();
sndMgr.playSound("Click");
sndMgr.playSound("Player", 1, 0, 999);
sndMgr.playSound("bgm", 1, 0, 999);
gameTimer = new Timer(33);
fallingObjects = new Array();
flyingObjects = new Array();
coinArray = new Array();
cleanupObjects = new Array();
shadowObjects = new Array();
deadObjects = new Array();
powerSpawn = true;
itemDelay = 50;
ParticleManager.newParticleArray();
gameOver = false;
PowerUp = false;
seconds = 0;
score = 0;
coins = 0;
bonus = 1;
numToSpawn = 1;
bonus_s = 0;
updateInterface();
myMask = new GameMask();
myMask.y = (myMask.x = 5);
stage.addChild(myMask);
gameContainer = new Sprite();
backgroundObjects = new Sprite();
foregroundObject = new Sprite();
vfx_layer = new Sprite();
stage.addChild(gameContainer);
gameContainer.mask = myMask;
busker = new Player();
busker.speed = 7;
busker.x = 330;
busker.y = 370;
gameContainer.addChild(backgroundObjects);
gameContainer.addChild(busker);
gameContainer.addChild(foregroundObject);
gameContainer.addChild(vfx_layer);
gameTimer.addEventListener(TimerEvent.TIMER, GameUpdate);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyPressRelease);
gameTimer.start();
}
public function g5g_game_over(_arg1:MouseEvent):void{
g5g_game.play();
}
public function Connect():void{
sndMgr = SoundManager.getInstance();
sndMgr.addLibrarySound(menu_music, "Menu");
sndMgr.addLibrarySound(bgm_player, "Player");
sndMgr.addLibrarySound(sfx_chargeup, "Rif");
sndMgr.addLibrarySound(sfx_cooldown, "Rif_Fail");
sndMgr.addLibrarySound(BtnClick, "Click");
sndMgr.addLibrarySound(Dodge, "Dodge");
sndMgr.addLibrarySound(drop_object, "Drop");
sndMgr.addLibrarySound(sfx_fatty, "Fatty");
sndMgr.addLibrarySound(sfx_piano, "Piano");
sndMgr.addLibrarySound(GoldFish, "Fishy");
sndMgr.addLibrarySound(sfx_rock, "Rock");
sndMgr.addLibrarySound(sfx_newAnvil, "Anvil");
sndMgr.addLibrarySound(sfx_Powerup, "Powerup");
sndMgr.addLibrarySound(sfx_coin, "Coin");
sndMgr.addLibrarySound(ctsjingle, "BOOGERS");
sndMgr.addLibrarySound(sfx_baby, "Baby");
sndMgr.addLibrarySound(bgm_ingame, "bgm");
sndMgr.addLibrarySound(sfx_metalframe, "Metal");
sndMgr.addLibrarySound(HCjingle, "HC Chime");
root["audio_tog"].buttonMode = true;
root["audio_tog"].addEventListener(MouseEvent.MOUSE_DOWN, Mute);
}
public function realizeMainMenu():void{
stop();
sndMgr.playSound("Menu", 1, 0, 999);
root["playGame_btn"].playBTN.buttonMode = true;
root["playGame_btn"].helpBTN.buttonMode = true;
root["playGame_btn"].playBTN.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:MouseEvent):void{
gotoAndStop("Game");
});
root["playGame_btn"].helpBTN.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:MouseEvent):void{
root["playGame_btn"].helpIndi.play();
});
}
private function PL_LOADING(_arg1:ProgressEvent):void{
var _local2:Number = ((_arg1.bytesLoaded / _arg1.bytesTotal) * 100);
root["g5g_load"].movLoadingBar.scaleX = (_local2 / 100);
root["g5g_load"].txtPercent.text = String(_local2);
if (_local2 == 100){
this.gotoAndStop(2);
};
}
private function spawnNewObject():void{
var secCount:int;
var spawn:uint;
var p:Point;
var label:int;
var loop:int;
var linkedObj:Object;
var dropobject:DroppedObject;
var shad:Shadow;
var m:int;
var power:Powerup;
var timer:Timer;
var nub:*;
var thrownobject:ThrownObject;
var tim:Timer;
var objectFallSpeed:int = (10 - Math.floor((seconds / 30)));
var spawnedSideObject:Boolean;
trace(("DEBUG:OBJECT FALL SPEED" + objectFallSpeed));
var v:int = numToSpawn;
while (v > 0) {
secCount = (seconds / 10);
spawn = Math.floor(RandomRange(0, 7));
loop = 0;
if (spawn >= 2){
linkedObj = new Object();
dropobject = new DroppedObject();
p = horizontalSpawnArray[Math.floor(RandomRange(0, 7))];
dropobject.x = p.x;
dropobject.y = p.y;
if (secCount > 12){
secCount = 12;
};
do {
loop = (loop + 1);
label = Math.ceil(RandomRange(0, (secCount + 3)));
} while ((((label == lastObjID)) && ((loop < 3))));
lastObjID = label;
dropobject.gotoAndStop(label);
dropobject.speed = Math.floor(RandomRange((objectFallSpeed - 2), (objectFallSpeed + 2)));
if (!PowerUp){
shad = new Shadow();
shad.x = dropobject.x;
shad.y = 370;
shad.alpha = 0.25;
shad.width = dropobject.width;
backgroundObjects.addChild(shad);
};
linkedObj.obj = dropobject;
linkedObj.shad = shad;
fallingObjects.push(linkedObj);
foregroundObject.addChild(dropobject);
} else {
if (spawn == 1){
if (powerSpawn){
m = (foregroundObject.numChildren - 1);
while (m > -1) {
nub = foregroundObject.getChildAt(m);
if ((nub is Powerup)){
return;
};
m = (m - 1);
};
power = new Powerup();
p = horizontalSpawnArray[Math.floor(RandomRange(0, 7))];
power.x = p.x;
power.y = p.y;
power.xSpeed = 0;
power.ySpeed = 10;
coinArray.push(power);
foregroundObject.addChild(power);
powerSpawn = false;
timer = new Timer(1000, 45);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:TimerEvent){
powerSpawn = true;
});
timer.start();
};
} else {
if ((((spawn == 0)) && (!(spawnedSideObject)))){
if (PowerUp){
return;
};
spawnedSideObject = true;
thrownobject = new ThrownObject();
p = verticalSpawnArray[Math.floor(RandomRange(0, 2))];
thrownobject.x = p.x;
thrownobject.y = p.y;
if (thrownobject.x > 660){
thrownobject.scaleX = -1;
};
secCount = (secCount * 2);
if (secCount > 23){
secCount = 23;
};
label = Math.ceil(RandomRange(0, secCount));
thrownobject.gotoAndStop(label);
thrownobject.speed = 10;
thrownobject.tick = 0;
if (label < 20){
thrownobject.rot = 45;
} else {
thrownobject.rot = 0;
};
flyingObjects.push(thrownobject);
foregroundObject.addChild(thrownobject);
if (!PowerUp){
tim = new Timer(2000, 1);
tim.addEventListener(TimerEvent.TIMER_COMPLETE, hideWarning);
tim.start();
if (thrownobject.scaleX == -1){
sideObjWarningb.visible = true;
} else {
sideObjWarninga.visible = true;
};
sideObjWarning.visible = true;
};
};
};
};
v = (v - 1);
};
if (PowerUp){
turnObjectsToCoins();
};
}
private function hideWarning(_arg1:TimerEvent):void{
var e = _arg1;
try {
sideObjWarning.visible = false;
sideObjWarninga.visible = false;
sideObjWarningb.visible = false;
} catch(e:Error) {
};
}
public function realizeGameOver():void{
stop();
sndMgr.playSound("Menu", 1, 0, 999);
sndMgr.stopSound("Player");
sndMgr.stopSound("bgm");
root["playGame_btn"].buttonMode = true;
root["submit_btn"].buttonMode = true;
root["playGame_btn"].addEventListener(MouseEvent.MOUSE_UP, function (_arg1:MouseEvent):void{
gotoAndStop("Game");
});
root["submit_btn"].addEventListener(MouseEvent.CLICK, submitScore);
root["final_time"].text = String((seconds * 6));
root["final_coin"].text = String(score);
root["final_score"].text = String((score + (seconds * 6)));
var tween:TweenLite = new TweenLite(root["final_time"], 0.5, {x:345});
tween.play();
tween = new TweenLite(root["final_coin"], 0.75, {x:345});
tween.play();
tween = new TweenLite(root["final_score"], 1, {x:345});
tween.play();
tween = new TweenLite(root["final_time_txt"], 0.5, {x:44});
tween.play();
tween = new TweenLite(root["final_coin_txt"], 0.75, {x:150});
tween.play();
tween = new TweenLite(root["final_score_txt"], 1, {x:150});
tween.play();
}
}
}//package Busker
Section 2
//bgcolour_15 (BuskerPanic_fla.bgcolour_15)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class bgcolour_15 extends MovieClip {
public function bgcolour_15(){
addFrameScript(169, frame170);
}
function frame170(){
stop();
}
}
}//package BuskerPanic_fla
Section 3
//ctslogo_17 (BuskerPanic_fla.ctslogo_17)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class ctslogo_17 extends MovieClip {
public function ctslogo_17(){
addFrameScript(102, frame103);
}
function frame103(){
stop();
}
}
}//package BuskerPanic_fla
Section 4
//Helpindicator_39 (BuskerPanic_fla.Helpindicator_39)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class Helpindicator_39 extends MovieClip {
public function Helpindicator_39(){
addFrameScript(0, frame1, 41, frame42);
}
function frame42(){
gotoAndStop(1);
}
function frame1(){
stop();
}
}
}//package BuskerPanic_fla
Section 5
//logo_16 (BuskerPanic_fla.logo_16)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class logo_16 extends MovieClip {
public function logo_16(){
addFrameScript(87, frame88);
}
function frame88(){
stop();
}
}
}//package BuskerPanic_fla
Section 6
//menu_buttons_36 (BuskerPanic_fla.menu_buttons_36)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class menu_buttons_36 extends MovieClip {
public var helpIndi:MovieClip;
public var playBTN:MovieClip;
public var helpBTN:MovieClip;
public function menu_buttons_36(){
addFrameScript(54, frame55);
}
function frame55(){
stop();
}
}
}//package BuskerPanic_fla
Section 7
//menu_title_txt_35 (BuskerPanic_fla.menu_title_txt_35)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class menu_title_txt_35 extends MovieClip {
public function menu_title_txt_35(){
addFrameScript(96, frame97);
}
function frame97(){
stop();
}
}
}//package BuskerPanic_fla
Section 8
//movSplash_5 (BuskerPanic_fla.movSplash_5)
package BuskerPanic_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class movSplash_5 extends MovieClip {
public var g5g_playbtn:SimpleButton;
public var logo:MovieClip;
public var hand:MovieClip;
public function movSplash_5(){
addFrameScript(0, frame1, 109, frame110);
}
public function closeAndPlay(_arg1:MouseEvent):void{
MovieClip(root).play();
}
public function clickyclicky(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gimme5games.com/?ref=busker-panic_SPLASH"), "_blank");
}
function frame110(){
stop();
g5g_playbtn.addEventListener(MouseEvent.CLICK, closeAndPlay);
}
function frame1(){
hand.addEventListener(MouseEvent.CLICK, clickyclicky);
logo.addEventListener(MouseEvent.CLICK, clickyclicky);
}
}
}//package BuskerPanic_fla
Section 9
//rollout_43 (BuskerPanic_fla.rollout_43)
package BuskerPanic_fla {
import flash.display.*;
public dynamic class rollout_43 extends MovieClip {
public function rollout_43(){
addFrameScript(0, frame1, 29, frame30);
}
function frame30(){
stop();
}
function frame1(){
stop();
}
}
}//package BuskerPanic_fla
Section 10
//PropTween (com.greensock.core.PropTween)
package com.greensock.core {
public class PropTween {
public var priority:int;
public var start:Number;
public var prevNode:PropTween;
public var change:Number;
public var target:Object;
public var name:String;
public var property:String;
public var nextNode:PropTween;
public var isPlugin:Boolean;
public function PropTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean, _arg7:PropTween=null, _arg8:int=0){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
if (_arg7){
_arg7.prevNode = this;
this.nextNode = _arg7;
};
this.priority = _arg8;
}
}
}//package com.greensock.core
Section 11
//SimpleTimeline (com.greensock.core.SimpleTimeline)
package com.greensock.core {
public class SimpleTimeline extends TweenCore {
public var autoRemoveChildren:Boolean;
protected var _lastChild:TweenCore;
protected var _firstChild:TweenCore;
public function SimpleTimeline(_arg1:Object=null){
super(0, _arg1);
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local5:Number;
var _local6:TweenCore;
var _local4:TweenCore = _firstChild;
this.cachedTotalTime = _arg1;
this.cachedTime = _arg1;
while (_local4) {
_local6 = _local4.nextNode;
if (((_local4.active) || ((((((_arg1 >= _local4.cachedStartTime)) && (!(_local4.cachedPaused)))) && (!(_local4.gc)))))){
if (!_local4.cachedReversed){
_local4.renderTime(((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local4.cacheIsDirty) ? _local4.totalDuration : _local4.cachedTotalDuration;
_local4.renderTime((_local5 - ((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale)), _arg2, false);
};
};
_local4 = _local6;
};
}
public function addChild(_arg1:TweenCore):void{
if (((!(_arg1.gc)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
if (_firstChild){
_firstChild.prevNode = _arg1;
};
_arg1.nextNode = _firstChild;
_firstChild = _arg1;
_arg1.prevNode = null;
}
public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.gc){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_lastChild == _arg1){
_lastChild = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_firstChild == _arg1){
_firstChild = _arg1.nextNode;
};
};
}
public function get rawTime():Number{
return (this.cachedTotalTime);
}
}
}//package com.greensock.core
Section 12
//TweenCore (com.greensock.core.TweenCore)
package com.greensock.core {
import com.greensock.*;
public class TweenCore {
public var initted:Boolean;
protected var _hasUpdate:Boolean;
public var active:Boolean;
protected var _delay:Number;
public var cachedTime:Number;
public var cachedReversed:Boolean;
public var nextNode:TweenCore;
protected var _rawPrevTime:Number;// = -1
public var vars:Object;
public var cachedTotalTime:Number;
public var timeline:SimpleTimeline;
public var data;
public var cachedStartTime:Number;
public var prevNode:TweenCore;
public var cachedDuration:Number;
public var gc:Boolean;
protected var _pauseTime:Number;
public var cacheIsDirty:Boolean;
public var cachedPaused:Boolean;
public var cachedTimeScale:Number;
public var cachedTotalDuration:Number;
public static const version:Number = 1.13;
protected static var _classInitted:Boolean;
public function TweenCore(_arg1:Number=0, _arg2:Object=null){
this.vars = ((_arg2) || ({}));
this.cachedDuration = (this.cachedTotalDuration = ((_arg1) || (0)));
_delay = ((this.vars.delay) || (0));
this.cachedTimeScale = ((this.vars.timeScale) || (1));
this.active = Boolean((((((_arg1 == 0)) && ((_delay == 0)))) && (!((this.vars.immediateRender == false)))));
this.cachedTotalTime = (this.cachedTime = 0);
this.data = this.vars.data;
if (!_classInitted){
if (isNaN(TweenLite.rootFrame)){
TweenLite.initClass();
_classInitted = true;
} else {
return;
};
};
var _local3:SimpleTimeline = ((this.vars.timeline is SimpleTimeline)) ? this.vars.timeline : (this.vars.useFrames) ? TweenLite.rootFramesTimeline : TweenLite.rootTimeline;
this.cachedStartTime = (_local3.cachedTotalTime + _delay);
_local3.addChild(this);
if (this.vars.reversed){
this.cachedReversed = true;
};
if (this.vars.paused){
this.paused = true;
};
}
public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
}
public function get delay():Number{
return (_delay);
}
public function get duration():Number{
return (this.cachedDuration);
}
public function restart(_arg1:Boolean=false, _arg2:Boolean=true):void{
this.reversed = false;
this.paused = false;
this.setTotalTime((_arg1) ? -(_delay) : 0, _arg2);
}
public function set reversed(_arg1:Boolean):void{
if (_arg1 != this.cachedReversed){
this.cachedReversed = _arg1;
setTotalTime(this.cachedTotalTime, true);
};
}
public function set startTime(_arg1:Number):void{
var _local2:Boolean = Boolean(((!((this.timeline == null))) && (((!((_arg1 == this.cachedStartTime))) || (this.gc)))));
this.cachedStartTime = _arg1;
if (_local2){
this.timeline.addChild(this);
};
}
public function set delay(_arg1:Number):void{
this.startTime = (this.startTime + (_arg1 - _delay));
_delay = _arg1;
}
public function resume():void{
this.paused = false;
}
public function get paused():Boolean{
return (this.cachedPaused);
}
public function play():void{
this.reversed = false;
this.paused = false;
}
public function set duration(_arg1:Number):void{
this.cachedDuration = (this.cachedTotalDuration = _arg1);
setDirtyCache(false);
}
public function complete(_arg1:Boolean=false, _arg2:Boolean=false):void{
if (!_arg1){
renderTime(this.cachedTotalDuration, _arg2, false);
return;
};
if (this.timeline.autoRemoveChildren){
this.setEnabled(false, false);
} else {
this.active = false;
};
if (!_arg2){
if (((((this.vars.onComplete) && ((this.cachedTotalTime == this.cachedTotalDuration)))) && (!(this.cachedReversed)))){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
} else {
if (((((this.cachedReversed) && ((this.cachedTotalTime == 0)))) && (this.vars.onReverseComplete))){
this.vars.onReverseComplete.apply(null, this.vars.onReverseCompleteParams);
};
};
};
}
public function invalidate():void{
}
public function get totalTime():Number{
return (this.cachedTotalTime);
}
public function get reversed():Boolean{
return (this.cachedReversed);
}
public function get startTime():Number{
return (this.cachedStartTime);
}
public function set currentTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
protected function setDirtyCache(_arg1:Boolean=true):void{
var _local2:TweenCore = (_arg1) ? this : this.timeline;
while (_local2) {
_local2.cacheIsDirty = true;
_local2 = _local2.timeline;
};
}
public function reverse(_arg1:Boolean=true):void{
this.reversed = true;
if (_arg1){
this.paused = false;
} else {
if (this.gc){
this.setEnabled(true, false);
};
};
}
public function set paused(_arg1:Boolean):void{
if (((!((_arg1 == this.cachedPaused))) && (this.timeline))){
if (_arg1){
_pauseTime = this.timeline.rawTime;
} else {
this.cachedStartTime = (this.cachedStartTime + (this.timeline.rawTime - _pauseTime));
_pauseTime = NaN;
setDirtyCache(false);
};
this.cachedPaused = _arg1;
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
};
if (((!(_arg1)) && (this.gc))){
this.setTotalTime(this.cachedTotalTime, false);
this.setEnabled(true, false);
};
}
public function kill():void{
setEnabled(false, false);
}
public function set totalTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
public function get currentTime():Number{
return (this.cachedTime);
}
protected function setTotalTime(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
var _local4:Number;
if (this.timeline){
_local3 = (((_pauseTime) || ((_pauseTime == 0)))) ? _pauseTime : this.timeline.cachedTotalTime;
if (this.cachedReversed){
_local4 = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
this.cachedStartTime = (_local3 - ((_local4 - _arg1) / this.cachedTimeScale));
} else {
this.cachedStartTime = (_local3 - (_arg1 / this.cachedTimeScale));
};
if (!this.timeline.cacheIsDirty){
setDirtyCache(false);
};
if (this.cachedTotalTime != _arg1){
renderTime(_arg1, _arg2, false);
};
};
}
public function pause():void{
this.paused = true;
}
public function set totalDuration(_arg1:Number):void{
this.duration = _arg1;
}
public function get totalDuration():Number{
return (this.cachedTotalDuration);
}
public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
if (_arg1){
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
if (((!(_arg2)) && (this.gc))){
this.timeline.addChild(this);
};
} else {
this.active = false;
if (!_arg2){
this.timeline.remove(this, true);
};
};
this.gc = !(_arg1);
return (false);
}
}
}//package com.greensock.core
Section 13
//Circ (com.greensock.easing.Circ)
package com.greensock.easing {
public class Circ {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 * 0.5));
if (_arg1 < 1){
return ((((-(_arg3) * 0.5) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 * 0.5) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
}
}//package com.greensock.easing
Section 14
//TweenLite (com.greensock.TweenLite)
package com.greensock {
import flash.display.*;
import flash.events.*;
import com.greensock.core.*;
import flash.utils.*;
import com.greensock.plugins.*;
public class TweenLite extends TweenCore {
protected var _hasPlugins:Boolean;
public var propTweenLookup:Object;
public var cachedPT1:PropTween;
protected var _overwrite:uint;
protected var _ease:Function;
public var target;
public var ratio:Number;// = 0
protected var _overwrittenProps:Object;
protected var _notifyPluginsOfEnabled:Boolean;
public static const version:Number = 11.133;
public static var rootTimeline:SimpleTimeline;
public static var fastEaseLookup:Dictionary = new Dictionary(false);
public static var onPluginEvent:Function;
public static var rootFramesTimeline:SimpleTimeline;
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var masterList:Dictionary = new Dictionary(false);
public static var overwriteManager:Object;
public static var rootFrame:Number;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _shape:Shape = new Shape();
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, onReverseComplete:1, onReverseCompleteParams:1, onRepeat:1, onRepeatParams:1, proxiedEase:1, easeParams:1, yoyo:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, onReverseCompleteListener:1, onRepeatListener:1, orientToBezier:1, timeScale:1, immediateRender:1, repeat:1, repeatDelay:1, timeline:1, data:1, paused:1};
public function TweenLite(_arg1, _arg2:Number, _arg3:Object){
var _local5:TweenLite;
super(_arg2, _arg3);
this.target = _arg1;
if ((((this.target is TweenCore)) && (("timeScale" in this.vars)))){
this.cachedTimeScale = 1;
};
propTweenLookup = {};
_ease = defaultEase;
_overwrite = (((!((Number(_arg3.overwrite) > -1))) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
var _local4:Array = masterList[_arg1];
if (!_local4){
masterList[_arg1] = [this];
} else {
if (_overwrite == 1){
for each (_local5 in _local4) {
if (!_local5.gc){
_local5.setEnabled(false, false);
};
};
masterList[_arg1] = [this];
} else {
_local4[_local4.length] = this;
};
};
if (((this.active) || (this.vars.immediateRender))){
renderTime(0, false, true);
};
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Boolean;
var _local5:Number = this.cachedTime;
if (_arg1 >= this.cachedDuration){
this.cachedTotalTime = (this.cachedTime = this.cachedDuration);
this.ratio = 1;
_local4 = true;
if (this.cachedDuration == 0){
if ((((((_arg1 == 0)) || ((_rawPrevTime < 0)))) && (!((_rawPrevTime == _arg1))))){
_arg3 = true;
};
_rawPrevTime = _arg1;
};
} else {
if (_arg1 <= 0){
this.cachedTotalTime = (this.cachedTime = (this.ratio = 0));
if (_arg1 < 0){
this.active = false;
if (this.cachedDuration == 0){
if (_rawPrevTime > 0){
_arg3 = true;
_local4 = true;
};
_rawPrevTime = _arg1;
};
};
if (((this.cachedReversed) && (!((_local5 == 0))))){
_local4 = true;
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
this.ratio = _ease(_arg1, 0, 1, this.cachedDuration);
};
};
if ((((this.cachedTime == _local5)) && (!(_arg3)))){
return;
};
if (!this.initted){
init();
if (((!(_local4)) && (this.cachedTime))){
this.ratio = _ease(this.cachedTime, 0, 1, this.cachedDuration);
};
};
if (((!(this.active)) && (!(this.cachedPaused)))){
this.active = true;
};
if ((((((((_local5 == 0)) && (this.vars.onStart))) && (!((this.cachedTime == 0))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
var _local6:PropTween = this.cachedPT1;
while (_local6) {
_local6.target[_local6.property] = (_local6.start + (this.ratio * _local6.change));
_local6 = _local6.nextNode;
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local4){
if (((_hasPlugins) && (this.cachedPT1))){
onPluginEvent("onComplete", this);
};
complete(true, _arg2);
};
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:Array;
if (_arg1){
_local3 = TweenLite.masterList[this.target];
if (!_local3){
TweenLite.masterList[this.target] = [this];
} else {
_local3[_local3.length] = this;
};
};
super.setEnabled(_arg1, _arg2);
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
return (onPluginEvent((_arg1) ? "onEnable" : "onDisable", this));
};
return (false);
}
protected function init():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:Boolean;
var _local5:Array;
var _local6:PropTween;
if (typeof(this.vars.ease) == "function"){
_ease = this.vars.ease;
};
if (this.vars.easeParams){
this.vars.proxiedEase = _ease;
_ease = easeProxy;
};
this.cachedPT1 = null;
this.propTweenLookup = {};
for (_local1 in this.vars) {
if ((((_local1 in _reservedProps)) && (!((((_local1 == "timeScale")) && ((this.target is TweenCore))))))){
} else {
if ((((_local1 in plugins)) && (new ((plugins[_local1] as Class)).onInitTween(this.target, this.vars[_local1], this)))){
this.cachedPT1 = new PropTween(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true, this.cachedPT1);
if (this.cachedPT1.name == "_MULTIPLE_"){
_local2 = _local3.overwriteProps.length;
while (_local2--) {
this.propTweenLookup[_local3.overwriteProps[_local2]] = this.cachedPT1;
};
} else {
this.propTweenLookup[this.cachedPT1.name] = this.cachedPT1;
};
if (_local3.priority){
this.cachedPT1.priority = _local3.priority;
_local4 = true;
};
if (((_local3.onDisable) || (_local3.onEnable))){
_notifyPluginsOfEnabled = true;
};
_hasPlugins = true;
} else {
this.cachedPT1 = new PropTween(this.target, _local1, Number(this.target[_local1]), ((typeof(this.vars[_local1]))=="number") ? (Number(this.vars[_local1]) - this.target[_local1]) : Number(this.vars[_local1]), _local1, false, this.cachedPT1);
this.propTweenLookup[_local1] = this.cachedPT1;
};
};
};
if (_local4){
onPluginEvent("onInit", this);
};
if (this.vars.runBackwards){
_local6 = this.cachedPT1;
while (_local6) {
_local6.start = (_local6.start + _local6.change);
_local6.change = -(_local6.change);
_local6 = _local6.nextNode;
};
};
_hasUpdate = Boolean(!((this.vars.onUpdate == null)));
if (_overwrittenProps){
killVars(_overwrittenProps);
if (this.cachedPT1 == null){
this.setEnabled(false, false);
};
};
if ((((((((_overwrite > 1)) && (this.cachedPT1))) && (masterList[this.target]))) && ((_local5.length > 1)))){
if (overwriteManager.manageOverwrites(this, this.propTweenLookup, _local5, _overwrite)){
init();
};
};
this.initted = true;
}
public function killVars(_arg1:Object, _arg2:Boolean=true):Boolean{
var _local3:String;
var _local4:PropTween;
var _local5:Boolean;
if (_overwrittenProps == null){
_overwrittenProps = {};
};
for (_local3 in _arg1) {
if ((_local3 in propTweenLookup)){
_local4 = propTweenLookup[_local3];
if (((_local4.isPlugin) && ((_local4.name == "_MULTIPLE_")))){
_local4.target.killProps(_arg1);
if (_local4.target.overwriteProps.length == 0){
_local4.name = "";
};
};
if (_local4.name != "_MULTIPLE_"){
if (_local4.nextNode){
_local4.nextNode.prevNode = _local4.prevNode;
};
if (_local4.prevNode){
_local4.prevNode.nextNode = _local4.nextNode;
} else {
if (this.cachedPT1 == _local4){
this.cachedPT1 = _local4.nextNode;
};
};
if (((_local4.isPlugin) && (_local4.target.onDisable))){
_local4.target.onDisable();
if (_local4.target.activeDisable){
_local5 = true;
};
};
delete propTweenLookup[_local3];
};
};
if (_arg2){
_overwrittenProps[_local3] = 1;
};
};
return (_local5);
}
override public function invalidate():void{
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
onPluginEvent("onDisable", this);
};
this.cachedPT1 = null;
_overwrittenProps = null;
_hasUpdate = (this.initted = (this.active = (_notifyPluginsOfEnabled = false)));
this.propTweenLookup = {};
}
public static function initClass():void{
rootFrame = 0;
rootTimeline = new SimpleTimeline(null);
rootFramesTimeline = new SimpleTimeline(null);
rootTimeline.cachedStartTime = (getTimer() * 0.001);
rootFramesTimeline.cachedStartTime = rootFrame;
rootTimeline.autoRemoveChildren = true;
rootFramesTimeline.autoRemoveChildren = true;
_shape.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
}
public static function killTweensOf(_arg1:Object, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
if ((_arg1 in masterList)){
_local3 = masterList[_arg1];
_local4 = _local3.length;
while (_local4--) {
if (!TweenLite(_local3[_local4]).gc){
if (_arg2){
TweenLite(_local3[_local4]).complete(false, false);
} else {
TweenLite(_local3[_local4]).setEnabled(false, false);
};
};
};
delete masterList[_arg1];
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (new TweenLite(_arg1, _arg2, _arg3));
}
protected static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (1 - (_arg1 / _arg4));
return ((1 - (_arg1 * _arg1)));
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, immediateRender:false, useFrames:_arg4, overwrite:0}));
}
protected static function updateAll(_arg1:Event=null):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Array;
var _local5:int;
rootTimeline.renderTime((((getTimer() * 0.001) - rootTimeline.cachedStartTime) * rootTimeline.cachedTimeScale), false, false);
rootFrame++;
rootFramesTimeline.renderTime(((rootFrame - rootFramesTimeline.cachedStartTime) * rootFramesTimeline.cachedTimeScale), false, false);
if (!(rootFrame % 60)){
_local2 = masterList;
for (_local3 in _local2) {
_local4 = _local2[_local3];
_local5 = _local4.length;
while (_local5--) {
if (TweenLite(_local4[_local5]).gc){
_local4.splice(_local5, 1);
};
};
if (_local4.length == 0){
delete _local2[_local3];
};
};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package com.greensock
Section 15
//Debug (com.hexagonstar.util.debug.Debug)
package com.hexagonstar.util.debug {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public final class Debug {
public static const LEVEL_WARN:int = 2;
public static const LEVEL_DEBUG:int = 0;
public static const LEVEL_INFO:int = 1;
public static const LEVEL_FATAL:int = 4;
public static const LEVEL_ERROR:int = 3;
private static var _stage:Stage;
private static var _filterLevel:int = 0;
private static var _isEnabled:Boolean = true;
private static var _isConnected:Boolean = false;
private static var _isPollingFPS:Boolean = false;
private static var _stopWatch:StopWatch;
private static var _connection:LocalConnection;
private static var _fpsMeter:FPSMeter;
public static function forceGC():void{
try {
} catch(e1:Error) {
try {
new LocalConnection().connect("forceGC");
new LocalConnection().connect("forceGC");
} catch(e2:Error) {
};
};
}
private static function send(_arg1:String, _arg2, _arg3:int=1, _arg4:int=0):void{
var _local5:Number;
var _local6:ByteArray;
if (_isEnabled){
if (!_isConnected){
_isConnected = true;
_connection = new LocalConnection();
_connection.addEventListener(StatusEvent.STATUS, onStatus);
};
_local5 = 0;
if (typeof(_arg2) == "string"){
_local5 = String(_arg2).length;
} else {
if (typeof(_arg2) == "object"){
_local6 = new ByteArray();
_local6.writeObject(_arg2);
_local5 = _local6.length;
_local6 = null;
};
};
if (_local5 > 39000){
storeDataLSO(_arg1, _arg2);
_arg1 = "onLargeData";
_arg2 = null;
};
_connection.send("_alcon_lc", _arg1, _arg2, _arg3, _arg4, "");
};
}
public static function stop():void{
if (_fpsMeter){
_isPollingFPS = false;
_fpsMeter.stop();
_fpsMeter.removeEventListener(FPSMeter.FPS_UPDATE, onFPSUpdate);
_fpsMeter = null;
_stage = null;
};
}
public static function timerReset():void{
if (_stopWatch){
_stopWatch.reset();
};
}
private static function onFPSUpdate(_arg1:Event):void{
send("onFPS", ((((((_fpsMeter.fps + ",") + _stage.frameRate) + ",") + _fpsMeter.frt) + ",") + System.totalMemory));
}
public static function delimiter():void{
Debug.trace("[%DLT%]", 5);
}
public static function set enabled(_arg1:Boolean):void{
_isEnabled = _arg1;
}
public static function inspect(_arg1:Object):void{
send("onInspect", _arg1, 1, -1);
}
public static function timerStart(_arg1:String=""):void{
if (_isEnabled){
if (!_stopWatch){
_stopWatch = new StopWatch();
};
_stopWatch.start(_arg1);
};
}
public static function createCategory(_arg1:int, _arg2:String="", _arg3:uint=0, _arg4:uint=0xFFFF00):void{
send("onCategory", [_arg1, _arg2, _arg3, _arg4], 0, 0);
}
private static function storeDataLSO(_arg1:String, _arg2):void{
var flushResult:String;
var m = _arg1;
var d = _arg2;
var sharedObject:SharedObject = SharedObject.getLocal("alcon", "/");
sharedObject.data["alconMethod"] = m;
sharedObject.data["alconData"] = d;
try {
flushResult = sharedObject.flush();
if (flushResult == SharedObjectFlushStatus.FLUSHED){
return;
};
} catch(e:Error) {
Security.showSettings(SecurityPanel.LOCAL_STORAGE);
};
}
public static function hexDump(_arg1:Object):void{
send("onHexDump", _arg1, 0, 0);
}
private static function onStatus(_arg1:StatusEvent):void{
}
public static function get enabled():Boolean{
return (_isEnabled);
}
public static function trace(... _args):void{
var _local2:int = ((_args[1] is int)) ? _args[1] : 1;
if ((((_local2 >= _filterLevel)) && ((_local2 < 7)))){
send("onData", _args[0], _local2, 0);
};
}
public static function timerToString():void{
if (_stopWatch){
Debug.trace(_stopWatch.toString());
};
}
public static function mark(_arg1:uint=0xFF00FF):void{
send("onMarker", _arg1, 1, -1);
}
public static function timerInSeconds():void{
if (_stopWatch){
Debug.trace((_stopWatch.timeInSeconds + "s"));
};
}
public static function set filterLevel(_arg1:int):void{
if ((((_arg1 >= 0)) && ((_arg1 < 5)))){
_filterLevel = _arg1;
};
}
public static function monitor(_arg1:Stage, _arg2:int=500):void{
if (_isPollingFPS){
Debug.stop();
};
if (((_isEnabled) && (!(_fpsMeter)))){
_isPollingFPS = true;
_stage = _arg1;
sendCapabilities();
_fpsMeter = new FPSMeter(_stage, _arg2);
_fpsMeter.addEventListener(FPSMeter.FPS_UPDATE, onFPSUpdate);
_fpsMeter.start();
};
}
public static function time():void{
Debug.trace("[%TME%]", 5);
}
private static function sendCapabilities():void{
var _local3:XML;
var _local4:String;
var _local1:XML = describeType(Capabilities);
var _local2:Array = [];
for each (_local3 in _local1.*) {
_local4 = _local3.@name.toString();
if ((((((_local4.length > 0)) && (!((_local4 == "_internal"))))) && (!((_local4 == "prototype"))))){
_local2.push({p:_local4, v:Capabilities[_local4].toString()});
};
};
_local2.sortOn(["p"], Array.CASEINSENSITIVE);
send("onCap", _local2);
}
public static function clear():void{
Debug.trace("[%CLR%]", 5);
}
public static function timerStop():void{
if (_stopWatch){
_stopWatch.stop();
};
}
public static function timerInMilliSeconds():void{
if (_stopWatch){
Debug.trace((_stopWatch.timeInMilliSeconds + "ms"));
};
}
public static function get filterLevel():int{
return (_filterLevel);
}
public static function traceObj(_arg1:Object, _arg2:int=64, _arg3:int=1):void{
if ((((_arg3 >= _filterLevel)) && ((_arg3 < 7)))){
send("onData", _arg1, _arg3, _arg2);
};
}
public static function timerStopToString(_arg1:Boolean=false):void{
if (_stopWatch){
_stopWatch.stop();
Debug.trace(_stopWatch.toString());
if (_arg1){
_stopWatch.reset();
};
};
}
public static function pause():void{
Debug.trace("[%PSE%]", 5);
}
}
}//package com.hexagonstar.util.debug
Section 16
//FPSMeter (com.hexagonstar.util.debug.FPSMeter)
package com.hexagonstar.util.debug {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class FPSMeter extends EventDispatcher {
private var _delayMax:int;// = 10
private var _pollInterval:int;
private var _delay:int;
private var _ms:int;
private var _timer:Timer;
private var _prev:int;
private var _frt:int;
private var _fps:int;
private var _isRunning:Boolean;
private var _stage:Stage;
public static const FPS_UPDATE:String = "fpsUpdate";
public function FPSMeter(_arg1:Stage, _arg2:int=500){
_stage = _arg1;
_pollInterval = _arg2;
reset();
}
public function stop():void{
if (_isRunning){
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, onTimer);
_stage.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_timer = null;
reset();
};
}
public function reset():void{
_fps = 0;
_frt = 0;
_ms = 0;
_delay = 0;
_prev = 0;
_isRunning = false;
}
public function start():void{
if (!_isRunning){
_isRunning = true;
_timer = new Timer(_pollInterval, 0);
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
_timer.start();
};
}
private function onTimer(_arg1:TimerEvent):void{
dispatchEvent(new Event(FPSMeter.FPS_UPDATE));
}
public function get frt():int{
return (_frt);
}
public function get fps():int{
return (_fps);
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number = getTimer();
_delay++;
if (_delay >= _delayMax){
_delay = 0;
_fps = int(((1000 * _delayMax) / (_local2 - _prev)));
_prev = _local2;
};
_frt = (_local2 - _ms);
_ms = _local2;
}
}
}//package com.hexagonstar.util.debug
Section 17
//StopWatch (com.hexagonstar.util.debug.StopWatch)
package com.hexagonstar.util.debug {
import flash.utils.*;
public class StopWatch {
private var _stopTimeKeys:Array;
private var _startTimeKeys:Array;
private var _started:Boolean;// = false
private var _title:String;
public function StopWatch(){
reset();
}
public function get started():Boolean{
return (_started);
}
public function get timeInMilliSeconds():int{
if (_started){
_stopTimeKeys[(_startTimeKeys.length - 1)] = getTimer();
};
var _local1:int;
var _local2:int;
while (_local2 < _startTimeKeys.length) {
_local1 = (_local1 + (_stopTimeKeys[_local2] - _startTimeKeys[_local2]));
_local2++;
};
return (_local1);
}
public function stop():void{
var _local1:int;
if (_started){
_local1 = getTimer();
_stopTimeKeys[(_startTimeKeys.length - 1)] = _local1;
_started = false;
};
}
public function toString():String{
var _local3:int;
var _local4:int;
var _local1 = "\n ********************* [STOPWATCH] *********************";
if (_title != ""){
_local1 = (_local1 + ("\n * " + _title));
};
var _local2:int;
while (_local2 < _startTimeKeys.length) {
_local3 = _startTimeKeys[_local2];
_local4 = _stopTimeKeys[_local2];
_local1 = (_local1 + (((((("\n * started [" + format(_local3)) + "ms] stopped [") + format(_local4)) + "ms] time [") + format((_local4 - _local3))) + "ms]"));
_local2++;
};
if (_local2 == 0){
_local1 = (_local1 + "\n * never started.");
} else {
_local1 = (_local1 + (("\n * total runnning time: " + timeInSeconds) + "s"));
};
_local1 = (_local1 + "\n *******************************************************");
return (_local1);
}
public function get timeInSeconds():Number{
return ((timeInMilliSeconds / 1000));
}
public function reset():void{
_startTimeKeys = [];
_stopTimeKeys = [];
_started = false;
}
private function format(_arg1:int):String{
var _local2 = "";
var _local3:int = _arg1.toString().length;
var _local4:int;
while (_local4 < (5 - _local3)) {
_local2 = (_local2 + "0");
_local4++;
};
return ((_local2 + _arg1));
}
public function start(_arg1:String=""):void{
if (!_started){
_title = _arg1;
_started = true;
_startTimeKeys.push(getTimer());
};
}
}
}//package com.hexagonstar.util.debug
Section 18
//Collision (hardcircle.Collision)
package hardcircle {
import flash.display.*;
import flash.geom.*;
public class Collision {
public function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Boolean{
var _local4:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local4 == null))) && ((_local4.size.length > 0)))){
return (true);
};
return (false);
}
private function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:Rectangle):BitmapData{
var _local5:BitmapData = new BitmapData(_arg2.width, _arg2.height, true, 0);
var _local6:Matrix = new Matrix();
var _local7:Number = (_arg1.x - _arg4.x);
var _local8:Number = (_arg1.y - _arg4.y);
var _local9:Number = ((_arg4.x + _local7) - _arg2.x);
var _local10:Number = ((_arg4.y + _local8) - _arg2.y);
_local6.translate(_local9, _local10);
_local5.draw(_arg1, _local6);
var _local11:BitmapData = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local11.copyChannel(_local5, _local5.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local11);
}
public function getCollision(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Rectangle{
var _local4:Rectangle;
var _local5:DisplayObjectContainer;
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Boolean;
var _local9:Rectangle;
var _local10:BitmapData;
var _local11:BitmapData;
var _local12:uint;
var _local13:Number;
if (_arg1.parent == _arg2.parent){
_local5 = _arg1.parent;
_local6 = _arg1.getBounds(_local5);
_local7 = _arg2.getBounds(_local5);
_local8 = _local6.intersects(_local7);
if (_local8){
_local9 = _local6.union(_local7);
_local10 = getAlphaMap(_arg1, _local9, BitmapDataChannel.RED, _local6);
_local11 = getAlphaMap(_arg2, _local9, BitmapDataChannel.GREEN, _local7);
_local10.draw(_local11, new Matrix(), new ColorTransform(), BlendMode.LIGHTEN);
if (_arg3 > 1){
_arg3 = 1;
};
if (_arg3 < 0){
_arg3 = 0;
};
if (_arg3 == 0){
_local12 = 65792;
} else {
_local13 = Math.round((_arg3 * 0xFF));
_local12 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local4 = _local10.getColorBoundsRect(_local12, _local12);
_local10.getColorBoundsRect(_local12, _local12).x = (_local4.x + _local9.x);
_local4.y = (_local4.y + _local9.y);
return (_local4);
};
};
return (_local4);
}
public function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Point{
var _local4:Point;
var _local6:Number;
var _local7:Number;
var _local5:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local5 == null))) && ((_local5.size.length > 0)))){
_local6 = ((_local5.left + _local5.right) / 2);
_local7 = ((_local5.top + _local5.bottom) / 2);
_local4 = new Point(_local6, _local7);
};
return (_local4);
}
}
}//package hardcircle
Section 19
//HUDText (hardcircle.HUDText)
package hardcircle {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
public class HUDText extends Sprite {
private var parentMC;
private var tField:TextField;
private var animTimer:Timer;
private var scrollType:String;
private var tSprite:Sprite;
static const fontBold:Boolean = true;
static const animStepTime:int = 50;
static const myFont = new FUKFONT();
static const fontFace:String = "Arcade Normal";
static const animSteps:int = 15;
public function HUDText(_arg1, _arg2:Object, _arg3, _arg4:Number, _arg5:String, _arg6:Number=24, _arg7:Number=0xFFFFFF){
var tFormat:TextFormat;
var font:FUKFONT;
var mc = _arg1;
var txt = _arg2;
var x = _arg3;
var y = _arg4;
var type = _arg5;
var size = _arg6;
var colour = _arg7;
super();
try {
scrollType = type;
tFormat = new TextFormat();
font = new FUKFONT();
Font.registerFont(FUKFONT);
tFormat.font = myFont.fontName;
tFormat.size = size;
tFormat.bold = fontBold;
tFormat.color = colour;
tFormat.align = "center";
tField = new TextField();
tField.selectable = false;
tField.text = String(txt);
tField.setTextFormat(tFormat);
tField.autoSize = TextFieldAutoSize.CENTER;
tField.x = -((tField.width / 2));
tField.y = -((tField.height / 2));
tSprite = new Sprite();
tSprite.x = x;
tSprite.y = y;
tSprite.scaleX = 0;
tSprite.scaleY = 0;
tSprite.alpha = 0;
tSprite.addChild(tField);
parentMC = mc;
parentMC.addChildAt(tSprite, (parentMC.numChildren - 1));
animTimer = new Timer(animStepTime, animSteps);
animTimer.addEventListener(TimerEvent.TIMER, scrollText);
animTimer.addEventListener(TimerEvent.TIMER_COMPLETE, removeText);
animTimer.start();
} catch(e:Error) {
};
}
private function removeText(_arg1:TimerEvent){
tSprite.removeChild(tField);
parentMC.removeChild(tSprite);
tField = null;
tSprite = null;
delete ??getglobalscope
[this];
}
private function scrollText(_arg1:TimerEvent){
var _local2:Number = (_arg1.target.currentCount / animSteps);
if (scrollType == "burst"){
tSprite.scaleX = (((1 - _local2) * 0) + (_local2 * 2));
tSprite.scaleY = (((1 - _local2) * 0) + (_local2 * 2));
tSprite.alpha = (1 - _local2);
};
if (scrollType == "scrollup"){
tSprite.scaleX = 1;
tSprite.scaleY = 1;
tSprite.y--;
tSprite.alpha = (1 - _local2);
};
if (scrollType == "scrolldown"){
tSprite.scaleX = 1;
tSprite.scaleY = 1;
tSprite.y++;
tSprite.alpha = (1 - _local2);
};
}
}
}//package hardcircle
Section 20
//KeyObject (hardcircle.KeyObject)
package hardcircle {
public class KeyObject {
public static const KEY_LEFT:uint = 37;
public static const KEY_ESC:uint = 27;
public static const KEY_Space:uint = 32;
public static const KEY_UP:uint = 38;
public static const KEY_1:uint = 49;
public static const KEY_2:uint = 50;
public static const KEY_3:uint = 51;
public static const KEY_4:uint = 52;
public static const KEY_5:uint = 53;
public static const KEY_DOWN:uint = 40;
public static const KEY_A:uint = 65;
public static const KEY_D:uint = 68;
public static const KEY_J:uint = 74;
public static const KEY_K:uint = 75;
public static const KEY_L:uint = 76;
public static const KEY_Q:uint = 81;
public static const KEY_R:uint = 82;
public static const KEY_S:uint = 83;
public static const KEY_Z:uint = 90;
public static const KEY_SHIFT:uint = 16;
public static const KEY_W:uint = 87;
public static const KEY_RIGHT:uint = 39;
public static var DOWN_W:Boolean;
public static var DOWN_Shift:Boolean;
public static var DOWN_Space:Boolean;
public static var DOWN_Right:Boolean;
public static var DOWN_Left:Boolean;
public static var DOWN_Mouse:Boolean;
public static var DOWN_ESC:Boolean;
public static var DOWN_Down:Boolean;
public static var DOWN_1:Boolean;
public static var DOWN_2:Boolean;
public static var DOWN_3:Boolean;
public static var DOWN_4:Boolean;
public static var DOWN_5:Boolean;
public static var DOWN_A:Boolean;
public static var DOWN_D:Boolean;
public static var DOWN_J:Boolean;
public static var DOWN_K:Boolean;
public static var DOWN_L:Boolean;
public static var DOWN_Q:Boolean;
public static var DOWN_R:Boolean;
public static var DOWN_S:Boolean;
public static var DOWN_Up:Boolean;
public static var DOWN_Z:Boolean;
public static function initAll(){
DOWN_1 = false;
DOWN_2 = false;
DOWN_3 = false;
DOWN_4 = false;
DOWN_5 = false;
DOWN_A = false;
DOWN_D = false;
DOWN_J = false;
DOWN_K = false;
DOWN_L = false;
DOWN_Q = false;
DOWN_R = false;
DOWN_S = false;
DOWN_W = false;
DOWN_Z = false;
DOWN_Space = false;
DOWN_ESC = false;
DOWN_Mouse = false;
DOWN_Up = false;
DOWN_Right = false;
DOWN_Left = false;
DOWN_Down = false;
DOWN_Shift = false;
}
}
}//package hardcircle
Section 21
//ParticleManager (hardcircle.ParticleManager)
package hardcircle {
import flash.display.*;
public class ParticleManager {
private static const Radians:Number = (180 / Math.PI);
private static var Random:Number = Math.random();
private static var orbitArray:Array;
private static var particleArray:Array;
public static var particleContainer:MovieClip;
private static var particleDriftArray:Array;
public static function addExplosionParticle(_arg1:int, _arg2:Class, _arg3:int, _arg4:int):void{
var _local5:MovieClip;
while (_arg1 > 0) {
_local5 = new (_arg2);
_local5.x = (_arg3 + RandomRange(-20, 20));
_local5.y = (_arg4 + RandomRange(-20, 20));
particleContainer.addChild(_local5);
particleArray.push(_local5);
_arg1--;
};
}
public static function addOrbitParticle(_arg1:Class, _arg2, _arg3:Number=3, _arg4:Number=0.5, _arg5:Number=150, _arg6:String="follow"):void{
var _local7:MovieClip = new (_arg1);
_local7.type = "Orbit";
_local7.target = _arg2;
_local7.originalTarget = _arg2;
_local7.rotation = RandomRange(0, 360);
_local7.x = (_arg2.x + RandomRange(-1, 1));
_local7.y = (_arg2.y + RandomRange(-1, 1));
_local7.speed = _arg3;
_local7.turnRate = _arg4;
_local7.agroRange = _arg5;
_local7.mode = _arg6;
_local7.distanceX = 0;
_local7.distanceY = 0;
_local7.distanceTotal = 0;
_local7.moveDistanceX = 0;
_local7.moveDistanceY = 0;
_local7.moveX = 0;
_local7.moveY = 0;
_local7.totalmove = 0;
particleContainer.addChild(_local7);
orbitArray.push(_local7);
}
private static function RandomRange(_arg1:Number, _arg2:Number){
var _local3:Number = ((Math.random() * (_arg2 - _arg1)) + _arg1);
return (_local3);
}
public static function addStandardParticle(_arg1:Class, _arg2:int, _arg3:int, _arg4:Number=0, _arg5:MovieClip=null):void{
var _local6:MovieClip = new (_arg1);
_local6.x = _arg2;
_local6.y = _arg3;
_local6.rotation = _arg4;
if (_arg5 == null){
particleContainer.addChild(_local6);
} else {
_arg5.addChild(_local6);
};
particleArray.push(_local6);
}
public static function addDriftParticle(_arg1:Class, _arg2:int, _arg3:int, _arg4:int, _arg5:int=0, _arg6:int=0, _arg7:Number=0, _arg8=null):void{
var _local9:MovieClip = new (_arg1);
_local9.x = _arg2;
_local9.y = _arg3;
_local9.rotation = _arg7;
_local9.dx = _arg4;
_local9.dy = _arg5;
_local9.tick = 0;
_local9.to = _arg6;
_local9.flux = 1;
_local9.gotoAndStop(Math.floor(RandomRange(1, 3)));
if (_arg8 == null){
particleContainer.addChild(_local9);
} else {
_arg8.addChild(_local9);
};
particleDriftArray.push(_local9);
}
public static function newParticleArray():void{
orbitArray = new Array();
particleArray = new Array();
particleDriftArray = new Array();
}
public static function updateParticles(){
var _local1:int;
var _local2:MovieClip;
Random = Math.random();
_local1 = (orbitArray.length - 1);
while (_local1 > -1) {
_local2 = orbitArray[_local1];
_local2.distanceX = (_local2.target.x - _local2.x);
_local2.distanceY = (_local2.target.y - _local2.y);
_local2.distanceTotal = Math.sqrt(((_local2.distanceX * _local2.distanceX) + (_local2.distanceY * _local2.distanceY)));
if (_local2.distanceTotal <= _local2.agroRange){
_local2.moveDistanceX = ((_local2.turnRate * _local2.distanceX) / _local2.distanceTotal);
_local2.moveDistanceY = ((_local2.turnRate * _local2.distanceY) / _local2.distanceTotal);
_local2.moveX = (_local2.moveX + _local2.moveDistanceX);
_local2.moveY = (_local2.moveY + _local2.moveDistanceY);
_local2.totalmove = Math.sqrt(((_local2.moveX * _local2.moveX) + (_local2.moveY * _local2.moveY)));
_local2.moveX = ((_local2.speed * _local2.moveX) / _local2.totalmove);
_local2.moveY = ((_local2.speed * _local2.moveY) / _local2.totalmove);
if (_local2.mode == "follow"){
_local2.x = (_local2.x + _local2.moveX);
_local2.y = (_local2.y + _local2.moveY);
_local2.rotation = (Math.atan2(_local2.moveY, _local2.moveX) * Radians);
} else {
if (_local2.mode == "avoid"){
_local2.x = (_local2.x - _local2.moveX);
_local2.y = (_local2.y - _local2.moveY);
_local2.rotation = ((Math.atan2(_local2.moveY, _local2.moveX) * Radians) + 180);
};
};
};
_local1--;
};
_local1 = (particleArray.length - 1);
while (_local1 > -1) {
_local2 = particleArray[_local1];
if (_local2.currentLabel == "end"){
_local2.parent.removeChild(_local2);
particleArray.splice(_local1, 1);
};
_local1--;
};
_local1 = (particleDriftArray.length - 1);
while (_local1 > -1) {
_local2 = particleDriftArray[_local1];
_local2.tick++;
_local2.x = (_local2.x + _local2.dx);
_local2.y = (_local2.y + _local2.dy);
if (_local2.flux == 1){
_local2.scaleX = (_local2.scaleY = (_local2.scaleY - 0.02));
if (_local2.scaleX == 0.5){
_local2.flux = 0;
};
} else {
_local2.scaleX = (_local2.scaleY = (_local2.scaleY + 0.02));
if (_local2.scaleX == 1){
_local2.flux = 1;
};
};
if (_local2.tick >= _local2.to){
_local2.parent.removeChild(_local2);
particleDriftArray.splice(_local1, 1);
};
_local1--;
};
}
}
}//package hardcircle
Section 22
//SoundManager (hardcircle.SoundManager)
package hardcircle {
import flash.media.*;
import flash.events.*;
import flash.utils.*;
public class SoundManager {
private var _sounds:Array;
private var _soundsDict:Dictionary;
private static var NumSounds:int = 0;
private static var _instance:SoundManager;
private static var disableSounds:Boolean = false;
private static var MaxNumSound:int = 10;
private static var _allowInstance:Boolean;
public function SoundManager(){
this._soundsDict = new Dictionary(true);
this._sounds = new Array();
if (!SoundManager._allowInstance){
throw (new Error("Error:Only 1 instance of SoundManager necessary"));
};
}
private function FreeSoundChannel(_arg1:Event):void{
NumSounds--;
}
public function toggleEnableSounds():void{
disableSounds = !(disableSounds);
}
public function stopAllSounds(_arg1:Boolean=true):void{
var _local3:String;
NumSounds = 0;
var _local2:int;
while (_local2 < this._sounds.length) {
_local3 = this._sounds[_local2].name;
if (_arg1){
if (!this._soundsDict[_local3].paused){
this._soundsDict[_local3].pausedByAll = true;
this.stopSound(_local3);
};
} else {
this.stopSound(_local3);
};
_local2++;
};
}
public function muteAllSounds():void{
var _local2:String;
var _local1:int;
while (_local1 < this._sounds.length) {
_local2 = this._sounds[_local1].name;
this.setSoundVolume(_local2, 0);
_local1++;
};
}
public function SoundLimit(_arg1:uint):void{
MaxNumSound = _arg1;
}
public function disableSound():void{
disableSounds = true;
NumSounds = 0;
}
public function enableSound():void{
disableSounds = false;
NumSounds = 0;
}
public function stopSound(_arg1:String):void{
var _local2:Object = this._soundsDict[_arg1];
_local2.paused = true;
_local2.channel.stop();
_local2.position = _local2.channel.position;
}
public function setSoundVolume(_arg1:String, _arg2:Number):void{
var _local3:Object = this._soundsDict[_arg1];
var _local4:SoundTransform = _local3.channel.soundTransform;
_local4.volume = _arg2;
_local3.channel.soundTransform = _local4;
}
public function toString():String{
return (getQualifiedClassName(this));
}
public function addLibrarySound(_arg1, _arg2:String):Boolean{
var _local3:int;
while (_local3 < this._sounds.length) {
if (this._sounds[_local3].name == _arg2){
return (false);
};
_local3++;
};
var _local4:Object = new Object();
var _local5:Sound = new (_arg1);
_local4.name = _arg2;
_local4.sound = _local5;
_local4.channel = new SoundChannel();
_local4.position = 0;
_local4.paused = true;
_local4.volume = 1;
_local4.startTime = 0;
_local4.loops = 0;
_local4.pausedByAll = false;
this._soundsDict[_arg2] = _local4;
this._sounds.push(_local4);
return (true);
}
public function getSoundObject(_arg1:String):Sound{
return (this._soundsDict[_arg1].sound);
}
public function unmuteAllSounds():void{
var _local2:String;
var _local3:Object;
var _local4:SoundTransform;
var _local1:int;
while (_local1 < this._sounds.length) {
_local2 = this._sounds[_local1].name;
_local3 = this._soundsDict[_local2];
_local4 = _local3.channel.soundTransform;
_local4.volume = _local3.volume;
_local3.channel.soundTransform = _local4;
_local1++;
};
}
public function playSound(_arg1:String, _arg2:Number=1, _arg3:Number=0, _arg4:int=0):void{
if ((((NumSounds >= MaxNumSound)) || (disableSounds))){
return;
};
NumSounds++;
var _local5:Object = this._soundsDict[_arg1];
_local5.volume = _arg2;
_local5.startTime = _arg3;
_local5.loops = _arg4;
if (_local5.paused){
_local5.channel = _local5.sound.play(_local5.position, _local5.loops, new SoundTransform(_local5.volume));
} else {
_local5.channel = _local5.sound.play(_arg3, _local5.loops, new SoundTransform(_local5.volume));
};
_local5.paused = false;
_local5.channel.addEventListener(Event.SOUND_COMPLETE, FreeSoundChannel);
}
public static function getInstance():SoundManager{
if (SoundManager._instance == null){
SoundManager._allowInstance = true;
SoundManager._instance = new (SoundManager);
SoundManager._allowInstance = false;
};
return (SoundManager._instance);
}
}
}//package hardcircle
Section 23
//MochiBot (mochi.as3.MochiBot)
package mochi.as3 {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package mochi.as3
Section 24
//bgm_ingame (bgm_ingame)
package {
import flash.media.*;
public dynamic class bgm_ingame extends Sound {
}
}//package
Section 25
//bgm_player (bgm_player)
package {
import flash.media.*;
public dynamic class bgm_player extends Sound {
}
}//package
Section 26
//BtnClick (BtnClick)
package {
import flash.media.*;
public dynamic class BtnClick extends Sound {
}
}//package
Section 27
//Coin (Coin)
package {
import flash.display.*;
public dynamic class Coin extends MovieClip {
}
}//package
Section 28
//ctsjingle (ctsjingle)
package {
import flash.media.*;
public dynamic class ctsjingle extends Sound {
}
}//package
Section 29
//Dodge (Dodge)
package {
import flash.media.*;
public dynamic class Dodge extends Sound {
}
}//package
Section 30
//drop_object (drop_object)
package {
import flash.media.*;
public dynamic class drop_object extends Sound {
}
}//package
Section 31
//DroppedObject (DroppedObject)
package {
import flash.display.*;
public dynamic class DroppedObject extends MovieClip {
}
}//package
Section 32
//Dust (Dust)
package {
import flash.display.*;
public dynamic class Dust extends MovieClip {
public function Dust(){
addFrameScript(13, frame14);
}
function frame14(){
stop();
}
}
}//package
Section 33
//FUKFONT (FUKFONT)
package {
import flash.text.*;
public dynamic class FUKFONT extends Font {
}
}//package
Section 34
//GameMask (GameMask)
package {
import flash.display.*;
public dynamic class GameMask extends Sprite {
}
}//package
Section 35
//GoldFish (GoldFish)
package {
import flash.media.*;
public dynamic class GoldFish extends Sound {
}
}//package
Section 36
//HCjingle (HCjingle)
package {
import flash.media.*;
public dynamic class HCjingle extends Sound {
}
}//package
Section 37
//menu_music (menu_music)
package {
import flash.media.*;
public dynamic class menu_music extends Sound {
}
}//package
Section 38
//Note (Note)
package {
import flash.display.*;
public dynamic class Note extends MovieClip {
}
}//package
Section 39
//Player (Player)
package {
import flash.display.*;
public dynamic class Player extends MovieClip {
public var col_box:MovieClip;
public function Player(){
addFrameScript(24, frame25, 43, frame44);
}
function frame44(){
gotoAndPlay("walk");
}
function frame25(){
gotoAndPlay("idle");
}
}
}//package
Section 40
//Powerup (Powerup)
package {
import flash.display.*;
public dynamic class Powerup extends MovieClip {
}
}//package
Section 41
//rif (rif)
package {
import flash.media.*;
public dynamic class rif extends Sound {
}
}//package
Section 42
//scoreCloseButton (scoreCloseButton)
package {
import flash.display.*;
public dynamic class scoreCloseButton extends MovieClip {
}
}//package
Section 43
//sfx_baby (sfx_baby)
package {
import flash.media.*;
public dynamic class sfx_baby extends Sound {
}
}//package
Section 44
//sfx_chargeup (sfx_chargeup)
package {
import flash.media.*;
public dynamic class sfx_chargeup extends Sound {
}
}//package
Section 45
//sfx_coin (sfx_coin)
package {
import flash.media.*;
public dynamic class sfx_coin extends Sound {
}
}//package
Section 46
//sfx_cooldown (sfx_cooldown)
package {
import flash.media.*;
public dynamic class sfx_cooldown extends Sound {
}
}//package
Section 47
//sfx_fatty (sfx_fatty)
package {
import flash.media.*;
public dynamic class sfx_fatty extends Sound {
}
}//package
Section 48
//sfx_metalframe (sfx_metalframe)
package {
import flash.media.*;
public dynamic class sfx_metalframe extends Sound {
}
}//package
Section 49
//sfx_newAnvil (sfx_newAnvil)
package {
import flash.media.*;
public dynamic class sfx_newAnvil extends Sound {
}
}//package
Section 50
//sfx_piano (sfx_piano)
package {
import flash.media.*;
public dynamic class sfx_piano extends Sound {
}
}//package
Section 51
//sfx_Powerup (sfx_Powerup)
package {
import flash.media.*;
public dynamic class sfx_Powerup extends Sound {
}
}//package
Section 52
//sfx_rock (sfx_rock)
package {
import flash.media.*;
public dynamic class sfx_rock extends Sound {
}
}//package
Section 53
//Shadow (Shadow)
package {
import flash.display.*;
public dynamic class Shadow extends Sprite {
}
}//package
Section 54
//ThrownObject (ThrownObject)
package {
import flash.display.*;
public dynamic class ThrownObject extends MovieClip {
}
}//package
Section 55
//vfx_pop (vfx_pop)
package {
import flash.display.*;
public dynamic class vfx_pop extends MovieClip {
public function vfx_pop(){
addFrameScript(15, frame16);
}
function frame16(){
stop();
}
}
}//package
Section 56
//ZattikkaHiScores (ZattikkaHiScores)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import com.hexagonstar.util.debug.*;
import flash.external.*;
public class ZattikkaHiScores extends MovieClip {
private const EVENT_VIEW_HI_SCORE:String = "ViewHiScore=";
private const MSG_SERVER_ERROR:String = "Could not contact server, please try again in a few minutes.";
private const FB_ACTION:String = "/Facebook.action?";
private const HS_PLATFORM_WEB:int = 0;
private const TEST_SERVER_URL:String = "http://api.staging.zattikka.com";
private const DEV_TEST_MODE_FB:int = 2;
private const EVENT_SUBMIT_HI_SCORE:String = "SubmitHiScore=";
private const DEV_TEST_MODE_G5:int = 1;
private const EVENT_GET_HI_SCORES:String = "GetHiScores=";
private const VERSION_NUM:String = "1.0.15 (AS3)";
private const EVENT_VIEW_HI_SCORES:String = "ViewHiScores=";
private const TW_ACTION:String = "/Twitter.action?";
private const LIVE_SERVER_URL:String = "http://api.zattikka.com";
private const MSG_SUBMITTING_DETAILS:String = "Submitting hi-score details to the server, please wait.";
private const GFTP_URL:String = "http://www.gamesfortheplanet.com";
private const MSG_PLEASE_ENTER_NICKNAME:String = "Please enter your nickname.";
private const EVENT_PUBLISH_HI_SCORE_FEED_EXTERNAL:String = "PublishHiScoreFeedExternal=";
private const EVENT_POST_TWEET:String = "PostTweet=";
private const HS_PLATFORM_FACEBOOK:int = 1;
private const HS_ACTION:String = "/HiScore.action?";
private const EVENT_PUBLISH_HI_SCORE_FEED:String = "PublishHiScoreFeed=";
private const DEV_TEST_MODE_OFF:int = 0;
public var btnGFTP:SimpleButton;
private var gameKey:String;
private var SERVER_URL:String;// = "http://api.zattikka.com"
private var g5UserExists:Boolean;
private var entryScreen:MovieClip;// = null
private var devTestMode:int;// = 0
private var caller:Object;
private var score:Number;
private var g5User:Object;
private var fbUser:Object;
private var cxn:LocalConnection;
private var lowIsBest:Boolean;
private var gameId:Number;
private var infoScreen:MovieClip;// = null
private var levelId:Number;
private var fbSessionKey:String;
public var movEntryScreen:MovieClip;
private var msg1:String;
private var msg2:String;
private var fbUserExists:Boolean;
public var movInfoScreen:MovieClip;
private var gameCode:String;
public function ZattikkaHiScores(){
debug((("[ZattikkaHiScores VERSION " + VERSION_NUM) + "]"));
this.visible = false;
}
private function grabG5User():void{
this.g5User = ExternalInterface.call("getG5User");
this.g5UserExists = ((g5User == null)) ? false : !(isNaN(this.g5User[0]));
if (devTestMode == DEV_TEST_MODE_G5){
this.g5User = new Array("9", "RocketRonz");
this.g5UserExists = ((g5User == null)) ? false : !(isNaN(this.g5User[0]));
};
debug(("[ZattikkaHiScores::grabG5User] " + (g5UserExists) ? ((("userId = " + this.g5User[0]) + ", userName = ") + this.g5User[1]) : "g5User is empty"));
}
private function grabFacebookUser():void{
this.fbUser = ExternalInterface.call("getFBUser");
this.fbUserExists = ((fbUser == null)) ? false : !(isNaN(this.fbUser[0]));
this.fbSessionKey = ExternalInterface.call("getFBSessionKey");
if (devTestMode == DEV_TEST_MODE_FB){
this.fbUser = new Array("1383775213", "Dolphin Gimme-Five");
this.fbUserExists = ((fbUser == null)) ? false : !(isNaN(this.fbUser[0]));
this.fbSessionKey = "ad4dff81c4d2467efc456072-1383775213";
};
debug(("[ZattikkaHiScores::grabFacebookUser] " + (fbUserExists) ? ((((("userId = " + this.fbUser[0]) + ", userName = ") + this.fbUser[1]) + ", sessionKey = ") + this.fbSessionKey) : "fbUser is empty"));
}
private function getRandomString(_arg1:int):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1) {
_local2 = (_local2 + String.fromCharCode(getRandom(48, 122)));
_local3++;
};
return (_local2);
}
public function showInfoMessage(_arg1:String, _arg2:Boolean):void{
infoScreen["txtInfo"].text = _arg1;
infoScreen["btnBack"].visible = _arg2;
infoScreen["btnView"].visible = ((!(_arg2)) && (!(fbUserExists)));
infoScreen.visible = true;
entryScreen.visible = false;
}
private function showEntryScreen():void{
entryScreen["txtMsg1"].text = msg1;
entryScreen["txtMsg2"].text = msg2;
entryScreen["movNameAuto"].visible = ((g5UserExists) || (fbUserExists));
entryScreen["movNameManual"].visible = ((!(g5UserExists)) && (!(fbUserExists)));
entryScreen["movNameAuto"]["txtName"].text = (g5UserExists) ? this.g5User[1] : (fbUserExists) ? this.fbUser[1] : "";
entryScreen["movNameManual"]["txtName"].text = "";
entryScreen.visible = true;
infoScreen.visible = false;
}
private function replaceAll(_arg1:String, _arg2:String, _arg3:String):String{
var _local4 = "";
var _local5:int;
while (_local5 < _arg1.length) {
if (_arg1.charAt(_local5) == _arg2){
_local4 = (_local4 + _arg3);
} else {
_local4 = (_local4 + _arg1.charAt(_local5));
};
_local5++;
};
return (_local4);
}
private function xor(_arg1:String, _arg2:String, _arg3:Boolean):String{
var _local7:int;
var _local4 = "";
var _local5:int;
var _local6:int;
while (_local5 < _arg1.length) {
if (_local6 >= _arg2.length){
_local6 = 0;
};
_local7 = ((_arg1.charCodeAt(_local5) ^ _arg2.charCodeAt(_local6)) + 1);
if (_arg3){
debug(((("charCode = " + _local7) + " = ") + String.fromCharCode(_local7)));
};
_local4 = (_local4 + String.fromCharCode(_local7));
_local5++;
_local6++;
};
return (_local4);
}
private function submitScore():void{
showInfoMessage(MSG_SUBMITTING_DETAILS, false);
infoScreen.visible = true;
entryScreen.visible = false;
var _local1:int = (fbUserExists) ? HS_PLATFORM_FACEBOOK : HS_PLATFORM_WEB;
var _local2 = "";
var _local3 = "";
if (fbUserExists){
_local3 = this.fbUser[0];
_local2 = this.fbUser[1];
} else {
if (g5UserExists){
_local3 = this.g5User[0];
_local2 = this.g5User[1];
} else {
_local2 = entryScreen["movNameManual"]["txtName"].text;
};
};
var _local4:String = String(new Date().getTime());
var _local5:String = _local4.split("").reverse().join("");
var _local6:String = xor(_local5, this.gameKey, false);
var _local7 = "";
_local7 = (_local7 + (this.gameId + ","));
_local7 = (_local7 + (this.levelId + ","));
_local7 = (_local7 + (_local1 + ","));
_local7 = (_local7 + (this.score + ","));
_local7 = (_local7 + (_local3 + ","));
_local7 = (_local7 + (replaceAll(_local2, ",", "") + ","));
_local7 = (_local7 + ",");
_local7 = (_local7 + lowIsBest);
var _local8:String = xor(_local7, _local6, false);
debug(((("key [" + _local6.length) + "] = ") + _local6));
debug(((("plain [" + _local7.length) + "] = ") + _local7));
debug(((("cipher [" + _local8.length) + "] = ") + _local8));
_local8 = ((getRandomString(5) + _local8) + getRandomString(5));
var _local9:URLVariables = new URLVariables();
_local9.gameId = this.gameId;
_local9.platformId = _local1;
_local9.time = _local4;
_local9.data = _local8;
_local9.returnMessage = true;
hitServer(HS_ACTION, EVENT_SUBMIT_HI_SCORE, _local9);
}
private function debug(_arg1:String):void{
trace(_arg1);
Debug.trace(_arg1);
}
public function viewHiScores(_arg1:int, _arg2:Boolean=false):void{
debug(((("[ZattikkaHiScores::viewHiScores] gameId = " + _arg1) + ", testMode = ") + _arg2));
initServerURL(_arg2);
var _local3:String = ((SERVER_URL + HS_ACTION) + EVENT_VIEW_HI_SCORES);
_local3 = (_local3 + ("&gameId=" + _arg1));
navigateToURL(new URLRequest(_local3), "_blank");
}
private function facebookFeedExternal():void{
navigateToURL(new URLRequest(((SERVER_URL + FB_ACTION) + EVENT_PUBLISH_HI_SCORE_FEED_EXTERNAL)), "_blank");
try {
cxn = new LocalConnection();
cxn.allowDomain("*");
cxn.client = this;
cxn.connect("_cxnZattikkaHS");
} catch(err:Error) {
};
}
public function setDetails(_arg1:int, _arg2:int, _arg3:String, _arg4:String, _arg5:Boolean, _arg6:Number, _arg7:String, _arg8:String, _arg9:Boolean=false):void{
var gameId = _arg1;
var levelId = _arg2;
var gameCode = _arg3;
var gameKey = _arg4;
var lowIsBest = _arg5;
var score = _arg6;
var msg1 = _arg7;
var msg2 = _arg8;
var testMode = _arg9;
debug(((((((((((("[ZattikkaHiScores::setDetails] gameId = " + gameId) + ", levelId = ") + levelId) + ", gameCode = ") + gameCode) + ", lowIsBest = ") + lowIsBest) + ", score = ") + score) + ", testMode = ") + testMode));
initServerURL(testMode);
entryScreen = this["movEntryScreen"];
infoScreen = this["movInfoScreen"];
entryScreen.visible = false;
infoScreen.visible = false;
this.gameId = gameId;
this.levelId = levelId;
this.gameCode = gameCode;
this.gameKey = gameKey;
this.lowIsBest = lowIsBest;
this.score = score;
this.msg1 = msg1;
this.msg2 = msg2;
try {
grabG5User();
if (!g5UserExists){
grabFacebookUser();
};
} catch(err:Error) {
};
this["btnGFTP"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
entryScreen["btnSubmit"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
entryScreen["btnTwitter"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
entryScreen["btnFacebook"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
infoScreen["btnView"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
infoScreen["btnBack"].addEventListener(MouseEvent.MOUSE_DOWN, onButtonPress);
if (fbUserExists){
btn_submitScore();
} else {
showEntryScreen();
};
this.visible = true;
}
private function facebookFeed():void{
var _local1:URLVariables = new URLVariables();
_local1.gameId = this.gameId;
_local1.levelId = this.levelId;
_local1.score = this.score;
_local1.sessionKey = this.fbSessionKey;
_local1.returnMessage = true;
hitServer(FB_ACTION, EVENT_PUBLISH_HI_SCORE_FEED, _local1);
}
public function setFBUser(_arg1:String, _arg2:String):void{
debug(((("[ZattikkaHiScores::setFBUser] fbUserId = " + _arg1) + ", fbSessionKey = ") + _arg2));
this.fbUser = new Array(_arg1, "");
this.fbUserExists = true;
this.fbSessionKey = _arg2;
cxn.close();
facebookFeed();
}
public function loadHandler(_arg1:String, _arg2:Boolean, _arg3:Event):void{
var response:URLLoader;
var xml:XML;
var resCode:int;
var stripesEvent = _arg1;
var success = _arg2;
var event = _arg3;
debug(((((("[ZattikkaHiScores::loadHandler] stripesEvent = " + stripesEvent) + ", success = ") + success) + ", event = ") + event.toString()));
if (!success){
if (stripesEvent == EVENT_GET_HI_SCORES){
caller.getHiScores_Error();
} else {
showInfoMessage(MSG_SERVER_ERROR, true);
};
} else {
response = URLLoader(event.target);
xml = new XML(response.data);
resCode = xml.@code;
switch (stripesEvent){
case EVENT_SUBMIT_HI_SCORE:
showInfoMessage(xml.@msg, (resCode == -1));
if (((fbUserExists) && ((((resCode == 1)) || ((resCode == 2)))))){
try {
ExternalInterface.call("refreshFBHiScores", this.score, this.levelId);
ExternalInterface.call("streamPublish_FBConnect", this.msg1, this.levelId);
} catch(err:Error) {
};
};
break;
case EVENT_PUBLISH_HI_SCORE_FEED:
submitScore();
break;
case EVENT_GET_HI_SCORES:
caller.getHiScores_Callback(xml);
break;
};
};
}
private function getRandom(_arg1:Number, _arg2:Number):Number{
return ((Math.floor((Math.random() * ((_arg2 - _arg1) + 1))) + _arg1));
}
private function hitServer(_arg1:String, _arg2:String, _arg3:URLVariables):void{
var stripesAction = _arg1;
var stripesEvent = _arg2;
var vars = _arg3;
debug(((("[ZattikkaHiScores::hitServer] url = " + SERVER_URL) + stripesAction) + stripesEvent));
var request:URLRequest = new URLRequest(((SERVER_URL + stripesAction) + stripesEvent));
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
request.data = vars;
request.method = URLRequestMethod.POST;
request.requestHeaders = new Array(new URLRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"));
loader.addEventListener(Event.COMPLETE, function (_arg1:Event):void{
loadHandler(stripesEvent, true, _arg1);
});
loader.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:Event):void{
loadHandler(stripesEvent, false, _arg1);
});
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (_arg1:Event):void{
loadHandler(stripesEvent, false, _arg1);
});
loader.load(request);
}
private function twitterTweet():void{
var _local1:String = ((SERVER_URL + TW_ACTION) + EVENT_POST_TWEET);
_local1 = (_local1 + ("&gameId=" + this.gameId));
_local1 = (_local1 + ("&levelId=" + this.levelId));
_local1 = (_local1 + ("&score=" + this.score));
navigateToURL(new URLRequest(_local1), "_blank");
submitScore();
}
public function onButtonPress(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "btnGFTP":
navigateToURL(new URLRequest(GFTP_URL), "_blank");
break;
case "btnSubmit":
btn_submitScore();
break;
case "btnTwitter":
if (((((!(this.g5UserExists)) && (!(this.fbUserExists)))) && ((entryScreen["movNameManual"]["txtName"].text.length == 0)))){
showInfoMessage(MSG_PLEASE_ENTER_NICKNAME, true);
} else {
twitterTweet();
};
break;
case "btnFacebook":
if (this.fbUserExists){
facebookFeed();
} else {
facebookFeedExternal();
};
break;
case "btnView":
viewScore();
break;
case "btnBack":
setDetails(this.gameId, this.levelId, this.gameCode, this.gameKey, this.lowIsBest, this.score, this.msg1, this.msg2);
break;
};
}
public function viewScore():void{
var _local1:String = ((SERVER_URL + HS_ACTION) + EVENT_VIEW_HI_SCORE);
_local1 = (_local1 + ("&gameId=" + this.gameId));
_local1 = (_local1 + ("&levelId=" + this.levelId));
_local1 = (_local1 + ("&platformId=" + HS_PLATFORM_WEB));
_local1 = (_local1 + ("&gameCode=" + this.gameCode));
if (this.g5UserExists){
_local1 = (_local1 + ("&userId=" + this.g5User[0]));
} else {
_local1 = (_local1 + ("&name=" + entryScreen["movNameManual"]["txtName"].text));
};
navigateToURL(new URLRequest(_local1), "_blank");
}
private function btn_submitScore():void{
if (((((!(this.g5UserExists)) && (!(this.fbUserExists)))) && ((entryScreen["movNameManual"]["txtName"].text.length == 0)))){
showInfoMessage(MSG_PLEASE_ENTER_NICKNAME, true);
} else {
submitScore();
};
}
public function getHiScores(_arg1:Object, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean, _arg6:Boolean=false):void{
debug(((((((((("[ZattikkaHiScores::getHiScores] gameId = " + _arg2) + ", levelId = ") + _arg3) + ", numRows = ") + _arg4) + ", lowIsBest = ") + _arg5) + ", testMode = ") + _arg6));
initServerURL(_arg6);
this.caller = _arg1;
var _local7:URLVariables = new URLVariables();
_local7.gameId = _arg2;
_local7.levelId = _arg3;
_local7.platformId = 0;
_local7.viewPlatformId = 0;
_local7.userId = "";
_local7.numRows = _arg4;
_local7.lowIsBest = _arg5;
hitServer(HS_ACTION, EVENT_GET_HI_SCORES, _local7);
}
public function initServerURL(_arg1:Boolean):void{
var params:Object;
var fvSvrUrl:Object;
var testMode = _arg1;
if (testMode){
SERVER_URL = TEST_SERVER_URL;
} else {
try {
params = LoaderInfo(this.root.loaderInfo).parameters;
fvSvrUrl = params["svrUrl"];
if (((!((fvSvrUrl == null))) && ((fvSvrUrl.length > 0)))){
SERVER_URL = String(fvSvrUrl);
};
} catch(err:Error) {
};
};
debug(("[ZattikkaHiScores::initServerURL] SERVER_URL = " + SERVER_URL));
}
}
}//package