Section 1
//EnemyInfo (EnemySpawning.EnemyInfo)
package EnemySpawning {
public class EnemyInfo {
public var enemyName:String;
public var enemyCount:Number;
public function EnemyInfo(_arg1:String, _arg2:Number){
enemyName = _arg1;
enemyCount = _arg2;
}
}
}//package EnemySpawning
Section 2
//EnemySpawner (EnemySpawning.EnemySpawner)
package EnemySpawning {
import flash.events.*;
import flash.utils.*;
public class EnemySpawner {
private var hasSpanwerCompleted:Boolean;
private var spawnerWaves:EnemyWaves;
private var nextWaveIndex:Number;// = 0
private var secondTimer:Timer;
private var timeUntilNextWave:Number;// = NAN
private static var timeNeededBeforeSkip:Number = 3;
public static var indexOfWaveToShowShortcuts:uint = 12;
public static var indexOfFirstBulletImmuneWave:uint = 5;
public static var indexOfFirstFireImmuneWave:uint = 3;
public function EnemySpawner():void{
nextWaveIndex = 0;
timeUntilNextWave = NaN;
secondTimer = new Timer(1000, 0);
super();
spawnerWaves = new EnemyWaves();
}
private function _updateTimerDisplay():void{
GameState.setTimer(timeUntilNextWave);
}
private function _actuallySpawnNextWave(_arg1:EnemyWave):void{
var _local2:EnemyWave;
var _local3:String;
var _local4:Number;
GameState.userData.addToScore(timeUntilNextWave);
GameState.userData.addToSkipBonus(timeUntilNextWave);
_arg1.spawnWave();
nextWaveIndex++;
_local2 = spawnerWaves.waves[nextWaveIndex];
if (_local2 == null){
_onNoMoreWaves();
} else {
_local4 = _local2.time;
timeUntilNextWave = _local4;
_updateTimerDisplay();
};
_local3 = nextWaveIndex.toString();
GameState.mainObject.txtWave.text = _local3.concat(" / ", spawnerWaves.waves.length.toString());
GameState.mainObject.nextWaveButton.enabled = false;
}
private function _startSecondTimer():void{
secondTimer.addEventListener("timer", _onNextSecond);
secondTimer.start();
}
public function pauseSpawner():void{
secondTimer.stop();
}
public function nextWave():void{
if (PauseGame.gamePaused()){
return;
};
_spawnNextWave();
}
public function wavesAreStillSpawning():Boolean{
return (!(hasSpanwerCompleted));
}
public function getCurrentWave():Number{
return (nextWaveIndex);
}
public function resetSpawner():void{
hasSpanwerCompleted = false;
nextWaveIndex = 0;
secondTimer.stop();
}
private function _onNextSecond(_arg1:TimerEvent):void{
var _local2:EnemyWave;
timeUntilNextWave--;
_updateTimerDisplay();
if (timeUntilNextWave <= 0){
_spawnNextWave();
};
_local2 = spawnerWaves.waves[nextWaveIndex];
if (_local2 == null){
GameState.mainObject.nextWaveButton.enabled = false;
return;
};
if ((_local2.time - timeUntilNextWave) < EnemySpawner.timeNeededBeforeSkip){
GameState.mainObject.nextWaveButton.enabled = false;
} else {
GameState.mainObject.nextWaveButton.enabled = true;
};
}
private function _spawnNextWave():void{
var _local1:EnemyWave;
_local1 = spawnerWaves.waves[nextWaveIndex];
if (_local1 == null){
trace("EnemySpawner.spawnNextWave() failed, The next wave should never be null at this point");
};
if ((_local1.time - timeUntilNextWave) < EnemySpawner.timeNeededBeforeSkip){
return;
};
_actuallySpawnNextWave(_local1);
if (nextWaveIndex == EnemySpawner.indexOfFirstFireImmuneWave){
TacticalTipsHandler.requestFireImmuneHelp();
};
if (nextWaveIndex == EnemySpawner.indexOfFirstBulletImmuneWave){
TacticalTipsHandler.requestBulletImmuneHelp();
};
if (nextWaveIndex == EnemySpawner.indexOfWaveToShowShortcuts){
TacticalTipsHandler.requestShowShortcuts();
};
}
public function unpauseSpawner():void{
secondTimer.start();
}
public function startSpawner():void{
var _local1:EnemyWave;
timeUntilNextWave = 0;
hasSpanwerCompleted = false;
GameState.enableNextWaveButton();
_local1 = spawnerWaves.waves[nextWaveIndex];
_actuallySpawnNextWave(_local1);
_updateTimerDisplay();
_startSecondTimer();
}
private function _onNoMoreWaves():void{
secondTimer.stop();
hasSpanwerCompleted = true;
timeUntilNextWave = 0;
_updateTimerDisplay();
GameState.onNoMoreWaves();
}
}
}//package EnemySpawning
Section 3
//EnemyWave (EnemySpawning.EnemyWave)
package EnemySpawning {
public class EnemyWave {
public var enemyInfo:Array;
public var time:Number;
public function EnemyWave(_arg1:Number):void{
enemyInfo = new Array();
super();
time = _arg1;
}
public function spawnWave():void{
enemyInfo.forEach(handleEnemyInfo);
}
public function addEnemyInfo(_arg1:EnemyInfo):void{
enemyInfo.push(_arg1);
}
private function handleEnemyInfo(_arg1:EnemyInfo, _arg2:int, _arg3:Array):void{
var _local4:Number;
_local4 = 0;
while (_local4 < _arg1.enemyCount) {
GameState.createNewEnemy(_arg1.enemyName);
_local4++;
};
}
}
}//package EnemySpawning
Section 4
//EnemyWaves (EnemySpawning.EnemyWaves)
package EnemySpawning {
public class EnemyWaves {
public var waves:Array;
public function EnemyWaves():void{
waves = new Array();
super();
_addFirstSet();
_addSecondSet();
_addThirdSet();
}
private function _addFirstSet():void{
var _local1:EnemyWave;
var _local2:EnemyWave;
var _local3:EnemyWave;
var _local4:EnemyWave;
var _local5:EnemyWave;
var _local6:EnemyWave;
var _local7:EnemyWave;
_local1 = new EnemyWave(15);
_local1.addEnemyInfo(new EnemyInfo("EMT", 5));
waves.push(_local1);
_local2 = new EnemyWave(15);
_local2.addEnemyInfo(new EnemyInfo("Burster", 8));
waves.push(_local2);
_local3 = new EnemyWave(15);
_local3.addEnemyInfo(new EnemyInfo("Bio", 8));
waves.push(_local3);
_local4 = new EnemyWave(15);
_local4.addEnemyInfo(new EnemyInfo("Construction", 8));
waves.push(_local4);
_local5 = new EnemyWave(15);
_local5.addEnemyInfo(new EnemyInfo("Soldier", 5));
waves.push(_local5);
_local6 = new EnemyWave(15);
_local6.addEnemyInfo(new EnemyInfo("Fat", 10));
waves.push(_local6);
_local7 = new EnemyWave(15);
_local7.addEnemyInfo(new EnemyInfo("Fireman", 10));
waves.push(_local7);
}
private function _addSecondSet():void{
var _local1:EnemyWave;
var _local2:EnemyWave;
var _local3:EnemyWave;
var _local4:EnemyWave;
var _local5:EnemyWave;
var _local6:EnemyWave;
var _local7:EnemyWave;
_local1 = new EnemyWave(15);
_local1.addEnemyInfo(new EnemyInfo("EMT2", 5));
waves.push(_local1);
_local2 = new EnemyWave(15);
_local2.addEnemyInfo(new EnemyInfo("Burster2", 8));
waves.push(_local2);
_local3 = new EnemyWave(15);
_local3.addEnemyInfo(new EnemyInfo("Bio2", 8));
waves.push(_local3);
_local4 = new EnemyWave(15);
_local4.addEnemyInfo(new EnemyInfo("Construction2", 8));
waves.push(_local4);
_local5 = new EnemyWave(15);
_local5.addEnemyInfo(new EnemyInfo("Soldier2", 5));
waves.push(_local5);
_local6 = new EnemyWave(15);
_local6.addEnemyInfo(new EnemyInfo("Fat2", 10));
waves.push(_local6);
_local7 = new EnemyWave(15);
_local7.addEnemyInfo(new EnemyInfo("Fireman2", 10));
waves.push(_local7);
}
private function _addThirdSet():void{
var _local1:EnemyWave;
var _local2:EnemyWave;
var _local3:EnemyWave;
var _local4:EnemyWave;
var _local5:EnemyWave;
var _local6:EnemyWave;
var _local7:EnemyWave;
_local1 = new EnemyWave(15);
_local1.addEnemyInfo(new EnemyInfo("EMT3", 5));
waves.push(_local1);
_local2 = new EnemyWave(15);
_local2.addEnemyInfo(new EnemyInfo("Burster3", 8));
waves.push(_local2);
_local3 = new EnemyWave(15);
_local3.addEnemyInfo(new EnemyInfo("Bio3", 8));
waves.push(_local3);
_local4 = new EnemyWave(15);
_local4.addEnemyInfo(new EnemyInfo("Construction3", 8));
waves.push(_local4);
_local5 = new EnemyWave(15);
_local5.addEnemyInfo(new EnemyInfo("Soldier3", 10));
waves.push(_local5);
_local6 = new EnemyWave(15);
_local6.addEnemyInfo(new EnemyInfo("Fat3", 10));
waves.push(_local6);
_local7 = new EnemyWave(15);
_local7.addEnemyInfo(new EnemyInfo("Fireman3", 10));
waves.push(_local7);
}
}
}//package EnemySpawning
Section 5
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 6
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 7
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 8
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 9
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 10
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 11
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 12
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 13
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 14
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 15
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 16
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 17
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 18
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 19
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 20
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 21
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 22
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 23
//MatrixTransformer (fl.motion.MatrixTransformer)
package fl.motion {
import flash.geom.*;
public class MatrixTransformer {
public static function getSkewY(_arg1:Matrix):Number{
return ((Math.atan2(_arg1.b, _arg1.a) * (180 / Math.PI)));
}
public static function getScaleX(_arg1:Matrix):Number{
return (Math.sqrt(((_arg1.a * _arg1.a) + (_arg1.b * _arg1.b))));
}
public static function getScaleY(_arg1:Matrix):Number{
return (Math.sqrt(((_arg1.c * _arg1.c) + (_arg1.d * _arg1.d))));
}
public static function setSkewXRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number;
_local3 = getScaleY(_arg1);
_arg1.c = (-(_local3) * Math.sin(_arg2));
_arg1.d = (_local3 * Math.cos(_arg2));
}
public static function setRotation(_arg1:Matrix, _arg2:Number):void{
setRotationRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function rotateAroundInternalPoint(_arg1:Matrix, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Point;
_local5 = new Point(_arg2, _arg3);
_local5 = _arg1.transformPoint(_local5);
_arg1.tx = (_arg1.tx - _local5.x);
_arg1.ty = (_arg1.ty - _local5.y);
_arg1.rotate((_arg4 * (Math.PI / 180)));
_arg1.tx = (_arg1.tx + _local5.x);
_arg1.ty = (_arg1.ty + _local5.y);
}
public static function setSkewX(_arg1:Matrix, _arg2:Number):void{
setSkewXRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function setSkewY(_arg1:Matrix, _arg2:Number):void{
setSkewYRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function setScaleX(_arg1:Matrix, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = getScaleX(_arg1);
if (_local3){
_local4 = (_arg2 / _local3);
_arg1.a = (_arg1.a * _local4);
_arg1.b = (_arg1.b * _local4);
} else {
_local5 = getSkewYRadians(_arg1);
_arg1.a = (Math.cos(_local5) * _arg2);
_arg1.b = (Math.sin(_local5) * _arg2);
};
}
public static function setScaleY(_arg1:Matrix, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = getScaleY(_arg1);
if (_local3){
_local4 = (_arg2 / _local3);
_arg1.c = (_arg1.c * _local4);
_arg1.d = (_arg1.d * _local4);
} else {
_local5 = getSkewXRadians(_arg1);
_arg1.c = (-(Math.sin(_local5)) * _arg2);
_arg1.d = (Math.cos(_local5) * _arg2);
};
}
public static function setRotationRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
_local3 = getRotationRadians(_arg1);
_local4 = getSkewXRadians(_arg1);
setSkewXRadians(_arg1, ((_local4 + _arg2) - _local3));
setSkewYRadians(_arg1, _arg2);
}
public static function setSkewYRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number;
_local3 = getScaleX(_arg1);
_arg1.a = (_local3 * Math.cos(_arg2));
_arg1.b = (_local3 * Math.sin(_arg2));
}
public static function getSkewX(_arg1:Matrix):Number{
return ((Math.atan2(-(_arg1.c), _arg1.d) * (180 / Math.PI)));
}
public static function getSkewYRadians(_arg1:Matrix):Number{
return (Math.atan2(_arg1.b, _arg1.a));
}
public static function getSkewXRadians(_arg1:Matrix):Number{
return (Math.atan2(-(_arg1.c), _arg1.d));
}
public static function getRotation(_arg1:Matrix):Number{
return ((getRotationRadians(_arg1) * (180 / Math.PI)));
}
public static function rotateAroundExternalPoint(_arg1:Matrix, _arg2:Number, _arg3:Number, _arg4:Number):void{
_arg1.tx = (_arg1.tx - _arg2);
_arg1.ty = (_arg1.ty - _arg3);
_arg1.rotate((_arg4 * (Math.PI / 180)));
_arg1.tx = (_arg1.tx + _arg2);
_arg1.ty = (_arg1.ty + _arg3);
}
public static function getRotationRadians(_arg1:Matrix):Number{
return (getSkewYRadians(_arg1));
}
public static function matchInternalPointWithExternal(_arg1:Matrix, _arg2:Point, _arg3:Point):void{
var _local4:Point;
var _local5:Number;
var _local6:Number;
_local4 = _arg1.transformPoint(_arg2);
_local5 = (_arg3.x - _local4.x);
_local6 = (_arg3.y - _local4.y);
_arg1.tx = (_arg1.tx + _local5);
_arg1.ty = (_arg1.ty + _local6);
}
}
}//package fl.motion
Section 24
//EndGameDialogHandler (GuiHandling.EndGameDialogHandler)
package GuiHandling {
public class EndGameDialogHandler {
private static var lastPersonalBest:Number = 0;
private static var lineMarker:String = (String.fromCharCode(62) + " ");
public function EndGameDialogHandler():void{
}
public static function showEndGameMessages():void{
var _local1:Boolean;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Number;
var _local6:String;
var _local7:Number;
UseabilityLogger.sendLogInformation(((((("{The game has ended} score: " + GameState.userData.getScore().toString()) + " lives: ") + GameState.userData.getLives().toString()) + " wave: ") + GameState.enemySpawner.getCurrentWave()));
_local1 = GameState.userData.getLives();
if (_local1){
GameState.mainObject.EndGameDialogInstance.EndGameReason.text = "You defeated all of the Zombies!";
GameState.playSound(new sound_Applause());
} else {
GameState.mainObject.EndGameDialogInstance.EndGameReason.text = "The Zombies have over-run the city!";
GameState.playSound(new sound_flatlineEdited());
};
_local2 = GameState.userData.checkIfUserJustEarnedBronzeMedal();
_local3 = GameState.userData.checkIfUserJustEarnedSilverMedal();
_local4 = GameState.userData.checkIfUserJustEarnedGoldMedal();
_local5 = NaN;
_local6 = "";
if (_local2){
_local6 = (_local6 + (lineMarker + "Congratulations you earned the Bronze medal, you can now use combat boosts\n"));
};
if (_local3){
_local6 = (_local6 + (lineMarker + "Congratulations you earned the Silver medal, you can now use razor wire\n"));
};
if (_local4){
_local6 = (_local6 + (lineMarker + "Congratulations you earned the Gold medal, you can now use air strikes\n"));
};
if ((((GameState.userData.doesUserHaveBronzeMedal() == false)) && ((_local2 == false)))){
_local5 = (ScoreStatusBar.bronzeScore - GameState.userData.getScore());
_local6 = (_local6 + (((lineMarker + "You almost got the Bronze medal, you needed ") + _local5.toString()) + " more points!\n"));
} else {
if ((((GameState.userData.doesUserHaveSilverMedal() == false)) && ((_local3 == false)))){
_local5 = (ScoreStatusBar.silverScore - GameState.userData.getScore());
_local6 = (_local6 + (((lineMarker + "You almost got the Silver medal, you needed ") + _local5.toString()) + " more points!\n"));
} else {
if ((((GameState.userData.doesUserHaveGoldMedal() == false)) && ((_local4 == false)))){
_local5 = (ScoreStatusBar.goldScore - GameState.userData.getScore());
_local6 = (_local6 + (((lineMarker + "You almost got the Gold medal, you needed ") + _local5.toString()) + " more points!\n"));
};
};
};
if (GameState.userData.getScore() > lastPersonalBest){
_local7 = (GameState.userData.getScore() - lastPersonalBest);
_local6 = (_local6 + (((lineMarker + "You beat your best score by ") + _local7) + " points!\n"));
lastPersonalBest = GameState.userData.getPersonalBestScore();
} else {
_local7 = ((lastPersonalBest - GameState.userData.getScore()) + 1);
_local6 = (_local6 + (((lineMarker + "You needed ") + _local7) + " more points to beat your best score!\n"));
};
GameState.mainObject.EndGameDialogInstance.txtEndGameMessage.text = _local6;
}
}
}//package GuiHandling
Section 25
//ToolTipData (GuiHandling.ToolTipData)
package GuiHandling {
import flash.display.*;
public class ToolTipData {
public var toolTipText:String;// = null
public var movieClipToHandle:InteractiveObject;// = null
public function ToolTipData(_arg1:InteractiveObject, _arg2:String):void{
movieClipToHandle = null;
toolTipText = null;
super();
movieClipToHandle = _arg1;
toolTipText = _arg2;
}
}
}//package GuiHandling
Section 26
//ToolTipsHandler (GuiHandling.ToolTipsHandler)
package GuiHandling {
import flash.events.*;
import flash.text.*;
public class ToolTipsHandler {
private var toolTip:TextField;
private var toolTipDataSet:Array;
public static var fontSize:Number = 16;
public static var format:TextFormat = new TextFormat();
private static var xTooltipOffset:Number = 30;
public function ToolTipsHandler():void{
toolTipDataSet = new Array();
toolTip = new TextField();
super();
addToolTipData(new ToolTipData(GameState.mainObject.lblCost, "The amount of money required to place a Soldier"));
addToolTipData(new ToolTipData(GameState.mainObject.lblDamage, "The amount of damage a Soldier will do Zombies"));
addToolTipData(new ToolTipData(GameState.mainObject.lblRange, "How far a Soldier can shoot"));
addToolTipData(new ToolTipData(GameState.mainObject.lblROF, "How quickly a Soldier will shoot"));
addToolTipData(new ToolTipData(GameState.mainObject.lblKills, "The number of Zombies killed by the Soldier"));
addToolTipData(new ToolTipData(GameState.mainObject.lblUpgradeCost, "The cost to upgrade the selected Soldier"));
addToolTipData(new ToolTipData(GameState.mainObject.lblUpgradeDamage, "The amount of damage the Soldier will do when upgraded"));
addToolTipData(new ToolTipData(GameState.mainObject.lblUpgradeRange, "How far a Soldier can shoot when upgraded"));
addToolTipData(new ToolTipData(GameState.mainObject.lblUpgradeROF, "How quickly a Soldier will shoot when upgraded"));
_createGlobalToolTip();
}
private function _onIconMouseOut(_arg1:MouseEvent){
toolTip.visible = false;
}
private function _onIconMouseOver(_arg1:MouseEvent){
var _local2:ToolTipData;
for each (_local2 in toolTipDataSet) {
if (_local2.movieClipToHandle != _arg1.currentTarget){
} else {
toolTip.text = _local2.toolTipText;
toolTip.setTextFormat(format);
break;
};
};
toolTip.visible = true;
toolTip.x = (_arg1.stageX + xTooltipOffset);
toolTip.y = _arg1.stageY;
}
private function _createGlobalToolTip(){
toolTip.background = true;
toolTip.textColor = Colors.black;
toolTip.backgroundColor = Colors.lightGrey;
toolTip.multiline = false;
toolTip.autoSize = TextFieldAutoSize.CENTER;
toolTip.visible = false;
toolTip.mouseEnabled = false;
format.font = "LucidaConsole";
format.bold = true;
format.size = fontSize;
toolTip.setTextFormat(format);
GameState.mainObject.addChild(toolTip);
}
public function addToolTipData(_arg1:ToolTipData):void{
toolTipDataSet.push(_arg1);
_setupCallBacks(_arg1);
}
private function _setupCallBacks(_arg1:ToolTipData){
_arg1.movieClipToHandle.addEventListener(MouseEvent.MOUSE_OVER, _onIconMouseOver);
_arg1.movieClipToHandle.addEventListener(MouseEvent.MOUSE_OUT, _onIconMouseOut);
}
}
}//package GuiHandling
Section 27
//AirStrikeState (MouseStates.AirStrikeState)
package MouseStates {
import flash.display.*;
import flash.geom.*;
public class AirStrikeState extends MouseState {
private var mouseFollowingImage:Bitmap;
public function AirStrikeState():void{
mouseFollowingImage = new Bitmap();
super();
GameState.mainObject.addChild(mouseFollowingImage);
mouseFollowingImage.bitmapData = new image_airStrikeButton(0, 0);
mouseFollowingImage.visible = false;
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
if (GameState.selectTowerIfPossible(_arg1, _arg2) == true){
return;
};
if (!GameState.userData.canUserPlaceAirStrikes()){
playErrorSound();
return;
};
_local3 = GameState.tiles.getTile(_arg1, _arg2);
if (_local3.canTileHaveTower){
playErrorSound();
return;
};
new AirStrike(new Point(_arg1, _arg2));
GameState.userData.usedAirStrike();
if (!GameState.userData.canUserPlaceAirStrikes()){
GameState.mainObject.abilityAirStrikeButton.enabled = false;
};
}
override public function enable():void{
var _local1:String;
mouseFollowingImage.visible = true;
_local1 = "Call in a air strike to carpet bomb the streets.";
GameInterfaceHandler.showAbility(_local1);
GameInterfaceHandler.showStatTitle("Air Strike");
}
override public function disable():void{
mouseFollowingImage.visible = false;
GameInterfaceHandler.hideAbilityInfo();
GameInterfaceHandler.hideStatTitle();
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
mouseFollowingImage.x = _arg1;
mouseFollowingImage.y = _arg2;
}
}
}//package MouseStates
Section 28
//ArtilleryState (MouseStates.ArtilleryState)
package MouseStates {
import flash.geom.*;
public class ArtilleryState extends MouseState {
public function ArtilleryState():void{
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
if (GameState.selectTowerIfPossible(_arg1, _arg2) == true){
return;
};
if (!GameState.userData.canUserPlaceArtillery()){
return;
};
_local3 = GameState.tiles.getTile(_arg1, _arg2);
if (_local3.canTileHaveTower){
return;
};
new Artillery(new Point(_arg1, _arg2));
GameState.userData.usedArtillery();
}
override public function enable():void{
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
}
}
}//package MouseStates
Section 29
//CombatStim (MouseStates.CombatStim)
package MouseStates {
import flash.events.*;
import flash.utils.*;
public class CombatStim {
private var stimUsed:Boolean;// = false
private var stimmedTower:Tower;// = null
private var timerBar:LifeBar;// = null
private var applyTimer:Timer;// = null
private static var stimTimeMS:Number = 5000;
private static var stimSpeedupFactor:Number = 2;
private static var timerBarTickTimeMS:Number = 200;
public function CombatStim():void{
stimUsed = false;
stimmedTower = null;
timerBar = null;
applyTimer = null;
super();
}
private function _onTimerTick(_arg1:TimerEvent):void{
var _local2:Number;
_local2 = (1 - (_arg1.target.currentCount / _arg1.target.repeatCount));
timerBar.adjustLife(_local2);
timerBar.setPosition(stimmedTower.getPosition());
}
private function _onStimEffectFinished(_arg1):void{
stimmedTower.unboostTower((1 / stimSpeedupFactor));
timerBar.cleanup();
GameState.combatStims.splice(GameState.combatStims.indexOf(this), 1);
}
public function pause():void{
applyTimer.stop();
}
public function unpause():void{
applyTimer.start();
}
public function startApplyingEffect(_arg1:Tower):void{
var _local2:uint;
if (stimUsed == true){
throw (new Error("The stim ability should never be used more then once per stim."));
};
timerBar = new LifeBar(Tiles.tileSize.x);
timerBar.setPosition(_arg1.getPosition());
stimmedTower = _arg1;
stimUsed = true;
stimmedTower.boostTower(stimSpeedupFactor);
_local2 = Math.floor((stimTimeMS / timerBarTickTimeMS));
applyTimer = new Timer(timerBarTickTimeMS, _local2);
applyTimer.addEventListener(TimerEvent.TIMER, _onTimerTick);
applyTimer.addEventListener(TimerEvent.TIMER_COMPLETE, _onStimEffectFinished);
applyTimer.start();
}
}
}//package MouseStates
Section 30
//CombatStimState (MouseStates.CombatStimState)
package MouseStates {
import flash.display.*;
public class CombatStimState extends MouseState {
private var mouseFollowingImage:Bitmap;
public function CombatStimState():void{
mouseFollowingImage = new Bitmap();
super();
GameState.mainObject.addChild(mouseFollowingImage);
mouseFollowingImage.bitmapData = new image_combatStimButton(0, 0);
mouseFollowingImage.visible = false;
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
var _local4:Tower;
var _local5:CombatStim;
if (!GameState.userData.canUserPlaceMines()){
return;
};
_local3 = GameState.tiles.getTile(_arg1, _arg2);
if (!_local3.canTileHaveTower){
_onCannotUseStim();
return;
};
_local4 = _local3.getPlacedTower();
if (_local4 == null){
_onCannotUseStim();
return;
};
if (_local4.canTowerBeBoosted() == false){
_onCannotUseStim();
return;
};
_local5 = new CombatStim();
_local5.startApplyingEffect(_local4);
GameState.addCombatStim(_local5);
GameState.userData.usedMine();
GameState.playSound(new sound_stimPack());
if (!GameState.userData.canUserPlaceMines()){
GameState.mainObject.abilityMinesButton.enabled = false;
};
}
private function _onCannotUseStim():void{
playErrorSound();
}
override public function enable():void{
var _local1:String;
mouseFollowingImage.visible = true;
_local1 = "Combat boosting a soldier will double their rate of fire.";
GameInterfaceHandler.showAbility(_local1);
GameInterfaceHandler.showStatTitle("Combat Stim");
}
override public function disable():void{
mouseFollowingImage.visible = false;
GameInterfaceHandler.hideAbilityInfo();
GameInterfaceHandler.hideStatTitle();
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
mouseFollowingImage.x = _arg1;
mouseFollowingImage.y = _arg2;
}
}
}//package MouseStates
Section 31
//EmptyState (MouseStates.EmptyState)
package MouseStates {
public class EmptyState extends MouseState {
public function EmptyState():void{
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
GameState.selectTowerIfPossible(_arg1, _arg2);
}
override public function enable():void{
}
override public function disable():void{
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
}
}
}//package MouseStates
Section 32
//MouseFollower (MouseStates.MouseFollower)
package MouseStates {
import flash.geom.*;
public class MouseFollower {
private var active:Boolean;// = true
private var towerToPlaceDefinition:TowerDefinition;// = null
private var currentState:MouseState;
public static var emptyState:MouseState = new EmptyState();
public static var razorWireState:MouseState = new RazorWireState();
public static var towerSelectedState:MouseState = new TowerSelectedState();
public static var artilleryActionState:MouseState = new ArtilleryState();
public static var towerStampState:MouseState = new PlaceTowerState();
public static var combatStimState:MouseState = new CombatStimState();
public static var airStrikeActionState:MouseState = new AirStrikeState();
public function MouseFollower():void{
towerToPlaceDefinition = null;
active = true;
currentState = towerStampState;
super();
}
public function onMouseClicked(_arg1:Number, _arg2:Number):void{
if (PauseGame.gamePaused()){
return;
};
currentState.onMouseClicked(_arg1, _arg2);
}
public function setState(_arg1:MouseState):void{
if (_arg1 == null){
throw (new Error("MouseFollower.setState cannot be set to null"));
};
currentState.disable();
currentState = _arg1;
currentState.enable();
}
public function moveToPosition(_arg1:Point):void{
currentState.onRenderIcon(_arg1.x, _arg1.y);
}
public function getState():MouseState{
return (currentState);
}
}
}//package MouseStates
Section 33
//MouseState (MouseStates.MouseState)
package MouseStates {
public class MouseState {
public function MouseState():void{
}
public function disable():void{
}
public function onMouseClicked(_arg1:Number, _arg2:Number):void{
}
public function enable():void{
}
public function playErrorSound():void{
GameState.playSound(new sound_buzzer());
}
public function onRenderIcon(_arg1:Number, _arg2:Number):void{
}
}
}//package MouseStates
Section 34
//PlaceTowerState (MouseStates.PlaceTowerState)
package MouseStates {
import flash.display.*;
import flash.geom.*;
public class PlaceTowerState extends MouseState {
private var towerToPlace:Bitmap;
private var greenTile:Sprite;
private var towerRangeDisplay:Sprite;
private var redTile:Sprite;
public static var rangeDisplayTransparency:Number = 0.2;
public static var tileTransparency:Number = 0.5;
public function PlaceTowerState():void{
redTile = new Sprite();
greenTile = new Sprite();
towerToPlace = new Bitmap();
towerRangeDisplay = new Sprite();
super();
redTile.mouseEnabled = false;
GameState.mainObject.addChild(redTile);
greenTile.mouseEnabled = false;
GameState.mainObject.addChild(greenTile);
GameState.mainObject.addChild(towerToPlace);
towerRangeDisplay.mouseEnabled = false;
GameState.mainObject.addChild(towerRangeDisplay);
}
private function _drawRangeDisplay(_arg1:Number, _arg2:Number, _arg3:Number):void{
towerRangeDisplay.graphics.clear();
towerRangeDisplay.graphics.beginFill(Colors.blue, rangeDisplayTransparency);
towerRangeDisplay.graphics.drawCircle(_arg1, _arg2, _arg3);
}
override public function enable():void{
_enableTowerStamp();
GameInterfaceHandler.showTowerPlacement();
GameInterfaceHandler.setCurrentTowerStats(GameState.towerToPlace);
GameInterfaceHandler.showTowerToPlaceDescription(GameState.towerToPlace.description);
GameInterfaceHandler.showStatTitle(GameState.towerToPlace.towerName);
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
var _local4:Boolean;
if (GameState.selectTowerIfPossible(_arg1, _arg2) == true){
return;
};
_local3 = GameState.tiles.getTile(_arg1, _arg2);
_local4 = GameState.createNewTower(_local3);
if (!_local4){
playErrorSound();
};
}
private function _updateTowerStamp(_arg1:Point):void{
var _local2:TowerDefinition;
var _local3:Tile;
var _local4:Point;
var _local5:Point;
_local2 = GameState.towerToPlace;
_local3 = GameState.tiles.getTile(_arg1.x, _arg1.y);
towerToPlace.bitmapData = _local2.frames[0];
towerToPlace.width = Tiles.tileSize.x;
towerToPlace.height = Tiles.tileSize.y;
if (_local3 == null){
return;
};
_clearTiles();
_local4 = _local3.getPosition();
if ((((_local3.canTowerBePlaced() == true)) && (GameState.userData.towerCanBeAfforded(_local2)))){
_drawGreenTile(_local4.x, _local4.y);
} else {
_drawRedTile(_local4.x, _local4.y);
};
_drawTowerToPlace(_local4.x, _local4.y);
if (_local2 == null){
return;
};
_local5 = _local3.getCenter();
_drawRangeDisplay(_local5.x, _local5.y, (_local2.range * Tiles.tileSize.x));
_enableTowerStamp();
}
private function _drawRedTile(_arg1:Number, _arg2:Number):void{
redTile.graphics.clear();
redTile.graphics.beginFill(Colors.red, tileTransparency);
redTile.graphics.drawRect(_arg1, _arg2, Tiles.tileSize.x, Tiles.tileSize.y);
}
private function _drawTowerToPlace(_arg1:Number, _arg2:Number):void{
towerToPlace.x = _arg1;
towerToPlace.y = _arg2;
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
_updateTowerStamp(new Point(_arg1, _arg2));
}
override public function disable():void{
_disableTowerStamp();
GameInterfaceHandler.hideTowerToPlaceDescription();
}
private function _disableTowerStamp():void{
redTile.visible = false;
greenTile.visible = false;
towerToPlace.visible = false;
towerRangeDisplay.visible = false;
}
private function _enableTowerStamp():void{
redTile.visible = true;
greenTile.visible = true;
towerToPlace.visible = true;
towerRangeDisplay.visible = true;
}
private function _clearTiles():void{
redTile.graphics.clear();
greenTile.graphics.clear();
}
private function _drawGreenTile(_arg1:Number, _arg2:Number):void{
greenTile.graphics.clear();
greenTile.graphics.beginFill(Colors.green, tileTransparency);
greenTile.graphics.drawRect(_arg1, _arg2, Tiles.tileSize.x, Tiles.tileSize.y);
}
}
}//package MouseStates
Section 35
//RazorWire (MouseStates.RazorWire)
package MouseStates {
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class RazorWire extends GameObject {
private var timerBar:LifeBar;// = null
private var applyDamageTimer:Timer;// = null
private var effectAppliedCounter:Number;// = 0
private static var effectRadius:Number = (1 * Tiles.tileSize.x);
private static var damagePercentage:Number = 0.03;
private static var apllyEffectTimes:uint = Math.floor((RazorWire.lifeTimeMS / RazorWire.tickTimeMS));
private static var lifeTimeMS:Number = 10000;
private static var slowingFactor:Number = 0.5;
private static var tickTimeMS:Number = 300;
private static var slowDurationMS:Number = 1000;
public function RazorWire():void{
var _local1:Array;
timerBar = null;
effectAppliedCounter = 0;
applyDamageTimer = null;
_local1 = AnimationCreator.breakImageIntoFramesClass(new razorwire(0, 0), 1, 1);
super(0, _local1[0], new Point(Tiles.tileSize.x, Tiles.tileSize.y));
timerBar = new LifeBar(Tiles.tileSize.x);
}
public function unpause():void{
applyDamageTimer.start();
}
private function applySlowOnEnemy(_arg1:Enemy):void{
_arg1.applySlowEffect(new SlowEffect(slowingFactor, slowDurationMS, null));
}
public function startApplyingEffect(_arg1:Point):void{
setCenter(_arg1);
timerBar.setPosition(getPosition());
applyDamageTimer = new Timer(RazorWire.tickTimeMS, apllyEffectTimes);
applyDamageTimer.addEventListener(TimerEvent.TIMER, _applyEffect);
applyDamageTimer.addEventListener(TimerEvent.TIMER_COMPLETE, _onTimerComplete);
applyDamageTimer.start();
}
private function _cleanup():void{
applyDamageTimer.stop();
timerBar.cleanup();
cleanupGameObject();
GameState.razorWires.splice(GameState.razorWires.indexOf(this), 1);
}
public function cleanup():void{
_cleanup();
}
private function _applyEffect(_arg1):void{
var _local2:Array;
var _local3:Enemy;
var _local4:Number;
_local2 = CollisionChecker.getEnemiesInRadius(getCenter(), effectRadius);
for each (_local3 in _local2) {
_local3.applyDirectDamageAsPercentage(RazorWire.damagePercentage);
applySlowOnEnemy(_local3);
};
effectAppliedCounter++;
_local4 = (1 - (effectAppliedCounter / apllyEffectTimes));
timerBar.adjustLife(_local4);
timerBar.setPosition(getPosition());
}
private function _onTimerComplete(_arg1):void{
_cleanup();
}
public function pause():void{
applyDamageTimer.stop();
}
}
}//package MouseStates
Section 36
//RazorWireState (MouseStates.RazorWireState)
package MouseStates {
import flash.display.*;
import flash.geom.*;
public class RazorWireState extends MouseState {
private var mouseFollowingImage:Bitmap;
public function RazorWireState():void{
mouseFollowingImage = new Bitmap();
super();
GameState.mainObject.addChild(mouseFollowingImage);
mouseFollowingImage.bitmapData = new image_razerWireButton(0, 0);
mouseFollowingImage.visible = false;
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
var _local4:RazorWire;
if (GameState.selectTowerIfPossible(_arg1, _arg2) == true){
return;
};
if (!GameState.userData.canUserPlaceArtillery()){
playErrorSound();
return;
};
_local3 = GameState.tiles.getTile(_arg1, _arg2);
if (_local3.canTileHaveTower){
playErrorSound();
return;
};
GameState.userData.usedArtillery();
_local4 = new RazorWire();
_local4.startApplyingEffect(new Point(_arg1, _arg2));
if (!GameState.userData.canUserPlaceArtillery()){
GameState.mainObject.abilityArtilleryButton.enabled = false;
};
}
override public function enable():void{
var _local1:String;
mouseFollowingImage.visible = true;
_local1 = "Razor wire can be placed on the streets to slow and damage enemies passing over it.";
GameInterfaceHandler.showAbility(_local1);
GameInterfaceHandler.showStatTitle("Razor Wire");
}
override public function disable():void{
mouseFollowingImage.visible = false;
GameInterfaceHandler.hideAbilityInfo();
GameInterfaceHandler.hideStatTitle();
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
mouseFollowingImage.x = _arg1;
mouseFollowingImage.y = _arg2;
}
}
}//package MouseStates
Section 37
//TowerSelectedState (MouseStates.TowerSelectedState)
package MouseStates {
import GuiHandling.*;
import flash.text.*;
public class TowerSelectedState extends MouseState {
private var toolTip:TextField;
public function TowerSelectedState():void{
toolTip = new TextField();
super();
_createGlobalToolTip();
}
override public function enable():void{
TacticalTipsHandler.requestRangeIndicationHelp();
GameState.showStats(GameState.getSelectedTower().definition);
GameState.updateSelectedTowerDisplayInformation();
GameInterfaceHandler.toggleSelectedTowerKills(true);
GameInterfaceHandler.setSelectedTowerKills(GameState.getSelectedTower().getKills().toString());
GameInterfaceHandler.showStatTitle(GameState.getSelectedTower().definition.towerName);
}
private function _createGlobalToolTip(){
toolTip.background = true;
toolTip.textColor = Colors.black;
toolTip.backgroundColor = Colors.lightGrey;
toolTip.multiline = false;
toolTip.autoSize = TextFieldAutoSize.CENTER;
toolTip.visible = false;
toolTip.mouseEnabled = false;
toolTip.setTextFormat(ToolTipsHandler.format);
GameState.mainObject.addChild(toolTip);
}
override public function onMouseClicked(_arg1:Number, _arg2:Number):void{
GameState.selectTowerIfPossible(_arg1, _arg2);
}
private function _buttonShouldBeActive():Boolean{
var _local1:Tower;
var _local2:TowerDefinition;
_local1 = GameState.getSelectedTower();
_local2 = TowerDefinition.getTowerDefinition(_local1.definition.upgradeTower);
if (_local2 == null){
return (false);
};
if (!_local2.isAllowedInDemo){
toolTip.visible = true;
toolTip.text = "Upgrade not available in the Demo";
toolTip.setTextFormat(ToolTipsHandler.format);
toolTip.x = 100;
toolTip.x = GameState.mainObject.upgradeButton.x;
toolTip.y = GameState.mainObject.upgradeButton.y;
return (false);
};
toolTip.visible = false;
if (_local1 == null){
return (false);
};
if (!GameState.userData.towerCanBeAfforded(_local2)){
return (false);
};
return (true);
}
override public function onRenderIcon(_arg1:Number, _arg2:Number):void{
GameState.mainObject.upgradeButton.enabled = _buttonShouldBeActive();
}
override public function disable():void{
GameInterfaceHandler.hideStatTitle();
GameInterfaceHandler.toggleTowerPrimaryStats(false);
GameInterfaceHandler.toggleSelectedTowerKills(false);
GameInterfaceHandler.toggleGuiComponentsForUpgradeTowerStats(false);
GameState.selectedTowerRange.graphics.clear();
toolTip.visible = false;
}
}
}//package MouseStates
Section 38
//Sym_EndGameDialog_27 (ZombieDefense_fla.Sym_EndGameDialog_27)
package ZombieDefense_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Sym_EndGameDialog_27 extends MovieClip {
public var btn_EndGameSubmit:SimpleButton;
public var txtEndGameLifeBonus:TextField;
public var lblEndGame2:TextField;
public var lblEndGame3:TextField;
public var lblEndGame4:TextField;
public var btn_EndGameRestart:SimpleButton;
public var txtEndGameEnemiesKilled:TextField;
public var txtEndGameMessage:TextField;
public var txtEndGameSkipBonus:TextField;
public var lblEndGame1:TextField;
public var txtEndGameScore:TextField;
public var EndGameReason:TextField;
}
}//package ZombieDefense_fla
Section 39
//Sym_TacticalTipsDialog_4 (ZombieDefense_fla.Sym_TacticalTipsDialog_4)
package ZombieDefense_fla {
import flash.display.*;
public dynamic class Sym_TacticalTipsDialog_4 extends MovieClip {
public var testHelp:MovieClip;
public var btn_ToggleTacticalTips:SimpleButton;
public var btn_disableTacticalTips:SimpleButton;
}
}//package ZombieDefense_fla
Section 40
//advertisement (advertisement)
package {
import flash.display.*;
public dynamic class advertisement extends BitmapData {
public function advertisement(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 41
//AirStrike (AirStrike)
package {
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class AirStrike {
private var currentTileIndexX:uint;// = 0
private var currentTileIndexY:uint;// = 0
private static var delayForFlyBySoundMS:Number = 2000;
private static var timeToWaitMS:Number = 150;
private static var damagePercentagePerShot:Number = 0.25;
public function AirStrike(_arg1:Point):void{
var _local2:Tile;
var _local3:Timer;
currentTileIndexX = 0;
currentTileIndexY = 0;
super();
_local2 = GameState.tiles.getTile(_arg1.x, _arg1.y);
currentTileIndexY = _local2.getCoords().y;
GameState.playSound(new sound_Jet_FA18_PassBy1());
_local3 = new Timer(delayForFlyBySoundMS, 1);
_local3.addEventListener("timer", _flyBySoundDone);
_local3.start();
}
private function _performBombing(_arg1:TimerEvent):void{
var _local2:Tile;
_local2 = GameState.tiles.getTileFromCoord(currentTileIndexX, currentTileIndexY);
new Artillery(_local2.getCenter(), 1, 10, AirStrike.damagePercentagePerShot);
currentTileIndexX++;
}
private function _flyBySoundDone(_arg1:TimerEvent):void{
var _local2:Timer;
_local2 = new Timer(timeToWaitMS, Tiles.tileCounts.x);
_local2.addEventListener("timer", _performBombing);
_local2.start();
}
}
}//package
Section 42
//animatedZombieOne (animatedZombieOne)
package {
import flash.display.*;
public dynamic class animatedZombieOne extends BitmapData {
public function animatedZombieOne(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 43
//Animation (Animation)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Animation {
private var frameIndexes:Array;// = null
private var isAnimationPlaying:Boolean;// = false
private var playTimeMS:Number;// = NAN
private var animationLooping:Boolean;// = false
private var animationTimer:Timer;// = null
private var frames:Array;// = null
private var animationName:String;// = null
private var functionToCallbackTo:Function;// = null
private var bitmap:Bitmap;// = null
private var totalAnimationTimeMS:Number;// = NAN
private var currentFrameIndex:Number;// = 0
public function Animation(_arg1:Bitmap, _arg2:Array, _arg3:Array, _arg4:Number):void{
animationName = null;
playTimeMS = NaN;
frames = null;
currentFrameIndex = 0;
bitmap = null;
frameIndexes = null;
animationLooping = false;
functionToCallbackTo = null;
animationTimer = null;
isAnimationPlaying = false;
totalAnimationTimeMS = NaN;
super();
bitmap = _arg1;
frameIndexes = _arg2;
totalAnimationTimeMS = _arg4;
animationName = "Test";
frames = _arg3;
}
public function playLoopingAnimation(_arg1:Bitmap):void{
var _local2:Number;
if (isAnimationPlaying == true){
return;
};
bitmap = _arg1;
_local2 = (totalAnimationTimeMS / frameIndexes.length);
animationLooping = true;
animationTimer = new Timer(_local2, 0);
animationTimer.addEventListener("timer", _playFrame);
animationTimer.start();
}
private function _onAnimationDone():void{
if (functionToCallbackTo != null){
functionToCallbackTo();
};
}
public function playAnimationWithCallBack(_arg1:Bitmap, _arg2:Function):void{
var _local3:Number;
if (isAnimationPlaying == true){
return;
};
bitmap = _arg1;
_local3 = (totalAnimationTimeMS / frameIndexes.length);
functionToCallbackTo = _arg2;
animationTimer = new Timer(_local3, frameIndexes.length);
animationTimer.addEventListener("timer", _playFrame);
animationTimer.start();
}
public function stopAnimation():void{
animationTimer.stop();
isAnimationPlaying = false;
}
private function _playFrame(_arg1:TimerEvent):void{
var _local2:*;
_local2 = frameIndexes[currentFrameIndex];
bitmap.bitmapData = frames[_local2];
currentFrameIndex++;
if (currentFrameIndex == frameIndexes.length){
if (animationLooping){
currentFrameIndex = 0;
} else {
_onAnimationDone();
};
};
}
public function playAnimation(_arg1:Bitmap):void{
var _local2:Number;
if (isAnimationPlaying == true){
return;
};
bitmap = _arg1;
_local2 = (totalAnimationTimeMS / frameIndexes.length);
animationTimer = new Timer(_local2, frameIndexes.length);
animationTimer.addEventListener("timer", _playFrame);
animationTimer.start();
}
}
}//package
Section 44
//AnimationCreator (AnimationCreator)
package {
import flash.display.*;
import flash.geom.*;
public class AnimationCreator {
public static var emtEnemy:Number = 2;
public static var mgTower:Number = 1;
public function AnimationCreator():void{
}
public static function breakImageIntoFramesClass(_arg1:BitmapData, _arg2:Number, _arg3:Number):Array{
var _local4:*;
var _local5:*;
var _local6:Point;
var _local7:Point;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:*;
var _local16:*;
_local4 = _arg1.width;
_local5 = _arg1.height;
_local6 = new Point((_local4 / _arg2), (_local5 / _arg3));
_local7 = new Point(_arg2, _arg3);
_local8 = 0;
_local9 = _local6.y;
_local10 = new Array();
_local11 = 0;
while (_local11 < _arg3) {
_local12 = 0;
_local13 = _local6.x;
_local14 = 0;
while (_local14 < _arg2) {
_local15 = new Rectangle(_local12, _local8, _local13, _local9);
_local16 = new BitmapData(_local6.x, _local6.y);
_local16.copyPixels(_arg1, _local15, new Point(0, 0));
_local10.push(_local16);
_local12 = (_local12 + _local6.x);
_local13 = (_local13 + _local6.x);
_local14++;
};
_local8 = (_local8 + _local6.y);
_local9 = (_local9 + _local6.y);
_local11++;
};
return (_local10);
}
public static function breakImageIntoFrames(_arg1:String, _arg2:Number, _arg3:Number):Array{
var _local4:BitmapData;
var _local5:*;
var _local6:*;
var _local7:Point;
var _local8:Point;
var _local9:Number;
var _local10:Number;
var _local11:Array;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:*;
var _local17:*;
_local4 = null;
if (_arg1 == "mg"){
_local4 = new machineGun(50, 50);
} else {
if (_arg1 == "heavyMachineGunnerDefinition"){
_local4 = new heavyMachineGun(50, 50);
} else {
if (_arg1 == "vulcan"){
_local4 = new vulcan(50, 50);
} else {
if (_arg1 == "emt"){
_local4 = new EMTAnimated(50, 50);
} else {
if (_arg1 == "rifleman"){
_local4 = new rifleMan(50, 50);
} else {
if (_arg1 == "marksman"){
_local4 = new marksman(50, 50);
} else {
if (_arg1 == "sniper"){
_local4 = new sniper(50, 50);
} else {
if (_arg1 == "grenadier"){
_local4 = new grenadeThrower(50, 50);
} else {
if (_arg1 == "grenadeLauncher"){
_local4 = new grenadeLauncher(50, 50);
} else {
if (_arg1 == "rocketLauncher"){
_local4 = new rocketLauncher(50, 50);
} else {
if (_arg1 == "molotovCocktail"){
_local4 = new molotovCocktail(50, 50);
} else {
if (_arg1 == "incendieryGrenade"){
_local4 = new incendiaryGrenade(50, 50);
} else {
if (_arg1 == "flameThrower"){
_local4 = new flameThrower(50, 50);
} else {
if (_arg1 == "onFire"){
_local4 = new fire(50, 50);
} else {
if (_arg1 == "dizzy"){
_local4 = new dizzy(50, 50);
} else {
if (_arg1 == "missle"){
_local4 = new missle(50, 50);
} else {
if (_arg1 == "molotovBottle"){
_local4 = new molotovBottle(50, 50);
} else {
if (_arg1 == "exploAnim"){
_local4 = new exploAnim(50, 50);
} else {
if (_arg1 == "molotovExplosion"){
_local4 = new molotovExplosion(50, 50);
} else {
if (_arg1 == "incendiaryExplosion"){
_local4 = new incendiaryExplosion(50, 50);
} else {
if (_arg1 == "napalmFire"){
_local4 = new napalmFire(50, 50);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
_local5 = _local4.width;
_local6 = _local4.height;
_local7 = new Point((_local5 / _arg2), (_local6 / _arg3));
_local8 = new Point(_arg2, _arg3);
_local9 = 0;
_local10 = _local7.y;
_local11 = new Array();
_local12 = 0;
while (_local12 < _arg3) {
_local13 = 0;
_local14 = _local7.x;
_local15 = 0;
while (_local15 < _arg2) {
_local16 = new Rectangle(_local13, _local9, _local14, _local10);
_local17 = new BitmapData(_local7.x, _local7.y);
_local17.copyPixels(_local4, _local16, new Point(0, 0));
_local11.push(_local17);
_local13 = (_local13 + _local7.x);
_local14 = (_local14 + _local7.x);
_local15++;
};
_local9 = (_local9 + _local7.y);
_local10 = (_local10 + _local7.y);
_local12++;
};
return (_local11);
}
}
}//package
Section 45
//AoeEffect (AoeEffect)
package {
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class AoeEffect extends GameObject {
private var creatingTower:Tower;// = null
private static var effectRadius:Number = 0.5;
private static var damageToApply:Number = 6;
private static var lifeTime:Number = 3000;
private static var apllyEffectTimes:Number = 4;
public function AoeEffect(_arg1:Point, _arg2:Tower):void{
var _local3:Array;
var _local4:Animation;
var _local5:Timer;
var _local6:Timer;
creatingTower = null;
_local3 = AnimationCreator.breakImageIntoFrames("napalmFire", 4, 2);
super(0, _local3[0], new Point(Tiles.tileSize.x, Tiles.tileSize.y));
creatingTower = _arg2;
active = true;
setCenter(_arg1);
_local4 = new Animation(bitmap, new Array(0, 1, 2, 3, 4, 5, 6, 7), _local3, 350);
playAnimationLooping(_local4);
_local5 = new Timer((lifeTime / apllyEffectTimes), apllyEffectTimes);
_local5.addEventListener("timer", _applyDamage);
_local5.start();
_local6 = new Timer(lifeTime, 1);
_local6.addEventListener("timer", _cleanup);
_local6.start();
}
private function _cleanup(_arg1:TimerEvent):void{
cleanupGameObject();
}
private function _applyDamage(_arg1:TimerEvent):void{
var _local2:*;
var _local3:Array;
var _local4:Enemy;
_local2 = (AoeEffect.effectRadius * Tiles.tileSize.x);
_local3 = CollisionChecker.getEnemiesInRadius(getCenter(), _local2, CollisionChecker.ignoreFireEnemies);
for each (_local4 in _local3) {
_local4.applyDamage(creatingTower, damageToApply);
};
}
}
}//package
Section 46
//Artillery (Artillery)
package {
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class Artillery {
private var possibleOffset:Number;// = 40
private var shellDropTimer:Timer;// = null
private var shellsToDrop:Number;// = NAN
private var shellPercentageDamage:Number;// = NAN
private var effectPosition:Point;// = null
private static var effectRadius:Number = 40;
private static var hitIntervalMS:Number = 100;
public function Artillery(_arg1:Point, _arg2:Number=6, _arg3:Number=40, _arg4:Number=0.2):void{
shellsToDrop = NaN;
effectPosition = null;
shellDropTimer = null;
possibleOffset = 40;
shellPercentageDamage = NaN;
super();
effectPosition = _arg1;
shellsToDrop = _arg2;
possibleOffset = _arg3;
shellPercentageDamage = _arg4;
shellDropTimer = new Timer(hitIntervalMS, shellsToDrop);
shellDropTimer.addEventListener("timer", _onDropShell);
shellDropTimer.start();
}
private function _onDropShell(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (((possibleOffset * 2) * Math.random()) - possibleOffset);
_local3 = (((possibleOffset * 2) * Math.random()) - possibleOffset);
_dropArtilleryShell(new Point((effectPosition.x + _local2), (effectPosition.y + _local3)));
}
private function _dropArtilleryShell(_arg1:Point):void{
new Explosion(_arg1, AnimationCreator.breakImageIntoFrames("exploAnim", 4, 4));
_applyDamage(_arg1);
GameState.playSound(new sound_explosion2());
}
private function _applyDamage(_arg1:Point){
var _local2:Array;
var _local3:Enemy;
_local2 = CollisionChecker.getEnemiesInRadius(_arg1, Artillery.effectRadius);
for each (_local3 in _local2) {
_local3.applyDirectDamageAsPercentage(shellPercentageDamage);
};
}
}
}//package
Section 47
//BulletRetardant (BulletRetardant)
package {
import flash.display.*;
public dynamic class BulletRetardant extends BitmapData {
public function BulletRetardant(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 48
//burster (burster)
package {
import flash.display.*;
public dynamic class burster extends BitmapData {
public function burster(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 49
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 50
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 51
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 52
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 53
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 54
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 55
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 56
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 57
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 58
//buttonDisabled (buttonDisabled)
package {
import flash.display.*;
public dynamic class buttonDisabled extends BitmapData {
public function buttonDisabled(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 59
//buttonFocus (buttonFocus)
package {
import flash.display.*;
public dynamic class buttonFocus extends BitmapData {
public function buttonFocus(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 60
//buttonNoFocus (buttonNoFocus)
package {
import flash.display.*;
public dynamic class buttonNoFocus extends BitmapData {
public function buttonNoFocus(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 61
//buttonPress (buttonPress)
package {
import flash.display.*;
public dynamic class buttonPress extends BitmapData {
public function buttonPress(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 62
//ButtonWithToolTip (ButtonWithToolTip)
package {
import fl.controls.*;
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.text.*;
public class ButtonWithToolTip extends LabelButton {
private var clickCallBack:Function;
private var buttonPressEffectOn:Boolean;// = false
private var buttonIcon:DisplayObject;// = null
public var buttonHeight:Number;// = 25
private var buttonText:TextField;
public var buttonWidth:Number;// = 100
public var toolTipText:String;// = "default tool tip"
private var toolTipFormat:TextFormat;
private var toolTip:TextField;
private var toolTipsAreDisabled:Boolean;// = false
public static var toolTipOffsetX:Number = 40;
public static var alphaForDisabledIcons:Number = 0.25;
public static var alphaForEnabledIcons:Number = 1;
public static var pressEffectAmount:Number = 2;
public function ButtonWithToolTip(_arg1:SimpleButton){
buttonWidth = 100;
buttonHeight = 25;
toolTipText = "default tool tip";
buttonPressEffectOn = false;
toolTipsAreDisabled = false;
buttonIcon = null;
super();
if (_arg1 == null){
return;
};
buttonWidth = _arg1.width;
buttonHeight = _arg1.height;
width = _arg1.width;
height = _arg1.height;
x = _arg1.x;
y = _arg1.y;
_setupMouseCallBacks();
_setupStyles();
}
private function _setupStyles():void{
var _local1:Bitmap;
var _local2:Bitmap;
var _local3:Bitmap;
var _local4:Bitmap;
_local1 = new Bitmap();
_local1.bitmapData = new buttonFocus(0, 0);
_local1.width = buttonWidth;
_local1.height = buttonHeight;
_local2 = new Bitmap();
_local2.bitmapData = new buttonNoFocus(0, 0);
_local2.width = buttonWidth;
_local2.height = buttonHeight;
_local3 = new Bitmap();
_local3.bitmapData = new buttonDisabled(0, 0);
_local3.width = buttonWidth;
_local3.height = buttonHeight;
_local4 = new Bitmap();
_local4.bitmapData = new buttonPress(0, 0);
_local4.width = buttonWidth;
_local4.height = buttonHeight;
setStyle("icon", _local2);
setStyle("overIcon", _local1);
setStyle("disabledIcon", _local3);
setStyle("downIcon", _local4);
setStyle("upSkin", _local2);
setStyle("selectedUpSkin", _local2);
setStyle("selectedOverSkin", _local2);
setStyle("selectedDownSkin", _local2);
setStyle("selectedDisabledSkin", _local2);
setStyle("overSkin", _local2);
setStyle("downSkin", _local2);
setStyle("disabledSkin", _local2);
}
private function _onMouseDown(_arg1){
_showButtonPressEffect();
}
public function setImage(_arg1:BitmapData):void{
var _local2:DisplayObject;
_local2 = ButtonWithToolTip.createBitmapIcon(_arg1);
addChild(_local2);
this.buttonIcon = _local2;
_positionButtonIcon();
}
private function _onMouseOver(_arg1){
var _local2:Sound;
_showToolTip();
_local2 = new sound_click01();
GameState.playSound(_local2);
}
private function _showToolTip():void{
var _local1:TextFormat;
if (toolTipsAreDisabled){
return;
};
_createToolTip();
_local1 = new TextFormat();
_local1.font = "Verdana";
_local1.size = 12;
_local1.bold = true;
toolTip.text = toolTipText;
toolTip.x = ((x + mouseX) + toolTipOffsetX);
toolTip.y = (y + mouseY);
toolTip.visible = true;
toolTip.setTextFormat(_local1);
}
private function _hideToolTip():void{
if (toolTipsAreDisabled){
return;
};
toolTip.visible = false;
}
private function _onEnterFrame(_arg1:Event):void{
if (this.enabled){
this.buttonIcon.alpha = alphaForEnabledIcons;
} else {
this.buttonIcon.alpha = alphaForDisabledIcons;
};
}
private function _showButtonPressEffect(){
if (buttonPressEffectOn == true){
return;
};
buttonPressEffectOn = true;
this.buttonIcon.x = (this.buttonIcon.x + pressEffectAmount);
this.buttonIcon.y = (this.buttonIcon.y + pressEffectAmount);
}
private function _setupMouseCallBacks():void{
addEventListener(MouseEvent.MOUSE_OVER, _onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, _onMouseOut);
addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, _onMouseUp);
addEventListener(MouseEvent.CLICK, _onClick);
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}
public function setText(_arg1:String, _arg2:uint=12):void{
var _local3:DisplayObject;
_local3 = ButtonWithToolTip.createTextIcon(_arg1, _arg2);
addChild(_local3);
this.buttonIcon = _local3;
_positionButtonIcon();
}
public function setClickCallBack(_arg1:Function):void{
clickCallBack = _arg1;
}
private function _onMouseOut(_arg1){
_hideToolTip();
_removeButtonPressEffect();
}
private function _createToolTip():void{
if (toolTip != null){
return;
};
toolTip = new TextField();
toolTip.background = true;
toolTip.backgroundColor = Colors.lightGrey;
toolTip.border = true;
toolTip.borderColor = 0;
toolTip.multiline = false;
toolTip.autoSize = TextFieldAutoSize.CENTER;
toolTip.visible = false;
toolTip.mouseEnabled = false;
GameState.mainObject.addChild(toolTip);
}
public function setupButtonIfNoReplacement():void{
_setupMouseCallBacks();
_setupStyles();
}
private function _positionButtonIcon():void{
var _local1:Number;
var _local2:Number;
_local1 = (this.width - buttonIcon.width);
_local2 = (this.height - buttonIcon.height);
buttonIcon.x = (0 + (_local1 / 2));
buttonIcon.y = (0 + (_local2 / 2));
}
private function _onClick(_arg1){
if (clickCallBack == null){
throw (new Error("A Button with tool tip does not have a click command"));
};
clickCallBack();
}
private function _onMouseUp(_arg1){
_removeButtonPressEffect();
}
private function _removeButtonPressEffect(){
if (buttonPressEffectOn == false){
return;
};
buttonPressEffectOn = false;
this.buttonIcon.x = (this.buttonIcon.x - pressEffectAmount);
this.buttonIcon.y = (this.buttonIcon.y - pressEffectAmount);
}
public function disableToolTips():void{
toolTipsAreDisabled = true;
}
public static function createTextIcon(_arg1:String, _arg2:uint):DisplayObject{
var _local3:TextField;
var _local4:TextFormat;
_local3 = new TextField();
_local3.multiline = false;
_local3.autoSize = TextFieldAutoSize.LEFT;
_local3.text = _arg1;
_local4 = new TextFormat();
_local4.font = "LucidaConsole";
_local4.color = Colors.white;
_local4.bold = true;
_local4.size = _arg2;
_local3.setTextFormat(_local4);
return (_local3);
}
public static function createBitmapIcon(_arg1:BitmapData):DisplayObject{
var _local2:Bitmap;
_local2 = new Bitmap();
_local2.bitmapData = _arg1;
return (_local2);
}
}
}//package
Section 63
//ColdRetardant (ColdRetardant)
package {
import flash.display.*;
public dynamic class ColdRetardant extends BitmapData {
public function ColdRetardant(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 64
//CollisionChecker (CollisionChecker)
package {
import flash.geom.*;
public class CollisionChecker {
public static var ignoreFireEnemies:uint = 1;
public function CollisionChecker():void{
}
private static function enemyWithinRadius(_arg1:Point, _arg2:Number, _arg3:Enemy):Boolean{
var _local4:Number;
var _local5:Number;
_local4 = Point.distance(_arg1, _arg3.getCenter());
_local5 = (_arg3.bitmap.width / 2);
if ((_local4 - _local5) > _arg2){
return (false);
};
return (true);
}
public static function getEnemiesInRadius(_arg1:Point, _arg2:Number, _arg3:uint=0):Array{
var _local4:Array;
var _local5:Enemy;
_local4 = new Array();
_local5 = null;
for each (_local5 in GameState.normalEnemies) {
if (enemyWithinRadius(_arg1, _arg2, _local5)){
_local4.push(_local5);
};
};
if (_arg3 != CollisionChecker.ignoreFireEnemies){
for each (_local5 in GameState.fireImmuneEnemies) {
if (enemyWithinRadius(_arg1, _arg2, _local5)){
_local4.push(_local5);
};
};
};
for each (_local5 in GameState.bulletImmuneEnemies) {
if (enemyWithinRadius(_arg1, _arg2, _local5)){
_local4.push(_local5);
};
};
for each (_local5 in GameState.slowImmuneEnemies) {
if (enemyWithinRadius(_arg1, _arg2, _local5)){
_local4.push(_local5);
};
};
return (_local4);
}
}
}//package
Section 65
//Colors (Colors)
package {
public class Colors {
public static var green:uint = 0xFF00;
public static var teal:uint = 0xFFFF;
public static var white:uint = 0xFFFFFF;
public static var red:uint = 0xFF0000;
public static var lightGrey:uint = 0x999999;
public static var blue:uint = 0xFF;
public static var purple:uint = 10030028;
public static var black:uint = 0;
public function Colors():void{
}
}
}//package
Section 66
//constructionWorkAnimated (constructionWorkAnimated)
package {
import flash.display.*;
public dynamic class constructionWorkAnimated extends BitmapData {
public function constructionWorkAnimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 67
//Cryptography (Cryptography)
package {
public class Cryptography {
public function Cryptography():void{
}
private static function HH(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
_arg1 = AddUnsigned(_arg1, AddUnsigned(AddUnsigned(H(_arg2, _arg3, _arg4), _arg5), _arg7));
return (AddUnsigned(RotateLeft(_arg1, _arg6), _arg2));
}
private static function ConvertToWordArray(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:Array;
var _local8:*;
var _local9:*;
_local3 = _arg1.length;
_local4 = (_local3 + 8);
_local5 = (((_local3 + 8) - (_local4 % 64)) / 64);
_local6 = ((_local5 + 1) * 16);
_local7 = new Array((_local6 - 1));
_local8 = 0;
_local9 = 0;
while (_local9 < _local3) {
_local2 = ((_local9 - (_local9 % 4)) / 4);
_local8 = ((_local9 % 4) * 8);
_local7[_local2] = (_local7[_local2] | (_arg1.charCodeAt(_local9) << _local8));
_local9++;
};
_local2 = ((_local9 - (_local9 % 4)) / 4);
_local8 = ((_local9 % 4) * 8);
_local7[_local2] = (_local7[_local2] | (128 << _local8));
_local7[(_local6 - 2)] = (_local3 << 3);
_local7[(_local6 - 1)] = (_local3 >>> 29);
return (_local7);
}
private static function RotateLeft(_arg1, _arg2){
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
private static function F(_arg1, _arg2, _arg3){
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function GG(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
_arg1 = AddUnsigned(_arg1, AddUnsigned(AddUnsigned(G(_arg2, _arg3, _arg4), _arg5), _arg7));
return (AddUnsigned(RotateLeft(_arg1, _arg6), _arg2));
}
private static function H(_arg1, _arg2, _arg3){
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function I(_arg1, _arg2, _arg3){
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function G(_arg1, _arg2, _arg3){
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function II(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
_arg1 = AddUnsigned(_arg1, AddUnsigned(AddUnsigned(I(_arg2, _arg3, _arg4), _arg5), _arg7));
return (AddUnsigned(RotateLeft(_arg1, _arg6), _arg2));
}
private static function AddUnsigned(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local5 = (_arg1 & 2147483648);
_local6 = (_arg2 & 2147483648);
_local3 = (_arg1 & 1073741824);
_local4 = (_arg2 & 1073741824);
_local7 = ((_arg1 & 1073741823) + (_arg2 & 1073741823));
if ((_local3 & _local4)){
return ((((_local7 ^ 2147483648) ^ _local5) ^ _local6));
};
if ((_local3 | _local4)){
if ((_local7 & 1073741824)){
return ((((_local7 ^ 3221225472) ^ _local5) ^ _local6));
};
return ((((_local7 ^ 1073741824) ^ _local5) ^ _local6));
//unresolved jump
};
return (((_local7 ^ _local5) ^ _local6));
}
private static function FF(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
_arg1 = AddUnsigned(_arg1, AddUnsigned(AddUnsigned(F(_arg2, _arg3, _arg4), _arg5), _arg7));
return (AddUnsigned(RotateLeft(_arg1, _arg6), _arg2));
}
private static function WordToHex(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = "";
_local3 = "";
_local5 = 0;
while (_local5 <= 3) {
_local4 = ((_arg1 >>> (_local5 * 8)) & 0xFF);
_local3 = ("0" + _local4.toString(16));
_local2 = (_local2 + _local3.substr((_local3.length - 2), 2));
_local5++;
};
return (_local2);
}
public static function MD5(_arg1:String):String{
var _local2:Array;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
var _local20:*;
var _local21:*;
var _local22:*;
var _local23:*;
var _local24:*;
var _local25:*;
var _local26:*;
var _local27:*;
var _local28:*;
_local2 = new Array();
_local12 = 7;
_local13 = 12;
_local14 = 17;
_local15 = 22;
_local16 = 5;
_local17 = 9;
_local18 = 14;
_local19 = 20;
_local20 = 4;
_local21 = 11;
_local22 = 16;
_local23 = 23;
_local24 = 6;
_local25 = 10;
_local26 = 15;
_local27 = 21;
_arg1 = Utf8Encode(_arg1);
_local2 = ConvertToWordArray(_arg1);
_local8 = 1732584193;
_local9 = 4023233417;
_local10 = 2562383102;
_local11 = 271733878;
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = _local8;
_local5 = _local9;
_local6 = _local10;
_local7 = _local11;
_local8 = FF(_local8, _local9, _local10, _local11, _local2[(_local3 + 0)], _local12, 3614090360);
_local11 = FF(_local11, _local8, _local9, _local10, _local2[(_local3 + 1)], _local13, 3905402710);
_local10 = FF(_local10, _local11, _local8, _local9, _local2[(_local3 + 2)], _local14, 606105819);
_local9 = FF(_local9, _local10, _local11, _local8, _local2[(_local3 + 3)], _local15, 3250441966);
_local8 = FF(_local8, _local9, _local10, _local11, _local2[(_local3 + 4)], _local12, 4118548399);
_local11 = FF(_local11, _local8, _local9, _local10, _local2[(_local3 + 5)], _local13, 1200080426);
_local10 = FF(_local10, _local11, _local8, _local9, _local2[(_local3 + 6)], _local14, 2821735955);
_local9 = FF(_local9, _local10, _local11, _local8, _local2[(_local3 + 7)], _local15, 4249261313);
_local8 = FF(_local8, _local9, _local10, _local11, _local2[(_local3 + 8)], _local12, 1770035416);
_local11 = FF(_local11, _local8, _local9, _local10, _local2[(_local3 + 9)], _local13, 2336552879);
_local10 = FF(_local10, _local11, _local8, _local9, _local2[(_local3 + 10)], _local14, 4294925233);
_local9 = FF(_local9, _local10, _local11, _local8, _local2[(_local3 + 11)], _local15, 2304563134);
_local8 = FF(_local8, _local9, _local10, _local11, _local2[(_local3 + 12)], _local12, 1804603682);
_local11 = FF(_local11, _local8, _local9, _local10, _local2[(_local3 + 13)], _local13, 4254626195);
_local10 = FF(_local10, _local11, _local8, _local9, _local2[(_local3 + 14)], _local14, 2792965006);
_local9 = FF(_local9, _local10, _local11, _local8, _local2[(_local3 + 15)], _local15, 1236535329);
_local8 = GG(_local8, _local9, _local10, _local11, _local2[(_local3 + 1)], _local16, 4129170786);
_local11 = GG(_local11, _local8, _local9, _local10, _local2[(_local3 + 6)], _local17, 3225465664);
_local10 = GG(_local10, _local11, _local8, _local9, _local2[(_local3 + 11)], _local18, 643717713);
_local9 = GG(_local9, _local10, _local11, _local8, _local2[(_local3 + 0)], _local19, 3921069994);
_local8 = GG(_local8, _local9, _local10, _local11, _local2[(_local3 + 5)], _local16, 3593408605);
_local11 = GG(_local11, _local8, _local9, _local10, _local2[(_local3 + 10)], _local17, 38016083);
_local10 = GG(_local10, _local11, _local8, _local9, _local2[(_local3 + 15)], _local18, 3634488961);
_local9 = GG(_local9, _local10, _local11, _local8, _local2[(_local3 + 4)], _local19, 3889429448);
_local8 = GG(_local8, _local9, _local10, _local11, _local2[(_local3 + 9)], _local16, 568446438);
_local11 = GG(_local11, _local8, _local9, _local10, _local2[(_local3 + 14)], _local17, 3275163606);
_local10 = GG(_local10, _local11, _local8, _local9, _local2[(_local3 + 3)], _local18, 4107603335);
_local9 = GG(_local9, _local10, _local11, _local8, _local2[(_local3 + 8)], _local19, 1163531501);
_local8 = GG(_local8, _local9, _local10, _local11, _local2[(_local3 + 13)], _local16, 2850285829);
_local11 = GG(_local11, _local8, _local9, _local10, _local2[(_local3 + 2)], _local17, 4243563512);
_local10 = GG(_local10, _local11, _local8, _local9, _local2[(_local3 + 7)], _local18, 1735328473);
_local9 = GG(_local9, _local10, _local11, _local8, _local2[(_local3 + 12)], _local19, 2368359562);
_local8 = HH(_local8, _local9, _local10, _local11, _local2[(_local3 + 5)], _local20, 4294588738);
_local11 = HH(_local11, _local8, _local9, _local10, _local2[(_local3 + 8)], _local21, 2272392833);
_local10 = HH(_local10, _local11, _local8, _local9, _local2[(_local3 + 11)], _local22, 1839030562);
_local9 = HH(_local9, _local10, _local11, _local8, _local2[(_local3 + 14)], _local23, 4259657740);
_local8 = HH(_local8, _local9, _local10, _local11, _local2[(_local3 + 1)], _local20, 2763975236);
_local11 = HH(_local11, _local8, _local9, _local10, _local2[(_local3 + 4)], _local21, 1272893353);
_local10 = HH(_local10, _local11, _local8, _local9, _local2[(_local3 + 7)], _local22, 4139469664);
_local9 = HH(_local9, _local10, _local11, _local8, _local2[(_local3 + 10)], _local23, 3200236656);
_local8 = HH(_local8, _local9, _local10, _local11, _local2[(_local3 + 13)], _local20, 681279174);
_local11 = HH(_local11, _local8, _local9, _local10, _local2[(_local3 + 0)], _local21, 3936430074);
_local10 = HH(_local10, _local11, _local8, _local9, _local2[(_local3 + 3)], _local22, 3572445317);
_local9 = HH(_local9, _local10, _local11, _local8, _local2[(_local3 + 6)], _local23, 76029189);
_local8 = HH(_local8, _local9, _local10, _local11, _local2[(_local3 + 9)], _local20, 3654602809);
_local11 = HH(_local11, _local8, _local9, _local10, _local2[(_local3 + 12)], _local21, 3873151461);
_local10 = HH(_local10, _local11, _local8, _local9, _local2[(_local3 + 15)], _local22, 530742520);
_local9 = HH(_local9, _local10, _local11, _local8, _local2[(_local3 + 2)], _local23, 3299628645);
_local8 = II(_local8, _local9, _local10, _local11, _local2[(_local3 + 0)], _local24, 4096336452);
_local11 = II(_local11, _local8, _local9, _local10, _local2[(_local3 + 7)], _local25, 1126891415);
_local10 = II(_local10, _local11, _local8, _local9, _local2[(_local3 + 14)], _local26, 2878612391);
_local9 = II(_local9, _local10, _local11, _local8, _local2[(_local3 + 5)], _local27, 4237533241);
_local8 = II(_local8, _local9, _local10, _local11, _local2[(_local3 + 12)], _local24, 1700485571);
_local11 = II(_local11, _local8, _local9, _local10, _local2[(_local3 + 3)], _local25, 2399980690);
_local10 = II(_local10, _local11, _local8, _local9, _local2[(_local3 + 10)], _local26, 4293915773);
_local9 = II(_local9, _local10, _local11, _local8, _local2[(_local3 + 1)], _local27, 2240044497);
_local8 = II(_local8, _local9, _local10, _local11, _local2[(_local3 + 8)], _local24, 1873313359);
_local11 = II(_local11, _local8, _local9, _local10, _local2[(_local3 + 15)], _local25, 4264355552);
_local10 = II(_local10, _local11, _local8, _local9, _local2[(_local3 + 6)], _local26, 2734768916);
_local9 = II(_local9, _local10, _local11, _local8, _local2[(_local3 + 13)], _local27, 1309151649);
_local8 = II(_local8, _local9, _local10, _local11, _local2[(_local3 + 4)], _local24, 4149444226);
_local11 = II(_local11, _local8, _local9, _local10, _local2[(_local3 + 11)], _local25, 3174756917);
_local10 = II(_local10, _local11, _local8, _local9, _local2[(_local3 + 2)], _local26, 718787259);
_local9 = II(_local9, _local10, _local11, _local8, _local2[(_local3 + 9)], _local27, 3951481745);
_local8 = AddUnsigned(_local8, _local4);
_local9 = AddUnsigned(_local9, _local5);
_local10 = AddUnsigned(_local10, _local6);
_local11 = AddUnsigned(_local11, _local7);
_local3 = (_local3 + 16);
};
_local28 = (((WordToHex(_local8) + WordToHex(_local9)) + WordToHex(_local10)) + WordToHex(_local11));
return (_local28.toLowerCase());
}
private static function Utf8Encode(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
if (_local4 < 128){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if ((((_local4 > 127)) && ((_local4 < 0x0800)))){
_local2 = (_local2 + String.fromCharCode(((_local4 >> 6) | 192)));
_local2 = (_local2 + String.fromCharCode(((_local4 & 63) | 128)));
} else {
_local2 = (_local2 + String.fromCharCode(((_local4 >> 12) | 224)));
_local2 = (_local2 + String.fromCharCode((((_local4 >> 6) & 63) | 128)));
_local2 = (_local2 + String.fromCharCode(((_local4 & 63) | 128)));
};
};
_local3++;
};
return (_local2);
}
}
}//package
Section 68
//dizzy (dizzy)
package {
import flash.display.*;
public dynamic class dizzy extends BitmapData {
public function dizzy(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 69
//DotEffect (DotEffect)
package {
import flash.events.*;
import flash.utils.*;
public class DotEffect {
private var tickCallback:Function;// = null
private var completionTimer:Timer;// = null
private var creatingTower:Tower;// = null
private var totalDamage:Number;// = NAN
private var applicationTimes:Number;// = NAN
private var completeCallback:Function;// = null
private var paused:Boolean;// = false
private var applyTimer:Timer;// = null
private var effectTime:Number;// = NAN
public function DotEffect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Tower, _arg5:Function, _arg6:Function):void{
totalDamage = NaN;
effectTime = NaN;
applicationTimes = NaN;
creatingTower = null;
tickCallback = null;
completeCallback = null;
applyTimer = null;
completionTimer = null;
paused = false;
super();
totalDamage = _arg1;
effectTime = _arg2;
applicationTimes = _arg3;
creatingTower = _arg4;
tickCallback = _arg5;
completeCallback = _arg6;
}
private function _onEffectFinished(_arg1:TimerEvent):void{
completeCallback(this);
}
public function getTimes():Number{
return (applicationTimes);
}
public function getCreatingTower():Tower{
return (creatingTower);
}
public function getTotalDamage():Number{
return (totalDamage);
}
public function cleanup():void{
applyTimer.stop();
completionTimer.stop();
}
public function getDamage():Number{
return ((totalDamage / applicationTimes));
}
public function startApplyingEffect():void{
var _local1:Number;
var _local2:Timer;
_local1 = (effectTime / applicationTimes);
applyTimer = new Timer(_local1, applicationTimes);
applyTimer.addEventListener(TimerEvent.TIMER, _onEffectTick);
applyTimer.start();
completionTimer = new Timer(effectTime, 1);
completionTimer.addEventListener(TimerEvent.TIMER, _onEffectFinished);
completionTimer.start();
_local2 = new Timer(300, 1);
_local2.addEventListener(TimerEvent.TIMER, _tryHelp);
_local2.start();
}
public function pauseDotEffect():void{
if (paused == true){
return;
};
applyTimer.stop();
completionTimer.stop();
paused = true;
}
public function getEffectTime():Number{
return (effectTime);
}
private function _onEffectTick(_arg1:TimerEvent):void{
tickCallback(this);
}
public function unpauseDotEffect():void{
if ((paused = false)){
return;
};
applyTimer.start();
completionTimer.start();
paused = false;
}
private function _tryHelp(_arg1):void{
TacticalTipsHandler.requestShowDotHelp();
}
}
}//package
Section 70
//EMTAnimated (EMTAnimated)
package {
import flash.display.*;
public dynamic class EMTAnimated extends BitmapData {
public function EMTAnimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 71
//Enemy (Enemy)
package {
import flash.geom.*;
public class Enemy extends GameObject {
private var size:Point;
private var destPoint:Point;
private var moveDown:Animation;// = null
private var isEnemyDead:Boolean;// = false
private var isDotBeingApplied:Boolean;// = false
private var onStunEffect:GameObject;// = null
private var moveUp:Animation;// = null
private var dotEffect:DotEffect;// = null
private var slowImmunity:GameObject;// = null
private var bulletImmunity:GameObject;// = null
private var death:Animation;// = null
public var offset:Point;// = null
private var onFireEffect:GameObject;// = null
private var moveRight:Animation;// = null
public var definition:EnemyDefinition;// = null
private var lifeBar:LifeBar;// = null
private var moveLeft:Animation;// = null
private var fireImmunity:GameObject;// = null
private var slowEffects:Array;
public var enemyInCity:Boolean;// = false
private var currentlife:Number;// = NAN
private static var animationPlayTime:Number = 500;
public static var stunnedFrames:Array = AnimationCreator.breakImageIntoFrames("dizzy", 2, 1);
public static var onFireFrames:Array = AnimationCreator.breakImageIntoFrames("onFire", 2, 1);
public static var pointsForKillingAnEnemy:Number = 1;
public function Enemy(_arg1:EnemyDefinition){
onFireEffect = null;
onStunEffect = null;
fireImmunity = null;
bulletImmunity = null;
slowImmunity = null;
currentlife = NaN;
destPoint = new Point();
size = new Point(25, 25);
offset = null;
isEnemyDead = false;
definition = null;
slowEffects = new Array();
dotEffect = null;
isDotBeingApplied = false;
moveUp = null;
moveDown = null;
moveLeft = null;
moveRight = null;
death = null;
enemyInCity = false;
lifeBar = null;
super(_arg1.speed, _arg1.frames[0], size);
definition = _arg1;
currentlife = definition.totalLife;
onFireEffect = new GameObject(0, Enemy.onFireFrames[0], size);
onFireEffect.active = true;
onFireEffect.setVisible(false);
onFireEffect.playAnimationLooping(new Animation(onFireEffect.bitmap, new Array(0, 1), Enemy.onFireFrames, 200));
mountObject(new MountInfo(onFireEffect));
onStunEffect = new GameObject(0, Enemy.stunnedFrames[0], size);
onStunEffect.active = true;
onStunEffect.setVisible(false);
onStunEffect.playAnimationLooping(new Animation(onStunEffect.bitmap, new Array(0, 1), Enemy.stunnedFrames, 200));
mountObject(new MountInfo(onStunEffect));
lifeBar = new LifeBar(size.x);
lifeBar.mountTo(this);
if (definition.immunityType == TowerDefinition.normalDamage){
bulletImmunity = new GameObject(0, new BulletRetardant(50, 50), new Point(10, 10));
bulletImmunity.active = true;
mountObject(new MountInfo(bulletImmunity, new Point(0, -15)));
} else {
if (definition.immunityType == TowerDefinition.fireDamage){
fireImmunity = new GameObject(0, new FlameRetardant(50, 50), new Point(10, 10));
fireImmunity.active = true;
mountObject(new MountInfo(fireImmunity, new Point(0, -15)));
} else {
if (definition.immunityType == TowerDefinition.slowDamage){
slowImmunity = new GameObject(0, new ColdRetardant(50, 50), new Point(10, 10));
slowImmunity.active = true;
mountObject(new MountInfo(slowImmunity, new Point(0, -15)));
};
};
};
setOnDestinationCallBack(_onDestinationReached);
_createAnimations();
}
private function _onPathEndReached(){
GameState.userData.takeLife();
_cleanup();
}
private function _cleanupLifeAndEffects():void{
if (lifeBar != null){
lifeBar.cleanup();
lifeBar = null;
};
if (onFireEffect != null){
onFireEffect.cleanupGameObject();
onFireEffect = null;
};
if (onStunEffect != null){
onStunEffect.cleanupGameObject();
onStunEffect = null;
};
}
public function cleanupForGameReset():void{
_cleanup();
}
public function applyDamage(_arg1:Tower, _arg2:Number=0):void{
var _local3:SlowEffect;
var _local4:*;
if (isEnemyDead == true){
return;
};
if (_arg1.definition.damageType == definition.immunityType){
return;
};
_local3 = _arg1.definition.specialAbility;
if (((!((_local3 == null))) && (!((definition.immunityType == TowerDefinition.slowDamage))))){
_applySlowEffect(_local3.getSpeedModifier(), _local3.getDuration());
};
_local4 = _arg1.definition.dotEffect;
if (_local4 != null){
_applyDotEffect(_local4.getTotalDamage(), _local4.getEffectTime(), _local4.getTimes(), _arg1);
};
if (_arg2 == 0){
_applyDamage(_arg1, _arg1.getDamage());
} else {
_applyDamage(_arg1, _arg2);
};
}
private function _onDestinationReached(){
var _local1:*;
var _local2:Point;
var _local3:Animation;
var _local4:Point;
_checkEnemyEnteredCity();
_local1 = destPoint;
destPoint = EnemyPath.getNextPoint(destPoint);
if (destPoint == null){
_onPathEndReached();
return;
};
_local2 = Tiles.realFromCoord(destPoint);
_local2.x = (_local2.x + offset.x);
_local2.y = (_local2.y + offset.y);
setDestination(_local2);
_local4 = getPosition();
if (_local1.x > destPoint.x){
_local3 = moveLeft;
} else {
if (_local1.x < destPoint.x){
_local3 = moveRight;
} else {
if (_local1.y < destPoint.y){
_local3 = moveDown;
} else {
if (_local1.y > destPoint.y){
_local3 = moveUp;
};
};
};
};
playAnimationLooping(_local3);
}
public function unpauseEnemy():void{
var _local1:SlowEffect;
unpauseGameObject();
for each (_local1 in slowEffects) {
_local1.unpauseSlowEffect();
};
if (dotEffect != null){
dotEffect.unpauseDotEffect();
};
}
private function _applyDamage(_arg1:Tower, _arg2:Number):void{
if (isEnemyDead == true){
return;
};
currentlife = (currentlife - _arg2);
lifeBar.adjustLife((currentlife / definition.totalLife));
if (currentlife > 0){
return;
};
if (_arg1 == null){
_onDeathByEffect();
} else {
_onDeathByTower(_arg1);
};
}
private function _applySlowEffect(_arg1:Number, _arg2:Number):void{
var _local3:SlowEffect;
onStunEffect.setVisible(true);
_local3 = new SlowEffect(_arg1, _arg2, onSlowEffectRemoved);
_local3.startApplyingEffect();
slowEffects.push(_local3);
_applyLowestSpeedMod();
}
private function _applyDotEffect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Tower):void{
if (isDotBeingApplied == false){
onFireEffect.setVisible(true);
isDotBeingApplied = true;
dotEffect = new DotEffect(_arg1, _arg2, _arg3, _arg4, onDotEffectTick, onDotEffectRemoved);
dotEffect.startApplyingEffect();
};
}
public function onDotEffectRemoved(_arg1:DotEffect):void{
if (isEnemyDead == true){
return;
};
isDotBeingApplied = false;
onFireEffect.setVisible(false);
}
public function isActive():Boolean{
if (active == false){
return (false);
};
if (isEnemyDead == true){
return (false);
};
return (true);
}
public function applyDirectDamageAsPercentage(_arg1:Number):void{
var _local2:Number;
_local2 = (_arg1 * definition.totalLife);
_applyDamage(null, _local2);
}
public function onSlowEffectRemoved(_arg1:SlowEffect):void{
var _local2:Number;
if (isEnemyDead == true){
return;
};
_local2 = slowEffects.indexOf(_arg1);
slowEffects.splice(_local2, 1);
_applyLowestSpeedMod();
if (slowEffects.length == 0){
onStunEffect.setVisible(false);
};
}
public function applySlowEffect(_arg1:SlowEffect):void{
if (_arg1 == null){
throw (new Error("Cannot apply a null slow effect on an Enemy"));
};
if (isEnemyDead == true){
return;
};
if (definition.immunityType == TowerDefinition.slowDamage){
return;
};
_applySlowEffect(_arg1.getSpeedModifier(), _arg1.getDuration());
}
private function _checkEnemyEnteredCity():void{
if (enemyInCity == true){
return;
};
if (((!((destPoint.x == 0))) && (!((destPoint.y == 11))))){
return;
};
enemyInCity = true;
}
public function startFollowingPath(){
var _local1:Point;
destPoint = EnemyPath.getFirstPoint();
_local1 = Tiles.realFromCoord(destPoint);
_local1.x = (_local1.x + offset.x);
_local1.y = (_local1.y + offset.y);
setDestination(_local1);
}
public function pauseEnemy():void{
var _local1:SlowEffect;
pauseGameObject();
for each (_local1 in slowEffects) {
_local1.pauseSlowEffect();
};
if (dotEffect != null){
dotEffect.pauseDotEffect();
};
}
public function applyDirectDamage(_arg1:Number):void{
_applyDamage(null, _arg1);
}
public function onDotEffectTick(_arg1:DotEffect):void{
if (isEnemyDead == true){
return;
};
_applyDamage(_arg1.getCreatingTower(), _arg1.getDamage());
}
public function onProjectileHit(_arg1:Projectile):void{
applyDamage(_arg1.creatingTower);
}
private function _applyLowestSpeedMod():void{
var _local1:Number;
var _local2:SlowEffect;
_local1 = 1;
for each (_local2 in slowEffects) {
if (_local2.getSpeedModifier() < _local1){
_local1 = _local2.getSpeedModifier();
};
};
setSpeedModifier(_local1);
}
private function _cleanup():void{
active = false;
_cleanupEffects();
_cleanupLifeAndEffects();
_cleanupImmunityImages();
GameState.removeEnemyFromGame(this);
super.cleanupGameObject();
}
private function _onDeathByTower(_arg1:Tower):void{
_arg1.addKill();
_performEnemyDeathActions();
}
private function _onDeathByEffect():void{
_performEnemyDeathActions();
}
private function _performEnemyDeathActions():void{
active = false;
new NumberDisplay(definition.loot, this.getPosition());
_cleanupLifeAndEffects();
_cleanupImmunityImages();
playAnimationWithCallBack(death, _cleanup);
isEnemyDead = true;
setSpeedModifier(0);
GameState.userData.addMoney(this.definition.loot);
GameState.userData.addToScore(Enemy.pointsForKillingAnEnemy);
GameState.userData.addEnemyKill();
}
private function _cleanupImmunityImages():void{
if (fireImmunity != null){
fireImmunity.cleanupGameObject();
fireImmunity = null;
};
if (bulletImmunity != null){
bulletImmunity.cleanupGameObject();
bulletImmunity = null;
};
if (slowImmunity != null){
slowImmunity.cleanupGameObject();
slowImmunity = null;
};
}
private function _cleanupEffects():void{
var _local1:SlowEffect;
for each (_local1 in slowEffects) {
_local1.cleanup();
};
slowEffects = null;
if (dotEffect != null){
dotEffect.cleanup();
dotEffect = null;
};
}
private function _createAnimations():void{
moveUp = new Animation(bitmap, new Array(0, 1, 2, 3), definition.frames, 800);
moveDown = new Animation(bitmap, new Array(4, 5, 6, 7), definition.frames, 800);
moveLeft = new Animation(bitmap, new Array(8, 9, 10, 11), definition.frames, 800);
moveRight = new Animation(bitmap, new Array(12, 13, 14, 15), definition.frames, 800);
death = new Animation(bitmap, new Array(16, 17, 18, 19), definition.frames, 1000);
}
}
}//package
Section 72
//enemyClip (enemyClip)
package {
import flash.display.*;
public dynamic class enemyClip extends MovieClip {
}
}//package
Section 73
//EnemyDefinition (EnemyDefinition)
package {
public class EnemyDefinition {
public var totalLife:Number;// = NAN
public var frames:Array;// = null
public var loot:Number;// = 1
public var enemyName:String;// = null
public var immunityType:String;// = null
public var speed:Number;// = NAN
public static var definitions:Array = new Array();
public function EnemyDefinition():void{
enemyName = null;
frames = null;
totalLife = NaN;
speed = NaN;
loot = 1;
immunityType = null;
super();
}
private static function _buildFirstSet():void{
var _local1:EnemyDefinition;
var _local2:EnemyDefinition;
var _local3:EnemyDefinition;
var _local4:EnemyDefinition;
var _local5:EnemyDefinition;
var _local6:EnemyDefinition;
var _local7:EnemyDefinition;
_local1 = new (EnemyDefinition);
_local1.enemyName = "EMT";
_local1.frames = AnimationCreator.breakImageIntoFrames("emt", 4, 5);
_local1.totalLife = 20;
_local1.speed = 2;
definitions.push(_local1);
_local2 = new (EnemyDefinition);
_local2.enemyName = "Burster";
_local2.frames = AnimationCreator.breakImageIntoFramesClass(new burster(0, 0), 4, 5);
_local2.totalLife = 25;
_local2.speed = 2;
definitions.push(_local2);
_local3 = new (EnemyDefinition);
_local3.enemyName = "Bio";
_local3.frames = AnimationCreator.breakImageIntoFramesClass(new z14(0, 0), 4, 5);
_local3.totalLife = 25;
_local3.speed = 2;
_local3.immunityType = TowerDefinition.fireDamage;
definitions.push(_local3);
_local4 = new (EnemyDefinition);
_local4.enemyName = "Construction";
_local4.frames = AnimationCreator.breakImageIntoFramesClass(new constructionWorkAnimated(0, 0), 4, 5);
_local4.totalLife = 45;
_local4.speed = 2;
_local4.immunityType = TowerDefinition.slowDamage;
definitions.push(_local4);
_local5 = new (EnemyDefinition);
_local5.enemyName = "Soldier";
_local5.frames = AnimationCreator.breakImageIntoFramesClass(new soldierAnimated(0, 0), 4, 5);
_local5.totalLife = 25;
_local5.speed = 2;
_local5.immunityType = TowerDefinition.normalDamage;
definitions.push(_local5);
_local6 = new (EnemyDefinition);
_local6.enemyName = "Fat";
_local6.frames = AnimationCreator.breakImageIntoFramesClass(new animatedZombieOne(0, 0), 4, 5);
_local6.totalLife = 45;
_local6.speed = 2;
definitions.push(_local6);
_local7 = new (EnemyDefinition);
_local7.enemyName = "Fireman";
_local7.frames = AnimationCreator.breakImageIntoFramesClass(new firemanAnimated(0, 0), 4, 5);
_local7.totalLife = 40;
_local7.speed = 2;
_local7.immunityType = TowerDefinition.fireDamage;
definitions.push(_local7);
}
public static function buildDefinitions():void{
_buildFirstSet();
_buildSecondSet();
_buildThirdSet();
}
public static function getDefinition(_arg1:String):EnemyDefinition{
var _local2:EnemyDefinition;
for each (_local2 in definitions) {
if (_arg1 == _local2.enemyName){
return (_local2);
};
};
return (null);
}
private static function _buildThirdSet():void{
var _local1:EnemyDefinition;
var _local2:EnemyDefinition;
var _local3:EnemyDefinition;
var _local4:EnemyDefinition;
var _local5:EnemyDefinition;
var _local6:EnemyDefinition;
var _local7:EnemyDefinition;
_local1 = new (EnemyDefinition);
_local1.enemyName = "EMT3";
_local1.frames = AnimationCreator.breakImageIntoFrames("emt", 4, 5);
_local1.totalLife = 100;
_local1.speed = 3;
_local1.loot = 3;
definitions.push(_local1);
_local2 = new (EnemyDefinition);
_local2.enemyName = "Burster3";
_local2.frames = AnimationCreator.breakImageIntoFramesClass(new burster(0, 0), 4, 5);
_local2.totalLife = 120;
_local2.speed = 3;
_local2.loot = 3;
definitions.push(_local2);
_local3 = new (EnemyDefinition);
_local3.enemyName = "Bio3";
_local3.frames = AnimationCreator.breakImageIntoFramesClass(new z14(0, 0), 4, 5);
_local3.totalLife = 120;
_local3.speed = 3;
_local3.immunityType = TowerDefinition.fireDamage;
_local3.loot = 3;
definitions.push(_local3);
_local4 = new (EnemyDefinition);
_local4.enemyName = "Construction3";
_local4.frames = AnimationCreator.breakImageIntoFramesClass(new constructionWorkAnimated(0, 0), 4, 5);
_local4.totalLife = 90;
_local4.speed = 3;
_local4.immunityType = TowerDefinition.slowDamage;
_local4.loot = 3;
definitions.push(_local4);
_local5 = new (EnemyDefinition);
_local5.enemyName = "Soldier3";
_local5.frames = AnimationCreator.breakImageIntoFramesClass(new soldierAnimated(0, 0), 4, 5);
_local5.totalLife = 60;
_local5.speed = 3;
_local5.immunityType = TowerDefinition.normalDamage;
_local5.loot = 3;
definitions.push(_local5);
_local6 = new (EnemyDefinition);
_local6.enemyName = "Fat3";
_local6.frames = AnimationCreator.breakImageIntoFramesClass(new animatedZombieOne(0, 0), 4, 5);
_local6.totalLife = 200;
_local6.speed = 3;
_local6.loot = 3;
definitions.push(_local6);
_local7 = new (EnemyDefinition);
_local7.enemyName = "Fireman3";
_local7.frames = AnimationCreator.breakImageIntoFramesClass(new firemanAnimated(0, 0), 4, 5);
_local7.totalLife = 200;
_local7.speed = 3;
_local7.immunityType = TowerDefinition.fireDamage;
_local7.loot = 3;
definitions.push(_local7);
}
private static function _buildSecondSet():void{
var _local1:EnemyDefinition;
var _local2:EnemyDefinition;
var _local3:EnemyDefinition;
var _local4:EnemyDefinition;
var _local5:EnemyDefinition;
var _local6:EnemyDefinition;
var _local7:EnemyDefinition;
_local1 = new (EnemyDefinition);
_local1.enemyName = "EMT2";
_local1.frames = AnimationCreator.breakImageIntoFrames("emt", 4, 5);
_local1.totalLife = 40;
_local1.speed = 3;
_local1.loot = 2;
definitions.push(_local1);
_local2 = new (EnemyDefinition);
_local2.enemyName = "Burster2";
_local2.frames = AnimationCreator.breakImageIntoFramesClass(new burster(0, 0), 4, 5);
_local2.totalLife = 50;
_local2.speed = 3;
_local2.loot = 2;
definitions.push(_local2);
_local3 = new (EnemyDefinition);
_local3.enemyName = "Bio2";
_local3.frames = AnimationCreator.breakImageIntoFramesClass(new z14(0, 0), 4, 5);
_local3.totalLife = 50;
_local3.speed = 3;
_local3.immunityType = TowerDefinition.fireDamage;
_local3.loot = 2;
definitions.push(_local3);
_local4 = new (EnemyDefinition);
_local4.enemyName = "Construction2";
_local4.frames = AnimationCreator.breakImageIntoFramesClass(new constructionWorkAnimated(0, 0), 4, 5);
_local4.totalLife = 90;
_local4.speed = 3;
_local4.immunityType = TowerDefinition.slowDamage;
_local4.loot = 2;
definitions.push(_local4);
_local5 = new (EnemyDefinition);
_local5.enemyName = "Soldier2";
_local5.frames = AnimationCreator.breakImageIntoFramesClass(new soldierAnimated(0, 0), 4, 5);
_local5.totalLife = 50;
_local5.speed = 3;
_local5.immunityType = TowerDefinition.normalDamage;
_local5.loot = 2;
definitions.push(_local5);
_local6 = new (EnemyDefinition);
_local6.enemyName = "Fat2";
_local6.frames = AnimationCreator.breakImageIntoFramesClass(new animatedZombieOne(0, 0), 4, 5);
_local6.totalLife = 90;
_local6.speed = 3;
_local6.loot = 2;
definitions.push(_local6);
_local7 = new (EnemyDefinition);
_local7.enemyName = "Fireman2";
_local7.frames = AnimationCreator.breakImageIntoFramesClass(new firemanAnimated(0, 0), 4, 5);
_local7.totalLife = 80;
_local7.speed = 3;
_local7.immunityType = TowerDefinition.fireDamage;
_local7.loot = 2;
definitions.push(_local7);
}
}
}//package
Section 74
//EnemyPath (EnemyPath)
package {
import flash.geom.*;
public class EnemyPath {
private static var pathCoords:Array = new Array();
public function EnemyPath(){
pathCoords.push(new Point(0, 11));
pathCoords.push(new Point(0, 10));
pathCoords.push(new Point(12, 10));
pathCoords.push(new Point(12, 7));
pathCoords.push(new Point(0, 7));
pathCoords.push(new Point(0, 4));
pathCoords.push(new Point(12, 4));
pathCoords.push(new Point(12, 1));
pathCoords.push(new Point(0, 1));
pathCoords.push(new Point(0, 0));
}
public static function getFirstPoint():Point{
return (pathCoords[0]);
}
public static function getNextPoint(_arg1:Point):Point{
var _local2:Number;
_local2 = pathCoords.indexOf(_arg1);
return (pathCoords[(_local2 + 1)]);
}
}
}//package
Section 75
//exploAnim (exploAnim)
package {
import flash.display.*;
public dynamic class exploAnim extends BitmapData {
public function exploAnim(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 76
//Explosion (Explosion)
package {
import flash.geom.*;
public class Explosion extends GameObject {
public function Explosion(_arg1:Point, _arg2:Array):void{
var _local3:Animation;
super(0, _arg2[0], new Point(55, 55));
active = true;
setCenter(_arg1);
_local3 = new Animation(bitmap, new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), _arg2, 350);
playAnimationWithCallBack(_local3, animationFinished);
}
public function animationFinished():void{
active = false;
cleanupGameObject();
}
}
}//package
Section 77
//fire (fire)
package {
import flash.display.*;
public dynamic class fire extends BitmapData {
public function fire(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 78
//firemanAnimated (firemanAnimated)
package {
import flash.display.*;
public dynamic class firemanAnimated extends BitmapData {
public function firemanAnimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 79
//FlameRetardant (FlameRetardant)
package {
import flash.display.*;
public dynamic class FlameRetardant extends BitmapData {
public function FlameRetardant(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 80
//flameThrower (flameThrower)
package {
import flash.display.*;
public dynamic class flameThrower extends BitmapData {
public function flameThrower(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 81
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 82
//GameInterfaceHandler (GameInterfaceHandler)
package {
import GuiHandling.*;
public class GameInterfaceHandler {
public static var toolTipsHandler = new ToolTipsHandler();
public function GameInterfaceHandler():void{
}
public static function toggleNextWaveButtonVisibility(_arg1:Boolean):void{
GameState.mainObject.nextWaveButton.visible = _arg1;
}
public static function setCurrentTowerStats(_arg1:TowerDefinition){
toggleTowerPrimaryStats(true);
GameState.mainObject.txtTowerCost.text = _arg1.cost.toString();
GameState.mainObject.txtTowerDamage.text = _arg1.damageString;
GameState.mainObject.txtTowerRange.text = _arg1.rangeString;
GameState.mainObject.txtTowerRof.text = _arg1.rofString;
}
public static function toggleGuiComponentsForUpgradeTowerStats(_arg1:Boolean):void{
GameState.mainObject.txtUpgradeTowerCost.visible = _arg1;
GameState.mainObject.txtUpgradeTowerDamage.visible = _arg1;
GameState.mainObject.txtUpgradeTowerRange.visible = _arg1;
GameState.mainObject.txtUpgradeTowerRof.visible = _arg1;
GameState.mainObject.btnUpgrade.visible = _arg1;
GameState.mainObject.upgradeButton.visible = _arg1;
GameState.mainObject.UpgradeStatsOverlay.visible = _arg1;
GameState.mainObject.lblUpgradeCost.visible = _arg1;
GameState.mainObject.lblUpgradeDamage.visible = _arg1;
GameState.mainObject.lblUpgradeRange.visible = _arg1;
GameState.mainObject.lblUpgradeROF.visible = _arg1;
}
public static function showStatTitle(_arg1:String):void{
GameState.mainObject.txtTowerName.text = _arg1;
GameState.mainObject.txtTowerName.visible = true;
}
public static function setSelectedTowerKills(_arg1:String):void{
GameState.mainObject.txtTowerKills.text = _arg1;
}
public static function showAbility(_arg1:String):void{
toggleTowerPrimaryStats(false);
GameState.mainObject.txtAbility.text = _arg1;
GameState.mainObject.txtAbility.visible = true;
}
public static function hideStatTitle():void{
GameState.mainObject.txtTowerName.visible = false;
}
public static function toggleTowerPrimaryStats(_arg1:Boolean):void{
GameState.mainObject.lblROF.visible = _arg1;
GameState.mainObject.lblRange.visible = _arg1;
GameState.mainObject.lblDamage.visible = _arg1;
GameState.mainObject.lblCost.visible = _arg1;
GameState.mainObject.txtTowerCost.visible = _arg1;
GameState.mainObject.txtTowerDamage.visible = _arg1;
GameState.mainObject.txtTowerRange.visible = _arg1;
GameState.mainObject.txtTowerRof.visible = _arg1;
}
public static function hideAbilityInfo():void{
GameState.mainObject.txtAbility.visible = false;
}
public static function hideTowerToPlaceDescription():void{
GameState.mainObject.txtTowerDescription.visible = false;
}
public static function showTowerPlacement():void{
toggleTowerPrimaryStats(true);
}
public static function toggleSelectedTowerKills(_arg1:Boolean):void{
GameState.mainObject.txtTowerKills.visible = _arg1;
GameState.mainObject.lblKills.visible = _arg1;
GameState.mainObject.sellButton.visible = _arg1;
}
public static function showTowerToPlaceDescription(_arg1:String):void{
GameState.mainObject.txtTowerDescription.visible = true;
GameState.mainObject.txtTowerDescription.text = _arg1;
}
}
}//package
Section 83
//GameObject (GameObject)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import fl.motion.*;
public class GameObject extends MovieClip {
public var active:Boolean;// = false
private var destination:Point;
private var position:Point;
public var bitmap:Bitmap;
private var speedModifier:Number;// = 1
private var collisionBox:Rectangle;
private var speed:Number;// = NAN
private var onPositionReachedCallback:Function;// = null
private var movingTowardsDestination:Boolean;// = false
private var bitmapData:BitmapData;// = null
private var currentPlayingAnimation:Animation;// = null
private var cleaned:Boolean;// = false
private var directionVector:Point;
private var mountedInfoArray:Array;
public var stopAtDestination:Boolean;// = true
private var isTower:Boolean;// = false
public static var layerAfterTilesIndex:uint = 3;
public function GameObject(_arg1:Number, _arg2:BitmapData, _arg3:Point, _arg4:Boolean=false):void{
position = new Point();
destination = new Point();
movingTowardsDestination = false;
directionVector = new Point();
onPositionReachedCallback = null;
mountedInfoArray = new Array();
bitmap = new Bitmap();
active = false;
stopAtDestination = true;
bitmapData = null;
currentPlayingAnimation = null;
speed = NaN;
speedModifier = 1;
collisionBox = new Rectangle();
cleaned = false;
isTower = false;
super();
if (_arg2 == null){
throw (new Error("tried to construct a GameObject with a null bitmapData reference"));
};
isTower = _arg4;
bitmap.bitmapData = _arg2;
bitmap.width = _arg3.x;
bitmap.height = _arg3.y;
if (isTower){
GameState.mainObject.addChildAt(bitmap, layerAfterTilesIndex);
} else {
GameState.enemyContainer.addChild(bitmap);
};
collisionBox.width = _arg3.x;
collisionBox.height = _arg3.y;
speed = _arg1;
bitmapData = _arg2;
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function rotateToPoint(_arg1:Point):void{
var _local2:Number;
var _local3:Matrix;
var _local4:*;
active = false;
_local2 = _getFacingRotation(_arg1);
_local3 = bitmap.transform.matrix;
_local4 = MatrixTransformer.getRotation(_local3);
MatrixTransformer.rotateAroundExternalPoint(_local3, (collisionBox.x + 17.5), (collisionBox.y + 17.5), (_local2 - _local4));
bitmap.transform.matrix = _local3;
}
public function setSpeedModifier(_arg1:Number):void{
speedModifier = _arg1;
}
public function playAnimationWithCallBack(_arg1:Animation, _arg2:Function):void{
if (currentPlayingAnimation != null){
currentPlayingAnimation.stopAnimation();
};
_arg1.playAnimationWithCallBack(bitmap, _arg2);
currentPlayingAnimation = _arg1;
}
private function _updatePosition():void{
position.x = (position.x + ((speed * speedModifier) * directionVector.x));
position.y = (position.y + ((speed * speedModifier) * directionVector.y));
bitmap.x = position.x;
bitmap.y = position.y;
collisionBox.x = position.x;
collisionBox.y = position.y;
}
public function adjustToBottom(_arg1:Point):Point{
return (new Point(_arg1.x, ((_arg1.y + collisionBox.height) - 10)));
}
public function setOnDestinationCallBack(_arg1:Function):void{
onPositionReachedCallback = _arg1;
}
public function setDestination(_arg1:Point):void{
destination.x = _arg1.x;
destination.y = _arg1.y;
movingTowardsDestination = true;
_updateDirectionVector();
}
public function setCenter(_arg1:Point):void{
position.x = (_arg1.x - (collisionBox.width / 2));
position.y = (_arg1.y - (collisionBox.height / 2));
bitmap.x = position.x;
bitmap.y = position.y;
}
public function getCenter():Point{
var _local1:Number;
var _local2:Number;
_local1 = (getPositionX() + (collisionBox.width / 2));
_local2 = (getPositionY() + (collisionBox.height / 2));
return (new Point(_local1, _local2));
}
public function wasThereCollision(_arg1:Rectangle):Boolean{
if (!active){
return (false);
};
if (collisionBox.intersects(_arg1)){
return (true);
};
return (false);
}
public function pauseGameObject():void{
if (!hasEventListener(Event.ENTER_FRAME)){
return;
};
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function getPositionAfterFrames(_arg1:Number):Point{
var _local2:*;
_local2 = new Point();
_local2.x = position.x;
_local2.y = position.y;
_local2.x = (_local2.x + (((speed * speedModifier) * directionVector.x) * _arg1));
_local2.y = (_local2.y + (((speed * speedModifier) * directionVector.y) * _arg1));
return (_local2);
}
private function _updateMountedObjects():void{
var _local1:MountInfo;
var _local2:Point;
for each (_local1 in mountedInfoArray) {
_local2 = new Point((getPositionX() + _local1.mountOffset.x), (getPositionY() + _local1.mountOffset.y));
_local1.mountedObject.setPosition(_local2);
};
}
public function getPositionX():Number{
return (position.x);
}
public function getPositionY():Number{
return (position.y);
}
public function getPosition():Point{
return (new Point(position.x, position.y));
}
private function _updateDirectionVector():void{
if (!movingTowardsDestination){
directionVector.x = 0;
directionVector.y = 0;
return;
};
directionVector = destination.subtract(position);
directionVector.normalize(1);
}
public function cleanupGameObject():void{
_cleanup();
}
public function getCollisionBox():Rectangle{
return (collisionBox);
}
public function playAnimation(_arg1:Animation):void{
if (currentPlayingAnimation != null){
currentPlayingAnimation.stopAnimation();
};
_arg1.playAnimation(bitmap);
currentPlayingAnimation = _arg1;
}
public function stopAnimation():void{
if (currentPlayingAnimation != null){
currentPlayingAnimation.stopAnimation();
};
currentPlayingAnimation = null;
}
public function unpauseGameObject():void{
if (hasEventListener(Event.ENTER_FRAME)){
return;
};
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function setVisible(_arg1:Boolean):void{
if (_arg1){
bitmap.visible = true;
} else {
bitmap.visible = false;
};
}
private function _cleanup():void{
if (cleaned == true){
return;
};
if (currentPlayingAnimation != null){
currentPlayingAnimation.stopAnimation();
};
currentPlayingAnimation = null;
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
if (isTower){
GameState.mainObject.removeChild(bitmap);
} else {
GameState.enemyContainer.removeChild(bitmap);
};
cleaned = true;
}
public function setPosition(_arg1:Point):void{
position.x = _arg1.x;
position.y = _arg1.y;
bitmap.x = _arg1.x;
bitmap.y = _arg1.y;
}
private function _checkForAtPosition():void{
if (!_isAtDestination()){
return;
};
movingTowardsDestination = false;
if (onPositionReachedCallback != null){
onPositionReachedCallback();
};
}
public function mountObject(_arg1:MountInfo):void{
mountedInfoArray.push(_arg1);
}
private function _isAtDestination():Boolean{
var _local1:Number;
var _local2:Point;
if (!stopAtDestination){
return (false);
};
_local1 = 10;
_local2 = position.subtract(destination);
if (_local2.length < _local1){
return (true);
};
return (false);
}
private function _enterFrameListener(_arg1:Event):void{
if (!active){
return;
};
if (stopAtDestination){
_updateDirectionVector();
};
_updatePosition();
if (stopAtDestination){
_checkForAtPosition();
};
_updateMountedObjects();
}
public function playAnimationLooping(_arg1:Animation):void{
if (currentPlayingAnimation != null){
currentPlayingAnimation.stopAnimation();
};
_arg1.playLoopingAnimation(bitmap);
currentPlayingAnimation = _arg1;
}
private function _getFacingRotation(_arg1:Point):Number{
var _local2:Point;
var _local3:Point;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = new Point((_arg1.x - getPositionX()), (_arg1.y - getPositionY()));
_local2.normalize(1);
_local3 = new Point(0, 1);
_local4 = ((_local2.x * _local3.x) + (_local2.y * _local3.y));
_local5 = Math.acos(_local4);
_local6 = (_local5 * (180 / Math.PI));
if (_arg1.x >= getPositionX()){
_local6 = (_local6 * -1);
};
return (_local6);
}
}
}//package
Section 84
//GameState (GameState)
package {
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import MouseStates.*;
import flash.events.*;
import EnemySpawning.*;
import GuiHandling.*;
import flash.utils.*;
import flash.net.*;
public class GameState {
public static var towerToPlace:TowerDefinition = null;
public static var volumeModifier:Number = 1;
public static var tilesHasFocus:Boolean = false;
public static var userData:UserData = null;
public static var gamePlayingState:String = "Game";
private static var path:EnemyPath = new EnemyPath();
private static var selectedTower:Tower = null;
public static var refundPercentage:Number = 0.7;
public static var combatStims:Array = new Array();
public static var normalEnemies:Array = new Array();
public static var bulletImmuneEnemies:Array = new Array();
private static var currentGameState:String = null;
public static var mainObject:ZombieDefense = null;
public static var preGameState:String = "PreGame";
public static var tiles:Tiles = new Tiles();
private static var mines:Array = new Array();
public static var gameEndedState:String = "PostGame";
public static var fireImmuneEnemies:Array = new Array();
public static var slowImmuneEnemies:Array = new Array();
public static var selectedTowerRange:Sprite = new Sprite();
public static var enemySpawner:EnemySpawner = new EnemySpawner();
public static var noEnemyCheckTimer:Timer = new Timer(1000, 0);
public static var enemyContainer:MovieClip = new MovieClip();
public static var razorWires:Array = new Array();
public static var mouseFollower:MouseFollower = null;
public static function updateAirStrikes():void{
mainObject.txtAirStrike.text = userData.getAirStrikes().toString();
}
public static function pauseGame():void{
UseabilityLogger.sendLogInformation("pauseGame");
PauseGame.togglePause();
}
public static function setupGame(_arg1:ZombieDefense){
mainObject = _arg1;
tiles = new Tiles();
mainObject.addChildAt(enemyContainer, 3);
userData = new UserData();
TowerDefinition.buildTowerDefinitions();
EnemyDefinition.buildDefinitions();
mainObject.resetTextFields();
mainObject.setButtonsPreGameState();
mouseFollower = new MouseFollower();
selectTower1();
mainObject.addChild(selectedTowerRange);
enterPreGameState();
}
public static function tilesLostFocus():void{
tilesHasFocus = false;
}
public static function getEnemyPath():EnemyPath{
return (path);
}
public static function setTimer(_arg1:Number):void{
mainObject.txtTimer.text = _arg1.toString();
}
public static function endGameBuy():void{
var _local1:URLRequest;
_local1 = new URLRequest("http://www.rivalgames.org");
navigateToURL(_local1, "_blank");
UseabilityLogger.sendLogInformation("endGameBuy");
}
public static function onTowerSelected(_arg1:Tower):void{
towerToPlace = null;
selectedTower = _arg1;
mouseFollower.setState(MouseFollower.towerSelectedState);
GameState.playSound(Tower.towerSelectedSound);
}
private static function _clearAllEnemies():void{
var _local1:Enemy;
for each (_local1 in normalEnemies) {
_local1.cleanupForGameReset();
};
for each (_local1 in fireImmuneEnemies) {
_local1.cleanupForGameReset();
};
for each (_local1 in bulletImmuneEnemies) {
_local1.cleanupForGameReset();
};
for each (_local1 in slowImmuneEnemies) {
_local1.cleanupForGameReset();
};
}
public static function onNoMoreWaves():void{
GameState.disableNextWaveButton();
GameInterfaceHandler.toggleNextWaveButtonVisibility(false);
noEnemyCheckTimer.addEventListener("timer", _checkForNoMoreEnemies);
noEnemyCheckTimer.start();
}
public static function selectAirstrikeAction():void{
mouseFollower.setState(MouseFollower.airStrikeActionState);
}
public static function updateMines():void{
mainObject.txtMines.text = userData.getMines().toString();
}
public static function playSound(_arg1:Sound, _arg2:Number=1):void{
var _local3:Number;
var _local4:Number;
var _local5:SoundTransform;
_local3 = 0;
_local4 = 0;
_local5 = new SoundTransform((volumeModifier * _arg2));
_arg1.play(_local3, _local4, _local5);
}
public static function cleanUpMovieClip(_arg1:MovieClip):void{
mainObject.cleanUpMovieClip(_arg1);
}
public static function onTowerToPlaceSelected(_arg1:TowerDefinition):void{
towerToPlace = _arg1;
mouseFollower.setState(MouseFollower.towerStampState);
}
public static function removeEnemyFromGame(_arg1:Enemy):void{
if (_arg1.definition.immunityType == null){
normalEnemies = removeEnemyFromArray(normalEnemies, _arg1);
} else {
if (_arg1.definition.immunityType == TowerDefinition.normalDamage){
bulletImmuneEnemies = removeEnemyFromArray(bulletImmuneEnemies, _arg1);
} else {
if (_arg1.definition.immunityType == TowerDefinition.fireDamage){
fireImmuneEnemies = removeEnemyFromArray(fireImmuneEnemies, _arg1);
} else {
if (_arg1.definition.immunityType == TowerDefinition.slowDamage){
slowImmuneEnemies = removeEnemyFromArray(slowImmuneEnemies, _arg1);
};
};
};
};
}
public static function getTileSize():Point{
return (Tiles.getTileSize());
}
private static function _cleanupRazorWires():void{
var _local1:RazorWire;
for each (_local1 in razorWires) {
_local1.cleanup();
};
razorWires = new Array();
}
public static function enableNextWaveButton():void{
mainObject.btnNextWave.enabled = true;
}
public static function gameUpdateCycle(_arg1:Number, _arg2:Number):void{
mouseFollower.moveToPosition(new Point(_arg1, _arg2));
updateMines();
updateArtillery();
updateAirStrikes();
}
public static function upgradeCurrentTower():void{
if (selectedTower == null){
return;
};
if (userData.towerCanBeAfforded(selectedTower.getUpgradedTowerDefinition()) == false){
return;
};
UseabilityLogger.sendLogInformation(("Upgrade Tower: " + selectedTower.definition.towerName));
selectedTower.upgrade();
userData.subtractMoney(selectedTower.getCost());
}
public static function help():void{
}
private static function _toggleAbilityButtons():void{
mainObject.abilityMinesButton.enabled = false;
mainObject.abilityArtilleryButton.enabled = false;
mainObject.abilityAirStrikeButton.enabled = false;
if (userData.doesUserHaveBronzeMedal()){
mainObject.abilityMinesButton.enabled = true;
};
if (userData.doesUserHaveSilverMedal()){
mainObject.abilityArtilleryButton.enabled = true;
};
if (userData.doesUserHaveGoldMedal()){
mainObject.abilityAirStrikeButton.enabled = true;
};
}
public static function addRazorWire(_arg1:RazorWire):void{
razorWires.push(_arg1);
}
public static function enterPreGameState():void{
currentGameState = preGameState;
PauseGame.unlockPausing();
PauseGame.unpauseGame();
_clearAllMines();
_popEndGameDialog();
enemySpawner.resetSpawner();
_clearAllEnemies();
_clearAllTowers();
_cleanupRazorWires();
userData.setStartingScore();
userData.setStartingLives();
userData.setStartingMoney();
userData.setStartingEnemiesKilled();
userData.setStartingSkipBonus();
userData.setStartingMines();
userData.setStartingArtillery();
userData.setStartingAirStrikes();
_toggleAbilityButtons();
mainObject.setButtonsPreGameState();
userData.scoreStatusBar.turnOnLifeBonusBar();
GameInterfaceHandler.toggleGuiComponentsForUpgradeTowerStats(false);
GameInterfaceHandler.toggleSelectedTowerKills(false);
GameInterfaceHandler.toggleTowerPrimaryStats(false);
GameInterfaceHandler.hideAbilityInfo();
GameInterfaceHandler.hideTowerToPlaceDescription();
GameInterfaceHandler.hideStatTitle();
selectTower1();
mouseFollower.setState(MouseFollower.towerStampState);
}
private static function _checkForMedalsAndDisplayEndGameMessage():void{
EndGameDialogHandler.showEndGameMessages();
}
public static function submitScore():void{
mainObject.EndGameDialogInstance.btn_EndGameSubmit.visible = false;
HighScoreList.submitScore(userData.getScore(), enemySpawner.getCurrentWave());
}
public static function userEndedTheGame():void{
userData.removeAllLives();
enterGameEndState();
}
public static function tilesGotFocus():void{
tilesHasFocus = true;
}
public static function createNewTower(_arg1:Tile):Boolean{
var _local2:Boolean;
var _local3:Boolean;
if (towerToPlace == null){
return (false);
};
_local2 = false;
_local3 = false;
if (towerToPlace.cost <= userData.getMoney()){
_local3 = true;
};
if (_local3){
_local2 = _arg1.placeTower(towerToPlace);
if (_local2){
UseabilityLogger.sendLogInformation(("Tower placed: " + towerToPlace.towerName));
userData.subtractMoney(towerToPlace.cost);
GameState.playSound(Tower.towerBuildSound);
};
};
return (_local2);
}
public static function selectTower3():void{
onTowerToPlaceSelected(TowerDefinition.getTowerDefinition("Grenadier"));
}
public static function selectTower4():void{
onTowerToPlaceSelected(TowerDefinition.getTowerDefinition("Molotov Cocktail"));
}
public static function selectTower1():void{
onTowerToPlaceSelected(TowerDefinition.getTowerDefinition("Machine Gunner"));
}
public static function selectTower2():void{
onTowerToPlaceSelected(TowerDefinition.getTowerDefinition("Rifleman"));
}
private static function _checkForNoMoreEnemies(_arg1:TimerEvent):void{
if (((enemySpawner.wavesAreStillSpawning()) && ((currentGameState == preGameState)))){
noEnemyCheckTimer.stop();
return;
};
if (currentGameState != gamePlayingState){
noEnemyCheckTimer.stop();
throw (new Error("_checkForNoMoreEnemies called in a bad game state"));
};
if (enemySpawner.wavesAreStillSpawning()){
noEnemyCheckTimer.stop();
throw (new Error("_checkForNoMoreEnemies called when waves were not finished spawning"));
};
if (normalEnemies.length > 0){
return;
};
if (fireImmuneEnemies.length > 0){
return;
};
if (bulletImmuneEnemies.length > 0){
return;
};
if (slowImmuneEnemies.length > 0){
return;
};
noEnemyCheckTimer.stop();
enterGameEndState();
}
public static function startGame():void{
if (PauseGame.gamePaused()){
return;
};
UseabilityLogger.sendLogInformation("startGame");
enterGameStartState();
}
public static function getSelectedTower():Tower{
return (selectedTower);
}
public static function updateArtillery():void{
mainObject.txtArtillery.text = userData.getArtillery().toString();
}
public static function setMoney(_arg1:Number):void{
mainObject.txtMoney.text = Math.floor(_arg1).toString();
}
public static function selectArtilleryAction():void{
mouseFollower.setState(MouseFollower.razorWireState);
}
public static function selectCombatBoostAction():void{
mouseFollower.setState(MouseFollower.combatStimState);
}
public static function sellCurrentTower():void{
if (selectedTower == null){
return;
};
selectedTower.sell();
}
public static function nextWave():void{
UseabilityLogger.sendLogInformation("Wave Skipped");
enemySpawner.nextWave();
}
public static function buyGame():void{
UseabilityLogger.sendLogInformation("buyGame");
}
private static function _pushEndGameDialog():void{
mainObject.EndGameDialogInstance.visible = true;
mainObject.EndGameDialogInstance.txtEndGameEnemiesKilled.text = userData.getEnemiesKilles().toString();
mainObject.EndGameDialogInstance.txtEndGameSkipBonus.text = userData.getSkipBonus().toString();
mainObject.EndGameDialogInstance.txtEndGameLifeBonus.text = userData.getCurrentScoreBonusPoints().toString();
mainObject.EndGameDialogInstance.txtEndGameScore.text = userData.getScore().toString();
_clearAllTowers();
_clearAllEnemies();
mouseFollower.setState(MouseFollower.emptyState);
mainObject.EndGameDialogInstance.btn_EndGameSubmit.visible = true;
}
public static function options():void{
}
private static function _popEndGameDialog():void{
mainObject.EndGameDialogInstance.visible = false;
}
public static function showStats(_arg1:TowerDefinition):void{
var _local2:TowerDefinition;
GameInterfaceHandler.setCurrentTowerStats(_arg1);
_local2 = TowerDefinition.getTowerDefinition(_arg1.upgradeTower);
if (_local2 != null){
mainObject.setUpgradeTowerStats(_local2);
};
}
public static function enterGameEndState():void{
currentGameState = gameEndedState;
userData.scoreStatusBar.turnOffLifeBonusBar();
userData.adjustScoreWithLifeBonus();
PauseGame.pauseGame();
PauseGame.lockPausing();
_clearAllMines();
mouseFollower.setState(MouseFollower.emptyState);
_pushEndGameDialog();
_checkForMedalsAndDisplayEndGameMessage();
}
public static function onAllLivesLost():void{
enterGameEndState();
}
public static function mouseClicked(_arg1:Number, _arg2:Number):void{
mouseFollower.onMouseClicked(_arg1, _arg2);
}
public static function setLives(_arg1:Number):void{
mainObject.txtLives.text = _arg1.toString();
}
public static function removeEnemyFromArray(_arg1:Array, _arg2:Enemy):Array{
var _local3:Array;
var _local4:Enemy;
_local3 = new Array();
for each (_local4 in _arg1) {
if (_local4 != _arg2){
_local3.push(_local4);
};
};
return (_local3);
}
private static function _clearAllMines():void{
var _local1:Mine;
_local1 = null;
while ((_local1 = mines.pop())) {
_local1.cleanup();
};
}
public static function updateSelectedTowerDisplayInformation():void{
var _local1:Point;
var _local2:Number;
if (selectedTower == null){
throw (new Error("updateSelectedTowerDisplayInformation called when selected tower null"));
};
GameInterfaceHandler.setCurrentTowerStats(selectedTower.definition);
mainObject.setUpgradeTowerStats(selectedTower.getUpgradedTowerDefinition());
selectedTowerRange.graphics.clear();
selectedTowerRange.graphics.beginFill(Colors.blue, PlaceTowerState.rangeDisplayTransparency);
selectedTowerRange.mouseEnabled = false;
_local1 = selectedTower.getCenter();
_local2 = (selectedTower.definition.range * Tiles.tileSize.x);
selectedTowerRange.graphics.drawCircle(_local1.x, _local1.y, _local2);
}
public static function getTiles():Tiles{
return (tiles);
}
public static function deselectTowerStamp():void{
mouseFollower.setState(MouseFollower.emptyState);
}
public static function mouseClicked_TowerStampState(_arg1:Number, _arg2:Number):void{
var _local3:Tile;
_local3 = tiles.getTile(_arg1, _arg2);
if (_local3.hasTower()){
return;
};
GameState.createNewTower(_local3);
}
private static function _clearAllTowers():void{
tiles.clearAllTiles();
}
public static function resetGame():void{
UseabilityLogger.sendLogInformation("resetGame");
enterPreGameState();
}
public static function endGameRestart():void{
resetGame();
UseabilityLogger.sendLogInformation("endGameRestart");
}
public static function createNewEnemy(_arg1:String):void{
var _local2:EnemyDefinition;
var _local3:MovieClip;
var _local4:Point;
var _local5:*;
var _local6:Enemy;
_local2 = EnemyDefinition.getDefinition(_arg1);
_local3 = mainObject.getSpawnArea();
_local4 = new Point((_local3.width * Math.random()), (_local3.height * Math.random()));
_local5 = new Point((_local3.x + _local4.x), (_local3.y + _local4.y));
_local6 = new Enemy(_local2);
_local6.offset = tiles.getRandomPathOffsetForEnemy(_local6);
_local6.setPosition(_local5);
_local6.startFollowingPath();
_local6.active = true;
if (_local6.definition.immunityType == null){
normalEnemies.push(_local6);
} else {
if (_local6.definition.immunityType == TowerDefinition.normalDamage){
bulletImmuneEnemies.push(_local6);
} else {
if (_local6.definition.immunityType == TowerDefinition.fireDamage){
fireImmuneEnemies.push(_local6);
} else {
if (_local6.definition.immunityType == TowerDefinition.slowDamage){
slowImmuneEnemies.push(_local6);
};
};
};
};
}
public static function disableNextWaveButton():void{
mainObject.btnNextWave.enabled = false;
}
public static function quitGame():void{
}
public static function addCombatStim(_arg1:CombatStim):void{
combatStims.push(_arg1);
}
public static function noThanks():void{
UseabilityLogger.sendLogInformation("noThanks");
GameState.mainObject.gameAddMC.visible = false;
}
public static function enterGameStartState():void{
currentGameState = gamePlayingState;
enemySpawner.startSpawner();
mainObject.setButtonsGamePlayingState();
}
public static function selectTowerIfPossible(_arg1:Number, _arg2:Number):Boolean{
var _local3:Tile;
_local3 = tiles.getTile(_arg1, _arg2);
if (_local3 == null){
return (false);
};
if (!_local3.hasTower()){
return (false);
};
onTowerSelected(_local3.getPlacedTower());
return (true);
}
public static function addMovieClip(_arg1:MovieClip):void{
mainObject.addMovieClip(_arg1);
}
}
}//package
Section 85
//grenadeLauncher (grenadeLauncher)
package {
import flash.display.*;
public dynamic class grenadeLauncher extends BitmapData {
public function grenadeLauncher(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 86
//grenadeThrower (grenadeThrower)
package {
import flash.display.*;
public dynamic class grenadeThrower extends BitmapData {
public function grenadeThrower(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 87
//heavyMachineGun (heavyMachineGun)
package {
import flash.display.*;
public dynamic class heavyMachineGun extends BitmapData {
public function heavyMachineGun(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 88
//HighScoreList (HighScoreList)
package {
import flash.net.*;
public class HighScoreList {
private static var hashKey:String = "@3)a2MFr6GyY&;^(QP7f";
public function HighScoreList():void{
}
public static function submitScore(_arg1:Number, _arg2:Number):void{
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:String;
var _local10:URLRequest;
_local3 = "flashScore=";
_local3 = _local3.concat(_arg1.toString());
_local4 = "&flashWave=";
_local4 = _local4.concat(_arg2.toString());
_local5 = "";
_local5 = _local5.concat(_arg1.toString(), _arg2.toString(), "flashDemo", hashKey);
_local6 = "&flashDigest=";
_local6 = _local6.concat(Cryptography.MD5(_local5));
_local7 = "&flashLevel=flashDemo";
_local8 = "http://www.rivalgames.org/highScore/flashDemo_highScoreSubmission.php?";
_local9 = _local8.concat(_local3, _local4, _local6, _local7);
_local10 = new URLRequest(_local9);
navigateToURL(_local10);
}
}
}//package
Section 89
//image_airStrikeButton (image_airStrikeButton)
package {
import flash.display.*;
public dynamic class image_airStrikeButton extends BitmapData {
public function image_airStrikeButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 90
//image_combatStimButton (image_combatStimButton)
package {
import flash.display.*;
public dynamic class image_combatStimButton extends BitmapData {
public function image_combatStimButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 91
//image_grenaderButton (image_grenaderButton)
package {
import flash.display.*;
public dynamic class image_grenaderButton extends BitmapData {
public function image_grenaderButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 92
//image_machineGunButton (image_machineGunButton)
package {
import flash.display.*;
public dynamic class image_machineGunButton extends BitmapData {
public function image_machineGunButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 93
//image_molotovButton (image_molotovButton)
package {
import flash.display.*;
public dynamic class image_molotovButton extends BitmapData {
public function image_molotovButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 94
//image_razerWireButton (image_razerWireButton)
package {
import flash.display.*;
public dynamic class image_razerWireButton extends BitmapData {
public function image_razerWireButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 95
//image_sniperButton (image_sniperButton)
package {
import flash.display.*;
public dynamic class image_sniperButton extends BitmapData {
public function image_sniperButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 96
//incendiaryExplosion (incendiaryExplosion)
package {
import flash.display.*;
public dynamic class incendiaryExplosion extends BitmapData {
public function incendiaryExplosion(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 97
//incendiaryGrenade (incendiaryGrenade)
package {
import flash.display.*;
public dynamic class incendiaryGrenade extends BitmapData {
public function incendiaryGrenade(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 98
//incendiaryGrenadeAnimated (incendiaryGrenadeAnimated)
package {
import flash.display.*;
public dynamic class incendiaryGrenadeAnimated extends BitmapData {
public function incendiaryGrenadeAnimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 99
//LifeBar (LifeBar)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
public class LifeBar extends MovieClip {
private var mountedEnemy;// = null
private var life:Sprite;
private var barHeight:Number;// = NAN
private var backGround:Sprite;
private var lifeMod:Number;// = 1
private var barWidth:Number;// = NAN
private static var lifeBarHeight:Number = 5;
public function LifeBar(_arg1:Number):void{
backGround = new Sprite();
life = new Sprite();
lifeMod = 1;
barWidth = NaN;
barHeight = NaN;
mountedEnemy = null;
super();
barWidth = _arg1;
barHeight = lifeBarHeight;
backGround.graphics.beginFill(Colors.black);
backGround.graphics.drawRect(0, 0, barWidth, barHeight);
backGround.mouseEnabled = false;
GameState.enemyContainer.addChild(backGround);
life.graphics.beginFill(Colors.red);
life.graphics.drawRect(0, 0, barWidth, barHeight);
life.mouseEnabled = false;
GameState.enemyContainer.addChild(life);
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
private function _redrawBackground(_arg1:Number, _arg2:Number):void{
backGround.graphics.clear();
backGround.graphics.beginFill(Colors.black);
backGround.graphics.drawRect(_arg1, (_arg2 - lifeBarHeight), barWidth, barHeight);
}
public function adjustLife(_arg1:Number):void{
lifeMod = _arg1;
if (lifeMod < 0){
lifeMod = 0;
};
if (lifeMod > 1){
lifeMod = 1;
};
}
private function _redrawLife(_arg1:Number, _arg2:Number):void{
life.graphics.clear();
life.graphics.beginFill(Colors.red);
life.graphics.drawRect(_arg1, (_arg2 - lifeBarHeight), (barWidth * lifeMod), barHeight);
}
public function mountTo(_arg1:Enemy):void{
mountedEnemy = _arg1;
}
private function _cleanup():void{
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
GameState.enemyContainer.removeChild(backGround);
GameState.enemyContainer.removeChild(life);
}
public function cleanup():void{
_cleanup();
}
public function setPosition(_arg1:Point):void{
_redrawBackground(_arg1.x, _arg1.y);
_redrawLife(_arg1.x, _arg1.y);
}
private function _enterFrameListener(_arg1:Event):void{
if (mountedEnemy == null){
return;
};
_redrawBackground(mountedEnemy.getPositionX(), mountedEnemy.getPositionY());
_redrawLife(mountedEnemy.getPositionX(), mountedEnemy.getPositionY());
}
}
}//package
Section 100
//machineGun (machineGun)
package {
import flash.display.*;
public dynamic class machineGun extends BitmapData {
public function machineGun(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 101
//marksman (marksman)
package {
import flash.display.*;
public dynamic class marksman extends BitmapData {
public function marksman(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 102
//Mine (Mine)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class Mine {
private var cleaned:Boolean;// = false
private var thinkTimer:Timer;// = null
private var minePosition:Point;// = null
private var mineSprite:Sprite;
private static var effectRadius:Number = 50;
private static var thinkTimeMS:Number = 200;
private static var mineDamage:Number = 100;
private static var detonationRadius:Number = 25;
public function Mine(_arg1:Point):void{
thinkTimer = null;
minePosition = null;
cleaned = false;
mineSprite = new Sprite();
super();
minePosition = _arg1;
mineSprite.graphics.beginFill(Colors.red);
mineSprite.graphics.drawCircle(_arg1.x, _arg1.y, 5);
GameState.mainObject.addChild(mineSprite);
thinkTimer = new Timer(thinkTimeMS, 0);
thinkTimer.addEventListener("timer", _think);
thinkTimer.start();
}
private function _think(_arg1:TimerEvent):void{
var _local2:Array;
var _local3:Enemy;
_local2 = CollisionChecker.getEnemiesInRadius(minePosition, Mine.detonationRadius);
if (_local2.length == 0){
return;
};
for each (_local3 in _local2) {
_local3.applyDirectDamage(mineDamage);
};
new Explosion(minePosition, AnimationCreator.breakImageIntoFrames("exploAnim", 4, 4));
GameState.playSound(new sound_Explosion());
cleanup();
}
public function cleanup():void{
if (cleaned == true){
return;
};
thinkTimer.removeEventListener("timer", _think);
thinkTimer.stop();
GameState.mainObject.removeChild(mineSprite);
cleaned = true;
}
}
}//package
Section 103
//missle (missle)
package {
import flash.display.*;
public dynamic class missle extends BitmapData {
public function missle(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 104
//molotovBottle (molotovBottle)
package {
import flash.display.*;
public dynamic class molotovBottle extends BitmapData {
public function molotovBottle(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 105
//molotovCocktail (molotovCocktail)
package {
import flash.display.*;
public dynamic class molotovCocktail extends BitmapData {
public function molotovCocktail(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 106
//molotovExplosion (molotovExplosion)
package {
import flash.display.*;
public dynamic class molotovExplosion extends BitmapData {
public function molotovExplosion(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 107
//MountInfo (MountInfo)
package {
import flash.geom.*;
public class MountInfo {
public var mountedObject:GameObject;// = null
public var mountOffset:Point;
public function MountInfo(_arg1:GameObject, _arg2:Point=null):void{
mountedObject = null;
mountOffset = new Point(0, 0);
super();
mountedObject = _arg1;
if (_arg2 != null){
mountOffset = _arg2;
};
}
}
}//package
Section 108
//napalmFire (napalmFire)
package {
import flash.display.*;
public dynamic class napalmFire extends BitmapData {
public function napalmFire(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 109
//number (number)
package {
import flash.display.*;
public dynamic class number extends BitmapData {
public function number(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 110
//NumberDisplay (NumberDisplay)
package {
import flash.geom.*;
public class NumberDisplay {
var numberGO:GameObject;// = null
var frames:Array;
private static var horizontalAdjustmentAmount:Number = 14;
public function NumberDisplay(_arg1:Number, _arg2:Point):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Animation;
var _local7:Point;
frames = AnimationCreator.breakImageIntoFramesClass(new number(0, 0), 10, 1);
numberGO = null;
super();
if (_arg1 < 0){
trace(_arg1);
throw (new Error("NumberDisplay number to show out of range"));
};
if (_arg1 > 99){
throw (new Error("NumberDisplay number to show out of range"));
};
if (_arg1 > 9){
_local3 = (_arg1 % 10);
_local4 = Math.floor((_arg1 / 10));
new NumberDisplay(_local3, _arg2);
new NumberDisplay(_local4, new Point((_arg2.x - horizontalAdjustmentAmount), _arg2.y));
} else {
_local5 = (_arg1 - 1);
if (_local5 == -1){
_local5 = 9;
};
numberGO = new GameObject(2, frames[_local5], new Point(15, 15));
numberGO.setPosition(_arg2);
_local6 = new Animation(numberGO.bitmap, new Array(_local5, _local5), frames, 1000);
numberGO.playAnimationWithCallBack(_local6, _onAnimationOver);
_local7 = new Point(_arg2.x, (_arg2.y - 100));
numberGO.active = true;
numberGO.setDestination(_local7);
};
}
private function _onAnimationOver(){
numberGO.cleanupGameObject();
numberGO = null;
frames = null;
}
}
}//package
Section 111
//PauseGame (PauseGame)
package {
import MouseStates.*;
public class PauseGame {
private static var isGamePaused:Boolean = false;
private static var canGameBePaused:Boolean = true;
public function PauseGame():void{
}
public static function gamePaused():Boolean{
return (isGamePaused);
}
private static function _unpauseAllEnemies():void{
var _local1:Enemy;
for each (_local1 in GameState.normalEnemies) {
_local1.unpauseEnemy();
};
for each (_local1 in GameState.fireImmuneEnemies) {
_local1.unpauseEnemy();
};
for each (_local1 in GameState.bulletImmuneEnemies) {
_local1.unpauseEnemy();
};
for each (_local1 in GameState.slowImmuneEnemies) {
_local1.unpauseEnemy();
};
}
private static function _unpauseAllAbilities():void{
var _local1:RazorWire;
var _local2:CombatStim;
for each (_local1 in GameState.razorWires) {
_local1.unpause();
};
for each (_local2 in GameState.combatStims) {
_local2.unpause();
};
}
public static function unpauseGame():void{
if (canGameBePaused == false){
return;
};
if (isGamePaused == false){
return;
};
isGamePaused = false;
_unpauseAllEnemies();
_unpauseAllTowers();
_unpauseAllAbilities();
GameState.enemySpawner.unpauseSpawner();
}
public static function pauseGame():void{
if (canGameBePaused == false){
return;
};
if (isGamePaused == true){
return;
};
isGamePaused = true;
_pauseAllEnemies();
_pauseAllTowers();
_pauseAllAbilities();
GameState.enemySpawner.pauseSpawner();
}
public static function togglePause():void{
var _local1:Boolean;
if (canGameBePaused == false){
return;
};
_local1 = !(isGamePaused);
if (_local1){
pauseGame();
} else {
unpauseGame();
};
}
private static function _unpauseTower(_arg1:Tower):void{
_arg1.unpauseTower();
_arg1.unpauseGameObject();
}
private static function _unpauseAllTowers():void{
GameState.tiles.forEachTower(_unpauseTower);
}
public static function lockPausing():void{
canGameBePaused = false;
}
private static function _pauseTower(_arg1:Tower):void{
_arg1.pauseGameObject();
_arg1.pauseTower();
}
public static function unlockPausing():void{
canGameBePaused = true;
}
private static function _pauseAllTowers():void{
GameState.tiles.forEachTower(_pauseTower);
}
private static function _pauseAllEnemies():void{
var _local1:Enemy;
for each (_local1 in GameState.normalEnemies) {
_local1.pauseEnemy();
};
for each (_local1 in GameState.fireImmuneEnemies) {
_local1.pauseEnemy();
};
for each (_local1 in GameState.bulletImmuneEnemies) {
_local1.pauseEnemy();
};
for each (_local1 in GameState.slowImmuneEnemies) {
_local1.pauseEnemy();
};
}
private static function _pauseAllAbilities():void{
var _local1:RazorWire;
var _local2:CombatStim;
for each (_local1 in GameState.razorWires) {
_local1.pause();
};
for each (_local2 in GameState.combatStims) {
_local2.pause();
};
}
}
}//package
Section 112
//PersonalBest (PersonalBest)
package {
import flash.display.*;
public dynamic class PersonalBest extends BitmapData {
public function PersonalBest(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 113
//Projectile (Projectile)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
public class Projectile extends GameObject {
private var size:Point;
private var timeOut:Number;// = 10000
private var speed:Number;// = 5
private var cleaned:Boolean;// = false
public var creatingTower:Tower;// = null
public function Projectile(_arg1:Tower, _arg2:BitmapData){
var _local3:Timer;
speed = 5;
size = new Point(25, 25);
timeOut = 10000;
creatingTower = null;
cleaned = false;
super(speed, _arg2, _arg1.definition.imageSize);
creatingTower = _arg1;
active = true;
setOnDestinationCallBack(_onDestinationReached);
stopAtDestination = true;
_local3 = new Timer(timeOut, 1);
_local3.addEventListener("timer", _projectileTimedOut);
_local3.start();
}
private function _projectileTimedOut(_arg1:TimerEvent):void{
_cleanup();
}
private function _createExplosionAnimation(_arg1:Point):void{
if (creatingTower.definition.projectileExplosionFrames == null){
return;
};
new Explosion(_arg1, creatingTower.definition.projectileExplosionFrames);
}
private function _createAoeEffectIfUsed(_arg1:Point):void{
var _local2:Tile;
if (creatingTower.definition.towerName != "Incendiery Grenade"){
return;
};
_local2 = GameState.tiles.getTile(_arg1.x, _arg1.y);
if (_local2 == null){
return;
};
new AoeEffect(_local2.getCenter(), creatingTower);
}
private function _cleanup():void{
if (cleaned == false){
cleaned = true;
active = false;
cleanupGameObject();
creatingTower = null;
};
}
private function _applyExplosiveDamageAtPosition(){
var _local1:Point;
var _local2:Number;
var _local3:Array;
var _local4:Enemy;
_local1 = getCenter();
_local2 = creatingTower.getExplosiveRange();
_local3 = null;
if (this.creatingTower.definition.damageType == TowerDefinition.fireDamage){
_local3 = CollisionChecker.getEnemiesInRadius(_local1, _local2, CollisionChecker.ignoreFireEnemies);
} else {
_local3 = CollisionChecker.getEnemiesInRadius(_local1, _local2);
};
for each (_local4 in _local3) {
_local4.onProjectileHit(this);
};
_createExplosionAnimation(getCenter());
_createAoeEffectIfUsed(getCenter());
}
private function _onDestinationReached():void{
if (creatingTower.definition.projectileHitSound != null){
GameState.playSound(creatingTower.definition.projectileHitSound);
};
if (creatingTower.isExplosive()){
_applyExplosiveDamageAtPosition();
} else {
throw (new Error("non explosive projectile hit, there should be no projectiles like this."));
};
_cleanup();
}
private function _enterFrameListener(_arg1:Event):void{
if (!active){
return;
};
}
}
}//package
Section 114
//razorwire (razorwire)
package {
import flash.display.*;
public dynamic class razorwire extends BitmapData {
public function razorwire(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 115
//rifleMan (rifleMan)
package {
import flash.display.*;
public dynamic class rifleMan extends BitmapData {
public function rifleMan(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 116
//rocketLauncher (rocketLauncher)
package {
import flash.display.*;
public dynamic class rocketLauncher extends BitmapData {
public function rocketLauncher(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 117
//RPGanimated (RPGanimated)
package {
import flash.display.*;
public dynamic class RPGanimated extends BitmapData {
public function RPGanimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 118
//ScoreStatusBar (ScoreStatusBar)
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import GuiHandling.*;
import flash.text.*;
public class ScoreStatusBar extends Sprite {
private var lineDrawer:Sprite;
private var backGround:Sprite;
private var lifeBonuseBar:Sprite;
private var progressBarColor:uint;
private var lifeBonuseBarColor:uint;
private var progressBar:Sprite;
private var percentageFilled:Number;// = 0
private var scoreDisplay:TextField;// = null
private var backgroundColor:uint;
private var bonusBarTurnedOff:Boolean;// = false
private var format:TextFormat;
private static var mcGoldMedal:MovieClip = GameState.mainObject.mcGoldMedal;
public static var scoreLabelOffsetX:Number = 45;
public static var scoreLabelOffsetY:Number = 70;
public static var silverScore:Number = 330;
private static var mcBronzeMedal:MovieClip = GameState.mainObject.mcBronzeMedal;
public static var maxScore:Number = 610;
public static var goldScore:Number = 400;
private static var bottomY:Number = (nameOfMovieClipToReplace.y + nameOfMovieClipToReplace.height);
public static var bronzeScore:Number = 250;
private static var barHeight:Number = nameOfMovieClipToReplace.height;
public static var nameOfMovieClipToReplace:MovieClip = GameState.mainObject.scoreStatusBar;
private static var medalSize:Point = new Point(32, 32);
private static var minScore:Number = 0;
private static var topY:Number = nameOfMovieClipToReplace.y;
private static var leftX:Number = nameOfMovieClipToReplace.x;
private static var barWidth:Number = nameOfMovieClipToReplace.width;
private static var mcPersonalBest:MovieClip = GameState.mainObject.mcPersonalBest;
private static var mcSilverMedal:MovieClip = GameState.mainObject.mcSilverMedal;
private static var rightX:Number = (nameOfMovieClipToReplace.x + nameOfMovieClipToReplace.width);
private static var personalBestToolTip = new ToolTipData(mcPersonalBest, "Your best score is: 0");
public function ScoreStatusBar(_arg1:Number):void{
backGround = new Sprite();
progressBar = new Sprite();
lifeBonuseBar = new Sprite();
lineDrawer = new Sprite();
backgroundColor = Colors.black;
progressBarColor = Colors.white;
lifeBonuseBarColor = Colors.green;
percentageFilled = 0;
bonusBarTurnedOff = false;
scoreDisplay = null;
format = new TextFormat();
super();
GameState.mainObject.addChild(backGround);
GameState.mainObject.addChild(progressBar);
GameState.mainObject.addChild(lifeBonuseBar);
GameInterfaceHandler.toolTipsHandler.addToolTipData(new ToolTipData(backGround, "This bar shows you the status of your score"));
GameInterfaceHandler.toolTipsHandler.addToolTipData(new ToolTipData(progressBar, "This bar represent your current score"));
GameInterfaceHandler.toolTipsHandler.addToolTipData(new ToolTipData(lifeBonuseBar, "This bar represents the score bonus gained from lives"));
lineDrawer.graphics.lineStyle(2, 0xFFD700, 1, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
GameState.mainObject.addChild(lineDrawer);
_setupBronzeTrophyImage();
_setupSilverTrophyImage();
_setupGoldTrophyImage();
_drawPersonalBestImage(_arg1);
GameInterfaceHandler.toolTipsHandler.addToolTipData(personalBestToolTip);
_redrawBronzeLine();
_redrawSilverLine();
_redrawGoldLine();
_createFormat();
scoreDisplay = new TextField();
scoreDisplay.multiline = false;
scoreDisplay.autoSize = TextFieldAutoSize.LEFT;
scoreDisplay.text = "99";
scoreDisplay.background = true;
scoreDisplay.background = false;
GameState.mainObject.addChild(scoreDisplay);
scoreDisplay.setTextFormat(format);
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function turnOnLifeBonusBar():void{
bonusBarTurnedOff = false;
}
private function _redrawBackground():void{
backGround.graphics.clear();
backGround.graphics.beginFill(backgroundColor);
backGround.graphics.drawRect(leftX, topY, barWidth, barHeight);
}
private function _setupGoldTrophyImage():void{
var _local1:String;
_local1 = (("You need " + goldScore) + " points for the Gold medal");
_setTrophyImageLocation(mcGoldMedal, goldScore, _local1);
}
public function setValue(_arg1:Number):void{
_adjust((_arg1 / maxScore));
}
private function _setTrophyImageLocation(_arg1:MovieClip, _arg2:Number, _arg3:String):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = (_arg2 / maxScore);
_local5 = (_local4 * nameOfMovieClipToReplace.height);
_arg1.width = medalSize.x;
_arg1.height = medalSize.y;
GameInterfaceHandler.toolTipsHandler.addToolTipData(new ToolTipData(_arg1, _arg3));
_local6 = (_arg1.height / 2);
_arg1.x = rightX;
_arg1.y = ((bottomY - _local5) - _local6);
}
private function _redrawSilverLine():void{
var _local1:Number;
var _local2:Number;
_local1 = (silverScore / maxScore);
_local2 = (_local1 * nameOfMovieClipToReplace.height);
lineDrawer.graphics.moveTo(leftX, (bottomY - _local2));
lineDrawer.graphics.lineTo(rightX, (bottomY - _local2));
}
public function turnOffLifeBonusBar():void{
bonusBarTurnedOff = true;
}
private function _redrawProgress():void{
var _local1:Point;
progressBar.graphics.clear();
progressBar.graphics.beginFill(progressBarColor);
_local1 = new Point(leftX, (bottomY - (barHeight * percentageFilled)));
progressBar.graphics.drawRect(_local1.x, _local1.y, nameOfMovieClipToReplace.width, (barHeight * percentageFilled));
_updateScoreDisplay((_local1.x - scoreLabelOffsetX), (_local1.y - scoreLabelOffsetY));
}
private function _redrawBronzeLine():void{
var _local1:Number;
var _local2:Number;
_local1 = (bronzeScore / maxScore);
_local2 = (_local1 * nameOfMovieClipToReplace.height);
lineDrawer.mouseEnabled = false;
lineDrawer.graphics.moveTo(leftX, (bottomY - _local2));
lineDrawer.graphics.lineTo(rightX, (bottomY - _local2));
}
private function _setPersonalBestLocation(_arg1:MovieClip, _arg2:Number, _arg3:Point):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = (_arg2 / maxScore);
_local5 = (_local4 * nameOfMovieClipToReplace.height);
_local6 = (_arg1.height / 2);
_arg1.x = (leftX - _arg1.width);
_arg1.y = ((bottomY - _local5) - _local6);
}
private function _setupBronzeTrophyImage():void{
var _local1:String;
_local1 = (("You need " + bronzeScore) + " points for the Bronze medal");
_setTrophyImageLocation(mcBronzeMedal, bronzeScore, _local1);
}
public function cleanup():void{
_cleanup();
}
private function _drawPersonalBestImage(_arg1:Number):void{
_setPersonalBestLocation(mcPersonalBest, _arg1, new Point(16, 16));
}
public function updatePersonalBestImage(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (_arg1 / maxScore);
_local3 = (_local2 * nameOfMovieClipToReplace.height);
_local4 = (mcPersonalBest.height / 2);
mcPersonalBest.y = ((bottomY - _local3) - _local4);
personalBestToolTip.toolTipText = ("Your best score is: " + _arg1.toString());
}
private function _redrawGoldLine():void{
var _local1:Number;
var _local2:Number;
_local1 = (goldScore / maxScore);
_local2 = (_local1 * nameOfMovieClipToReplace.height);
lineDrawer.graphics.moveTo(leftX, (bottomY - _local2));
lineDrawer.graphics.lineTo(rightX, (bottomY - _local2));
}
private function _adjust(_arg1:Number):void{
percentageFilled = _arg1;
if (percentageFilled < 0){
percentageFilled = 0;
};
if (percentageFilled > 1){
percentageFilled = 1;
};
}
private function _cleanup():void{
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
GameState.mainObject.removeChild(backGround);
GameState.mainObject.removeChild(progressBar);
}
private function _redrawLifeBonusBar():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Point;
if (bonusBarTurnedOff == true){
lifeBonuseBar.graphics.clear();
return;
};
_local1 = GameState.userData.getCurrentScoreBonusPoints();
_local2 = (_local1 / maxScore);
_local3 = (_local2 * barHeight);
lifeBonuseBar.graphics.clear();
lifeBonuseBar.graphics.beginFill(lifeBonuseBarColor);
_local4 = new Point(leftX, (bottomY - ((barHeight * percentageFilled) + _local3)));
lifeBonuseBar.graphics.drawRect(_local4.x, _local4.y, nameOfMovieClipToReplace.width, _local3);
}
private function _setupSilverTrophyImage():void{
var _local1:String;
_local1 = (("You need " + silverScore) + " points for the Silver medal");
_setTrophyImageLocation(mcSilverMedal, silverScore, _local1);
}
private function _enterFrameListener(_arg1:Event):void{
_redrawBackground();
_redrawProgress();
_redrawLifeBonusBar();
}
private function _createFormat():void{
format.font = "LucidaConsole";
format.bold = false;
format.size = 16;
format.color = Colors.white;
}
private function _updateScoreDisplay(_arg1:Number, _arg2:Number):void{
scoreDisplay.x = _arg1;
scoreDisplay.y = _arg2;
scoreDisplay.text = ("Score\n" + GameState.userData.getScore());
scoreDisplay.setTextFormat(format);
}
}
}//package
Section 119
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 120
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 121
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 122
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 123
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 124
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 125
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 126
//SlowEffect (SlowEffect)
package {
import flash.events.*;
import flash.utils.*;
public class SlowEffect {
private var callback:Function;// = null
private var slowEffectDoneTimer:Timer;// = null
private var duration:Number;// = NAN
private var speedModifier:Number;// = NAN
public function SlowEffect(_arg1:Number, _arg2:Number, _arg3:Function):void{
speedModifier = NaN;
duration = NaN;
callback = null;
slowEffectDoneTimer = null;
super();
speedModifier = _arg1;
duration = _arg2;
callback = _arg3;
}
public function pauseSlowEffect():void{
slowEffectDoneTimer.stop();
}
public function cleanup():void{
slowEffectDoneTimer.stop();
}
private function _onSlowEffectFinished(_arg1:TimerEvent):void{
callback(this);
}
public function startApplyingEffect():void{
slowEffectDoneTimer = new Timer(duration, 1);
slowEffectDoneTimer.addEventListener("timer", _onSlowEffectFinished);
slowEffectDoneTimer.start();
}
public function unpauseSlowEffect():void{
slowEffectDoneTimer.start();
}
public function getSpeedModifier():Number{
return (speedModifier);
}
public function getDuration():Number{
return (duration);
}
}
}//package
Section 127
//sniper (sniper)
package {
import flash.display.*;
public dynamic class sniper extends BitmapData {
public function sniper(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 128
//soldierAnimated (soldierAnimated)
package {
import flash.display.*;
public dynamic class soldierAnimated extends BitmapData {
public function soldierAnimated(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 129
//sound_Applause (sound_Applause)
package {
import flash.media.*;
public dynamic class sound_Applause extends Sound {
}
}//package
Section 130
//sound_buzzer (sound_buzzer)
package {
import flash.media.*;
public dynamic class sound_buzzer extends Sound {
}
}//package
Section 131
//sound_click01 (sound_click01)
package {
import flash.media.*;
public dynamic class sound_click01 extends Sound {
}
}//package
Section 132
//sound_Explosion (sound_Explosion)
package {
import flash.media.*;
public dynamic class sound_Explosion extends Sound {
}
}//package
Section 133
//sound_explosion2 (sound_explosion2)
package {
import flash.media.*;
public dynamic class sound_explosion2 extends Sound {
}
}//package
Section 134
//sound_flatlineEdited (sound_flatlineEdited)
package {
import flash.media.*;
public dynamic class sound_flatlineEdited extends Sound {
}
}//package
Section 135
//sound_IncendieryGrenade (sound_IncendieryGrenade)
package {
import flash.media.*;
public dynamic class sound_IncendieryGrenade extends Sound {
}
}//package
Section 136
//sound_Jet_FA18_PassBy1 (sound_Jet_FA18_PassBy1)
package {
import flash.media.*;
public dynamic class sound_Jet_FA18_PassBy1 extends Sound {
}
}//package
Section 137
//sound_JoeyScream (sound_JoeyScream)
package {
import flash.media.*;
public dynamic class sound_JoeyScream extends Sound {
}
}//package
Section 138
//sound_MachineGun_1 (sound_MachineGun_1)
package {
import flash.media.*;
public dynamic class sound_MachineGun_1 extends Sound {
}
}//package
Section 139
//sound_Moltov (sound_Moltov)
package {
import flash.media.*;
public dynamic class sound_Moltov extends Sound {
}
}//package
Section 140
//sound_reload (sound_reload)
package {
import flash.media.*;
public dynamic class sound_reload extends Sound {
}
}//package
Section 141
//sound_reload2 (sound_reload2)
package {
import flash.media.*;
public dynamic class sound_reload2 extends Sound {
}
}//package
Section 142
//sound_Scream_F_1 (sound_Scream_F_1)
package {
import flash.media.*;
public dynamic class sound_Scream_F_1 extends Sound {
}
}//package
Section 143
//sound_Scream_M_0 (sound_Scream_M_0)
package {
import flash.media.*;
public dynamic class sound_Scream_M_0 extends Sound {
}
}//package
Section 144
//sound_Scream_M_1 (sound_Scream_M_1)
package {
import flash.media.*;
public dynamic class sound_Scream_M_1 extends Sound {
}
}//package
Section 145
//sound_Scream_M_2 (sound_Scream_M_2)
package {
import flash.media.*;
public dynamic class sound_Scream_M_2 extends Sound {
}
}//package
Section 146
//sound_Sniper_1 (sound_Sniper_1)
package {
import flash.media.*;
public dynamic class sound_Sniper_1 extends Sound {
}
}//package
Section 147
//sound_Sniper_2 (sound_Sniper_2)
package {
import flash.media.*;
public dynamic class sound_Sniper_2 extends Sound {
}
}//package
Section 148
//sound_stimPack (sound_stimPack)
package {
import flash.media.*;
public dynamic class sound_stimPack extends Sound {
}
}//package
Section 149
//sound_yellgroan (sound_yellgroan)
package {
import flash.media.*;
public dynamic class sound_yellgroan extends Sound {
}
}//package
Section 150
//sound_zipper (sound_zipper)
package {
import flash.media.*;
public dynamic class sound_zipper extends Sound {
}
}//package
Section 151
//TacticalTipsHandler (TacticalTipsHandler)
package {
import flash.display.*;
public class TacticalTipsHandler {
private static var wasShortcutsHelpShow:Boolean = false;
public static var howToPlaceDialog:uint = enumCounter++;
public static var hotKeysDialog:uint = enumCounter++;
public static var dialog:MovieClip = null;
private static var wasDotHelpShown:Boolean = false;
private static var wasRangeHelpShow:Boolean = false;
private static var wasTowerPlacementHelpShow:Boolean = false;
private static var wasFireImmuneHelpShow:Boolean = false;
public static var bulletImmuneEnemiesDialog:uint = enumCounter++;
private static var wasBulletImmuneHelpShow:Boolean = false;
public static var window:MovieClip = null;
public static var dotEffectDialog:uint = enumCounter++;
public static var fireImmuneEnemiesDialog:uint = enumCounter++;
private static var tacticalTipsTurnedOff:Boolean = false;
public static var rangeIndicatorDialog:uint = enumCounter++;
public static var enumCounter:uint = 1;
public static function requestFireImmuneHelp():void{
if ((((wasFireImmuneHelpShow == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(fireImmuneEnemiesDialog);
TacticalTipsHandler.wasFireImmuneHelpShow = true;
}
public static function showHelpDialog(_arg1:uint){
dialog.gotoAndStop(_arg1);
}
public static function requestRangeIndicationHelp():void{
if ((((wasRangeHelpShow == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(rangeIndicatorDialog);
TacticalTipsHandler.wasRangeHelpShow = true;
}
public static function requestShowDotHelp():void{
if ((((wasDotHelpShown == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(dotEffectDialog);
TacticalTipsHandler.wasDotHelpShown = true;
}
public static function showTacticalTipsWindow():void{
window.visible = true;
PauseGame.pauseGame();
PauseGame.lockPausing();
}
public static function hideTacticalTipsWindow():void{
UseabilityLogger.sendLogInformation("hide tactical tips");
window.visible = false;
PauseGame.unlockPausing();
PauseGame.unpauseGame();
}
public static function turnOff():void{
UseabilityLogger.sendLogInformation("turn off tactical tips");
tacticalTipsTurnedOff = true;
hideTacticalTipsWindow();
}
public static function requestTowerPlacementHelp():void{
if ((((wasTowerPlacementHelpShow == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(howToPlaceDialog);
TacticalTipsHandler.wasTowerPlacementHelpShow = true;
}
public static function requestShowShortcuts():void{
if ((((wasShortcutsHelpShow == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(hotKeysDialog);
TacticalTipsHandler.wasShortcutsHelpShow = true;
}
public static function requestBulletImmuneHelp():void{
if ((((wasBulletImmuneHelpShow == true)) || (tacticalTipsTurnedOff))){
return;
};
TacticalTipsHandler.showTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(bulletImmuneEnemiesDialog);
TacticalTipsHandler.wasBulletImmuneHelpShow = true;
}
}
}//package
Section 152
//Tile (Tile)
package {
import flash.geom.*;
public class Tile {
public var canTileHaveTower:Boolean;// = false
private var placedTower:Tower;// = null
private var isTowerPlaced:Boolean;// = false
private var tileCoords:Point;
private var tilePosition:Point;
public function Tile(){
canTileHaveTower = false;
isTowerPlaced = false;
placedTower = null;
tilePosition = new Point();
tileCoords = new Point();
super();
}
public function placeTower(_arg1:TowerDefinition):Boolean{
var _local2:Boolean;
_local2 = false;
if (_canTowerBePlaced()){
_actuallyPlaceTower(_arg1);
_local2 = true;
};
return (_local2);
}
public function getCenter():Point{
var _local1:Number;
var _local2:Number;
_local1 = (Tiles.tileSize.x / 2);
_local2 = (Tiles.tileSize.y / 2);
return (new Point((tilePosition.x + _local1), (tilePosition.y + _local2)));
}
public function getCoords():Point{
return (tileCoords);
}
public function getPlacedTower():Tower{
return (placedTower);
}
public function canTowerBePlaced():Boolean{
return (_canTowerBePlaced());
}
private function _actuallyPlaceTower(_arg1:TowerDefinition){
var _local2:Tower;
isTowerPlaced = true;
_local2 = new Tower(_arg1);
_local2.setPosition(new Point(tilePosition.x, tilePosition.y));
_local2.tile = this;
placedTower = _local2;
}
public function hasTower():Boolean{
return (isTowerPlaced);
}
public function getPosition():Point{
return (new Point(tilePosition.x, tilePosition.y));
}
public function setCoords(_arg1:Number, _arg2:Number){
tileCoords.x = _arg1;
tileCoords.y = _arg2;
}
public function setPosition(_arg1:Number, _arg2:Number){
tilePosition.x = _arg1;
tilePosition.y = _arg2;
}
public function clearTower():void{
if (placedTower == null){
return;
};
placedTower.cleanup();
placedTower = null;
isTowerPlaced = false;
}
private function _canTowerBePlaced():Boolean{
if ((((canTileHaveTower == true)) && ((isTowerPlaced == false)))){
return (true);
};
return (false);
}
}
}//package
Section 153
//TileRow (TileRow)
package {
public class TileRow {
public var tilesInRow:Array;
public function TileRow(_arg1:Number){
var _local2:Number;
tilesInRow = new Array();
super();
tilesInRow = new Array(_arg1);
_local2 = 0;
while (_local2 < _arg1) {
tilesInRow[_local2] = new Tile();
_local2++;
};
}
public function getTile(_arg1:Number){
if (_arg1 < 0){
return (null);
};
if (_arg1 >= tilesInRow.length){
return (null);
};
return (tilesInRow[_arg1]);
}
}
}//package
Section 154
//Tiles (Tiles)
package {
import flash.geom.*;
public class Tiles {
private static var tileRows:Array = new Array(tileCounts.y);
public static var tileSize:Point = new Point((tileWidth / tileCounts.x), (tileHeight / tileCounts.y));
public static var tileCounts:Point = new Point(15, 12);
public static var tileHeight:Number = 420;
public static var tileImagePosition:Point = new Point(138, 12);
public static var tileWidth:Number = 520;
public function Tiles(){
_createTiles();
_setupPlacementTiles();
_setupTileCoords();
}
public function getTile(_arg1:Number, _arg2:Number):Tile{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:TileRow;
var _local7:Number;
var _local8:Tile;
_local3 = (_arg1 - tileImagePosition.x);
_local4 = (_arg2 - tileImagePosition.y);
_local3 = (_local3 / tileSize.x);
_local4 = (_local4 / tileSize.y);
_local5 = Math.floor(_local4);
if (_local5 < 0){
return (null);
};
if (_local5 >= tileRows.length){
return (null);
};
_local6 = tileRows[_local5];
_local7 = Math.floor(_local3);
_local8 = _local6.getTile(_local7);
return (_local8);
}
public function getTileFromCoord(_arg1:Number, _arg2:Number):Tile{
var _local3:Number;
var _local4:TileRow;
var _local5:Number;
var _local6:Tile;
_local3 = _arg2;
_local4 = tileRows[_local3];
_local5 = _arg1;
_local6 = _local4.getTile(_local5);
return (_local6);
}
private function _setupTileCoords(){
var _local1:Number;
var _local2:Number;
var _local3:Tile;
var _local4:*;
_local1 = 0;
while (_local1 < tileCounts.x) {
_local2 = 0;
while (_local2 < tileCounts.y) {
_local3 = getTileFromCoord(_local1, _local2);
_local3.setCoords(_local1, _local2);
_local4 = Tiles.realFromCoord(new Point(_local1, _local2));
_local3.setPosition(_local4.x, _local4.y);
_local2++;
};
_local1++;
};
}
public function getRandomPathOffsetForEnemy(_arg1:Enemy):Point{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:*;
_local2 = tileSize.x;
_local3 = tileSize.y;
_local4 = (Math.random() * _local2);
_local5 = (Math.random() * (_local3 - 10));
_local4 = (_local4 / 2);
_local6 = (0 + _local4);
_local7 = (0 - _local5);
return (new Point(_local6, _local7));
}
public function clearAllTiles():void{
var _local1:TileRow;
var _local2:Tile;
for each (_local1 in tileRows) {
for each (_local2 in _local1.tilesInRow) {
_local2.clearTower();
};
};
}
public function forEachTile(_arg1:Function):void{
var _local2:TileRow;
var _local3:Tile;
for each (_local2 in tileRows) {
for each (_local3 in _local2.tilesInRow) {
_arg1(_local3);
};
};
}
private function _createTiles(){
var _local1:Number;
var _local2:TileRow;
_local1 = 0;
while (_local1 < tileCounts.y) {
_local2 = new TileRow(tileCounts.x);
tileRows[_local1] = _local2;
_local1++;
};
}
private function _addPlacementTilesRow(_arg1:Number){
_setupTileCanHaveTower(getTileFromCoord(1, _arg1));
_setupTileCanHaveTower(getTileFromCoord(2, _arg1));
_setupTileCanHaveTower(getTileFromCoord(4, _arg1));
_setupTileCanHaveTower(getTileFromCoord(5, _arg1));
_setupTileCanHaveTower(getTileFromCoord(7, _arg1));
_setupTileCanHaveTower(getTileFromCoord(8, _arg1));
_setupTileCanHaveTower(getTileFromCoord(10, _arg1));
_setupTileCanHaveTower(getTileFromCoord(11, _arg1));
_setupTileCanHaveTower(getTileFromCoord(13, _arg1));
_setupTileCanHaveTower(getTileFromCoord(14, _arg1));
}
public function getTowerCount():uint{
var _local1:uint;
var _local2:TileRow;
var _local3:Tile;
var _local4:Tower;
_local1 = 0;
for each (_local2 in tileRows) {
for each (_local3 in _local2.tilesInRow) {
_local4 = _local3.getPlacedTower();
if (_local4 != null){
_local1++;
};
};
};
return (_local1);
}
private function _setupTileCanHaveTower(_arg1:Tile){
_arg1.canTileHaveTower = true;
}
private function _setupPlacementTiles(){
_addPlacementTilesRow(0);
_addPlacementTilesRow(2);
_addPlacementTilesRow(3);
_addPlacementTilesRow(5);
_addPlacementTilesRow(6);
_addPlacementTilesRow(8);
_addPlacementTilesRow(9);
_addPlacementTilesRow(11);
}
public function forEachTower(_arg1:Function):void{
var _local2:TileRow;
var _local3:Tile;
var _local4:Tower;
for each (_local2 in tileRows) {
for each (_local3 in _local2.tilesInRow) {
_local4 = _local3.getPlacedTower();
if (_local4 != null){
_arg1(_local4);
};
};
};
}
public static function getTileSize():Point{
return (tileSize);
}
public static function realFromCoord(_arg1:Point):Point{
var _local2:Point;
_local2 = new Point();
_local2.x = ((_arg1.x * tileSize.x) + tileImagePosition.x);
_local2.y = ((_arg1.y * tileSize.y) + tileImagePosition.y);
return (_local2);
}
public static function getTileSizeX():Number{
return (tileSize.x);
}
public static function getTileSizeY():Number{
return (tileSize.y);
}
}
}//package
Section 155
//Tower (Tower)
package {
import flash.geom.*;
import flash.media.*;
import MouseStates.*;
import flash.events.*;
import flash.utils.*;
public class Tower extends GameObject {
private var readyStateTimer:Timer;// = null
public var definition:TowerDefinition;// = null
private var isTowerBoosted:Boolean;// = false
private var currentState:Number;
public var tile:Tile;// = null
private var kills:Number;// = 0
private var attackSpeed:Number;// = NAN
public static var projectileFramesDefault:Array = AnimationCreator.breakImageIntoFrames("onFire", 2, 1);
private static var BUILD_STATE:Number = 0;
public static var towerBuildSound:Sound = new sound_reload();
public static var towerSelectedSound:Sound = new sound_reload2();
public static var pointsForBuildingTower:Number = 1;
private static var timerIntervalMS:Number = 100;
private static var upgradeSound:Sound = new sound_zipper();
private static var READY_STATE:Number = 1;
public static var framesToLeadShows:Number = 10;
private static var buildTime:Number = 2000;
private static var CHANGING_STATE:Number = 2;
public function Tower(_arg1:TowerDefinition){
definition = null;
tile = null;
kills = 0;
attackSpeed = NaN;
currentState = BUILD_STATE;
readyStateTimer = null;
isTowerBoosted = false;
super(0, _arg1.frames[0], Tiles.getTileSize(), true);
active = true;
definition = _arg1;
attackSpeed = definition.attackSpeed;
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function upgrade():void{
var _local1:*;
if (definition.upgradeTower == null){
return;
};
_local1 = TowerDefinition.getTowerDefinition(definition.upgradeTower);
definition = _local1;
attackSpeed = definition.attackSpeed;
stopAnimation();
bitmap.bitmapData = definition.frames[0];
GameState.updateSelectedTowerDisplayInformation();
GameState.playSound(Tower.upgradeSound);
}
public function getUpgradedTowerDefinition():TowerDefinition{
var _local1:*;
_local1 = TowerDefinition.getTowerDefinition(definition.upgradeTower);
return (_local1);
}
public function unpauseTower():void{
if (hasEventListener(Event.ENTER_FRAME)){
return;
};
readyStateTimer.start();
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function boostTower(_arg1:Number):void{
if (isTowerBoosted){
throw (new Error("Combat boosts cannot be stacked on a tower."));
};
attackSpeed = (attackSpeed / _arg1);
isTowerBoosted = true;
}
private function _isEnemyTargetable(_arg1, _arg2:int, _arg3:Array):Boolean{
var _local4:Enemy;
_local4 = _arg1;
if (!_local4.isActive()){
return (false);
};
if (_enemyIsOutOfRange(_local4)){
return (false);
};
if (_local4.enemyInCity == false){
return (false);
};
return (true);
}
public function getCost():Number{
return (definition.cost);
}
private function _findTarget():Enemy{
var _local1:Enemy;
_local1 = null;
_local1 = _findTargets(GameState.normalEnemies);
if (_local1 != null){
return (_local1);
};
if (definition.damageType != TowerDefinition.fireDamage){
_local1 = _findTargets(GameState.fireImmuneEnemies);
if (_local1 != null){
return (_local1);
};
};
if (definition.damageType != TowerDefinition.normalDamage){
_local1 = _findTargets(GameState.bulletImmuneEnemies);
if (_local1 != null){
return (_local1);
};
};
return (_findTargets(GameState.slowImmuneEnemies));
}
public function getExplosiveRange():Number{
var _local1:Point;
_local1 = GameState.getTileSize();
return ((definition.explosiveRadius * _local1.x));
}
private function _buildState():void{
var _local1:Number;
currentState = CHANGING_STATE;
_local1 = (buildTime / Tower.timerIntervalMS);
readyStateTimer = new Timer(Tower.timerIntervalMS, Math.ceil(_local1));
readyStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, _switchToReadyState);
readyStateTimer.start();
}
public function sell():void{
var _local1:Number;
this.tile.clearTower();
_local1 = Math.floor((getCost() * GameState.refundPercentage));
GameState.userData.addMoney(_local1);
_cleanup();
GameState.mouseFollower.setState(MouseFollower.emptyState);
new NumberDisplay(_local1, this.getPosition());
}
private function _switchToReadyState(_arg1:TimerEvent):void{
currentState = READY_STATE;
}
public function getDamage():Number{
return (definition.damage);
}
private function _findTargets(_arg1:Array):Enemy{
var _local2:Array;
_local2 = _arg1.filter(_isEnemyTargetable);
if (_local2.length > 0){
return (_local2[0]);
};
return (null);
}
public function unboostTower(_arg1:Number):void{
attackSpeed = (attackSpeed / _arg1);
isTowerBoosted = false;
}
private function _createProjectile(_arg1:Point):void{
var _local2:Projectile;
var _local3:Animation;
_local2 = null;
if (definition.projectileFrames != null){
_local2 = new Projectile(this, definition.projectileFrames[0]);
} else {
_local2 = new Projectile(this, Tower.projectileFramesDefault[0]);
};
if (definition.projectileAnimation != null){
_local3 = new Animation(bitmap, new Array(0, 1, 2, 3, 4, 5, 6, 7), definition.projectileFrames, 500);
_local2.playAnimationLooping(_local3);
};
_local2.setPosition(this.getCenter());
_local2.setDestination(_arg1);
_local2.active = true;
}
private function _readyState():void{
var _local1:Enemy;
var _local2:Number;
_local1 = _findTarget();
if (_local1 != null){
currentState = CHANGING_STATE;
_fireAtTarget(_local1);
_local2 = (attackSpeed / Tower.timerIntervalMS);
readyStateTimer = new Timer(Tower.timerIntervalMS, Math.ceil(_local2));
readyStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, _switchToReadyState);
readyStateTimer.start();
};
}
public function canTowerBeBoosted():Boolean{
return (!(isTowerBoosted));
}
public function cleanup():void{
_cleanup();
}
private function _cleanup():void{
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
cleanupGameObject();
}
public function addKill():void{
kills++;
if ((((GameState.getSelectedTower() == this)) && ((GameState.mouseFollower.getState() == MouseFollower.towerSelectedState)))){
GameState.updateSelectedTowerDisplayInformation();
};
}
public function pauseTower():void{
if (!hasEventListener(Event.ENTER_FRAME)){
return;
};
readyStateTimer.stop();
removeEventListener(Event.ENTER_FRAME, _enterFrameListener);
}
public function getRange():Number{
return (definition.range);
}
private function _enemyIsOutOfRange(_arg1:Enemy):Boolean{
var _local2:Number;
var _local3:Number;
_local2 = (_arg1.bitmap.height / 2);
_local3 = Point.distance(_arg1.getCenter(), getCenter());
if ((_local3 - _local2) > (definition.range * Tiles.getTileSize().x)){
return (true);
};
return (false);
}
private function _playFireSound():void{
if (definition.fireSound == null){
return;
};
GameState.playSound(definition.fireSound);
}
private function _playFireAnimation(_arg1:Point):void{
var _local2:Animation;
_local2 = new Animation(bitmap, new Array(0, 1, 2, 0), definition.frames, 100);
playAnimation(_local2);
rotateToPoint(_arg1);
}
private function _fireAtTarget(_arg1:Enemy):void{
var _local2:Point;
var _local3:Point;
if (definition.instantHit == false){
_local2 = _arg1.getPositionAfterFrames(framesToLeadShows);
_local3 = _arg1.adjustToBottom(_local2);
_createProjectile(_local3);
_playFireAnimation(_local3);
} else {
_arg1.applyDamage(this);
_playFireAnimation(_arg1.getPosition());
};
_playFireSound();
}
public function isExplosive():Boolean{
return (definition.isExplosive);
}
private function _enterFrameListener(_arg1:Event):void{
switch (currentState){
case BUILD_STATE:
_buildState();
break;
case READY_STATE:
_readyState();
break;
};
}
public function getKills():Number{
return (kills);
}
}
}//package
Section 156
//TowerDefinition (TowerDefinition)
package {
import flash.geom.*;
import flash.media.*;
public class TowerDefinition {
public var fireSound:Sound;// = null
public var imageSize:Point;
public var projectileAnimation:Animation;// = null
public var frames:Array;// = null
public var specialAbility:SlowEffect;// = null
public var towerName:String;// = null
public var rangeString:String;// = "default rangeString"
public var dotEffect:DotEffect;// = null
public var rofString;// = "default rofString"
public var range:Number;// = NAN
public var projectileHitSound:Sound;// = null
public var damageType:String;// = null
public var upgradeTower:String;// = null
public var cost:Number;// = NAN
public var explosiveRadius:Number;// = NAN
public var isExplosive:Boolean;// = false
public var attackSpeed:Number;// = NAN
public var damageString:String;// = "default damageString"
public var isAllowedInDemo:Boolean;// = true
public var projectileFrames:Array;// = null
public var instantHit:Boolean;// = false
public var damage:Number;// = NAN
public var projectileExplosionFrames:Array;// = null
public var description:String;// = null
public static var fireDamage:String = "Fire";
private static var definitions:Array = new Array();
private static var definitionsDefined:Boolean = false;
public static var slowDamage:String = "Slow";
public static var explosiveDamage:String = "Explosive";
public static var normalDamage:String = "Normal";
public function TowerDefinition():void{
towerName = null;
cost = NaN;
damage = NaN;
range = NaN;
upgradeTower = null;
attackSpeed = NaN;
instantHit = false;
damageType = null;
fireSound = null;
frames = null;
specialAbility = null;
isExplosive = false;
explosiveRadius = NaN;
dotEffect = null;
projectileFrames = null;
projectileAnimation = null;
projectileHitSound = null;
projectileExplosionFrames = null;
damageString = "default damageString";
rangeString = "default rangeString";
rofString = "default rofString";
isAllowedInDemo = true;
imageSize = new Point(25, 25);
description = null;
super();
}
public static function getTowerDefinition(_arg1:String):TowerDefinition{
var _local2:TowerDefinition;
for each (_local2 in TowerDefinition.definitions) {
if (_local2.towerName == _arg1){
return (_local2);
};
};
return (null);
}
public static function buildTowerDefinitions():void{
if (TowerDefinition.definitionsDefined == false){
TowerDefinition.definitionsDefined = true;
addDefinitions();
};
}
private static function addDefinitions():void{
var _local1:TowerDefinition;
var _local2:TowerDefinition;
var _local3:TowerDefinition;
var _local4:TowerDefinition;
var _local5:TowerDefinition;
var _local6:TowerDefinition;
var _local7:TowerDefinition;
var _local8:TowerDefinition;
var _local9:TowerDefinition;
var _local10:TowerDefinition;
var _local11:TowerDefinition;
var _local12:TowerDefinition;
_local1 = new (TowerDefinition);
_local1.towerName = "Machine Gunner";
_local1.cost = 3;
_local1.damage = 6;
_local1.range = 2;
_local1.upgradeTower = "Heavy Machine Gunner";
_local1.attackSpeed = 600;
_local1.instantHit = true;
_local1.damageType = normalDamage;
_local1.fireSound = new sound_MachineGun_1();
_local1.frames = AnimationCreator.breakImageIntoFrames("mg", 4, 1);
_local1.damageString = "Very Low";
_local1.rangeString = "Near";
_local1.rofString = "Medium";
definitions.push(_local1);
_local1.description = "Short range soldier with a fast attack.";
_local2 = new (TowerDefinition);
_local2.towerName = "Heavy Machine Gunner";
_local2.cost = 15;
_local2.damage = 16;
_local2.range = 2;
_local2.upgradeTower = "Vulcan Cannon";
_local2.attackSpeed = 400;
_local2.instantHit = true;
_local2.damageType = normalDamage;
_local2.fireSound = new sound_MachineGun_1();
_local2.frames = AnimationCreator.breakImageIntoFrames("heavyMachineGunnerDefinition", 4, 1);
_local2.damageString = "Low";
_local2.rangeString = "Near";
_local2.rofString = "Medium";
definitions.push(_local2);
_local3 = new (TowerDefinition);
_local3.towerName = "Vulcan Cannon";
_local3.cost = 30;
_local3.damage = 16;
_local3.range = 2;
_local3.attackSpeed = 200;
_local3.instantHit = true;
_local3.damageType = normalDamage;
_local3.fireSound = new sound_MachineGun_1();
_local3.frames = AnimationCreator.breakImageIntoFrames("vulcan", 4, 1);
_local3.damageString = "Low";
_local3.rangeString = "Near";
_local3.rofString = "Fast";
_local3.isAllowedInDemo = false;
definitions.push(_local3);
_local4 = new (TowerDefinition);
_local4.towerName = "Rifleman";
_local4.cost = 5;
_local4.damage = 15;
_local4.range = 4;
_local4.upgradeTower = "Marksman";
_local4.attackSpeed = 2000;
_local4.instantHit = true;
_local4.damageType = normalDamage;
_local4.fireSound = new sound_Sniper_1();
_local4.frames = AnimationCreator.breakImageIntoFrames("rifleman", 4, 1);
_local4.damageString = "Low";
_local4.rangeString = "Far";
_local4.rofString = "Slow";
definitions.push(_local4);
_local4.description = "Long range soldier with great damage.";
_local5 = new (TowerDefinition);
_local5.towerName = "Marksman";
_local5.cost = 20;
_local5.damage = 65;
_local5.range = 5.5;
_local5.upgradeTower = "Sniper";
_local5.attackSpeed = 2000;
_local5.instantHit = true;
_local5.damageType = normalDamage;
_local5.fireSound = new sound_Sniper_2();
_local5.frames = AnimationCreator.breakImageIntoFrames("marksman", 4, 1);
_local5.damageString = "High";
_local5.rangeString = "Very Far";
_local5.rofString = "Slow";
definitions.push(_local5);
_local6 = new (TowerDefinition);
_local6.towerName = "Sniper";
_local6.cost = 30;
_local6.damage = 90;
_local6.range = 7;
_local6.attackSpeed = 2000;
_local6.instantHit = true;
_local6.damageType = normalDamage;
_local6.fireSound = new sound_Sniper_2();
_local6.frames = AnimationCreator.breakImageIntoFrames("sniper", 4, 1);
_local6.damageString = "Very High";
_local6.rangeString = "Super Far";
_local6.rofString = "Slow";
_local6.isAllowedInDemo = false;
definitions.push(_local6);
_local7 = new (TowerDefinition);
_local7.towerName = "Grenadier";
_local7.cost = 5;
_local7.damage = 5;
_local7.range = 1;
_local7.upgradeTower = "Grenade Launcher";
_local7.attackSpeed = 2500;
_local7.instantHit = false;
_local7.damageType = explosiveDamage;
_local7.fireSound = null;
_local7.frames = AnimationCreator.breakImageIntoFrames("grenadier", 4, 1);
_local7.specialAbility = new SlowEffect(0.75, 2000, null);
_local7.isExplosive = true;
_local7.explosiveRadius = 0.7;
_local7.projectileHitSound = new sound_Explosion();
_local7.projectileExplosionFrames = AnimationCreator.breakImageIntoFrames("exploAnim", 4, 4);
_local7.projectileFrames = AnimationCreator.breakImageIntoFramesClass(new RPGanimated(0, 0), 4, 1);
_local7.projectileAnimation = new Animation(null, new Array(0, 1, 2, 3), _local7.projectileFrames, 200);
_local7.damageString = "Very Low";
_local7.rangeString = "Very Near";
_local7.rofString = "Low";
definitions.push(_local7);
_local7.description = "Support soldier which slows Zombies down.";
_local8 = new (TowerDefinition);
_local8.towerName = "Grenade Launcher";
_local8.cost = 25;
_local8.damage = 7;
_local8.range = 2;
_local8.upgradeTower = "Rocket Launcher";
_local8.attackSpeed = 2500;
_local8.instantHit = false;
_local8.damageType = explosiveDamage;
_local8.fireSound = null;
_local8.frames = AnimationCreator.breakImageIntoFrames("grenadeLauncher", 4, 1);
_local8.specialAbility = new SlowEffect(0.65, 4000, null);
_local8.isExplosive = true;
_local8.explosiveRadius = 0.8;
_local8.projectileHitSound = new sound_Explosion();
_local8.projectileExplosionFrames = AnimationCreator.breakImageIntoFrames("exploAnim", 4, 4);
_local8.projectileFrames = AnimationCreator.breakImageIntoFramesClass(new RPGanimated(0, 0), 4, 1);
_local8.projectileAnimation = new Animation(null, new Array(0, 1, 2, 3), _local8.projectileFrames, 200);
_local8.damageString = "Very Low";
_local8.rangeString = "Near";
_local8.rofString = "Low";
definitions.push(_local8);
_local9 = new (TowerDefinition);
_local9.towerName = "Rocket Launcher";
_local9.cost = 40;
_local9.damage = 8;
_local9.range = 2.4;
_local9.attackSpeed = 2500;
_local9.instantHit = false;
_local9.damageType = explosiveDamage;
_local9.fireSound = null;
_local9.frames = AnimationCreator.breakImageIntoFrames("rocketLauncher", 4, 4);
_local9.specialAbility = new SlowEffect(0.5, 6000, null);
_local9.isExplosive = true;
_local9.explosiveRadius = 1;
_local9.projectileFrames = AnimationCreator.breakImageIntoFrames("missle", 1, 1);
_local9.projectileHitSound = new sound_Explosion();
_local9.projectileExplosionFrames = AnimationCreator.breakImageIntoFrames("exploAnim", 4, 4);
_local9.damageString = "Very Low";
_local9.rangeString = "Medium";
_local9.rofString = "Low";
_local9.isAllowedInDemo = false;
definitions.push(_local9);
_local10 = new (TowerDefinition);
_local10.towerName = "Molotov Cocktail";
_local10.cost = 5;
_local10.damage = 0;
_local10.range = 1;
_local10.upgradeTower = "Incendiery Grenade";
_local10.attackSpeed = 2000;
_local10.damageType = fireDamage;
_local10.frames = AnimationCreator.breakImageIntoFrames("molotovCocktail", 4, 3);
_local10.dotEffect = new DotEffect(25, 5000, 5, null, null, null);
_local10.isExplosive = true;
_local10.explosiveRadius = 0.7;
_local10.projectileFrames = AnimationCreator.breakImageIntoFrames("molotovBottle", 4, 2);
_local10.projectileAnimation = new Animation(null, new Array(0, 1, 2, 3, 4, 5, 6, 7), _local10.projectileFrames, 200);
_local10.projectileHitSound = new sound_Moltov();
_local10.projectileExplosionFrames = AnimationCreator.breakImageIntoFrames("molotovExplosion", 4, 3);
_local10.damageString = "Medium";
_local10.rangeString = "Very Near";
_local10.rofString = "Low";
definitions.push(_local10);
_local10.description = "This Soldier lights enemies on fire doing damage over time.";
_local11 = new (TowerDefinition);
_local11.towerName = "Incendiery Grenade";
_local11.cost = 25;
_local11.damage = 0;
_local11.range = 2;
_local11.upgradeTower = "Flamethrower";
_local11.attackSpeed = 2000;
_local11.damageType = fireDamage;
_local11.frames = AnimationCreator.breakImageIntoFrames("incendieryGrenade", 4, 3);
_local11.dotEffect = new DotEffect(25, 5000, 5, null, null, null);
_local11.isExplosive = true;
_local11.explosiveRadius = 0.8;
_local11.projectileHitSound = new sound_IncendieryGrenade();
_local11.projectileExplosionFrames = AnimationCreator.breakImageIntoFrames("incendiaryExplosion", 4, 2);
_local11.projectileFrames = AnimationCreator.breakImageIntoFramesClass(new incendiaryGrenadeAnimated(0, 0), 4, 1);
_local11.projectileAnimation = new Animation(null, new Array(0, 1, 2, 3), _local11.projectileFrames, 200);
_local11.damageString = "Medium";
_local11.rangeString = "Near";
_local11.rofString = "Low";
_local11.imageSize = new Point(12.5, 12.5);
definitions.push(_local11);
_local12 = new (TowerDefinition);
_local12.towerName = "Flamethrower";
_local12.cost = 40;
_local12.damage = 0;
_local12.range = 1.5;
_local12.attackSpeed = 1000;
_local12.damageType = fireDamage;
_local12.frames = AnimationCreator.breakImageIntoFrames("flameThrower", 1, 1);
_local12.dotEffect = new DotEffect(50, 5000, 5, null, null, null);
_local12.damageString = "High";
_local12.rangeString = "Near";
_local12.rofString = "Medium";
_local12.isAllowedInDemo = false;
definitions.push(_local12);
}
}
}//package
Section 157
//UseabilityLogger (UseabilityLogger)
package {
import flash.events.*;
import flash.utils.*;
public class UseabilityLogger {
private static var logReceiver:String = "http://69.248.104.76/useabilityLogging.php";
private static var uniqueId:uint = _generateUniqueId();
private static var gameStartTime:Number = new Date().getTime();
public function UseabilityLogger():void{
}
public static function sendLogInformation(_arg1:String):void{
}
private static function _generateUniqueId():uint{
var _local1:uint;
_local1 = 0;
_local1 = (_local1 + Math.floor((Math.random() * 10)));
_local1 = (_local1 + Math.floor((Math.random() * 100)));
_local1 = (_local1 + Math.floor((Math.random() * 1000)));
_local1 = (_local1 + Math.floor((Math.random() * 10000)));
_local1 = (_local1 + Math.floor((Math.random() * 100000)));
_local1 = (_local1 + Math.floor((Math.random() * 1000000)));
return (_local1);
}
public static function startHeartBeats():void{
var _local1:Number;
var _local2:Timer;
_local1 = (60 * 1000);
_local2 = new Timer(_local1, 0);
_local2.addEventListener(TimerEvent.TIMER, _generateHeartBeat);
_local2.start();
}
private static function _generateHeartBeat(_arg1):void{
sendLogInformation(((((("{Heart Beat} score: " + GameState.userData.getScore().toString()) + " lives: ") + GameState.userData.getLives().toString()) + " wave: ") + GameState.enemySpawner.getCurrentWave()));
}
}
}//package
Section 158
//UserData (UserData)
package {
public class UserData {
private var mines:uint;
private var hasBronzeMedal:Boolean;// = false
private var lives:Number;// = NAN
private var score:Number;// = NAN
private var screamSounds:Array;
private var personalBestScore:Number;// = 0
private var money:Number;// = NAN
private var enemiesKilled:uint;
private var artillery:uint;
public var scoreStatusBar:ScoreStatusBar;// = null
private var airStrikes:uint;
private var skipBonus:Number;// = NAN
private var hasSilverMedal:Boolean;// = false
private var hasGoldMedal:Boolean;// = false
private static var startingMoney:Number = 20;
private static var startingEnemiesKilled:uint = 0;
private static var startingLives:Number = 20;
private static var startingSkipBonus:Number = 0;
private static var startingScore:Number = 0;
private static var startingArtillery:uint = 2;
private static var startingAirStrikes:uint = 1;
private static var startingMines:uint = 5;
private static var lifeBonusModifier:Number = 10;
public function UserData(){
personalBestScore = 0;
money = NaN;
lives = NaN;
score = NaN;
skipBonus = NaN;
scoreStatusBar = null;
screamSounds = new Array();
hasBronzeMedal = false;
hasSilverMedal = false;
hasGoldMedal = false;
super();
scoreStatusBar = new ScoreStatusBar(personalBestScore);
_buildScreamSounds();
}
public function usedArtillery():void{
UseabilityLogger.sendLogInformation("usedArtillery");
artillery--;
}
public function getMoney(){
return (money);
}
public function getArtillery():Number{
return (artillery);
}
public function removeAllLives(){
lives = 0;
GameState.setLives(lives);
}
public function checkIfUserJustEarnedSilverMedal():Boolean{
if (hasSilverMedal){
return (false);
};
if (getScore() < ScoreStatusBar.silverScore){
return (false);
};
hasSilverMedal = true;
UseabilityLogger.sendLogInformation("user earned silver");
return (true);
}
private function _adjustPersonalBest(){
if (score <= personalBestScore){
return;
};
personalBestScore = score;
scoreStatusBar.updatePersonalBestImage(personalBestScore);
}
public function canUserPlaceArtillery():Boolean{
if (artillery <= 0){
return (false);
};
if (doesUserHaveSilverMedal() == false){
return (false);
};
return (true);
}
public function subtractMoney(_arg1:Number){
money = (money - _arg1);
GameState.setMoney(money);
}
public function getEnemiesKilles():Number{
return (enemiesKilled);
}
public function addMoney(_arg1:Number){
money = (money + _arg1);
GameState.setMoney(money);
}
public function setStartingEnemiesKilled():void{
enemiesKilled = startingEnemiesKilled;
}
private function _buildScreamSounds():void{
screamSounds.push(new sound_JoeyScream());
screamSounds.push(new sound_Scream_F_1());
screamSounds.push(new sound_Scream_M_0());
screamSounds.push(new sound_Scream_M_1());
screamSounds.push(new sound_Scream_M_2());
screamSounds.push(new sound_yellgroan());
}
public function takeLife(){
lives--;
GameState.setLives(lives);
_checkForGameLostCondition();
_playRandomScream();
}
public function setStartingMoney():void{
money = startingMoney;
GameState.setMoney(money);
}
public function checkIfUserJustEarnedBronzeMedal():Boolean{
if (hasBronzeMedal){
return (false);
};
if (getScore() < ScoreStatusBar.bronzeScore){
return (false);
};
hasBronzeMedal = true;
UseabilityLogger.sendLogInformation("user earned bronze");
return (true);
}
public function setStartingArtillery():void{
if (doesUserHaveSilverMedal()){
artillery = startingArtillery;
} else {
artillery = 0;
};
}
public function usedMine():void{
UseabilityLogger.sendLogInformation("usedMine");
mines--;
}
public function getSkipBonus():Number{
return (skipBonus);
}
public function setStartingAirStrikes():void{
if (doesUserHaveGoldMedal()){
airStrikes = startingAirStrikes;
} else {
airStrikes = 0;
};
}
public function canUserPlaceAirStrikes():Boolean{
if (airStrikes <= 0){
return (false);
};
if (doesUserHaveGoldMedal() == false){
return (false);
};
return (true);
}
public function setStartingSkipBonus():void{
skipBonus = startingSkipBonus;
}
private function _onScoreAdjusted():void{
scoreStatusBar.setValue(score);
_adjustPersonalBest();
}
public function addToSkipBonus(_arg1:Number):void{
skipBonus = (skipBonus + _arg1);
}
private function _playRandomScream():void{
var _local1:Number;
var _local2:Number;
_local1 = screamSounds.length;
_local2 = Math.floor(((_local1 - 1) * Math.random()));
GameState.playSound(screamSounds[_local2], 0.3);
}
public function towerCanBeAfforded(_arg1:TowerDefinition):Boolean{
var _local2:Boolean;
_local2 = false;
if (_arg1 != null){
if (_arg1.cost <= money){
_local2 = true;
};
};
return (_local2);
}
public function getMines():Number{
return (mines);
}
public function getAirStrikes():Number{
return (airStrikes);
}
public function getLives(){
return (lives);
}
public function getCurrentScoreBonusPoints():Number{
return ((getLives() * UserData.lifeBonusModifier));
}
public function canUserPlaceMines():Boolean{
if (mines <= 0){
return (false);
};
if (doesUserHaveBronzeMedal() == false){
return (false);
};
return (true);
}
public function adjustScoreWithLifeBonus():void{
score = (score + getCurrentScoreBonusPoints());
_onScoreAdjusted();
}
public function doesUserHaveSilverMedal():Boolean{
return (hasSilverMedal);
}
public function usedAirStrike():void{
UseabilityLogger.sendLogInformation("usedAirStrike");
airStrikes--;
}
public function getScore(){
return (score);
}
public function checkIfUserJustEarnedGoldMedal():Boolean{
if (hasGoldMedal){
return (false);
};
if (getScore() < ScoreStatusBar.goldScore){
return (false);
};
hasGoldMedal = true;
UseabilityLogger.sendLogInformation("user earned gold");
return (true);
}
public function setStartingLives():void{
lives = startingLives;
GameState.setLives(lives);
}
public function doesUserHaveGoldMedal():Boolean{
return (hasGoldMedal);
}
private function _checkForGameLostCondition(){
if (lives > 0){
return;
};
GameState.onAllLivesLost();
}
public function setStartingMines():void{
if (doesUserHaveBronzeMedal()){
mines = startingMines;
} else {
mines = 0;
};
}
public function doesUserHaveBronzeMedal():Boolean{
return (hasBronzeMedal);
}
public function addEnemyKill():void{
enemiesKilled++;
}
public function addToScore(_arg1:Number){
score = (score + _arg1);
_onScoreAdjusted();
}
public function setStartingScore(){
score = startingScore;
_onScoreAdjusted();
}
public function getPersonalBestScore():Number{
return (personalBestScore);
}
}
}//package
Section 159
//vulcan (vulcan)
package {
import flash.display.*;
public dynamic class vulcan extends BitmapData {
public function vulcan(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 160
//z14 (z14)
package {
import flash.display.*;
public dynamic class z14 extends BitmapData {
public function z14(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 161
//ZombieDefense (ZombieDefense)
package {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
public dynamic class ZombieDefense extends MovieClip {
public var mcBronzeMedal:MovieClip;
public var btnRestart:SimpleButton;
public var tower3Button:ButtonWithToolTip;// = null
public var btnUpgrade:SimpleButton;
public var restartButton:ButtonWithToolTip;// = null
public var txtMoney:TextField;
public var lblROF:MovieClip;
public var startButton:ButtonWithToolTip;// = null
public var lblEndGame2:TextField;
public var txtTowerRange:TextField;
public var txtUpgradeTowerCost:TextField;
public var abilityMinesButton:ButtonWithToolTip;// = null
public var slider_Volume:Slider;
public var tacticalHelpWindow:MovieClip;
public var quitButton:ButtonWithToolTip;// = null
public var lblUpgradeROF:MovieClip;
public var txtUpgradeTowerRange:TextField;
public var pauseGameButton:ButtonWithToolTip;// = null
public var mcLevelImage:MovieClip;
public var upgradeButton:ButtonWithToolTip;// = null
private var bindKeyboardTimer:Timer;
public var scoreStatusBar:MovieClip;
public var lblUpgradeCost:MovieClip;
public var mcSilverMedal:MovieClip;
public var txtLives:TextField;
public var lblUpgradeDamage:MovieClip;
public var txtTowerRof:TextField;
public var txtAbility:TextField;
public var lblCost:MovieClip;
public var txtTowerName:TextField;
public var txtUpgradeTowerDamage:TextField;
public var spawnArea:MovieClip;
public var EndGameDialogInstance:MovieClip;
public var txtTimer:TextField;
public var btn_Mines:SimpleButton;
public var lblKills:MovieClip;
public var toggleTacticalTipsButton:ButtonWithToolTip;// = null
public var lblDamage:MovieClip;
public var btnQuit:SimpleButton;
public var UpgradeStatsOverlay:MovieClip;
public var txtArtillery:TextField;
public var endGame_restartButton:ButtonWithToolTip;// = null
public var tower2Button:ButtonWithToolTip;// = null
public var nextWaveButton:ButtonWithToolTip;// = null
public var mcPersonalBest:MovieClip;
public var btnPause:SimpleButton;
public var btn_Artillery:SimpleButton;
public var endGame_buyButton:ButtonWithToolTip;// = null
public var btnNextWave:SimpleButton;
public var endGame_submitButton:ButtonWithToolTip;// = null
public var txtAirStrike:TextField;
public var gameAddMC:MovieClip;// = null
public var sellButton:ButtonWithToolTip;// = null
public var lblRange:MovieClip;
public var txtTowerDamage:TextField;
public var disableTacticalTipsButton:ButtonWithToolTip;// = null
public var lblUpgradeRange:MovieClip;
public var tower4Button:ButtonWithToolTip;// = null
private var windowLostFocusMessage:TextField;// = null
public var abilityAirStrikeButton:ButtonWithToolTip;// = null
public var btnStart:SimpleButton;
public var btn_AirStrike:SimpleButton;
public var mcGoldMedal:MovieClip;
public var txtWave:TextField;
public var tower1Button:ButtonWithToolTip;// = null
public var abilityArtilleryButton:ButtonWithToolTip;// = null
public var tiles:Tiles;
public var txtUpgradeTowerRof:TextField;
public var btn_EndGameBuy:SimpleButton;
public var txtTowerDescription:TextField;
public var btnTower2:SimpleButton;
public var btnTower3:SimpleButton;
public var btnSell:SimpleButton;
public var btnTower1:SimpleButton;
public var btnTower4:SimpleButton;
public var txtTowerKills:TextField;
public var txtTowerCost:TextField;
public var txtMines:TextField;
private static var key_m:uint = 77;
private static var key_n:uint = 78;
private static var key_a:uint = 65;
private static var key_1:uint = 49;
private static var key_2:uint = 50;
private static var key_s:uint = 83;
private static var key_4:uint = 52;
private static var key_u:uint = 85;
private static var key_escape:uint = 27;
private static var key_3:uint = 51;
private static var key_b:uint = 66;
public function ZombieDefense(){
var _local1:Number;
var _local2:Number;
var _local3:Timer;
gameAddMC = null;
tiles = new Tiles();
upgradeButton = null;
sellButton = null;
nextWaveButton = null;
tower1Button = null;
tower2Button = null;
tower3Button = null;
tower4Button = null;
abilityMinesButton = null;
abilityArtilleryButton = null;
abilityAirStrikeButton = null;
toggleTacticalTipsButton = null;
startButton = null;
restartButton = null;
quitButton = null;
pauseGameButton = null;
endGame_restartButton = null;
endGame_buyButton = null;
endGame_submitButton = null;
disableTacticalTipsButton = null;
bindKeyboardTimer = new Timer(300, 0);
windowLostFocusMessage = null;
super();
addFrameScript(0, frame1);
setupButtonsWithToolTips();
GameState.setupGame(this);
addEventListener(Event.ENTER_FRAME, _enterFrameListener);
mcLevelImage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseClicked);
slider_Volume.minimum = 0;
slider_Volume.maximum = 100;
slider_Volume.value = 100;
slider_Volume.addEventListener(SliderEvent.CHANGE, _onVolumeSliderChanged);
TacticalTipsHandler.window = GameState.mainObject.tacticalHelpWindow;
TacticalTipsHandler.dialog = GameState.mainObject.tacticalHelpWindow.testHelp;
TacticalTipsHandler.hideTacticalTipsWindow();
TacticalTipsHandler.showHelpDialog(TacticalTipsHandler.bulletImmuneEnemiesDialog);
toggleTacticalTipsButton.setClickCallBack(TacticalTipsHandler.hideTacticalTipsWindow);
bindKeyboardTimer.addEventListener(TimerEvent.TIMER, setupKeyboardListening);
bindKeyboardTimer.start();
_setupLostFocusMessage();
this.stage.addEventListener(Event.ACTIVATE, _activate);
this.stage.addEventListener(Event.DEACTIVATE, _deactivate);
_local1 = 10000;
_local2 = 1;
_local3 = new Timer(_local1, _local2);
_local3.addEventListener(TimerEvent.TIMER, _giveUserTowerPlacingHelp);
_local3.start();
_createGameAd();
}
public function setUpgradeTowerStats(_arg1:TowerDefinition){
if (_arg1 != null){
GameInterfaceHandler.toggleGuiComponentsForUpgradeTowerStats(true);
txtUpgradeTowerCost.text = _arg1.cost.toString();
txtUpgradeTowerDamage.text = _arg1.damageString;
txtUpgradeTowerRange.text = _arg1.rangeString;
txtUpgradeTowerRof.text = _arg1.rofString;
} else {
GameInterfaceHandler.toggleGuiComponentsForUpgradeTowerStats(false);
};
}
private function _deactivate(_arg1){
windowLostFocusMessage.visible = true;
}
public function cleanUpMovieClip(_arg1:MovieClip):void{
super.removeChild(_arg1);
}
private function _activate(_arg1){
windowLostFocusMessage.visible = false;
}
function frame1(){
stop();
}
public function setupButtonsWithToolTips():void{
upgradeButton = new ButtonWithToolTip(btnUpgrade);
upgradeButton.toolTipText = "Upgrade the selected Soldier";
upgradeButton.setText("Upgrade");
upgradeButton.setClickCallBack(GameState.upgradeCurrentTower);
btnUpgrade.visible = false;
addChild(upgradeButton);
sellButton = new ButtonWithToolTip(btnSell);
sellButton.toolTipText = "Sell the selected Soldier";
sellButton.setText("Sell");
sellButton.setClickCallBack(GameState.sellCurrentTower);
btnSell.visible = false;
addChild(sellButton);
nextWaveButton = new ButtonWithToolTip(btnNextWave);
nextWaveButton.toolTipText = "The next set of Zombies will enter the city";
nextWaveButton.setText("Next Wave");
nextWaveButton.setClickCallBack(GameState.nextWave);
btnNextWave.visible = false;
addChild(nextWaveButton);
tower4Button = new ButtonWithToolTip(btnTower4);
tower4Button.toolTipText = "Molotov Cocktail";
tower4Button.setImage(new image_molotovButton(0, 0));
tower4Button.setClickCallBack(GameState.selectTower4);
btnTower4.visible = false;
addChild(tower4Button);
tower3Button = new ButtonWithToolTip(btnTower3);
tower3Button.toolTipText = "Grenadier";
tower3Button.setImage(new image_grenaderButton(0, 0));
tower3Button.setClickCallBack(GameState.selectTower3);
btnTower3.visible = false;
addChild(tower3Button);
tower2Button = new ButtonWithToolTip(btnTower2);
tower2Button.toolTipText = "Rifleman";
tower2Button.setImage(new image_sniperButton(0, 0));
tower2Button.setClickCallBack(GameState.selectTower2);
btnTower2.visible = false;
addChild(tower2Button);
tower1Button = new ButtonWithToolTip(btnTower1);
tower1Button.toolTipText = "Machine Gunner";
tower1Button.setImage(new image_machineGunButton(0, 0));
tower1Button.setClickCallBack(GameState.selectTower1);
btnTower1.visible = false;
addChild(tower1Button);
abilityMinesButton = new ButtonWithToolTip(btn_Mines);
abilityMinesButton.toolTipText = "Select Combat Boost Ability";
abilityMinesButton.setImage(new image_combatStimButton(0, 0));
abilityMinesButton.setClickCallBack(GameState.selectCombatBoostAction);
btn_Mines.visible = false;
addChild(abilityMinesButton);
abilityArtilleryButton = new ButtonWithToolTip(btn_Artillery);
abilityArtilleryButton.toolTipText = "Select Razor Wire Ability";
abilityArtilleryButton.setImage(new image_razerWireButton(0, 0));
abilityArtilleryButton.setClickCallBack(GameState.selectArtilleryAction);
btn_Artillery.visible = false;
addChild(abilityArtilleryButton);
abilityAirStrikeButton = new ButtonWithToolTip(btn_AirStrike);
abilityAirStrikeButton.toolTipText = "Select Air Strike Ability";
abilityAirStrikeButton.setImage(new image_airStrikeButton(0, 0));
abilityAirStrikeButton.setClickCallBack(GameState.selectAirstrikeAction);
btn_AirStrike.visible = false;
addChild(abilityAirStrikeButton);
toggleTacticalTipsButton = new ButtonWithToolTip(tacticalHelpWindow.btn_ToggleTacticalTips);
toggleTacticalTipsButton.disableToolTips();
toggleTacticalTipsButton.setText("Close");
tacticalHelpWindow.btn_ToggleTacticalTips.visible = false;
tacticalHelpWindow.addChild(toggleTacticalTipsButton);
startButton = new ButtonWithToolTip(btnStart);
startButton.disableToolTips();
startButton.setText("Start", 24);
startButton.setClickCallBack(GameState.startGame);
btnStart.visible = false;
addChild(startButton);
restartButton = new ButtonWithToolTip(btnRestart);
restartButton.disableToolTips();
restartButton.setText("Reset", 24);
restartButton.setClickCallBack(GameState.resetGame);
btnRestart.visible = false;
addChild(restartButton);
pauseGameButton = new ButtonWithToolTip(btnPause);
pauseGameButton.disableToolTips();
pauseGameButton.setText("Pause", 16);
pauseGameButton.setClickCallBack(GameState.pauseGame);
btnPause.visible = false;
addChild(pauseGameButton);
quitButton = new ButtonWithToolTip(btnQuit);
quitButton.disableToolTips();
quitButton.setText("End Game", 16);
quitButton.setClickCallBack(GameState.userEndedTheGame);
btnQuit.visible = false;
addChild(quitButton);
endGame_restartButton = new ButtonWithToolTip(EndGameDialogInstance.btn_EndGameRestart);
endGame_restartButton.disableToolTips();
endGame_restartButton.setText("Play Again", 16);
endGame_restartButton.setClickCallBack(GameState.endGameRestart);
EndGameDialogInstance.btn_EndGameRestart.visible = false;
EndGameDialogInstance.addChild(endGame_restartButton);
endGame_buyButton = new ButtonWithToolTip(btn_EndGameBuy);
endGame_buyButton.disableToolTips();
endGame_buyButton.setText("Website", 16);
endGame_buyButton.setClickCallBack(GameState.endGameBuy);
btn_EndGameBuy.visible = false;
addChild(endGame_buyButton);
endGame_submitButton = new ButtonWithToolTip(EndGameDialogInstance.btn_EndGameSubmit);
endGame_submitButton.disableToolTips();
endGame_submitButton.setText("Submit Score", 16);
endGame_submitButton.setClickCallBack(GameState.submitScore);
EndGameDialogInstance.btn_EndGameSubmit.visible = false;
EndGameDialogInstance.addChild(endGame_submitButton);
disableTacticalTipsButton = new ButtonWithToolTip(tacticalHelpWindow.btn_disableTacticalTips);
disableTacticalTipsButton.disableToolTips();
disableTacticalTipsButton.setText("Don't show any more tips.", 16);
disableTacticalTipsButton.setClickCallBack(TacticalTipsHandler.turnOff);
tacticalHelpWindow.btn_disableTacticalTips.visible = false;
tacticalHelpWindow.addChild(disableTacticalTipsButton);
}
private function _giveUserTowerPlacingHelp(_arg1):void{
if (GameState.getTiles().getTowerCount() > 0){
return;
};
TacticalTipsHandler.requestTowerPlacementHelp();
}
public function setButtonsPreGameState():void{
startButton.visible = true;
restartButton.visible = false;
nextWaveButton.visible = false;
}
private function _onVolumeSliderChanged(_arg1){
GameState.volumeModifier = (slider_Volume.value / 100);
}
private function _setupLostFocusMessage():void{
var _local1:TextFormat;
windowLostFocusMessage = new TextField();
windowLostFocusMessage.background = true;
windowLostFocusMessage.textColor = Colors.black;
windowLostFocusMessage.backgroundColor = Colors.lightGrey;
windowLostFocusMessage.multiline = false;
windowLostFocusMessage.autoSize = TextFieldAutoSize.CENTER;
windowLostFocusMessage.visible = false;
windowLostFocusMessage.mouseEnabled = false;
windowLostFocusMessage.text = "The flash window has lost focus, The keyboard cannot be used.";
windowLostFocusMessage.x = (stage.width / 4);
windowLostFocusMessage.y = (stage.height / 2);
_local1 = new TextFormat();
_local1.font = "LucidaConsole";
_local1.color = Colors.black;
_local1.bold = true;
_local1.size = 18;
windowLostFocusMessage.setTextFormat(_local1);
addChild(windowLostFocusMessage);
}
public function resetTextFields(){
txtTowerCost.text = "";
txtTowerDamage.text = "";
txtTowerRange.text = "";
txtTowerKills.text = "";
txtUpgradeTowerCost.text = "";
txtUpgradeTowerDamage.text = "";
txtUpgradeTowerRange.text = "";
txtWave.text = "0";
txtLives.text = "0";
txtTimer.text = "0";
txtMoney.text = "0";
}
public function addMovieClip(_arg1:MovieClip):void{
super.addChild(_arg1);
}
public function setButtonsGamePlayingState():void{
startButton.visible = false;
restartButton.visible = true;
nextWaveButton.visible = true;
}
private function _onMouseClicked(_arg1){
GameState.mouseClicked(mouseX, mouseY);
}
private function _onKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case key_1:
GameState.selectTower1();
break;
case key_2:
GameState.selectTower2();
break;
case key_3:
GameState.selectTower3();
break;
case key_4:
GameState.selectTower4();
break;
case key_s:
GameState.sellCurrentTower();
break;
case key_u:
GameState.upgradeCurrentTower();
break;
case key_n:
GameState.nextWave();
break;
case key_a:
GameState.selectArtilleryAction();
break;
case key_b:
GameState.selectAirstrikeAction();
break;
case key_escape:
GameState.deselectTowerStamp();
break;
};
}
public function setupKeyboardListening(_arg1):void{
if (this.stage == null){
return;
};
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, _onKeyUp);
bindKeyboardTimer.stop();
}
private function _createGameAd():void{
var _local1:Bitmap;
var _local2:Number;
var _local3:ButtonWithToolTip;
var _local4:ButtonWithToolTip;
var _local5:String;
gameAddMC = new MovieClip();
addChild(gameAddMC);
_local1 = new Bitmap();
_local1.bitmapData = new advertisement(0, 0);
gameAddMC.addChild(_local1);
_local2 = 530;
_local3 = new ButtonWithToolTip(btnUpgrade);
_local3.disableToolTips();
_local3.buttonWidth = 200;
_local3.buttonHeight = 45;
_local3.width = 200;
_local3.height = 45;
_local3.x = 300;
_local3.y = _local2;
_local3.setupButtonIfNoReplacement();
_local3.setText("Buy the Game");
_local3.setClickCallBack(GameState.buyGame);
gameAddMC.addChild(_local3);
_local4 = new ButtonWithToolTip(btnUpgrade);
_local4.disableToolTips();
_local4.buttonWidth = 200;
_local4.buttonHeight = 45;
_local4.width = 200;
_local4.height = 45;
_local4.x = 550;
_local4.y = _local2;
_local4.setupButtonIfNoReplacement();
_local4.setText("No Thanks");
_local4.setClickCallBack(GameState.noThanks);
gameAddMC.addChild(_local4);
gameAddMC.visible = false;
UseabilityLogger.startHeartBeats();
_local5 = "dd953dbac135aca5";
}
private function _enterFrameListener(_arg1):void{
GameState.gameUpdateCycle(mouseX, mouseY);
}
public function getSpawnArea():MovieClip{
return (spawnArea);
}
}
}//package