Section 1
//MainTimeline (burgerdefense_v1_fla.MainTimeline)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class MainTimeline extends MovieClip {
public var monster_inc;
public var total_hit;
public var game_over_outcome;
public var upgrade_radius;
public var mute;
public var tank_1:MovieClip;
public var initialTime;
public var total_fired;
public var upgrade_clip_explode;
public var max_cannon;
public var new_monster;
public var game_over_break;
public var particle_effects;
public var monster_e_inc;
public var gravity;
public var go_button:SimpleButton;
public var new_cannon;
public var enemy_poisoned;
public var gamedata3_1a:MovieClip;
public var gameSpace1:MovieClip;
public var ground2_1:MovieClip;
public var firepower;
public var upgrade_active;
public var monster_energy;
public var monster_type;
public var upgrade_poison;
public var burgers;
public var next_level_stop;
public var uinitialTime;
public var particles;
public var upgrade_spikes;
public var firstClick;
public var hardFired;
public var money;
public var angle;
public var monster_xspeed;
public var money_earned;
public var total_combo;
public var mouseDown:Boolean;
public var fired;
public var angle_xdif;
public var Nav;
public var time_over;
public var game_over;
public var game_time;
public var upgrade_time;
public var total_acc;
public var upgrade_clip_money;
public var myMenu:ContextMenu;
public var game_winner;
public var currentCount;
public var combo_count_five;
public var gamedata3_1:MovieClip;
public var upgrade_clip_poison;
public var current_level;
public var next_level;
public var spawn_max_monster;
public var cannon_strength;
public var GTimer:Timer;
public var gamedata2_1:MovieClip;
public var node_1:MovieClip;
public var angle_ydif;
public var gamedata_1:MovieClip;
public var fireStop;
public var crosshair_1:MovieClip;
public var menuItem1:ContextMenuItem;
public var monsters_placed;
public var menuItem2:ContextMenuItem;
public var upgrade_clip_spikes;
public var ground_1:MovieClip;
public var upgrade_approved;
public var max_firepower;
public var upgrade_type;
public var runTimer;
public var spawn_max_cannon;
public var back_button:SimpleButton;
public var enemy_kill_score;
public var cannons_left;
public var bar_border_1:MovieClip;
public var delay;
public var upgrade_clip;
public var upgrade_time_max;
public var total_accuracy;
public var cannon_delay;
public var upgrade_explode;
public var total_score;
public var explode_strength;
public var thoomp_1:MovieClip;
public var levelCount;
public var gpause;
public var help_button:SimpleButton;
public var max_monster;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
public function describeSpike(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = gameSpace1.addChild(new spike_description());
_local2.x = (mouseX - 5);
_local2.y = (mouseY - 5);
_local2.name = "spike_description1";
_local2.spike_damage_txt.text = String(("Current Damage: " + cannon_strength));
if (upgrade_spikes <= 2){
_local2.spike_upgrade_txt.text = String(("Next Upgrade: $" + upgrade_clip_spikes));
} else {
_local2.spike_upgrade_txt.text = String("");
};
}
public function doSomething(_arg1:ContextMenuEvent):void{
var _local2:String;
var _local3:URLRequest;
_local2 = "http://www.burgerdefense.com";
_local3 = new URLRequest(_local2);
navigateToURL(_local3, "_blank");
}
public function upgradePoison(_arg1:MouseEvent):void{
var _local2:*;
if (upgrade_type == "none"){
upgrade_type = "poison";
};
_local2 = gameSpace1.getChildByName("poison_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("poison_description1"));
};
}
public function place_enemy(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6):void{
var _local7:MovieClip;
if (_arg6 == 1){
_local7 = gameSpace1.addChild(new enemy());
} else {
if (_arg6 == 2){
_local7 = gameSpace1.addChild(new enemy2());
} else {
if (_arg6 == 3){
_local7 = gameSpace1.addChild(new enemy3());
} else {
if (_arg6 == 4){
_local7 = gameSpace1.addChild(new enemy4());
} else {
_local7 = gameSpace1.addChild(new enemy());
};
};
};
};
_local7.name = ("enemy_" + spawn_max_monster);
_local7.x = _arg1;
_local7.y = _arg2;
_local7.yspeed = 0;
_local7.xspeed = _arg3;
_local7.energy = _arg4;
_local7.energy_max = _arg4;
_local7.poison_level = 0;
_local7.pi = _arg5;
_local7.dead = false;
_local7.hit = false;
_local7.delay_hit = 25;
_local7.count = 1;
_local7.max_count = 2;
_local7.new_count = 0;
_local7.hit = false;
_local7.addEventListener(Event.ENTER_FRAME, move_enemy);
}
public function gameHelp(_arg1:MouseEvent):void{
gotoAndStop(2);
}
function frame2(){
go_button.addEventListener(MouseEvent.CLICK, gameGo);
help_button.addEventListener(MouseEvent.CLICK, gameHelp);
stop();
}
function frame4(){
firstClick = true;
Nav = false;
mute = false;
gpause = false;
particle_effects = true;
gravity = 3;
money = 200;
money_earned = 10;
burgers = 20;
combo_count_five = 0;
fired = 0;
hardFired = 0;
fireStop = false;
max_firepower = 5;
total_fired = 0;
total_hit = 0;
total_accuracy = 0;
cannon_strength = 50;
explode_strength = Math.floor((cannon_strength / 3));
cannons_left = max_firepower;
initialTime = getTimer();
uinitialTime = getTimer();
upgrade_time = 0;
upgrade_time_max = 1000;
upgrade_type = "none";
upgrade_approved = false;
upgrade_active = false;
upgrade_clip = 0;
upgrade_explode = 0;
upgrade_spikes = 0;
upgrade_poison = 0;
upgrade_radius = 150;
upgrade_clip_money = 250;
upgrade_clip_explode = 150;
upgrade_clip_poison = 170;
upgrade_clip_spikes = 200;
time_over = false;
game_over = false;
game_over_break = false;
game_over_outcome = "";
enemy_poisoned = 0;
cannon_delay = 0;
new_cannon = 0;
spawn_max_cannon = 0;
max_cannon = max_firepower;
delay = 50;
new_monster = 0;
monsters_placed = 0;
spawn_max_monster = 0;
max_monster = 0;
monster_xspeed = 0.5;
monster_e_inc = 10;
monster_energy = monster_e_inc;
monster_type = new enemy();
current_level = 0;
next_level = 1;
next_level_stop = false;
monster_inc = 2;
game_time = 0;
GTimer = new Timer(5, 0);
levelCount = 999;
currentCount = levelCount;
runTimer = true;
angle_xdif = 0;
angle_ydif = 0;
angle = 0;
firepower = 0;
particles = 0;
enemy_kill_score = 0;
total_score = 0;
total_acc = 0;
total_combo = 0;
game_winner = 0;
gameSpace1 = this.addChild(new gameSpace());
gameSpace1.name = "gameSpace1";
gameSpace1.x = 0;
gameSpace1.y = 0;
ground2_1 = gameSpace1.addChild(new ground2());
ground2_1.x = 0;
ground2_1.y = 196;
ground_1 = gameSpace1.addChild(new ground());
ground_1.x = 0;
ground_1.y = 198;
tank_1 = gameSpace1.addChild(new tank());
tank_1.x = 465;
tank_1.y = 198;
node_1 = gameSpace1.addChild(new node());
node_1.x = 468;
node_1.y = 0xFF;
gamedata_1 = gameSpace1.addChild(new gamedata());
gamedata_1.x = 25;
gamedata_1.y = 315;
gamedata2_1 = gameSpace1.addChild(new gamedata2());
gamedata2_1.x = 25;
gamedata2_1.y = 0;
gamedata3_1 = gameSpace1.addChild(new gamedata3());
gamedata3_1.x = 25;
gamedata3_1.y = 363;
bar_border_1 = gameSpace1.addChild(new bar_border());
bar_border_1.x = 349;
bar_border_1.y = 293;
thoomp_1 = gameSpace1.addChild(new thoomp());
thoomp_1.x = -300;
thoomp_1.y = -300;
crosshair_1 = gameSpace1.addChild(new crosshair());
crosshair_1.x = 50;
crosshair_1.y = 50;
gamedata_1.explode_button.addEventListener(MouseEvent.CLICK, upgradeExplode);
gamedata_1.explode_button.addEventListener(MouseEvent.ROLL_OVER, describeExplode);
gamedata_1.explode_button.addEventListener(MouseEvent.ROLL_OUT, describeExplode2);
gamedata_1.spike_button.addEventListener(MouseEvent.CLICK, upgradeSpike);
gamedata_1.spike_button.addEventListener(MouseEvent.ROLL_OVER, describeSpike);
gamedata_1.spike_button.addEventListener(MouseEvent.ROLL_OUT, describeSpike2);
gamedata_1.clip_button.addEventListener(MouseEvent.CLICK, upgradeClip);
gamedata_1.clip_button.addEventListener(MouseEvent.ROLL_OVER, describeClip);
gamedata_1.clip_button.addEventListener(MouseEvent.ROLL_OUT, describeClip2);
gamedata_1.poison_button.addEventListener(MouseEvent.CLICK, upgradePoison);
gamedata_1.poison_button.addEventListener(MouseEvent.ROLL_OVER, describePoison);
gamedata_1.poison_button.addEventListener(MouseEvent.ROLL_OUT, describePoison2);
gamedata_1.sound_button.addEventListener(MouseEvent.CLICK, muteSound);
gamedata_1.quality_button.addEventListener(MouseEvent.CLICK, lowerQuality);
gamedata_1.effects_button.addEventListener(MouseEvent.CLICK, dropEffects);
gamedata_1.pause_button.addEventListener(MouseEvent.CLICK, gamePause);
stage.addEventListener(Event.ENTER_FRAME, moveMouse);
stage.addEventListener(Event.ENTER_FRAME, textShow);
stage.addEventListener(Event.ENTER_FRAME, OEF);
stop();
stop();
}
public function moveShot(_arg1:Event){
var enemy_count:*;
var enemyChecker:*;
var combo_graphic_1:*;
var event = _arg1;
var _local3 = event.target;
with (_local3) {
if (gpause == false){
diry = (diry + gravity);
x = (x + (dirx / 30));
y = (y + (diry / 30));
while (ground_1.hitTestPoint(x, y, true)) {
y--;
rotation = (rotation - 1);
dirx = (dirx + final_momentum);
if ((((dirx >= 0)) && ((blow_up_state == false)))){
dirx = 0;
rotation = final_rotation;
if (u_explode >= 1){
gotoAndPlay("explode");
if (mute == false){
thoomp_1.gotoAndPlay("explode2");
};
} else {
gotoAndPlay(26);
};
blow_up_state = true;
} else {
if ((((dirx >= 0)) && ((blow_up_state == true)))){
dirx = 0;
rotation = final_rotation;
};
};
};
if (!ground_1.hitTestPoint(x, y, true)){
rotation = (rotation - 10);
};
};
enemy_count = 1;
while (enemy_count <= max_monster) {
enemyChecker = parent.getChildByName(("enemy_" + enemy_count));
if (enemyChecker){
if (((parent.getChildByName(("enemy_" + enemy_count)).hitTestPoint(x, y, true)) && ((parent.getChildByName(("enemy_" + enemy_count)).dead == false)))){
if (p_strength > 0){
parent.getChildByName(("enemy_" + enemy_count)).poison_level = p_strength;
};
if ((((u_explode >= 1)) && ((blowing_up == false)))){
parent.getChildByName(("enemy_" + enemy_count)).energy = (parent.getChildByName(("enemy_" + enemy_count)).energy - c_strength);
dirx = 0;
gotoAndPlay("explode");
if (mute == false){
thoomp_1.gotoAndPlay("explode");
};
total_hit++;
blowing_up = true;
};
if (u_explode == 0){
parent.getChildByName(("enemy_" + enemy_count)).energy = (parent.getChildByName(("enemy_" + enemy_count)).energy - c_strength);
if (mute == false){
thoomp_1.gotoAndPlay("crack");
};
total_hit++;
dead = true;
};
};
if (blowing_up == true){
distance_from_turret_x = (x - parent.getChildByName(("enemy_" + enemy_count)).x);
distance_from_turret_y = (y - parent.getChildByName(("enemy_" + enemy_count)).y);
if ((((Math.sqrt(((distance_from_turret_x * distance_from_turret_x) + (distance_from_turret_y * distance_from_turret_y))) < (radius / 2))) && ((parent.getChildByName(("enemy_" + enemy_count)).hit == false)))){
combo = (combo + 1);
parent.getChildByName(("enemy_" + enemy_count)).energy = (parent.getChildByName(("enemy_" + enemy_count)).energy - e_strength);
parent.getChildByName(("enemy_" + enemy_count)).hit = true;
if (p_strength > 0){
parent.getChildByName(("enemy_" + enemy_count)).poison_level = p_strength;
};
if ((((combo >= 5)) && ((combo_finished == false)))){
if (particle_effects == true){
createExplosion(x, (y - 20));
createExplosion((x + 15), (y - 20));
createExplosion((x - 15), (y - 20));
};
combo_graphic_1 = stage.addChild(new combo_graphic());
combo_graphic_1.name = ("combo_" + name);
combo_graphic_1.x = x;
combo_graphic_1.y = (y - 15);
if (mute == false){
thoomp_1.gotoAndPlay("combo");
};
p_strength = (p_strength * 2);
combo = 0;
radius = (radius + 200);
e_strength = (e_strength * 3.5);
combo_count_five = (combo_count_five + 1);
combo_finished = true;
parent.getChildByName(("enemy_" + enemy_count)).hit = false;
};
};
};
};
enemy_count++;
};
if (currentFrame == 25){
dead = true;
};
if (currentFrame == 35){
dead = true;
};
if ((((x < -10)) || ((x > 525)))){
dead = true;
};
if (dead == true){
fired--;
event.target.removeEventListener(Event.ENTER_FRAME, moveShot);
try {
gameSpace1.removeChild(DisplayObject(event.target));
} catch(err1:Error) {
trace(err1.message);
};
};
if (game_over == true){
};
};
}
function frame1(){
gamedata3_1a = this.addChild(new gamedata3());
gamedata3_1a.x = 25;
gamedata3_1a.y = 363;
myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
menuItem1 = new ContextMenuItem("Game by Rob Foor 2008");
menuItem2 = new ContextMenuItem("BurgerDefense.com");
menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSomething);
myMenu.customItems.push(menuItem1);
myMenu.customItems.push(menuItem2);
this.contextMenu = myMenu;
MochiAd.showPreGameAd({clip:root, id:"4d6395c7952b0bd2", res:"500x350"});
}
public function gameGo(_arg1:MouseEvent):void{
gotoAndStop(1, "Game");
}
function frame3(){
back_button.addEventListener(MouseEvent.CLICK, gameBack);
}
public function describeClip(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = gameSpace1.addChild(new clip_description());
_local2.x = (mouseX - 5);
_local2.y = (mouseY - 5);
_local2.name = "clip_description1";
_local2.clip_damage_txt.text = String(("Max Firepower: " + max_firepower));
if (upgrade_clip <= 2){
_local2.clip_upgrade_txt.text = String(("Next Upgrade: $" + upgrade_clip_money));
} else {
_local2.clip_upgrade_txt.text = String("");
};
}
public function onStageMouseUp(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);
mouseDown = false;
firstClick = true;
}
public function muteSound(_arg1:MouseEvent):void{
if (mute == false){
mute = true;
gamedata_1.option_sound.gotoAndStop(2);
} else {
mute = false;
gamedata_1.option_sound.gotoAndStop(1);
};
}
public function lowerQuality(_arg1:MouseEvent):void{
if (stage.quality == "HIGH"){
stage.quality = "LOW";
gamedata_1.option_quality.gotoAndStop(2);
} else {
stage.quality = "HIGH";
gamedata_1.option_quality.gotoAndStop(1);
};
}
public function level_timer(_arg1:TimerEvent):void{
if (gpause == false){
currentCount--;
};
game_time = Math.floor((currentCount / 100));
if (currentCount == 0){
switch_levels();
currentCount = levelCount;
GTimer.stop();
};
}
public function describeClip2(_arg1:MouseEvent):void{
var _local2:*;
_local2 = gameSpace1.getChildByName("clip_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("clip_description1"));
};
}
public function switch_levels():void{
spawn_max_monster = 0;
if (current_level == 0){
levelCount = 299;
monster_e_inc = 30;
};
if (current_level == 4){
monster_e_inc = 150;
};
if (current_level == 6){
monster_e_inc = 200;
};
if (current_level == 7){
monster_e_inc = 250;
};
if (current_level == 9){
monster_e_inc = 325;
};
max_monster = (max_monster + monster_inc);
monster_energy = (monster_energy + monster_e_inc);
money_earned = (money_earned + 1);
current_level = (current_level + 1);
next_level_stop = true;
runTimer = true;
if (current_level == next_level){
if ((((current_level <= 19)) && ((game_over == false)))){
if (game_time > 0){
next_level_stop = false;
next_level = (next_level + 1);
};
} else {
next_level_stop = true;
};
};
if (current_level == 6){
ground_1.gotoAndPlay(2);
ground2_1.gotoAndPlay(2);
};
if (current_level == 11){
ground_1.gotoAndPlay(26);
ground2_1.gotoAndPlay(26);
};
if (current_level == 16){
ground_1.gotoAndPlay(51);
ground2_1.gotoAndPlay(51);
};
}
public function describePoison2(_arg1:MouseEvent):void{
var _local2:*;
_local2 = gameSpace1.getChildByName("poison_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("poison_description1"));
};
}
public function dropEffects(_arg1:MouseEvent):void{
if (particle_effects == true){
particle_effects = false;
gamedata_1.option_effects.gotoAndStop(2);
} else {
particle_effects = true;
gamedata_1.option_effects.gotoAndStop(1);
};
}
public function OEF(_arg1:Event){
var game_bar_1:MovieClip;
var bar_border_1:MovieClip;
var UTimer:Timer;
var upgrade_potato:*;
var xplacement:*;
var yplacement:*;
var monster_energy_temp:*;
var monster_xspeed_temp:*;
var ranNum:*;
var poison_immunity:*;
var gamedata4_1:MovieClip;
var event = _arg1;
if (Nav == false){
angle_xdif = (mouseX - tank_1.x);
angle_ydif = ((mouseY - tank_1.y) * -1);
if (angle_xdif >= 1){
angle_xdif = (angle_xdif * -1);
};
if (angle_xdif == 0){
angle_xdif = (angle_xdif - 1);
};
if (angle_xdif <= -37){
angle = (Math.atan((angle_ydif / angle_xdif)) / (Math.PI / 180));
} else {
angle = -70;
(angle_xdif <= -37);
};
if (angle_xdif < 0){
angle = (angle + 180);
};
if ((((angle_xdif >= 0)) && ((angle_ydif > 0)))){
angle = (angle + 360);
};
if (angle > 160){
angle = 160;
};
if (angle < 20){
angle = 110;
};
tank_1.cannon.rotation = (angle * -1);
firepower = Math.sqrt(((angle_xdif * angle_xdif) + (angle_ydif * angle_ydif)));
if (firepower > 200){
firepower = 200;
};
if (firepower < 90){
firepower = 90;
};
};
if (fired >= max_firepower){
fireStop = true;
};
if (fired == 0){
fireStop = false;
hardFired = 0;
cannons_left = (max_firepower - hardFired);
};
if (fired < 0){
fired = 0;
};
if (((((!((upgrade_type == "none"))) && ((upgrade_active == false)))) && ((gpause == false)))){
if ((((((upgrade_type == "clip")) && ((money >= upgrade_clip_money)))) && ((upgrade_clip <= 2)))){
money = (money - upgrade_clip_money);
upgrade_approved = true;
} else {
if ((((((upgrade_type == "explode")) && ((money >= upgrade_clip_explode)))) && ((upgrade_explode <= 2)))){
money = (money - upgrade_clip_explode);
upgrade_approved = true;
} else {
if ((((((upgrade_type == "spikes")) && ((money >= upgrade_clip_spikes)))) && ((upgrade_spikes <= 2)))){
money = (money - upgrade_clip_spikes);
upgrade_approved = true;
} else {
if ((((((upgrade_type == "poison")) && ((money >= upgrade_clip_poison)))) && ((upgrade_poison <= 2)))){
money = (money - upgrade_clip_poison);
upgrade_approved = true;
} else {
upgrade_type = "none";
};
};
};
};
} else {
if ((((gpause == true)) && ((upgrade_approved == false)))){
upgrade_type = "none";
};
};
if (upgrade_approved == true){
if (upgrade_active == false){
upgrade_potato = function (_arg1:TimerEvent):void{
var _local2:*;
if (gpause == false){
upgrade_time++;
};
_local2 = (upgrade_time / upgrade_time_max);
if (_local2 <= 1){
game_bar_1.bar.scaleX = _local2;
};
if (upgrade_approved == false){
UTimer.stop();
};
};
game_bar_1 = gameSpace1.addChild(new game_bar());
game_bar_1.x = 349;
game_bar_1.y = 293;
game_bar_1.name = "game_bar";
bar_border_1 = gameSpace1.addChild(new bar_border());
bar_border_1.x = 349;
bar_border_1.y = 293;
bar_border_1.name = "bar_border";
game_bar_1.bar.scaleX = 0;
UTimer = new Timer(10, 0);
UTimer.addEventListener(TimerEvent.TIMER, upgrade_potato);
UTimer.start();
};
upgrade_active = true;
if (upgrade_time >= upgrade_time_max){
if (upgrade_type == "clip"){
upgrade_clip_money = (upgrade_clip_money + 400);
max_firepower = (max_firepower + 5);
upgrade_clip = (upgrade_clip + 1);
};
if (upgrade_type == "explode"){
upgrade_clip_explode = (upgrade_clip_explode + 300);
upgrade_radius = (upgrade_radius + 20);
explode_strength = (explode_strength + 55);
upgrade_explode = (upgrade_explode + 1);
};
if (upgrade_type == "spikes"){
upgrade_clip_spikes = (upgrade_clip_spikes + 400);
cannon_strength = (cannon_strength + 70);
upgrade_spikes = (upgrade_spikes + 1);
};
if (upgrade_type == "poison"){
upgrade_clip_poison = (upgrade_clip_poison + 400);
enemy_poisoned = (enemy_poisoned + 1);
upgrade_poison = (upgrade_poison + 1);
};
upgrade_active = false;
upgrade_approved = false;
upgrade_type = "none";
upgrade_time = 0;
gameSpace1.removeChild(gameSpace1.getChildByName("game_bar"));
gameSpace1.removeChild(gameSpace1.getChildByName("bar_border"));
};
};
if (gpause == false){
if (spawn_max_monster < max_monster){
new_monster++;
};
if (new_monster == delay){
spawn_max_monster++;
monsters_placed++;
new_monster = 0;
xplacement = -50;
yplacement = 0;
monster_energy_temp = monster_energy;
monster_xspeed_temp = monster_xspeed;
poison_immunity = 0;
if ((((current_level >= 1)) && ((current_level <= 5)))){
monster_type = 1;
poison_immunity = 0;
};
if ((((current_level >= 6)) && ((current_level <= 10)))){
monster_type = 3;
poison_immunity = -1;
};
if ((((current_level >= 11)) && ((current_level <= 15)))){
monster_type = 2;
poison_immunity = 1;
ranNum = Math.floor(((Math.random() * (3 - 1)) + 1));
if (ranNum == 1){
yplacement = 200;
};
monster_xspeed_temp = 0.7;
};
if ((((current_level >= 16)) && ((current_level <= 20)))){
monster_type = 4;
poison_immunity = 0;
xplacement = Math.floor(((Math.random() * (200 - 0)) + 0));
};
if (current_level == 21){
monster_type = Math.floor(((Math.random() * (5 - 1)) + 1));
if ((((monster_type == 1)) || ((monster_type == 4)))){
poison_immunity = 0;
} else {
if (monster_type == 3){
poison_immunity = -1;
} else {
if (monster_type == 2){
poison_immunity = 1;
} else {
poison_immunity = 0;
};
};
};
};
place_enemy(xplacement, yplacement, monster_xspeed_temp, monster_energy_temp, poison_immunity, monster_type);
};
};
if ((((((((spawn_max_monster == max_monster)) && ((monsters_placed == 0)))) && ((game_over == false)))) && ((runTimer == true)))){
runTimer = false;
GTimer.addEventListener(TimerEvent.TIMER, level_timer);
GTimer.start();
};
if (current_level == 20){
};
if ((((((current_level == 20)) && ((monsters_placed == 0)))) && (!((spawn_max_monster == 0))))){
game_over = true;
game_over_outcome = "winner";
};
if (burgers <= 0){
time_over = true;
game_over = true;
game_over_outcome = "loser";
};
if (game_over == true){
if (game_over_break == false){
gamedata4_1 = gameSpace1.addChild(new gamedata4());
gamedata4_1.x = 18;
gamedata4_1.y = 15;
if (game_over_outcome == "winner"){
gamedata4_1.end_graphic.gotoAndStop(2);
game_winner = 10000;
};
total_killed = (enemy_kill_score / 100);
total_acc = ((total_accuracy * 0.01) * 1000);
total_combo = (combo_count_five * 10);
total_score = ((((enemy_kill_score + money) + total_acc) + total_combo) + game_winner);
gamedata4_1.money_txt.text = String(("$" + money));
gamedata4_1.total_combo_txt.text = String(total_combo);
gamedata4_1.combo_txt.text = String(combo_count_five);
gamedata4_1.total_acc_txt.text = String(total_acc);
gamedata4_1.acc_txt.text = String((total_accuracy + "%"));
gamedata4_1.total_killed_txt.text = String(total_killed);
gamedata4_1.enemy_kill_txt.text = String(enemy_kill_score);
gamedata4_1.total_txt.text = String(total_score);
Nav = true;
gpause = true;
game_over_break = true;
};
};
if (total_fired > 0){
total_accuracy = Math.floor(((total_hit / total_fired) * 100));
};
if (game_over == false){
total_score = (enemy_kill_score + (combo_count_five * 10));
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageMouseDown);
if (fired == 0){
cannon_delay = 15;
spawn_max_cannon = 0;
firstClick = true;
max_cannon = max_firepower;
};
if (mouseDown){
if (firstClick == true){
firstClick = false;
shootShot();
} else {
if (spawn_max_cannon < (max_cannon - 1)){
new_cannon++;
};
if (new_cannon == cannon_delay){
spawn_max_cannon++;
new_cannon = 0;
shootShot();
};
};
};
}
public function upgradeExplode(_arg1:MouseEvent):void{
var _local2:*;
if (upgrade_type == "none"){
upgrade_type = "explode";
};
_local2 = gameSpace1.getChildByName("explode_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("explode_description1"));
};
}
public function onStageMouseDown(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);
mouseDown = true;
}
public function gamePause(_arg1:MouseEvent):void{
if (gpause == false){
gpause = true;
} else {
gpause = false;
};
}
public function upgradeSpike(_arg1:MouseEvent):void{
var _local2:*;
if (upgrade_type == "none"){
upgrade_type = "spikes";
};
_local2 = gameSpace1.getChildByName("spike_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("spike_description1"));
};
}
public function describeExplode2(_arg1:MouseEvent):void{
var _local2:*;
_local2 = gameSpace1.getChildByName("explode_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("explode_description1"));
};
}
public function moveMouse(_arg1){
if ((((((mouseY > 290)) || ((gpause == true)))) || ((game_over == true)))){
Mouse.show();
Nav = true;
} else {
Mouse.hide();
Nav = false;
};
if ((((((Nav == false)) && ((gpause == false)))) && ((game_over == false)))){
crosshair_1.x = mouseX;
crosshair_1.y = mouseY;
} else {
crosshair_1.x = -300;
crosshair_1.y = -300;
};
}
public function describeSpike2(_arg1:MouseEvent):void{
var _local2:*;
_local2 = gameSpace1.getChildByName("spike_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("spike_description1"));
};
}
public function move_enemy(_arg1:Event){
var PercentLoaded:*;
var colorTransform2:*;
var earned_money_1:*;
var event = _arg1;
var _local3 = event.target;
with (_local3) {
if (currentFrame == 42){
gotoAndPlay(1);
};
if (currentFrame == 1){
if (dead == true){
gotoAndPlay("dead");
};
};
if (currentFrame == 74){
event.target.removeEventListener(Event.ENTER_FRAME, move_enemy);
gameSpace1.removeChild(DisplayObject(event.target));
};
if (gameSpace1.getChildByName(("enemy_" + name))){
if (gameSpace1.getChildByName(("enemy_" + name)).currentFrame == 25){
gameSpace1.removeChild(gameSpace1.getChildByName(("enemy_" + name)));
};
if (game_over == true){
gameSpace1.removeChild(gameSpace1.getChildByName(("enemy_" + name)));
};
};
if (hit == true){
if (count < max_count){
new_count++;
};
if (new_count == delay_hit){
count++;
new_count = 0;
count = 1;
max_count = 2;
hit = false;
};
};
if (dead == false){
PercentLoaded = ((energy / energy_max) * 100);
PercentLoaded = (energy / energy_max);
if (PercentLoaded <= 1){
bar.scaleX = PercentLoaded;
};
if ((((poison_level > 0)) && (!((pi == -1))))){
colorTransform2 = transform.colorTransform;
colorTransform2.color = "0x00EE00";
bar.transform.colorTransform = colorTransform2;
};
};
if (gpause == false){
if (pi == 0){
energy = (energy - poison_level);
} else {
if (pi == 1){
energy = (energy - (poison_level * 4));
} else {
if (pi == -1){
energy = energy;
} else {
energy = (energy - poison_level);
};
};
};
yspeed = (yspeed + (gravity / 10));
x = (x + xspeed);
while (ground_1.hitTestPoint((x + (width / 2)), ((y + height) - 10), true)) {
y--;
yspeed = 0;
};
if (!ground_1.hitTestPoint((x + (width / 2)), ((y + height) - 9), true)){
y = (y + yspeed);
} else {
yspeed = 0;
};
if (node_1.hitTestPoint(x, y, true)){
xspeed = -3;
gotoAndPlay(75);
dead = true;
burgers--;
if (burgers <= 0){
burgers = 0;
};
};
};
if (x > 500){
monsters_placed--;
event.target.removeEventListener(Event.ENTER_FRAME, move_enemy);
gameSpace1.removeChild(DisplayObject(event.target));
};
if (y > 500){
monsters_placed--;
event.target.removeEventListener(Event.ENTER_FRAME, move_enemy);
gameSpace1.removeChild(DisplayObject(event.target));
};
if ((((energy <= 0)) && ((dead == false)))){
earned_money_1 = gameSpace1.addChild(new earned_money());
earned_money_1.name = ("enemy_" + name);
earned_money_1.x = x;
earned_money_1.y = (y + 5);
earned_money_1.money_money.money_earned_txt.text = String(("+$" + money_earned));
gotoAndPlay("dead");
dead = true;
xspeed = 0;
money = (money + money_earned);
enemy_kill_score = (enemy_kill_score + 100);
monsters_placed--;
};
};
}
public function describeExplode(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = gameSpace1.addChild(new explode_description());
_local2.x = (mouseX - 5);
_local2.y = (mouseY - 5);
_local2.name = "explode_description1";
_local2.explode_damage_txt.text = String(("Current Damage: " + explode_strength));
if (upgrade_explode <= 2){
_local2.explode_upgrade_txt.text = String(("Next Upgrade: $" + upgrade_clip_explode));
} else {
_local2.explode_upgrade_txt.text = String("");
};
}
public function upgradeClip(_arg1:MouseEvent):void{
var _local2:*;
if (upgrade_type == "none"){
upgrade_type = "clip";
};
_local2 = gameSpace1.getChildByName("clip_description1");
if (_local2){
gameSpace1.removeChild(gameSpace1.getChildByName("clip_description1"));
};
}
public function createExplosion(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:MovieClip;
var _local11:ColorTransform;
_local3 = new Array("0xFF0000", "0x00FF00", "0x0000FF", "0xFFFF00", "0xFF00FF", "0x00FFFF");
particles++;
i = 0;
while (i < 2) {
_local4 = ((_arg1 + Math.floor((Math.random() * (40 + 40)))) - 40);
_local5 = (_arg2 + ((Math.floor((Math.random() * (25 - 1))) + 1) * -1));
_local6 = (Math.floor((Math.random() * (15 - 1))) + 1);
_local7 = (Math.floor((Math.random() * (5 - 0))) + 0);
_local8 = (Math.floor((Math.random() * (0.6 - 0.3))) + 0.3);
_local9 = (Math.floor((Math.random() * (0.7 - 0.5))) + 0.5);
_local10 = stage.addChild(new myParticle());
_local11 = _local10.transform.colorTransform;
_local11.color = _local3[_local7];
_local10.fireworkz.transform.colorTransform = _local11;
_local10.x = _local4;
_local10.y = _local5;
_local10.scaleX = _local8;
_local10.scaleY = _local8;
_local10.alpha = _local9;
_local10.gotoAndPlay(_local6);
_local10.name = (("Particle1_" + particles) + i);
i++;
};
}
public function describePoison(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = gameSpace1.addChild(new poison_description());
_local2.x = (mouseX - 5);
_local2.y = (mouseY - 5);
_local2.name = "poison_description1";
_local2.poison_damage_txt.text = String(("Toxic Level: " + enemy_poisoned));
if (upgrade_poison <= 2){
_local2.poison_upgrade_txt.text = String(("Next Upgrade: $" + upgrade_clip_poison));
} else {
_local2.poison_upgrade_txt.text = String("");
};
}
public function shootShot():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:MovieClip;
if ((((((hardFired < max_firepower)) && ((fireStop == false)))) && ((Nav == false)))){
if (mute == false){
thoomp_1.gotoAndPlay("cannon");
};
money--;
total_fired++;
hardFired++;
fired++;
cannons_left = (max_firepower - hardFired);
_local1 = (tank_1.cannon.rotation - 1);
_local2 = (tank_1.x + (48 * Math.cos(((_local1 * Math.PI) / 180))));
_local3 = (tank_1.y + (48 * Math.sin(((_local1 * Math.PI) / 180))));
_local4 = gameSpace1.addChild(new cannonball());
_local4.x = _local2;
_local4.y = _local3;
_local4.name = ("cannon_" + total_fired);
_local4.lasty = 0;
_local4.x_stop = false;
_local4.dirx = (Math.cos(((_local1 * Math.PI) / 180)) * firepower);
_local4.diry = (Math.sin(((_local1 * Math.PI) / 180)) * firepower);
_local4.final_rotation = (Math.floor((Math.random() * (360 - 0))) + 0);
_local4.final_momentum = (Math.floor((Math.random() * (5 - 1))) + 1);
_local4.blow_up_state = false;
_local4.blowing_up = false;
_local4.combo = 0;
_local4.combo_finished = false;
_local4.c_strength = cannon_strength;
_local4.e_strength = explode_strength;
_local4.u_explode = upgrade_explode;
_local4.radius = upgrade_radius;
_local4.p_strength = enemy_poisoned;
_local4.dead = false;
_local4.addEventListener(Event.ENTER_FRAME, moveShot);
if (upgrade_spikes == 1){
_local4.spikes.gotoAndStop(2);
} else {
if (upgrade_spikes == 2){
_local4.spikes.gotoAndStop(3);
} else {
if (upgrade_spikes == 3){
_local4.spikes.gotoAndStop(4);
} else {
_local4.spikes.gotoAndStop(1);
};
};
};
if (upgrade_poison > 0){
_local4.poisoned1.gotoAndStop(2);
} else {
_local4.poisoned1.gotoAndStop(1);
};
};
}
public function textShow(_arg1:Event){
gamedata2_1.money_txt.text = String(("$" + money));
gamedata2_1.burger_txt.text = String(burgers);
gamedata2_1.timer_txt.text = String(game_time);
gamedata2_1.level_txt.text = String(current_level);
gamedata_1.explode_txt.text = String((upgrade_explode + " / 3"));
gamedata_1.spike_txt.text = String((upgrade_spikes + " / 3"));
gamedata_1.clip_txt.text = String((upgrade_clip + " / 3"));
gamedata_1.poison_txt.text = String((upgrade_poison + " / 3"));
gamedata_1.ammo_txt.text = String(cannons_left);
gamedata_1.combo_txt.text = String(combo_count_five);
gamedata_1.acc_txt.text = String(total_accuracy);
gamedata_1.total_txt.text = String(enemy_kill_score);
}
public function gameBack(_arg1:MouseEvent):void{
gotoAndStop(1);
}
}
}//package burgerdefense_v1_fla
Section 2
//poisoned_57 (burgerdefense_v1_fla.poisoned_57)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class poisoned_57 extends MovieClip {
public function poisoned_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package burgerdefense_v1_fla
Section 3
//Symbol11_58 (burgerdefense_v1_fla.Symbol11_58)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class Symbol11_58 extends MovieClip {
public function Symbol11_58(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package burgerdefense_v1_fla
Section 4
//Symbol21_12 (burgerdefense_v1_fla.Symbol21_12)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Symbol21_12 extends MovieClip {
public var money_earned_txt:TextField;
}
}//package burgerdefense_v1_fla
Section 5
//Symbol30_4 (burgerdefense_v1_fla.Symbol30_4)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class Symbol30_4 extends MovieClip {
public function Symbol30_4(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package burgerdefense_v1_fla
Section 6
//xmark_28 (burgerdefense_v1_fla.xmark_28)
package burgerdefense_v1_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class xmark_28 extends MovieClip {
public function xmark_28(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package burgerdefense_v1_fla
Section 7
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 8
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.34");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 9
//bar_border (bar_border)
package {
import flash.display.*;
public dynamic class bar_border extends MovieClip {
}
}//package
Section 10
//cannonball (cannonball)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class cannonball extends MovieClip {
public var spikes:MovieClip;
public var poisoned1:MovieClip;
public function cannonball(){
addFrameScript(0, frame1, 13, frame14, 24, frame25, 34, frame35);
}
function frame14(){
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame35(){
stop();
}
}
}//package
Section 11
//clip_description (clip_description)
package {
import flash.display.*;
import flash.text.*;
public dynamic class clip_description extends MovieClip {
public var clip_upgrade_txt:TextField;
public var clip_damage_txt:TextField;
}
}//package
Section 12
//combo_graphic (combo_graphic)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class combo_graphic extends MovieClip {
public function combo_graphic(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
stage.removeChild(stage.getChildByName(name));
}
}
}//package
Section 13
//crosshair (crosshair)
package {
import flash.display.*;
public dynamic class crosshair extends MovieClip {
}
}//package
Section 14
//earned_money (earned_money)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class earned_money extends MovieClip {
public var money_money:MovieClip;
public function earned_money(){
addFrameScript(24, frame25);
}
function frame25(){
}
}
}//package
Section 15
//enemy (enemy)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class enemy extends MovieClip {
public var bar:MovieClip;
public function enemy(){
addFrameScript(0, frame1, 41, frame42, 73, frame74, 115, frame116);
}
function frame74(){
stop();
}
function frame1(){
}
function frame116(){
gotoAndPlay(75);
}
function frame42(){
}
}
}//package
Section 16
//enemy2 (enemy2)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class enemy2 extends MovieClip {
public var bar:MovieClip;
public function enemy2(){
addFrameScript(0, frame1, 41, frame42, 73, frame74, 115, frame116);
}
function frame74(){
stop();
}
function frame1(){
}
function frame116(){
gotoAndPlay(75);
}
function frame42(){
}
}
}//package
Section 17
//enemy3 (enemy3)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class enemy3 extends MovieClip {
public var bar:MovieClip;
public function enemy3(){
addFrameScript(0, frame1, 41, frame42, 73, frame74, 115, frame116);
}
function frame74(){
stop();
}
function frame1(){
}
function frame116(){
gotoAndPlay(75);
}
function frame42(){
}
}
}//package
Section 18
//enemy4 (enemy4)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class enemy4 extends MovieClip {
public var bar:MovieClip;
public function enemy4(){
addFrameScript(0, frame1, 41, frame42, 73, frame74, 115, frame116);
}
function frame74(){
stop();
}
function frame1(){
}
function frame116(){
gotoAndPlay(75);
}
function frame42(){
}
}
}//package
Section 19
//explode_description (explode_description)
package {
import flash.display.*;
import flash.text.*;
public dynamic class explode_description extends MovieClip {
public var explode_upgrade_txt:TextField;
public var explode_damage_txt:TextField;
}
}//package
Section 20
//game_bar (game_bar)
package {
import flash.display.*;
public dynamic class game_bar extends MovieClip {
public var bar:MovieClip;
}
}//package
Section 21
//gamedata (gamedata)
package {
import flash.display.*;
import flash.text.*;
public dynamic class gamedata extends MovieClip {
public var clip_button:SimpleButton;
public var total_txt:TextField;
public var clip_txt:TextField;
public var explode_txt:TextField;
public var effects_button:SimpleButton;
public var option_quality:MovieClip;
public var option_effects:MovieClip;
public var combo_txt:TextField;
public var poison_button:SimpleButton;
public var explode_button:SimpleButton;
public var sound_button:SimpleButton;
public var ammo_txt:TextField;
public var spike_button:SimpleButton;
public var quality_button:SimpleButton;
public var pause_button:SimpleButton;
public var spike_txt:TextField;
public var poison_txt:TextField;
public var acc_txt:TextField;
public var option_sound:MovieClip;
}
}//package
Section 22
//gamedata2 (gamedata2)
package {
import flash.display.*;
import flash.text.*;
public dynamic class gamedata2 extends MovieClip {
public var level_txt:TextField;
public var money_txt:TextField;
public var timer_txt:TextField;
public var burger_txt:TextField;
}
}//package
Section 23
//gamedata3 (gamedata3)
package {
import flash.display.*;
public dynamic class gamedata3 extends MovieClip {
}
}//package
Section 24
//gamedata4 (gamedata4)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class gamedata4 extends MovieClip {
public var total_txt:TextField;
public var total_combo_txt:TextField;
public var combo_txt:TextField;
public var submit_button:SimpleButton;
public var money_txt:TextField;
public var end_graphic:MovieClip;
public var total_killed_txt:TextField;
public var total_acc_txt:TextField;
public var acc_txt:TextField;
public var enemy_kill_txt:TextField;
public function gamedata4(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
MochiServices.connect("4d6395c7952b0bd2", root);
submit_button.addEventListener(MouseEvent.CLICK, gameSubmit);
stop();
}
function frame2(){
stop();
}
public function myClosefunction(){
gotoAndStop(2);
}
public function gameSubmit(_arg1:MouseEvent):void{
MochiScores.showLeaderboard({boardID:"9b9651265e258494", score:root.total_score, onClose:myClosefunction});
}
}
}//package
Section 25
//gameSpace (gameSpace)
package {
import flash.display.*;
public dynamic class gameSpace extends MovieClip {
}
}//package
Section 26
//ground (ground)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class ground extends MovieClip {
public function ground(){
addFrameScript(0, frame1, 24, frame25, 49, frame50, 74, frame75);
}
function frame75(){
stop();
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 27
//ground2 (ground2)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class ground2 extends MovieClip {
public function ground2(){
addFrameScript(0, frame1, 24, frame25, 49, frame50, 74, frame75);
}
function frame75(){
stop();
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 28
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.6");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 29
//myParticle (myParticle)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class myParticle extends MovieClip {
public var fireworkz:MovieClip;
public function myParticle(){
addFrameScript(34, frame35);
}
function frame35(){
stop();
stage.removeChild(stage.getChildByName(name));
}
}
}//package
Section 30
//node (node)
package {
import flash.display.*;
public dynamic class node extends MovieClip {
}
}//package
Section 31
//poison_description (poison_description)
package {
import flash.display.*;
import flash.text.*;
public dynamic class poison_description extends MovieClip {
public var poison_upgrade_txt:TextField;
public var poison_damage_txt:TextField;
}
}//package
Section 32
//spike_description (spike_description)
package {
import flash.display.*;
import flash.text.*;
public dynamic class spike_description extends MovieClip {
public var spike_upgrade_txt:TextField;
public var spike_damage_txt:TextField;
}
}//package
Section 33
//tank (tank)
package {
import flash.display.*;
public dynamic class tank extends MovieClip {
public var cannon:MovieClip;
}
}//package
Section 34
//thoomp (thoomp)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
public dynamic class thoomp extends MovieClip {
public function thoomp(){
addFrameScript(0, frame1, 16, frame17, 58, frame59, 89, frame90, 173, frame174, 199, frame200);
}
function frame200(){
stop();
}
function frame90(){
stop();
}
function frame174(){
stop();
}
function frame1(){
stop();
}
function frame17(){
stop();
}
function frame59(){
stop();
}
}
}//package
Section 35
//upgrade_bar (upgrade_bar)
package {
import flash.display.*;
public dynamic class upgrade_bar extends MovieClip {
public var bar:MovieClip;
}
}//package