Section 1
//Link (classes.game.Link)
package classes.game {
import flash.display.*;
public dynamic class Link extends MovieClip {
public var link:MovieClip;
}
}//package classes.game
Section 2
//audio_clips_29 (fish_school_fla.audio_clips_29)
package fish_school_fla {
import flash.display.*;
public dynamic class audio_clips_29 extends MovieClip {
public function audio_clips_29(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package fish_school_fla
Section 3
//CancelButton_26 (fish_school_fla.CancelButton_26)
package fish_school_fla {
import flash.display.*;
import flash.text.*;
public dynamic class CancelButton_26 extends MovieClip {
public var message_text:TextField;
}
}//package fish_school_fla
Section 4
//content_holder_8 (fish_school_fla.content_holder_8)
package fish_school_fla {
import flash.display.*;
public dynamic class content_holder_8 extends MovieClip {
public function content_holder_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package fish_school_fla
Section 5
//link_container_41 (fish_school_fla.link_container_41)
package fish_school_fla {
import flash.display.*;
public dynamic class link_container_41 extends MovieClip {
public var link_bar:MovieClip;
}
}//package fish_school_fla
Section 6
//LoadBar_6 (fish_school_fla.LoadBar_6)
package fish_school_fla {
import flash.display.*;
public dynamic class LoadBar_6 extends MovieClip {
public var Fill:MovieClip;
}
}//package fish_school_fla
Section 7
//PointText_46 (fish_school_fla.PointText_46)
package fish_school_fla {
import flash.display.*;
import flash.text.*;
public dynamic class PointText_46 extends MovieClip {
public var PointText:TextField;
}
}//package fish_school_fla
Section 8
//PreloaderScreen_1 (fish_school_fla.PreloaderScreen_1)
package fish_school_fla {
import flash.display.*;
public dynamic class PreloaderScreen_1 extends MovieClip {
public var loader:LoadBarSymbol;
}
}//package fish_school_fla
Section 9
//SubmitButton_27 (fish_school_fla.SubmitButton_27)
package fish_school_fla {
import flash.display.*;
import flash.text.*;
public dynamic class SubmitButton_27 extends MovieClip {
public var message_text:TextField;
}
}//package fish_school_fla
Section 10
//Background (Background)
package {
import flash.display.*;
public dynamic class Background extends MovieClip {
}
}//package
Section 11
//Bloop_sfx (Bloop_sfx)
package {
import flash.media.*;
public dynamic class Bloop_sfx extends Sound {
}
}//package
Section 12
//Bubble (Bubble)
package {
import flash.display.*;
public class Bubble extends MovieClip {
public var _type:int;
public var _speed:Number;
public var _scale:Number;
public var _spawnState:Boolean;// = true
public var _state:String;
public var _scrollOffsetX:Number;
public function Bubble():void{
_spawnState = true;
super();
deactivate();
}
public function shake():void{
x = (x + (((Math.random() * 6) + 1) - 3));
}
public function activate():void{
_state = "Active";
_speed = (((Math.random() * 3) * 1.25) + 4);
x = (Math.random() * 640);
y = (480 + height);
_scale = (((Math.random() * 30) + 30) / 100);
scaleX = _scale;
scaleY = _scale;
alpha = 0.4;
visible = true;
_spawnState = false;
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update(_arg1:Number):void{
switch (_state){
case "Active":
x = (x - _scrollOffsetX);
y = (y - _speed);
shake();
if (y < -(height)){
deactivate();
};
break;
};
}
}
}//package
Section 13
//BubbleManager (BubbleManager)
package {
import flash.display.*;
import flash.utils.*;
public class BubbleManager extends MovieClip {
public var active:Array;
public var bubbles:Array;
private var spawnInitTime:Number;
private var spawnDelay:Number;// = 0.25
public function BubbleManager():void{
bubbles = new Array();
active = new Array();
spawnDelay = 0.25;
spawnInitTime = getTimer();
super();
}
public function init(_arg1:Number):void{
var _local2:int;
_local2 = 0;
while (_local2 < _arg1) {
bubbles[_local2] = new Bubble();
addChild(bubbles[_local2]);
_local2++;
};
}
public function deactivateAllBubbles():void{
var _local1:int;
var _local2:int;
_local2 = bubbles.length;
_local1 = 0;
while (_local1 < _local2) {
bubbles[_local1].deactivate();
bubbles[_local1]._spawnState = true;
_local1++;
};
active = new Array();
}
public function spawn():void{
var bubble_index:int;
bubble_index = inactive_bubble();
if (bubble_index >= 0){
var _local2 = bubbles[bubble_index];
with (_local2) {
activate();
x = (Math.random() * GameManager.screenWidth);
y = (GameManager.screenHeight + height);
_scale = (((Math.random() * 25) + 25) / 100);
scaleX = _scale;
scaleY = _scale;
_scrollOffsetX = 0;
active.push(bubbles[bubble_index]);
};
};
}
public function spawnCheck():void{
if (GameManager.elapsedTime(spawnInitTime) > spawnDelay){
spawnInitTime = getTimer();
spawn();
};
}
public function update(_arg1:Number):void{
var index:int;
var bubble_count:int;
var elapsedTime = _arg1;
bubble_count = active.length;
index = 0;
while (index < bubble_count) {
var _local3 = active[index];
with (_local3) {
if (_state == "Inactive"){
_spawnState = true;
active.splice(index, 1);
index--;
bubble_count--;
} else {
update(elapsedTime);
};
};
index = (index + 1);
};
}
public function inactive_bubble():int{
var _local1:int;
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = bubbles.length;
_local1 = 0;
while (_local1 < _local3) {
if (bubbles[_local1]._spawnState){
_local2 = _local1;
break;
};
_local1++;
};
return (_local2);
}
}
}//package
Section 14
//CreditsScreen (CreditsScreen)
package {
import flash.events.*;
import flash.display.*;
public class CreditsScreen extends MovieClip {
public var _state:String;
public var Continue:MovieClip;
public function CreditsScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
}
public function check_rollovers(){
if (Continue.hitTestPoint(mouseX, mouseY)){
Continue.scaleX = 1.25;
Continue.scaleY = 1.25;
} else {
Continue.scaleX = 1;
Continue.scaleY = 1;
};
}
public function menu_mouseUp(_arg1:MouseEvent){
if (Continue.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "MainMenu";
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package
Section 15
//Fish (Fish)
package {
import flash.geom.*;
import flash.display.*;
public class Fish extends MovieClip {
public var _waiting:Boolean;// = false
public var _type:int;
public var collision_box:MovieClip;
public var _speed:Number;
public var _scale:Number;
public var _topSpeed:Number;// = 300
public var _rotationSpeed;// = 10
public var _initTime:Number;
public var _history:Array;
public var _spawnState:Boolean;// = true
public var _schooling:Boolean;// = false
public var _lastX:Number;
public var _lastY:Number;
public var _defaultSpeed:Number;// = 180
public var _state:String;
public var _facing:Number;
public var _schoolIndex:int;
public function Fish():void{
_defaultSpeed = 180;
_topSpeed = 300;
_rotationSpeed = 10;
_spawnState = true;
_history = new Array();
_waiting = false;
_schooling = false;
super();
deactivate();
}
public function rotateLeft():void{
_facing = (_facing - _rotationSpeed);
}
public function activate():void{
_state = "Active";
visible = true;
_spawnState = false;
}
public function resetHistory():void{
_history = new Array();
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function bob():void{
y = (y + ((((Math.random() * 5) + 1) - 3.5) / 2));
}
public function rotateRight():void{
_facing = (_facing + _rotationSpeed);
}
public function update(_arg1:Number):void{
var _local2:Point;
switch (_state){
case "Player":
x = (x + ((_speed * _arg1) * Math.cos(((_facing * Math.PI) / 180))));
y = (y + ((_speed * _arg1) * Math.sin(((_facing * Math.PI) / 180))));
rotation = (_facing + 180);
_local2 = new Point(x, y);
_history.push(_local2);
break;
case "Schooling":
_facing = ((smallzMath.getAngle(_lastX, _lastY, x, y) / Math.PI) * 180);
rotation = (_facing + 180);
bob();
_lastX = x;
_lastY = y;
break;
case "Active":
bob();
break;
};
}
}
}//package
Section 16
//fish_school (fish_school)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public dynamic class fish_school extends MovieClip {
private var load_percent:Number;
private var UI_HighScores:HighScoresScreen;
private var UI_MainMenu:MainMenuScreen;
public var PopUp_UI:PopUp;
public var BubbleControl:BubbleManager;
private var UI_Submit:SubmitScoreScreen;
public var KeyboardControl:smallzKeyboardManager;
private var TheBackground:Background;
private var UI_Pause:PauseScreen;
private var UI_HintPrompt:HintPrompt;
private var Fish_Count:int;// = 50
public var ScorePopUpControl:ScorePopUpManager;
private var UI_Instructions:InstructionsScreen;
public var MessageControl:MessageManager;
public var HighScoreControl:HighScoreManager;
private var Soundtrack:SoundtrackMusic;
public var FishControl:FishManager;
private var UI_Credits:CreditsScreen;
private var UI_Game:GameUIScreen;
public var load_screen:MovieClip;
private var PlayerFish:Fish;
public static var SFX_Bloop:Bloop_sfx;
public function fish_school(){
Fish_Count = 50;
super();
addFrameScript(0, frame1, 2, frame3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
Security.loadPolicyFile("http://games.smallzworld.com/crossdomain.xml");
}
public function preload(){
stop();
this.addEventListener(Event.ENTER_FRAME, showProgress);
}
private function process_input(){
if (KeyboardControl.isPressed(37)){
PlayerFish.rotateLeft();
};
if (KeyboardControl.isPressed(38)){
PlayerFish._speed = PlayerFish._topSpeed;
} else {
PlayerFish._speed = PlayerFish._defaultSpeed;
};
if (KeyboardControl.isPressed(39)){
PlayerFish.rotateRight();
};
if (KeyboardControl.isPressed(40)){
};
if (KeyboardControl.isPressed(32)){
if (GameManager.gameState == "HintPrompt"){
UI_HintPrompt.visible = false;
GameManager.gameState = "Game";
};
};
}
public function mouseUp_handler(_arg1:MouseEvent){
var _local2:URLRequest;
switch (GameManager.gameState){
case "Game":
break;
case "MainMenu":
UI_MainMenu.menu_mouseUp(_arg1);
if (MessageControl.messagePod.hitTestPoint(mouseX, mouseY)){
_local2 = new URLRequest(MessageControl.messagePod._linkURL);
navigateToURL(_local2);
};
if (GameManager.gameState != "MainMenu"){
MessageControl.messagePod.visible = false;
};
break;
case "Instructions":
UI_Instructions.menu_mouseUp(_arg1);
break;
case "HintPrompt":
break;
case "Credits":
UI_Credits.menu_mouseUp(_arg1);
break;
case "Pause":
UI_Pause.menu_mouseUp(_arg1);
break;
case "HighScores":
UI_HighScores.menu_mouseUp(_arg1);
break;
case "GameOver":
UI_Submit.menu_mouseUp(_arg1);
break;
};
}
public function initApplication(){
var _local1:int;
Soundtrack = new SoundtrackMusic();
SFX_Bloop = new Bloop_sfx();
TheBackground = new Background();
TheBackground.cacheAsBitmp = true;
addChild(TheBackground);
TheBackground.x = 0;
TheBackground.y = 0;
BubbleControl = new BubbleManager();
addChild(BubbleControl);
BubbleControl.init(5);
FishControl = new FishManager();
addChild(FishControl);
PlayerFish = new Fish();
PlayerFish.gotoAndStop(1);
addChild(PlayerFish);
FishControl.init(50, PlayerFish);
UI_Game = new GameUIScreen();
addChild(UI_Game);
UI_MainMenu = new MainMenuScreen();
addChild(UI_MainMenu);
UI_Instructions = new InstructionsScreen();
addChild(UI_Instructions);
UI_Credits = new CreditsScreen();
addChild(UI_Credits);
UI_Pause = new PauseScreen();
addChild(UI_Pause);
UI_HighScores = new HighScoresScreen();
addChild(UI_HighScores);
UI_Submit = new SubmitScoreScreen();
addChild(UI_Submit);
UI_HintPrompt = new HintPrompt();
addChild(UI_HintPrompt);
UI_HintPrompt.visible = false;
UI_HintPrompt.x = ((GameManager.screenWidth / 2) - 150);
UI_HintPrompt.y = ((GameManager.screenHeight / 2) - 150);
PopUp_UI = new PopUp();
addChild(PopUp_UI);
ScorePopUpControl = new ScorePopUpManager();
addChild(ScorePopUpControl);
ScorePopUpControl.init(5);
MessageControl = new MessageManager();
addChild(MessageControl.messagePod);
HighScoreControl = new HighScoreManager();
KeyboardControl = new smallzKeyboardManager();
addChild(KeyboardControl);
KeyboardControl.init();
stage.addEventListener(Event.ENTER_FRAME, main_loop);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp_handler);
stage.focus = this;
Soundtrack.play(0, 999);
}
private function main_loop(_arg1:Event){
var _local2:Number;
_local2 = GameManager.clock_pulse();
process_input();
BubbleControl.spawnCheck();
BubbleControl.update(_local2);
switch (GameManager.gameState){
case "Game":
if (UI_Game._state == "Inactive"){
UI_Game.activate();
PlayerFish.activate();
PlayerFish._state = "Player";
PlayerFish._speed = 200;
PlayerFish._facing = 180;
PlayerFish.x = (GameManager.screenWidth / 2);
PlayerFish.y = (GameManager.screenHeight / 2);
PlayerFish._scale = 0.75;
PlayerFish.scaleX = PlayerFish._scale;
PlayerFish.scaleY = PlayerFish._scale;
FishControl.schoolCount = 0;
};
if (GameManager.spawnFish){
FishControl.spawn();
GameManager.spawnFish = false;
};
PlayerFish.update(_local2);
FishControl.update(_local2);
FishControl.collsionPlayerFish(ScorePopUpControl);
ScorePopUpControl.update(_local2);
UI_Game.score.text = ("Score " + GameManager.playerScore);
break;
case "MainMenu":
if (UI_MainMenu._state == "Inactive"){
UI_MainMenu.activate();
UI_Game.deactivate();
if (!MessageControl._messageLoaded){
MessageControl.load_message(GameManager.gameID);
};
};
if (MessageControl._messageLoaded){
MessageControl.display_message(163, 145);
};
UI_MainMenu.check_rollovers();
break;
case "HintPrompt":
if (!UI_HintPrompt.visible){
UI_HintPrompt.visible = true;
};
break;
case "Instructions":
if (UI_Instructions._state == "Inactive"){
UI_Instructions.activate();
};
UI_Instructions.check_rollovers();
break;
case "Credits":
if (UI_Credits._state == "Inactive"){
UI_Credits.activate();
};
UI_Credits.check_rollovers();
break;
case "GameOver":
if (UI_Submit._state == "Inactive"){
UI_Submit.activate();
};
UI_Submit.check_rollovers();
break;
case "Pause":
if (UI_Pause._state == "Inactive"){
UI_Pause.activate();
};
break;
case "SaveHighScore":
HighScoreControl.save_highscore(GameManager.gameID, 0, UI_Submit.user_name.text, GameManager.level, GameManager.playerScore, 0, "No Comment");
break;
case "HighScores":
if (UI_HighScores._state == "Inactive"){
UI_HighScores.activate();
HighScoreControl.load_highscores(GameManager.gameID);
};
if (GameManager._highScoresLoaded){
UI_HighScores.update();
GameManager._highScoresLoaded = false;
};
UI_HighScores.check_rollovers();
break;
case "Reset":
GameManager.resetGame();
PlayerFish.resetHistory();
FishControl.deactivateAllFish();
GameManager.hintInitTime = getTimer();
GameManager.gameState = "HintPrompt";
break;
};
}
function frame3(){
stop();
}
function frame1(){
preload();
}
public function adFinished():void{
load_screen.visible = false;
GameManager.gameState = "MainMenu";
gotoAndPlay(2);
initApplication();
}
public function showAds(){
stop();
MochiAd.showPreGameAd({clip:root, id:"9c65d1ab0af866f4", res:"640x480", ad_finished:adFinished});
}
public function showProgress(_arg1:Event):void{
load_percent = Math.round(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
load_screen.loader.load_bar.Fill.width = (198 * (load_percent / 100));
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
this.removeEventListener(Event.ENTER_FRAME, showProgress);
load_screen.visible = false;
showAds();
};
}
public function object_manager(_arg1:TimerEvent){
var _local2:int;
_local2 = int(((Math.random() * 3) + 1));
switch (_local2){
case 1:
break;
case 2:
break;
case 3:
break;
};
}
}
}//package
Section 17
//FishManager (FishManager)
package {
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
public class FishManager extends MovieClip {
public var active:Array;
public var fish:Array;
public var maxPoints:Number;// = 5000
public var schoolCount:int;
public var maxScoreDelay:Number;// = 7
public var spawnFishScale;// = 0.35
public var spawnInitTime:Number;
public var spawnDelay:Number;// = 1.25
public var PlayerFish:Fish;
public function FishManager():void{
fish = new Array();
active = new Array();
spawnDelay = 1.25;
spawnInitTime = getTimer();
spawnFishScale = 0.35;
maxPoints = 5000;
maxScoreDelay = 7;
super();
}
public function init(_arg1:Number, _arg2:Fish):void{
var _local3:int;
PlayerFish = _arg2;
_local3 = 0;
while (_local3 < _arg1) {
fish[_local3] = new Fish();
fish[_local3].cacheAsBitmap = true;
addChild(fish[_local3]);
fish[_local3]._type = 1;
fish[_local3].gotoAndStop(fish[_local3]._type);
_local3++;
};
}
public function inactiveFish():int{
var _local1:int;
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = fish.length;
_local1 = 0;
while (_local1 < _local3) {
if (fish[_local1]._spawnState){
_local2 = _local1;
break;
};
_local1++;
};
return (_local2);
}
public function collsionPlayerFish(_arg1:ScorePopUpManager):void{
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = active.length;
if ((((((((PlayerFish.x < 20)) || ((PlayerFish.x > 620)))) || ((PlayerFish.y > 460)))) || ((PlayerFish.y < 20)))){
GameManager.gameState = "GameOver";
};
_local2 = 0;
while (_local2 < _local3) {
if (active[_local2]._waiting){
if (active[_local2].hitTestObject(PlayerFish)){
fish_school.SFX_Bloop.play();
schoolCount++;
active[_local2]._state = "Schooling";
active[_local2]._schoolIndex = (PlayerFish._history.length - (schoolCount * 8));
PlayerFish._schooling = true;
GameManager.spawnFish = true;
active[_local2]._waiting = false;
_local4 = GameManager.elapsedTime(active[_local2]._initTime);
if (_local4 < maxScoreDelay){
_local5 = ((maxScoreDelay - _local4) / maxScoreDelay);
_local6 = int((maxPoints * _local5));
} else {
_local6 = 0;
};
_arg1.activate(active[_local2].x, active[_local2].y, _local6);
GameManager.playerScore = (GameManager.playerScore + _local6);
};
} else {
if (active[_local2].hitTestObject(PlayerFish.collision_box)){
GameManager.gameState = "GameOver";
};
};
_local2++;
};
}
public function spawn():void{
var fish_index:int;
var randomLoc:Point;
fish_index = inactiveFish();
if (fish_index >= 0){
var _local2 = fish[fish_index];
with (_local2) {
randomLoc = validSpawnPoint();
activate();
rotation = 0;
_waiting = true;
x = randomLoc.x;
y = randomLoc.y;
_type = (int((Math.random() * 5)) + 2);
_scale = spawnFishScale;
scaleX = _scale;
scaleY = _scale;
_initTime = getTimer();
gotoAndStop(_type);
active.push(fish[fish_index]);
};
};
}
public function deactivateAllFish():void{
var _local1:int;
var _local2:int;
_local2 = fish.length;
_local1 = 0;
while (_local1 < _local2) {
fish[_local1].deactivate();
fish[_local1]._spawnState = true;
_local1++;
};
active = new Array();
}
public function spawnCheck():void{
if (GameManager.elapsedTime(spawnInitTime) > spawnDelay){
spawnInitTime = getTimer();
spawn();
};
}
public function update(_arg1:Number):void{
var index:int;
var fish_count:int;
var elapsedTime = _arg1;
fish_count = active.length;
index = 0;
while (index < fish_count) {
var _local3 = active[index];
with (_local3) {
if (_state == "Inactive"){
_spawnState = true;
active.splice(index, 1);
index--;
fish_count--;
} else {
if (_state == "Schooling"){
x = PlayerFish._history[_schoolIndex].x;
y = PlayerFish._history[_schoolIndex].y;
_schoolIndex++;
};
update(elapsedTime);
};
};
index = (index + 1);
};
}
public function validSpawnPoint():Point{
var _local1:Boolean;
var _local2:Point;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:int;
var _local7:int;
_local1 = false;
_local6 = active.length;
_local7 = 0;
while (((!(_local1)) && ((_local7 < 300)))) {
_local3 = ((Math.random() * (GameManager.screenWidth - 100)) + 50);
_local4 = ((Math.random() * (GameManager.screenHeight - 100)) + 50);
_local2 = new Point(_local3, _local4);
_local1 = true;
_local5 = 0;
while (_local5 < _local6) {
if (smallzMath.get_distance(active[_local5].x, active[_local5].y, _local3, _local4) < 100){
_local1 = false;
};
_local5++;
};
if (smallzMath.get_distance(PlayerFish.x, PlayerFish.y, _local3, _local4) < 100){
_local1 = false;
};
_local7++;
};
if (_local7 == 300){
_local3 = ((Math.random() * (GameManager.screenWidth - 100)) + 50);
_local4 = ((Math.random() * (GameManager.screenHeight - 100)) + 50);
_local2 = new Point(_local3, _local4);
};
return (_local2);
}
}
}//package
Section 18
//GameManager (GameManager)
package {
import flash.utils.*;
public class GameManager {
public static var _highScores:Array;
public static var level:int = 1;
public static var gameID:int = 16;
public static var Debug:Boolean = false;
public static var clockPulseInitTime:Number = getTimer();
public static var health:Number = 100;
public static var spawnFish:Boolean = true;
public static var hintInitTime:Number;
public static var levelPromptInitTime:Number;
public static var _highScoresLoaded:Boolean = false;
public static var playerScore:uint = 0;
public static var screenHeight:Number = 480;
public static var screenWidth:Number = 640;
public static var hintDuration:Number = 5;
public static var levelPromptDuration:Number;
public static var initTime:Number;
public static var gameState:String = "MainMenu";
public function GameManager():void{
}
public static function timeString(_arg1:int):String{
var _local2:int;
var _local3:String;
_local2 = Math.floor((_arg1 / 60));
_arg1 = (_arg1 - (_local2 * 60));
_local3 = ((_local2 + ":") + String((_arg1 + 100)).substr(1, 2));
return (_local3);
}
public static function increment_score(_arg1:uint):void{
playerScore = (playerScore + _arg1);
}
public static function resetGame():void{
playerScore = 0;
health = 100;
level = 1;
spawnFish = true;
gameState = "Game";
}
public static function clock_pulse():Number{
var _local1:Number;
_local1 = elapsedTime(clockPulseInitTime);
clockPulseInitTime = getTimer();
return (_local1);
}
public static function decrement_health(_arg1:Number):void{
health = (health - _arg1);
if (health < 0){
health = 0;
};
}
public static function increment_health(_arg1:Number):void{
health = (health + _arg1);
if (health > 100){
health = 100;
};
}
public static function elapsedTime(_arg1:Number):Number{
var _local2:Number;
_local2 = ((getTimer() - _arg1) / 1000);
return (_local2);
}
}
}//package
Section 19
//GameUIScreen (GameUIScreen)
package {
import flash.display.*;
import flash.text.*;
public class GameUIScreen extends MovieClip {
public var score:TextField;
public var _state:String;
public function GameUIScreen():void{
x = 0;
y = 0;
deactivate();
}
public function activate():void{
_state = "Active";
visible = true;
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package
Section 20
//GrayBallSymbol (GrayBallSymbol)
package {
import flash.display.*;
public dynamic class GrayBallSymbol extends MovieClip {
}
}//package
Section 21
//HighScoreListingSymbol (HighScoreListingSymbol)
package {
import flash.display.*;
import flash.text.*;
public dynamic class HighScoreListingSymbol extends MovieClip {
public var User:TextField;
public var Rank:TextField;
public var Score:TextField;
}
}//package
Section 22
//HighScoreManager (HighScoreManager)
package {
import flash.events.*;
import flash.net.*;
public class HighScoreManager {
public function HighScoreManager():void{
}
private function highscores_handler(_arg1:Event):void{
var _local2:URLLoader;
var _local3:int;
var _local4:Array;
_local2 = URLLoader(_arg1.target);
_local4 = new Array();
_local3 = 1;
while (_local3 <= 10) {
if (_local2.data[("Score_" + _local3)]){
_local4[(_local3 - 1)] = new HighScoreRecord(_local3, _local2.data[("User_" + _local3)], _local2.data[("Score_" + _local3)], 0, "");
};
_local3++;
};
GameManager._highScores = _local4;
GameManager._highScoresLoaded = true;
GameManager.gameState = "HighScores";
}
private function save_highscore_handler(_arg1:Event):void{
var _local2:URLLoader;
var _local3:int;
_local2 = URLLoader(_arg1.target);
GameManager.gameState = "HighScores";
}
public function load_highscores(_arg1:int):void{
var _local2:URLRequest;
var _local3:URLVariables;
var _local4:URLLoader;
_local2 = new URLRequest("http://games.smallzworld.com/RecordManagement.php");
_local3 = new URLVariables();
_local3.Routine = "AS3LoadHighScores";
_local3.Game_ID = _arg1;
_local2.data = _local3;
_local4 = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.addEventListener(Event.COMPLETE, highscores_handler);
_local4.load(_local2);
GameManager.gameState = "Loading";
GameManager._highScoresLoaded = false;
}
public function save_highscore(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:String):void{
var _local8:URLRequest;
var _local9:URLVariables;
var _local10:URLLoader;
_local8 = new URLRequest("http://games.smallzworld.com/RecordManagement.php");
_local9 = new URLVariables();
_local9.Routine = "AddHighScore";
_local9.Game_ID = _arg1;
_local9.Profile_ID = _arg2;
_local9.UserName = _arg3;
_local9.Level = _arg4;
_local9.Score = _arg5;
_local9.TimeScore = _arg6;
_local9.Comment = _arg7;
_local8.data = _local9;
_local10 = new URLLoader();
_local10.dataFormat = URLLoaderDataFormat.VARIABLES;
_local10.addEventListener(Event.COMPLETE, save_highscore_handler);
_local10.load(_local8);
GameManager.gameState = "Saving";
}
}
}//package
Section 23
//HighScoreRecord (HighScoreRecord)
package {
public class HighScoreRecord {
public var _comment:String;
public var _level:int;
public var _rank:int;
public var _user:String;
public var _score:Number;
public function HighScoreRecord(_arg1:int, _arg2:String, _arg3:Number, _arg4:int, _arg5:String):void{
_rank = _arg1;
_user = _arg2;
_score = _arg3;
_level = _arg4;
_comment = _arg5;
}
}
}//package
Section 24
//HighScoresScreen (HighScoresScreen)
package {
import flash.events.*;
import flash.display.*;
public class HighScoresScreen extends MovieClip {
public var score_10:HighScoreListingSymbol;
public var _state:String;
public var score_2:HighScoreListingSymbol;
public var score_6:HighScoreListingSymbol;
public var score_7:HighScoreListingSymbol;
public var score_9:HighScoreListingSymbol;
public var score_3:HighScoreListingSymbol;
public var Continue:MovieClip;
public var score_5:HighScoreListingSymbol;
public var score_8:HighScoreListingSymbol;
public var score_1:HighScoreListingSymbol;
public var score_4:HighScoreListingSymbol;
public function HighScoresScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
var _local1:int;
_state = "Active";
visible = true;
_local1 = 1;
while (_local1 <= 10) {
this[("score_" + _local1)].visible = false;
_local1++;
};
}
public function check_rollovers():void{
if (Continue.hitTestPoint(mouseX, mouseY)){
Continue.scaleX = 1.25;
Continue.scaleY = 1.25;
} else {
Continue.scaleX = 1;
Continue.scaleY = 1;
};
}
public function menu_mouseUp(_arg1:MouseEvent):void{
if (Continue.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "MainMenu";
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
var index:int;
var score_count:int;
var score_index:int;
score_count = GameManager._highScores.length;
index = 0;
while (index < score_count) {
var _local2 = GameManager;
with (_local2) {
score_index = (index + 1);
this[("score_" + score_index)].Rank.text = String(_highScores[index]._rank);
this[("score_" + score_index)].Score.text = String(_highScores[index]._score);
this[("score_" + score_index)].User.text = _highScores[index]._user;
this[("score_" + score_index)].visible = true;
};
index = (index + 1);
};
}
}
}//package
Section 25
//HintPrompt (HintPrompt)
package {
import flash.display.*;
import flash.text.*;
public dynamic class HintPrompt extends MovieClip {
public var message_text:TextField;
}
}//package
Section 26
//InstructionsScreen (InstructionsScreen)
package {
import flash.events.*;
import flash.display.*;
public class InstructionsScreen extends MovieClip {
public var _state:String;
public var Continue:MovieClip;
public function InstructionsScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
}
public function check_rollovers():void{
if (Continue.hitTestPoint(mouseX, mouseY)){
Continue.scaleX = 1.25;
Continue.scaleY = 1.25;
} else {
Continue.scaleX = 1;
Continue.scaleY = 1;
};
}
public function menu_mouseUp(_arg1:MouseEvent):void{
if (Continue.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "MainMenu";
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package
Section 27
//LoadBarSymbol (LoadBarSymbol)
package {
import flash.display.*;
public dynamic class LoadBarSymbol extends MovieClip {
public var load_bar:MovieClip;
}
}//package
Section 28
//MainMenuScreen (MainMenuScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class MainMenuScreen extends MovieClip {
public var PlayGame:MovieClip;
public var HighScores:MovieClip;
public var _state:String;
public var Credits:MovieClip;
public var Instructions:MovieClip;
public var LeaderBoards:MovieClip;
public var Smallzworld:MovieClip;
public function MainMenuScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
}
public function check_rollovers():void{
if (PlayGame.hitTestPoint(mouseX, mouseY)){
PlayGame.scaleX = 1.25;
PlayGame.scaleY = 1.25;
} else {
PlayGame.scaleX = 1;
PlayGame.scaleY = 1;
};
if (Instructions.hitTestPoint(mouseX, mouseY)){
Instructions.scaleX = 1.25;
Instructions.scaleY = 1.25;
} else {
Instructions.scaleX = 1;
Instructions.scaleY = 1;
};
if (Credits.hitTestPoint(mouseX, mouseY)){
Credits.scaleX = 1.25;
Credits.scaleY = 1.25;
} else {
Credits.scaleX = 1;
Credits.scaleY = 1;
};
if (HighScores.hitTestPoint(mouseX, mouseY)){
HighScores.scaleX = 1.25;
HighScores.scaleY = 1.25;
} else {
HighScores.scaleX = 1;
HighScores.scaleY = 1;
};
if (Smallzworld.hitTestPoint(mouseX, mouseY)){
Smallzworld.scaleX = 1.25;
Smallzworld.scaleY = 1.25;
} else {
Smallzworld.scaleX = 1;
Smallzworld.scaleY = 1;
};
if (LeaderBoards.hitTestPoint(mouseX, mouseY)){
LeaderBoards.scaleX = 1.25;
LeaderBoards.scaleY = 1.25;
} else {
LeaderBoards.scaleX = 1;
LeaderBoards.scaleY = 1;
};
}
public function menu_mouseUp(_arg1:MouseEvent){
var _local2:URLRequest;
var _local3:URLRequest;
if (PlayGame.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "Reset";
};
if (Instructions.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "Instructions";
};
if (Credits.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "Credits";
};
if (HighScores.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "HighScores";
};
if (LeaderBoards.hitTestPoint(_arg1.stageX, _arg1.stageY)){
_local2 = new URLRequest(("http://games.smallzworld.com/Main.php?PageType=DisplayHighScores&Game_ID=" + GameManager.gameID));
navigateToURL(_local2);
};
if (Smallzworld.hitTestPoint(_arg1.stageX, _arg1.stageY)){
_local3 = new URLRequest("http://games.smallzworld.com/");
navigateToURL(_local3);
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package
Section 29
//Message (Message)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class Message extends MovieClip {
public var loader:Loader;
public var _messageText:String;
public var imageIcon:MovieClip;
public var message_text:TextField;
public var _imageLoaded:Boolean;// = false
public var _imageURL:String;
public var _state:String;
public var _linkURL:String;
public function Message():void{
_imageLoaded = false;
loader = new Loader();
super();
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function display_message(_arg1:Number, _arg2:Number, _arg3:String, _arg4:String):void{
var _local5:URLRequest;
if (imageIcon){
removeChild(imageIcon);
};
imageIcon = new MovieClip();
addChild(imageIcon);
loader = new Loader();
if (_arg4 == ""){
_arg4 = "http://www.smallzworld.com/media/images/avatars/smallz_avatar.jpg";
};
_local5 = new URLRequest((_arg4 + "?hey=1"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, iconLoaded);
activate();
message_text.text = _arg3;
x = _arg1;
y = _arg2;
loader.load(_local5);
}
private function iconLoaded(_arg1:Event):void{
var _local2:String;
imageIcon.addChild(loader.content);
imageIcon.x = 50;
imageIcon.y = 40;
_local2 = _imageURL.substr((_imageURL.length - 3), 3);
if (_local2 != "swf"){
imageIcon.width = 60;
imageIcon.height = 60;
};
}
}
}//package
Section 30
//MessageManager (MessageManager)
package {
import flash.events.*;
import flash.net.*;
public class MessageManager {
public var _messageLoaded;// = false
public var messagePod:Message;
public function MessageManager():void{
_messageLoaded = false;
super();
messagePod = new Message();
}
private function message_handler(_arg1:Event):void{
var _local2:URLLoader;
var _local3:int;
_local2 = URLLoader(_arg1.target);
if (_local2.data.MessageText){
messagePod._messageText = _local2.data.MessageText;
messagePod._linkURL = _local2.data.LinkURL;
messagePod._imageURL = _local2.data.ImageURL;
};
_messageLoaded = true;
}
public function load_message(_arg1:int):void{
var _local2:URLRequest;
var _local3:URLVariables;
var _local4:URLLoader;
_local2 = new URLRequest("http://games.smallzworld.com/RecordManagement.php");
_local3 = new URLVariables();
_local3.Routine = "AS3Message";
_local3.Game_ID = _arg1;
_local2.data = _local3;
_local4 = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.addEventListener(Event.COMPLETE, message_handler);
_local4.load(_local2);
GameManager.gameState = "MainMenu";
_messageLoaded = false;
}
public function display_message(_arg1:Number, _arg2:Number){
messagePod.display_message(_arg1, _arg2, messagePod._messageText, messagePod._imageURL);
_messageLoaded = false;
}
}
}//package
Section 31
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.1");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 32
//MyArial (MyArial)
package {
import flash.text.*;
public dynamic class MyArial extends Font {
}
}//package
Section 33
//Orb (Orb)
package {
import flash.display.*;
public dynamic class Orb extends MovieClip {
}
}//package
Section 34
//PauseScreen (PauseScreen)
package {
import flash.events.*;
import flash.display.*;
public class PauseScreen extends MovieClip {
public var _state:String;
public var Continue:MovieClip;
public function PauseScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
}
public function menu_mouseUp(_arg1:MouseEvent):void{
if (Continue.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "MainMenu";
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package
Section 35
//PopUp (PopUp)
package {
import flash.display.*;
import flash.text.*;
public class PopUp extends MovieClip {
public var box_text:TextField;
public var _scale:Number;
public var _state:String;
public var title_text:TextField;
public var _scaleSpeed:Number;// = 250
public function PopUp():void{
_scaleSpeed = 250;
super();
deactivate();
}
public function activate(_arg1:String, _arg2:String):void{
x = (GameManager.screenWidth / 2);
y = (GameManager.screenHeight / 2);
_state = "Active";
title_text.text = _arg1;
box_text.text = _arg2;
visible = true;
}
public function transition_out():void{
_state = "Shrink";
}
public function transition_in():void{
_scale = 0.01;
scaleX = _scale;
scaleY = _scale;
_state = "Grow";
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update(_arg1:Number):void{
switch (_state){
case "Active":
break;
case "Grow":
_scale = (_scale + ((_arg1 * _scaleSpeed) / 100));
if (_scale >= 1){
_scale = 1;
_state = "Active";
};
scaleX = _scale;
scaleY = _scale;
break;
case "Shrink":
_scale = (_scale - ((_arg1 * _scaleSpeed) / 100));
if (_scale <= 0.1){
_scale = 1;
deactivate();
};
scaleX = _scale;
scaleY = _scale;
break;
case "Inactive":
break;
};
}
}
}//package
Section 36
//ScorePopUp (ScorePopUp)
package {
import flash.display.*;
import classes.game.*;
import classes.smallz.*;
public class ScorePopUp extends MovieClip {
public var _speed;// = 150
public var _spawnState:Boolean;// = true
public var _state:String;
public var _scoreValue:Number;
public var PointText:MovieClip;
public function ScorePopUp():void{
_speed = 150;
_spawnState = true;
super();
addFrameScript(22, frame23);
deactivate();
}
public function activate():void{
visible = true;
_state = "Active";
_spawnState = false;
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
function frame23(){
this.stop();
}
public function update(_arg1:Number):void{
switch (_state){
case "Active":
if (PointText){
if (PointText.PointText){
PointText.PointText.text = _scoreValue;
};
};
if (currentFrame == totalFrames){
deactivate();
};
break;
};
}
}
}//package
Section 37
//ScorePopUpManager (ScorePopUpManager)
package {
import flash.display.*;
import classes.game.*;
public class ScorePopUpManager extends MovieClip {
public var active:Array;
public var popups:Array;
public var _scale:Number;// = 0.5
public function ScorePopUpManager():void{
popups = new Array();
active = new Array();
_scale = 0.5;
super();
}
public function inactive_popup():int{
var _local1:int;
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = popups.length;
_local1 = 0;
while (_local1 < _local3) {
if (popups[_local1]._spawnState){
_local2 = _local1;
break;
};
_local1++;
};
return (_local2);
}
public function activate(_arg1:Number, _arg2:Number, _arg3:Number):void{
var popup_index:int;
var loc_x = _arg1;
var loc_y = _arg2;
var score_value = _arg3;
popup_index = inactive_popup();
active.push(popups[popup_index]);
var _local5 = popups[popup_index];
with (_local5) {
activate();
x = loc_x;
y = loc_y;
scaleX = _scale;
scaleY = _scale;
_scoreValue = score_value;
gotoAndPlay(1);
};
}
public function init(_arg1:int){
var _local2:int;
_local2 = 0;
while (_local2 < _arg1) {
popups[_local2] = new ScorePopUp();
addChild(popups[_local2]);
_local2++;
};
}
public function deactivate_all_popups():void{
var _local1:int;
var _local2:int;
_local2 = popups.length;
_local1 = 0;
while (_local1 < _local2) {
popups[_local1].deactivate();
popups[_local1]._spawnState = true;
_local1++;
};
active = new Array();
}
public function update(_arg1:Number):void{
var index:int;
var popup_count:int;
var elapsedTime = _arg1;
popup_count = active.length;
index = 0;
while (index < popup_count) {
var _local3 = active[index];
with (_local3) {
if (_state == "Inactive"){
_spawnState = true;
active.splice(index, 1);
index--;
popup_count--;
} else {
update(elapsedTime);
};
};
index = (index + 1);
};
}
}
}//package
Section 38
//smallzKeyboardManager (smallzKeyboardManager)
package {
import flash.events.*;
import flash.display.*;
public class smallzKeyboardManager extends Sprite {
public var pressed:Array;
public function smallzKeyboardManager(){
pressed = new Array();
super();
}
public function init(){
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
public function kill(){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
public function isPressed(_arg1:int){
if (pressed.indexOf(_arg1) == -1){
return (false);
};
return (true);
}
public function keyPressed(_arg1:KeyboardEvent){
var _local2:int;
_local2 = pressed.indexOf(_arg1.keyCode);
if (_local2 == -1){
pressed.push(_arg1.keyCode);
};
}
public function keyReleased(_arg1:KeyboardEvent){
var _local2:int;
_local2 = pressed.indexOf(_arg1.keyCode);
if (_local2 != -1){
pressed.splice(_local2, 1);
};
}
}
}//package
Section 39
//smallzMath (smallzMath)
package {
import flash.geom.*;
public class smallzMath {
public static function random_point(_arg1:Number, _arg2:Number):Point{
var _local3:Point;
_local3 = new Point(0, 0);
_local3.x = (Math.random() * _arg1);
_local3.y = (Math.random() * _arg2);
return (_local3);
}
public static function get_angle_point(_arg1:Point, _arg2:Point):Number{
return (Math.atan2((_arg2.y - _arg1.y), (_arg2.x - _arg1.x)));
}
public static function getAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)));
}
public static function pDistance(_arg1:Point, _arg2:Point):Number{
var _local3:Number;
_local3 = Math.sqrt((((_arg1.x - _arg2.x) * (_arg1.x - _arg2.x)) + ((_arg1.y - _arg2.y) * (_arg1.y - _arg2.y))));
return (_local3);
}
public static function get_distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = Math.sqrt((((_arg1 - _arg3) * (_arg1 - _arg3)) + ((_arg2 - _arg4) * (_arg2 - _arg4))));
return (_local5);
}
}
}//package
Section 40
//SoundtrackMusic (SoundtrackMusic)
package {
import flash.media.*;
public dynamic class SoundtrackMusic extends Sound {
}
}//package
Section 41
//SubmitScoreScreen (SubmitScoreScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class SubmitScoreScreen extends MovieClip {
public var Submit:MovieClip;
public var user_name:TextField;
public var message_text:TextField;
public var score:TextField;
public var Cancel:MovieClip;
public var _state:String;
public function SubmitScoreScreen():void{
x = 0;
y = 0;
_state = "Inactive";
visible = false;
}
public function activate():void{
_state = "Active";
visible = true;
score.text = ("Final Score " + String(GameManager.playerScore));
}
public function check_rollovers():void{
if (Submit.hitTestPoint(mouseX, mouseY)){
Submit.scaleX = 1.25;
Submit.scaleY = 1.25;
} else {
Submit.scaleX = 1;
Submit.scaleY = 1;
};
if (Cancel.hitTestPoint(mouseX, mouseY)){
Cancel.scaleX = 1.25;
Cancel.scaleY = 1.25;
} else {
Cancel.scaleX = 1;
Cancel.scaleY = 1;
};
}
public function menu_mouseUp(_arg1:MouseEvent):void{
if (Cancel.hitTestPoint(_arg1.stageX, _arg1.stageY)){
deactivate();
GameManager.gameState = "HighScores";
};
if (((Submit.hitTestPoint(_arg1.stageX, _arg1.stageY)) && (Submit.visible))){
deactivate();
GameManager.gameState = "SaveHighScore";
};
}
public function deactivate():void{
_state = "Inactive";
visible = false;
}
public function update():void{
switch (_state){
case "Active":
break;
};
}
}
}//package