Section 1
//assets_1 (BloodyEast_fla.assets_1)
package BloodyEast_fla {
import flash.display.*;
public dynamic class assets_1 extends MovieClip {
public function assets_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BloodyEast_fla
Section 2
//IndeterminateBar (fl.controls.progressBarClasses.IndeterminateBar)
package fl.controls.progressBarClasses {
import flash.display.*;
import flash.events.*;
import fl.core.*;
public class IndeterminateBar extends UIComponent {
protected var bar:Sprite;
protected var barMask:Sprite;
protected var patternBmp:BitmapData;
protected var animationCount:uint;// = 0
private static var defaultStyles:Object = {indeterminateSkin:"ProgressBar_indeterminateSkin"};
public function IndeterminateBar(){
animationCount = 0;
super();
setSize(0, 0);
startAnimation();
}
protected function drawBar():void{
var _local1:Graphics;
if (patternBmp == null){
return;
};
_local1 = bar.graphics;
_local1.clear();
_local1.beginBitmapFill(patternBmp);
_local1.drawRect(0, 0, (_width + patternBmp.width), _height);
_local1.endFill();
}
protected function drawMask():void{
var _local1:Graphics;
_local1 = barMask.graphics;
_local1.clear();
_local1.beginFill(0, 0);
_local1.drawRect(0, 0, _width, _height);
_local1.endFill();
}
override public function get visible():Boolean{
return (super.visible);
}
override public function set visible(_arg1:Boolean):void{
if (_arg1){
startAnimation();
} else {
stopAnimation();
};
super.visible = _arg1;
}
protected function startAnimation():void{
addEventListener(Event.ENTER_FRAME, handleEnterFrame, false, 0, true);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawPattern();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawBar();
drawMask();
};
super.draw();
}
override protected function configUI():void{
bar = new Sprite();
addChild(bar);
barMask = new Sprite();
addChild(barMask);
bar.mask = barMask;
}
protected function stopAnimation():void{
removeEventListener(Event.ENTER_FRAME, handleEnterFrame);
}
protected function drawPattern():void{
var _local1:DisplayObject;
_local1 = getDisplayObjectInstance(getStyleValue("indeterminateSkin"));
if (patternBmp){
patternBmp.dispose();
};
patternBmp = new BitmapData((_local1.width << 0), (_local1.height << 0), true, 0);
patternBmp.draw(_local1);
}
protected function handleEnterFrame(_arg1:Event):void{
if (patternBmp == null){
return;
};
animationCount = ((animationCount + 2) % patternBmp.width);
bar.x = -(animationCount);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.progressBarClasses
Section 3
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.events.*;
import flash.utils.*;
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 4
//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 5
//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 6
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
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 7
//ProgressBar (fl.controls.ProgressBar)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.controls.progressBarClasses.*;
public class ProgressBar extends UIComponent {
protected var _direction:String;// = "right"
protected var _mode:String;// = "event"
protected var _value:Number;// = 0
protected var _indeterminate:Boolean;// = true
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 0
protected var determinateBar:DisplayObject;
protected var _loaded:Number;
protected var _source:Object;
protected var track:DisplayObject;
protected var indeterminateBar:UIComponent;
private static var defaultStyles:Object = {trackSkin:"ProgressBar_trackSkin", barSkin:"ProgressBar_barSkin", indeterminateSkin:"ProgressBar_indeterminateSkin", indeterminateBar:IndeterminateBar, barPadding:0};
public function ProgressBar(){
_direction = ProgressBarDirection.RIGHT;
_indeterminate = true;
_mode = ProgressBarMode.EVENT;
_minimum = 0;
_maximum = 0;
_value = 0;
super();
}
public function get minimum():Number{
return (_minimum);
}
public function get source():Object{
return (_source);
}
public function set minimum(_arg1:Number):void{
if (_mode != ProgressBarMode.MANUAL){
return;
};
_minimum = _arg1;
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function drawBars():void{
var _local1:DisplayObject;
var _local2:DisplayObject;
_local1 = determinateBar;
_local2 = indeterminateBar;
determinateBar = getDisplayObjectInstance(getStyleValue("barSkin"));
addChild(determinateBar);
indeterminateBar = (getDisplayObjectInstance(getStyleValue("indeterminateBar")) as UIComponent);
indeterminateBar.setStyle("indeterminateSkin", getStyleValue("indeterminateSkin"));
addChild(indeterminateBar);
if (((!((_local1 == null))) && (!((_local1 == determinateBar))))){
removeChild(_local1);
};
if (((!((_local2 == null))) && (!((_local2 == determinateBar))))){
removeChild(_local2);
};
}
protected function setupSourceEvents():void{
_source.addEventListener(ProgressEvent.PROGRESS, handleProgress, false, 0, true);
_source.addEventListener(Event.COMPLETE, handleComplete, false, 0, true);
}
public function set maximum(_arg1:Number):void{
setProgress(_value, _arg1);
}
public function set source(_arg1:Object):void{
if (_source == _arg1){
return;
};
if (_mode != ProgressBarMode.MANUAL){
resetProgress();
};
_source = _arg1;
if (_source == null){
return;
};
if (_mode == ProgressBarMode.EVENT){
setupSourceEvents();
} else {
if (_mode == ProgressBarMode.POLLED){
addEventListener(Event.ENTER_FRAME, pollSource, false, 0, true);
};
};
}
protected function drawTrack():void{
var _local1:DisplayObject;
_local1 = track;
track = getDisplayObjectInstance(getStyleValue("trackSkin"));
addChildAt(track, 0);
if (((!((_local1 == null))) && (!((_local1 == track))))){
removeChild(_local1);
};
}
protected function handleProgress(_arg1:ProgressEvent):void{
_setProgress(_arg1.bytesLoaded, _arg1.bytesTotal, true);
}
public function set sourceName(_arg1:String):void{
var _local2:DisplayObject;
if (!componentInspectorSetting){
return;
};
if (_arg1 == ""){
return;
};
_local2 = (parent.getChildByName(_arg1) as DisplayObject);
if (_local2 == null){
throw (new Error((("Source clip '" + _arg1) + "' not found on parent.")));
};
source = _local2;
}
protected function resetProgress():void{
if ((((_mode == ProgressBarMode.EVENT)) && (!((_source == null))))){
cleanupSourceEvents();
} else {
if (_mode == ProgressBarMode.POLLED){
removeEventListener(Event.ENTER_FRAME, pollSource);
} else {
if (_source != null){
_source = null;
};
};
};
_minimum = (_maximum = (_value = 0));
}
public function get percentComplete():Number{
return (((((_maximum <= _minimum)) || ((_value <= _minimum)))) ? 0 : Math.max(0, Math.min(100, (((_value - _minimum) / (_maximum - _minimum)) * 100))));
}
public function setProgress(_arg1:Number, _arg2:Number):void{
if (_mode != ProgressBarMode.MANUAL){
return;
};
_setProgress(_arg1, _arg2);
}
protected function pollSource(_arg1:Event):void{
if (_source == null){
return;
};
_setProgress(_source.bytesLoaded, _source.bytesTotal, true);
if ((((_maximum > 0)) && ((_maximum == _value)))){
removeEventListener(Event.ENTER_FRAME, pollSource);
dispatchEvent(new Event(Event.COMPLETE));
};
}
public function get indeterminate():Boolean{
return (_indeterminate);
}
public function set value(_arg1:Number):void{
setProgress(_arg1, _maximum);
}
public function set direction(_arg1:String):void{
_direction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function _setProgress(_arg1:Number, _arg2:Number, _arg3:Boolean=false):void{
if ((((_arg1 == _value)) && ((_arg2 == _maximum)))){
return;
};
_value = _arg1;
_maximum = _arg2;
if (((!((_value == _loaded))) && (_arg3))){
dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, _value, _maximum));
_loaded = _value;
};
if (_mode != ProgressBarMode.MANUAL){
setIndeterminate((_arg2 == 0));
};
invalidate(InvalidationType.DATA);
}
public function set mode(_arg1:String):void{
if (_mode == _arg1){
return;
};
resetProgress();
_mode = _arg1;
if ((((_arg1 == ProgressBarMode.EVENT)) && (!((_source == null))))){
setupSourceEvents();
} else {
if (_arg1 == ProgressBarMode.POLLED){
addEventListener(Event.ENTER_FRAME, pollSource, false, 0, true);
};
};
setIndeterminate(!((_mode == ProgressBarMode.MANUAL)));
}
public function reset():void{
var _local1:Object;
_setProgress(0, 0);
_local1 = _source;
_source = null;
source = _local1;
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawTrack();
drawBars();
invalidate(InvalidationType.STATE, false);
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.STATE)){
indeterminateBar.visible = _indeterminate;
determinateBar.visible = !(_indeterminate);
invalidate(InvalidationType.DATA, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
invalidate(InvalidationType.DATA, false);
};
if (((isInvalid(InvalidationType.DATA)) && (!(_indeterminate)))){
drawDeterminateBar();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
}
protected function drawDeterminateBar():void{
var _local1:Number;
var _local2:Number;
_local1 = (percentComplete / 100);
_local2 = Number(getStyleValue("barPadding"));
determinateBar.width = Math.round(((width - (_local2 * 2)) * _local1));
determinateBar.x = ((_direction)==ProgressBarDirection.LEFT) ? ((width - _local2) - determinateBar.width) : _local2;
}
public function get value():Number{
return (_value);
}
public function set indeterminate(_arg1:Boolean):void{
if (((!((_mode == ProgressBarMode.MANUAL))) || ((_indeterminate == _arg1)))){
return;
};
setIndeterminate(_arg1);
}
protected function setIndeterminate(_arg1:Boolean):void{
if (_indeterminate == _arg1){
return;
};
_indeterminate = _arg1;
invalidate(InvalidationType.STATE);
}
protected function handleComplete(_arg1:Event):void{
_setProgress(_maximum, _maximum, true);
dispatchEvent(_arg1);
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("barPadding"));
track.width = width;
track.height = height;
indeterminateBar.setSize((width - (_local1 * 2)), (height - (_local1 * 2)));
indeterminateBar.move(_local1, _local1);
indeterminateBar.drawNow();
determinateBar.height = (height - (_local1 * 2));
determinateBar.y = _local1;
}
public function get direction():String{
return (_direction);
}
public function get mode():String{
return (_mode);
}
protected function cleanupSourceEvents():void{
_source.removeEventListener(ProgressEvent.PROGRESS, handleProgress);
_source.removeEventListener(Event.COMPLETE, handleComplete);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 8
//ProgressBarDirection (fl.controls.ProgressBarDirection)
package fl.controls {
public class ProgressBarDirection {
public static const RIGHT:String = "right";
public static const LEFT:String = "left";
}
}//package fl.controls
Section 9
//ProgressBarMode (fl.controls.ProgressBarMode)
package fl.controls {
public class ProgressBarMode {
public static const MANUAL:String = "manual";
public static const EVENT:String = "event";
public static const POLLED:String = "polled";
}
}//package fl.controls
Section 10
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
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 11
//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 12
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 13
//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 14
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.utils.*;
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 15
//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 16
//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 17
//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 18
//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 19
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.core.*;
import flash.text.*;
import flash.utils.*;
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 20
//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 21
//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 22
//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 23
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
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 24
//AnimatedSprite (AnimatedSprite)
package {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class AnimatedSprite {
public var bForward:Boolean;// = true
private var tmpString:String;
private var _H:int;
private var _hW;
private var _W;
private var _cachedBtm:Array;
public var _srcMc:MovieClip;
public var scl:Number;// = 1
public var _frm:int;// = 0
public var bLoop:Boolean;// = true
public var sclY:Number;// = 1
private var _hH;
public function AnimatedSprite(_arg1:String, _arg2:String, _arg3:int, _arg4:int){
var _local6:BitmapData;
_cachedBtm = new Array();
super();
tmpString = _arg1;
_hW = _arg3;
_hH = _arg4;
_W = (2 * _hW);
_H = (2 * _hH);
var _local5:Object = getDefinitionByName(_arg1);
_srcMc = new (_local5);
_srcMc.gotoAndStop(_arg2);
while (_srcMc.currentLabel != "stop") {
_local6 = new BitmapData(_W, _H, true, 0);
_local6.draw(_srcMc);
_cachedBtm[_cachedBtm.length] = _local6;
_srcMc.nextFrame();
};
}
public function drawAndPlay(_arg1:BitmapData, _arg2:Number, _arg3:Number){
if (_frm >= _cachedBtm.length){
if (bLoop){
_frm = 0;
} else {
_frm = (_cachedBtm.length - 1);
};
};
if (_frm < 0){
if (bLoop){
_frm = (_cachedBtm.length - 1);
} else {
_frm = 0;
};
};
var _local4:Matrix = new Matrix();
_local4.scale(scl, sclY);
if (scl == -1){
_local4.translate(((_arg2 - _hW) + _W), (_arg3 - _hH));
} else {
_local4.translate((_arg2 - _hW), (_arg3 - _hH));
};
_arg1.draw(_cachedBtm[_frm], _local4);
if (bForward){
_frm++;
} else {
_frm--;
};
}
public function drawFrame(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number){
var _local5:Matrix = new Matrix();
_local5.scale(scl, sclY);
if (scl == -1){
_local5.translate(((_arg3 - (_hW * scl)) + _W), (_arg4 - (_hH * sclY)));
} else {
_local5.translate((_arg3 - (_hW * scl)), (_arg4 - (_hH * sclY)));
};
_arg1.draw(_cachedBtm[_arg2], _local5);
}
public function drawVertical(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number){
var _local5:Matrix = new Matrix();
var _local6:int;
while (_local6 < _arg2) {
_local5.identity();
_local5.scale(scl, sclY);
if (scl == -1){
_local5.translate(((_arg3 - _hW) + _W), ((_arg4 - _hH) + (_local6 * _H)));
} else {
_local5.translate((_arg3 - _hW), ((_arg4 - _hH) + (_local6 * _H)));
};
_arg1.draw(_cachedBtm[_local6], _local5);
_local6++;
};
}
}
}//package
Section 25
//Building (Building)
package {
import flash.display.*;
import flash.geom.*;
public class Building {
private var _deadBuildingIdxs:Array;
private var _hW:int;
public var _blgBD:BitmapData;
public var _bd:BitmapData;
public var bDead:Boolean;// = false
private var _bkgSpd:Number;
private var i;
private var j;
public var _x;
public var _y:Number;
public var _idx:int;
public function Building(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:BitmapData){
_bd = _arg6;
_blgBD = _arg1;
_bkgSpd = Main._bkgSpd;
_idx = _arg2;
_hW = _arg3;
_deadBuildingIdxs = Main._deadBuildingIdxs;
reset(_arg4, _arg5);
}
public function draw(){
if (bDead){
return;
};
var _local1:Matrix = new Matrix();
_local1.translate((_x - _hW), (_y - _hW));
_bd.draw(_blgBD, _local1);
}
public function update(){
if (bDead){
return;
};
_y = (_y + _bkgSpd);
if ((_y >> 9) == 1){
bDead = true;
_deadBuildingIdxs.push(_idx);
};
}
public function reset(_arg1:Number, _arg2:Number){
bDead = false;
_x = _arg1;
_y = _arg2;
}
}
}//package
Section 26
//bush0 (bush0)
package {
import flash.display.*;
public dynamic class bush0 extends MovieClip {
}
}//package
Section 27
//bush1 (bush1)
package {
import flash.display.*;
public dynamic class bush1 extends MovieClip {
}
}//package
Section 28
//bush2 (bush2)
package {
import flash.display.*;
public dynamic class bush2 extends MovieClip {
}
}//package
Section 29
//bush3 (bush3)
package {
import flash.display.*;
public dynamic class bush3 extends MovieClip {
}
}//package
Section 30
//clutchSnd (clutchSnd)
package {
import flash.media.*;
public dynamic class clutchSnd extends Sound {
}
}//package
Section 31
//eliceMC (eliceMC)
package {
import flash.display.*;
public dynamic class eliceMC extends MovieClip {
}
}//package
Section 32
//Enemy (Enemy)
package {
import flash.display.*;
import flash.geom.*;
public class Enemy {
private var _player:Player;
public var _value:Number;
private var _lifeValueShape:Shape;
public var _x;
private var _lifeMax:int;
private var _reloadMax:Number;
private var plDX;
private var plDY;
public var _type:int;
private var _tankBulletAS:AnimatedSprite;
private var _asFrm:int;// = 1
private var _tankBloodAS:AnimatedSprite;
private var _bkgSpd;
private var zone:Zone;
private var _tangents:Array;
private var _zI;
private var _zJ:int;
private var _main:Main;
public var _radius:Number;
private var mtrx:Matrix;
private var _turretBloodAS:AnimatedSprite;
public var _aS:AnimatedSprite;
private var _rocketeerBloodAS:AnimatedSprite;
private var _reload;
private var _zones:Array;
private var _gunnerBulletAS:AnimatedSprite;
private var _rocketeerBulletAS:AnimatedSprite;
private var _deadEnemiesIdxs:Array;
private var _life:int;// = 100
private var _jeepBulletAS:AnimatedSprite;
private var plSX;
private var plSY:Number;
public var bDead:Boolean;// = false
private var _jeepBloodAS:AnimatedSprite;
private var _bd:BitmapData;
private var j:int;
public var _deadBullets:Array;
private var i;
public var _bullets:Array;
private var _deadEnemyBlood:Array;
private var _enemyBlood:Array;
public var _y:Number;
private var _turretBulletAS:AnimatedSprite;
public var _idx:int;
private var _gunnerBloodAS:AnimatedSprite;
private static var c:int;
public function Enemy(_arg1:AnimatedSprite, _arg2:Number, _arg3:int, _arg4:int, _arg5:int, _arg6:Number, _arg7:Number, _arg8:BitmapData){
_lifeValueShape = new Shape();
mtrx = new Matrix();
_enemyBlood = new Array();
_deadEnemyBlood = new Array();
super();
_bd = _arg8;
_aS = _arg1;
_bkgSpd = Main._bkgSpd;
_radius = _arg5;
_zones = Main._zones;
_idx = _arg4;
_deadEnemiesIdxs = Main._deadEnemiesIdxs;
_player = Main._player;
_tangents = Main._tangents;
_gunnerBulletAS = Main._gunnerBulletAS;
_jeepBulletAS = Main._jeepBulletAS;
_rocketeerBulletAS = Main._rocketeerBulletAS;
_tankBulletAS = Main._tankBulletAS;
_turretBulletAS = Main._turretBulletAS;
_bullets = Main._enemyBullets;
_deadBullets = Main._deadEnemyBullets;
_gunnerBloodAS = Main._gunnerBloodAS;
_jeepBloodAS = Main._jeepBloodAS;
_rocketeerBloodAS = Main._rocketeerBloodAS;
_tankBloodAS = Main._tankBloodAS;
_turretBloodAS = Main._turretBloodAS;
_enemyBlood = Main._enemyBlood;
_deadEnemyBlood = Main._deadEnemyBlood;
reset(_arg6, _arg7, _arg2, _arg3);
}
private function calculateRotation(){
var _local1:Number;
if (plDX < 20){
if (plSY == 1){
_asFrm = 1;
} else {
_asFrm = 13;
};
} else {
if (plDY < 20){
if (plSX == 1){
_asFrm = 7;
} else {
_asFrm = 19;
};
} else {
_local1 = (plDX / plDY);
i = 1;
while (i < 7) {
if ((((_local1 > _tangents[i])) && ((_local1 < _tangents[(i + 1)])))){
if ((((plSX == 1)) && ((plSY == 1)))){
_asFrm = i;
break;
} else {
if ((((plSX == 1)) && ((plSY == -1)))){
_asFrm = (6 + i);
break;
} else {
if ((((plSX == -1)) && ((plSY == -1)))){
_asFrm = (12 + i);
break;
} else {
if ((((plSX == -1)) && ((plSY == 1)))){
_asFrm = (18 + i);
break;
};
};
};
};
};
i++;
};
};
};
}
private function die(){
var _local1:AnimatedSprite;
var _local2:EnemyBlood;
var _local3:int;
bDead = true;
removeFromOldZone();
_deadEnemiesIdxs.push(_idx);
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
_player._score = (_player._score + _value);
};
if (_type == 5){
_local1 = _gunnerBloodAS;
} else {
if (_type == 7){
_local1 = _jeepBloodAS;
} else {
if (_type == 6){
_local1 = _rocketeerBloodAS;
} else {
if (_type == 8){
_local1 = _tankBloodAS;
} else {
if (_type == 9){
_local1 = _turretBloodAS;
};
};
};
};
};
if (_deadEnemyBlood.length > 0){
_local2 = _enemyBlood[_deadEnemyBlood.pop()];
_local2._aS = _local1;
_local2.reset(_x, _y);
} else {
_local3 = _enemyBlood.length;
_local2 = new EnemyBlood(_local1, _local3, 25, _x, _y, _bd);
_enemyBlood[_local3] = _local2;
};
}
private function createNewRocket(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Number;
var _local6:EnemyBullet;
var _local7:Number;
var _local8:AnimatedSprite;
_local4 = 1;
_local5 = 1;
_local1 = (_player._x - _x);
_local2 = ((_player._y - (50 * _bkgSpd)) - _y);
if (_local1 < 0){
_local4 = -1;
_local1 = -(_local1);
};
if (_local2 < 0){
_local5 = -1;
_local2 = -(_local2);
};
if (_local2 != 0){
_local3 = (_local1 / _local2);
} else {
_local3 = Number.MAX_VALUE;
};
if (_type == 5){
_local8 = _gunnerBulletAS;
_local7 = 3;
} else {
if (_type == 6){
_local8 = _jeepBulletAS;
_local7 = 5;
} else {
if (_type == 7){
_local8 = _rocketeerBulletAS;
_local7 = 8;
} else {
if (_type == 8){
_local8 = _tankBulletAS;
_local7 = 11;
} else {
if (_type == 9){
_local8 = _turretBulletAS;
_local7 = 14;
};
};
};
};
};
if (_deadBullets.length > 0){
_local6 = _bullets[_deadBullets.pop()];
_local6.reset(_x, _y, _local7, _local3, _local4, _local5, _type);
_local6.aS = _local8;
} else {
_local6 = new EnemyBullet(_local8, _bullets.length, 12.5, _x, _y, _local7, _bd, _local3, _local4, _local5, _type);
_bullets[_bullets.length] = _local6;
};
}
private function removeFromOldZone(){
var _local1:*;
if (_zI == int.MAX_VALUE){
return;
};
zone = _zones[_zI][_zJ];
for (_local1 in zone._enemies) {
if (_local1 == _idx){
delete zone._enemies[_local1];
};
};
}
public function draw(){
if (bDead){
return;
};
_aS.drawFrame(_bd, (_asFrm - 1), _x, _y);
_lifeValueShape.graphics.clear();
_lifeValueShape.graphics.lineStyle(2, 0xFF0000, 1, false, "normal", CapsStyle.NONE);
_lifeValueShape.graphics.moveTo(-16, -20);
_lifeValueShape.graphics.lineTo((-16 + ((_life / _lifeMax) * 32)), -20);
mtrx.identity();
mtrx.translate(_x, _y);
_bd.draw(_lifeValueShape, mtrx);
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){
_type = _arg4;
if (_type == 5){
_reloadMax = 30;
_lifeMax = 100;
_life = _lifeMax;
};
if (_type == 7){
_reloadMax = 35;
_lifeMax = 245;
_life = _lifeMax;
};
if (_type == 6){
_reloadMax = 40;
_lifeMax = 100;
_life = _lifeMax;
};
if (_type == 8){
_reloadMax = 50;
_lifeMax = 475;
_life = _lifeMax;
};
if (_type == 9){
_reloadMax = 55;
_lifeMax = 625;
_life = _lifeMax;
};
bDead = false;
_value = _arg3;
_x = _arg1;
_y = _arg2;
_reload = 0;
_zI = int.MAX_VALUE;
_zJ = int.MAX_VALUE;
}
public function damage(_arg1:int){
_reloadMax = (_reloadMax + Math.abs(((_arg1 / _life) * 15)));
_life = (_life - _arg1);
if ((((_life <= 0)) && ((bDead == false)))){
die();
};
}
public function update(){
var _local1:*;
var _local2:int;
if (bDead){
return;
};
_y = (_y + _bkgSpd);
plSX = 1;
plSY = 1;
plDX = (_player._x - _x);
plDY = (_player._y - _y);
if (plDX < 0){
plDX = -(plDX);
plSX = -1;
};
if (plDY < 0){
plDY = -(plDY);
plSY = -1;
};
_asFrm = 1;
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
calculateRotation();
if (_type > 4){
_reload--;
if (_reload <= 0){
_reload = _reloadMax;
createNewRocket();
};
};
};
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
_local1 = (_x >> 6);
_local2 = (_y >> 6);
if (((!((_local1 == _zI))) || (!((_local2 == _zJ))))){
if (_zI != int.MAX_VALUE){
removeFromOldZone();
};
_zI = _local1;
_zJ = _local2;
zone = _zones[_zI][_zJ];
zone._enemies[String(_idx)] = _idx;
};
} else {
if ((_y >> 9) == 1){
die();
};
};
}
}
}//package
Section 33
//EnemyBlood (EnemyBlood)
package {
import flash.display.*;
import flash.utils.*;
public class EnemyBlood {
private var _bd:BitmapData;
public var bDead:Boolean;
private var _bkgSpd:Number;
private var _frm;
public var _radius:Number;
private var _deadEnemyBlood:Array;
public var _aS:AnimatedSprite;
public var _x;
public var _y;
private var _idx:int;
public function EnemyBlood(_arg1:AnimatedSprite, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:BitmapData){
_aS = _arg1;
reset(_arg4, _arg5);
_radius = _arg3;
_idx = _arg2;
_bd = _arg6;
_bkgSpd = Main._bkgSpd;
_deadEnemyBlood = Main._deadEnemyBlood;
}
public function die(){
bDead = true;
_deadEnemyBlood[_deadEnemyBlood.length] = _idx;
}
public function draw(){
if (bDead){
return;
};
_aS.drawFrame(_bd, 0, _x, _y);
}
public function reset(_arg1:Number, _arg2:Number){
_frm = 0;
bDead = false;
_x = _arg1;
_y = _arg2;
}
public function update(){
if (bDead){
return;
};
_y = (_y + _bkgSpd);
if ((_y >> 9) == 1){
die();
};
}
}
}//package
Section 34
//EnemyBullet (EnemyBullet)
package {
import flash.display.*;
import flash.utils.*;
public class EnemyBullet {
private var _frm;
private var _power:Number;
private var _player:Player;
private var _zones:Array;
public var aS:AnimatedSprite;
private var _explosions:Array;
private var _p1;
private var _bd:BitmapData;
private var _bkgSpd:Number;
private var zone:Zone;
public var bDead:Boolean;
private var _zI;
public var _radius:Number;
private var _dx;
private var _deadBullets:Array;
private var _zJ;
private var _spd;
private var _p;
public var _x;
public var _y;
private var _dy:Number;
private var _idx:int;
public function EnemyBullet(_arg1:AnimatedSprite, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:BitmapData, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:int){
aS = _arg1;
reset(_arg4, _arg5, _arg6, _arg8, _arg9, _arg10, _arg11);
_idx = _arg2;
_radius = _arg3;
_bd = _arg7;
_bkgSpd = Main._bkgSpd;
_zones = Main._zones;
_explosions = Main._player._explosions;
_deadBullets = Main._deadEnemyBullets;
_player = Main._player;
reset(_arg4, _arg5, _arg6, _arg8, _arg9, _arg10, _arg11);
}
private function removeFromOldZone(){
var _local1:*;
zone = _zones[_zI][_zJ];
for (_local1 in zone._enemyBullets) {
if (_local1 == _idx){
delete zone._enemyBullets[_local1];
};
};
}
public function update(){
var _local1:*;
var _local2:int;
if (bDead){
return;
};
_y = (_y + _bkgSpd);
_x = (_x + _dx);
_y = (_y + _dy);
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
_local1 = (_x >> 6);
_local2 = (_y >> 6);
if (((!((_local1 == _zI))) || (!((_local2 == _zJ))))){
if (_zI != int.MAX_VALUE){
removeFromOldZone();
};
_zI = _local1;
_zJ = _local2;
zone = _zones[_zI][_zJ];
zone._enemyBullets[String(_idx)] = _idx;
};
} else {
die();
};
}
public function die(){
var _local1:Explosion;
bDead = true;
if (_zI != int.MAX_VALUE){
removeFromOldZone();
_zI = int.MAX_VALUE;
_zJ = int.MAX_VALUE;
};
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
_deadBullets[_deadBullets.length] = _idx;
_local1 = new Explosion();
_local1._x = _x;
_local1._y = _y;
_local1._scl = (_power / 50);
_local1._frm = 1;
_explosions[_explosions.length] = _local1;
_player.damage(_power);
};
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:int){
_frm = 0;
bDead = false;
_power = _arg3;
_zI = int.MAX_VALUE;
_zJ = int.MAX_VALUE;
_x = _arg1;
_y = _arg2;
_p = _arg4;
_p1 = (_p + 1);
_dx = (((_arg5 * _p) * _spd) / _p1);
_dy = ((_arg6 * _spd) / _p1);
if (_arg7 == 5){
_spd = 6;
_x = (_x + (2 * _dx));
_y = (_y + (2 * _dy));
} else {
if (_arg7 == 7){
_spd = 5.9;
_x = (_x + (2 * _dx));
_y = (_y + (2 * _dy));
} else {
if (_arg7 == 6){
_spd = 5.4;
_x = (_x + (2 * _dx));
_y = (_y + (2 * _dy));
} else {
if (_arg7 == 8){
_spd = 4.9;
_x = (_x + (11 * _dx));
_y = (_y + (11 * _dy));
} else {
if (_arg7 == 9){
_spd = 4.7;
_x = (_x + (9 * _dx));
_y = (_y + (9 * _dy));
};
};
};
};
};
}
public function draw(){
if (bDead){
return;
};
_frm++;
if (_frm > 9){
_frm = 0;
};
aS.drawFrame(_bd, _frm, _x, _y);
}
}
}//package
Section 35
//Explosion (Explosion)
package {
public class Explosion {
public var _x;
public var _y:Number;
public var _scl:Number;
public var _frm:int;
}
}//package
Section 36
//explosionMC (explosionMC)
package {
import flash.display.*;
public dynamic class explosionMC extends MovieClip {
}
}//package
Section 37
//finalScoreMC (finalScoreMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class finalScoreMC extends MovieClip {
public var score:TextField;
public var replay:SimpleButton;
}
}//package
Section 38
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 39
//FrameTimer (FrameTimer)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
public class FrameTimer {
private var messageTextField:TextField;
public var messagePoint:Point;
public var messageRect:Rectangle;
private var messageText:String;
public var frameTimer:Timer;
public var canvasBD:BitmapData;
private var messageBitmapData:BitmapData;
public var parent:MovieClip;
public var framesCounted:int;// = 0
public var x:int;
public var y:int;
private var format:TextFormat;
public function FrameTimer(_arg1:MovieClip, _arg2:int, _arg3:int, _arg4:BitmapData):void{
format = new TextFormat();
messageTextField = new TextField();
super();
x = _arg2;
y = _arg3;
canvasBD = _arg4;
format.size = 12;
format.font = "Arial";
format.color = "0xffffff";
format.bold = true;
messageText = "0";
messageTextField.text = messageText;
messageTextField.setTextFormat(format);
messageTextField.width = 40;
messageTextField.height = 20;
messageBitmapData = new BitmapData(messageTextField.width, messageTextField.height, true, 4294901760);
parent = _arg1;
frameTimer = new Timer(1000, 0);
frameTimer.addEventListener(TimerEvent.TIMER, frameCounter, false, 0, true);
frameTimer.start();
messagePoint = new Point(x, y);
messageRect = new Rectangle(0, 0, messageTextField.width, messageTextField.height);
}
function frameCounter(_arg1:TimerEvent):void{
messageText = framesCounted.toString();
messageTextField.text = ("fps:" + messageText);
framesCounted = 0;
}
function countFrames():void{
framesCounted++;
}
function render():void{
format.size = 12;
format.font = "Arial";
format.color = "0xffffff";
format.bold = true;
messageTextField.setTextFormat(format);
messageBitmapData.fillRect(messageRect, 4294901760);
messageBitmapData.draw(messageTextField);
canvasBD.copyPixels(messageBitmapData, messageRect, messagePoint);
}
}
}//package
Section 40
//gunner0 (gunner0)
package {
import flash.display.*;
public dynamic class gunner0 extends MovieClip {
}
}//package
Section 41
//gunner1 (gunner1)
package {
import flash.display.*;
public dynamic class gunner1 extends MovieClip {
}
}//package
Section 42
//gunner2 (gunner2)
package {
import flash.display.*;
public dynamic class gunner2 extends MovieClip {
}
}//package
Section 43
//gunner3 (gunner3)
package {
import flash.display.*;
public dynamic class gunner3 extends MovieClip {
}
}//package
Section 44
//gunnerBloodMC (gunnerBloodMC)
package {
import flash.display.*;
public dynamic class gunnerBloodMC extends MovieClip {
}
}//package
Section 45
//gunnerBulletMC (gunnerBulletMC)
package {
import flash.display.*;
public dynamic class gunnerBulletMC extends MovieClip {
}
}//package
Section 46
//helipadMC (helipadMC)
package {
import flash.display.*;
public dynamic class helipadMC extends MovieClip {
}
}//package
Section 47
//houseOne0 (houseOne0)
package {
import flash.display.*;
public dynamic class houseOne0 extends MovieClip {
}
}//package
Section 48
//houseOne1 (houseOne1)
package {
import flash.display.*;
public dynamic class houseOne1 extends MovieClip {
}
}//package
Section 49
//houseOne2 (houseOne2)
package {
import flash.display.*;
public dynamic class houseOne2 extends MovieClip {
}
}//package
Section 50
//houseOne3 (houseOne3)
package {
import flash.display.*;
public dynamic class houseOne3 extends MovieClip {
}
}//package
Section 51
//houseThree0 (houseThree0)
package {
import flash.display.*;
public dynamic class houseThree0 extends MovieClip {
}
}//package
Section 52
//houseThree1 (houseThree1)
package {
import flash.display.*;
public dynamic class houseThree1 extends MovieClip {
}
}//package
Section 53
//houseThree2 (houseThree2)
package {
import flash.display.*;
public dynamic class houseThree2 extends MovieClip {
}
}//package
Section 54
//houseThree3 (houseThree3)
package {
import flash.display.*;
public dynamic class houseThree3 extends MovieClip {
}
}//package
Section 55
//houseTwo0 (houseTwo0)
package {
import flash.display.*;
public dynamic class houseTwo0 extends MovieClip {
}
}//package
Section 56
//houseTwo1 (houseTwo1)
package {
import flash.display.*;
public dynamic class houseTwo1 extends MovieClip {
}
}//package
Section 57
//houseTwo2 (houseTwo2)
package {
import flash.display.*;
public dynamic class houseTwo2 extends MovieClip {
}
}//package
Section 58
//houseTwo3 (houseTwo3)
package {
import flash.display.*;
public dynamic class houseTwo3 extends MovieClip {
}
}//package
Section 59
//jeep0 (jeep0)
package {
import flash.display.*;
public dynamic class jeep0 extends MovieClip {
}
}//package
Section 60
//jeep1 (jeep1)
package {
import flash.display.*;
public dynamic class jeep1 extends MovieClip {
}
}//package
Section 61
//jeep2 (jeep2)
package {
import flash.display.*;
public dynamic class jeep2 extends MovieClip {
}
}//package
Section 62
//jeep3 (jeep3)
package {
import flash.display.*;
public dynamic class jeep3 extends MovieClip {
}
}//package
Section 63
//jeepBloodMC (jeepBloodMC)
package {
import flash.display.*;
public dynamic class jeepBloodMC extends MovieClip {
}
}//package
Section 64
//jeepBulletMC (jeepBulletMC)
package {
import flash.display.*;
public dynamic class jeepBulletMC extends MovieClip {
}
}//package
Section 65
//LifeMC (LifeMC)
package {
import flash.display.*;
public dynamic class LifeMC extends MovieClip {
}
}//package
Section 66
//lockedMC (lockedMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class lockedMC extends MovieClip {
public var domeniu:TextField;
}
}//package
Section 67
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
public dynamic class Main extends MovieClip {
private const PERIOD:int = 25;
private var _lifeValueShape:Shape;
private var zI;
private var zJ:int;
private var _lastMouseX:Number;// = 0
private var _lastMouseY:Number;// = 0
private var _fps:FrameTimer;
public var clutch:clutchSnd;
private var upgradeStraight:Number;
private var _overUpdateTime:int;// = 0
private var _levelStartTime:int;// = 0
private var spaceMoved:Number;
private var _afterTime:int;// = 0
private var buildingPercentsSum:Number;
private var _lifeAS:AnimatedSprite;
private var unitStrings:Array;
public var menu:menuMC;
private var _heliY:Number;
public var st:soundtrack;
private var _pauseTime:int;// = 0
private var _heliX;
private var i;
private var j:int;
private var startMask:startMaskMC;
private var unitPercents:Array;
private var _mouseY:Number;// = 0
private var unitPercentsSum:Number;
private var lastRx:Number;// = 0
private var lastRy:Number;// = 0
private var _bkg:ScrollDownBackground;
private var _mouseX:Number;// = 0
private var stChn:SoundChannel;
private var _beforeTime:int;// = 0
private var upgradeTotal:Number;
private var enemySpacing:Number;
private var _btm:Bitmap;
private var _helpTF:TextField;
private var bMouseDown:Boolean;// = false
private var _bombsCntTF:TextField;
private var _excess:int;// = 0
private var bMute:Boolean;// = false
public var bPause:Boolean;// = false
private var upgradeMachineGun:Number;
private var _levelTF:TextField;
public var finalScore:finalScoreMC;
private var _rocketsCntTF:TextField;
private var random:Random;
private var zone:Zone;
private var _sleepTime:int;// = 0
private var unitValues:Array;
private var _scoreCntTF:TextField;
private var _timeDiff:int;// = 0
private var _lastWheelTime:int;// = 0
public var _nLevel:int;// = 1
public var upgrades:upgradesMC;
private var _helipad:AnimatedSprite;
private var enemyHalf:Number;// = 0
private var _mouseRct:BitmapData;
private var upgradeBomb:Number;
private var _bd:BitmapData;
private var lastEnemyHalf:Number;// = 0
private var enemySpaces:Number;
private var _gameTimer:Timer;
private var _levelTime:int;// = 0
private var txtFmt:TextFormat;
public static var _player:Player;
public static var _deadBuildingIdxs:Array = new Array();
public static var _unitsASs:Array = new Array();
public static var _tankBulletAS:AnimatedSprite;
public static var _tankBloodAS:AnimatedSprite;
public static var _bkgSpd:Number;
public static var _turretBloodAS:AnimatedSprite;
public static var _tangents:Array = new Array();
public static var _rocketeerBloodAS:AnimatedSprite;
public static var _buildings:Array = new Array();
public static var _zones:Array;
public static var _stgX;
public static var _stgY:int;
public static var _rocketeerBulletAS:AnimatedSprite;
public static var _bLevelOver:Boolean;
public static var _deadEnemiesIdxs:Array = new Array();
public static var _gunnerBulletAS:AnimatedSprite;
public static var _jeepBulletAS:AnimatedSprite;
public static var _gunnerBloodAS:AnimatedSprite;
public static var _turretBulletAS:AnimatedSprite;
public static var _enemies:Array = new Array();
public static var _enemyBullets:Array = new Array();
private static var c:int;
public static var _deadEnemyBullets:Array = new Array();
public static var _jeepBloodAS:AnimatedSprite;
public static var _enemyBlood:Array = new Array();
public static var _deadEnemyBlood:Array = new Array();
public static var _buildingBDs:Array = new Array();
public function Main(){
menu = new menuMC();
finalScore = new finalScoreMC();
upgrades = new upgradesMC();
unitPercents = new Array();
unitValues = new Array();
unitStrings = new Array();
_rocketsCntTF = new TextField();
_bombsCntTF = new TextField();
_scoreCntTF = new TextField();
_helpTF = new TextField();
_levelTF = new TextField();
txtFmt = new TextFormat();
_lifeValueShape = new Shape();
super();
addFrameScript(0, frame1, 2, frame3);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
trace("main construct");
stage.addEventListener(Event.ENTER_FRAME, runInit);
}
private function onDownMouse(_arg1:MouseEvent){
bMouseDown = true;
}
private function onStraightChange(_arg1:SliderEvent){
var _local3:Number;
var _local2:Number = ((upgrades.straight.value + upgrades.bomb.value) + upgrades.machineGun.value);
if (_local2 > upgradeTotal){
_local3 = ((_local2 - upgradeTotal) / 2);
upgrades.bomb.value = (upgrades.bomb.value - _local3);
upgrades.machineGun.value = (upgrades.machineGun.value - _local3);
};
}
private function onUpMouse(_arg1:MouseEvent){
bMouseDown = false;
}
private function runGame(_arg1:TimerEvent){
_beforeTime = getTimer();
_overUpdateTime = ((_beforeTime - _afterTime) - _sleepTime);
update();
draw();
_afterTime = getTimer();
_timeDiff = (_afterTime - _beforeTime);
_sleepTime = ((PERIOD - _timeDiff) - _overUpdateTime);
if (_sleepTime <= 0){
_excess = (_excess - _sleepTime);
_sleepTime = 2;
};
_gameTimer.delay = _sleepTime;
while (_excess > PERIOD) {
update();
_excess = (_excess - PERIOD);
};
_fps.countFrames();
_fps.render();
}
private function updateEnemies(){
var _local1:Enemy;
var _local2:Building;
var _local3:*;
var _local4:*;
var _local5:Number;
var _local6:String;
var _local7:*;
var _local8:Number;
var _local9:int;
var _local10:*;
var _local11:int;
var _local12:int;
spaceMoved = (spaceMoved + _bkgSpd);
i = 0;
while (i < _enemies.length) {
_enemies[i].update();
i++;
};
i = 0;
while (i < _buildings.length) {
_buildings[i].update();
i++;
};
if (_bLevelOver){
return;
};
if (spaceMoved > enemySpacing){
spaceMoved = 0;
i = 0;
while (i < enemySpaces) {
_local7 = (random.get() * unitPercentsSum);
_local8 = 0;
j = 0;
while (j < unitPercents.length) {
_local9 = (_local3 >> 7);
_local10 = ((j * 4) + _local9);
_local8 = (_local8 + unitPercents[j]);
if (_local10 < 28){
enemyHalf = 25;
} else {
enemyHalf = 50;
};
if (i == 0){
lastRx = 0;
};
_local5 = (random.get() * enemySpacing);
if (_local5 < enemyHalf){
_local5 = enemyHalf;
};
if ((lastRx > (enemySpacing - lastEnemyHalf))){
_local5 = (((lastRx + lastEnemyHalf) - enemySpacing) + enemyHalf);
};
lastRx = _local5;
lastEnemyHalf = enemyHalf;
_local3 = ((i * enemySpacing) + _local5);
if (_local3 < enemyHalf){
_local3 = enemyHalf;
};
_local4 = (-(random.get()) * enemySpacing);
if (_local4 > -50){
_local4 = -50;
};
if (_local4 < (-(enemySpacing) + 50)){
_local4 = (-(enemySpacing) + 50);
};
if (_local7 < _local8){
_local6 = (unitStrings[j] + String(_local9));
if (_local7 < buildingPercentsSum){
if (_deadBuildingIdxs.length > 0){
_local2 = _buildings[_deadBuildingIdxs.pop()];
_local2._blgBD = _buildingBDs[((j * 4) + _local9)];
_local2.reset(_local3, _local4);
} else {
_local12 = _buildings.length;
_local2 = new Building(_buildingBDs[((j * 4) + _local9)], _local12, 25, _local3, _local4, _bd);
_buildings[_local12] = _local2;
};
} else {
if (_deadEnemiesIdxs.length > 0){
_local11 = _deadEnemiesIdxs.pop();
_local1 = _enemies[_local11];
_local1.reset(_local3, _local4, unitValues[j], j);
_local1._type = j;
_local1._aS = _unitsASs[_local10];
} else {
_local11 = _enemies.length;
_local1 = new Enemy(_unitsASs[_local10], unitValues[j], j, _local11, enemyHalf, _local3, _local4, _bd);
_enemies[_local11] = _local1;
};
};
break;
};
j++;
};
i++;
};
};
}
private function onBombChange(_arg1:SliderEvent){
var _local3:Number;
var _local2:Number = ((upgrades.straight.value + upgrades.bomb.value) + upgrades.machineGun.value);
if (_local2 > upgradeTotal){
_local3 = ((_local2 - upgradeTotal) / 2);
upgrades.straight.value = (upgrades.straight.value - (_local2 - upgradeTotal));
upgrades.machineGun.value = (upgrades.machineGun.value - _local3);
};
}
public function init(){
var _local3:AnimatedSprite;
var _local4:Object;
var _local5:*;
trace("init");
random = new Random();
i = 1;
while (i < 7) {
_tangents[i] = Math.tan(((i - 1) * 15));
i++;
};
_tangents[7] = Number.MAX_VALUE;
_bkgSpd = 1;
_bkg = new ScrollDownBackground("sandMC");
_stgX = 0x0200;
_stgY = 450;
_helpTF.width = 400;
_levelTF.width = 100;
_levelTF.text = ("Level " + String(_nLevel));
_bd = new BitmapData(_stgX, _stgY, true, 0);
_btm = new Bitmap(_bd);
var _local1:MovieClip = new MovieClip();
_local1.graphics.beginFill(0xFFFFFF);
_local1.graphics.drawRect(0, 0, 4, 4);
_mouseRct = new BitmapData(4, 4);
_mouseRct.draw(_local1);
var _local2 = 8;
_zones = new Array(_local2);
i = 0;
while (i < _local2) {
_zones[i] = new Array(_local2);
i++;
};
i = 0;
while (i < _local2) {
j = 0;
while (j < _local2) {
_zones[i][j] = new Zone(i, j, _local2);
j++;
};
i++;
};
addChild(_btm);
addChild(menu);
addChild(finalScore);
addChild(upgrades);
_player = new Player((_stgX / 2), (_stgY - 100), _bd, getTimer(), this);
finalScore.visible = false;
upgrades.visible = false;
upgrades.straight.liveDragging = true;
upgrades.straight.snapInterval = 0.001;
upgrades.straight.minimum = 0;
upgrades.straight.addEventListener(SliderEvent.CHANGE, onStraightChange);
upgrades.bomb.liveDragging = true;
upgrades.bomb.snapInterval = 0.001;
upgrades.bomb.minimum = 0;
upgrades.bomb.addEventListener(SliderEvent.CHANGE, onBombChange);
upgrades.machineGun.liveDragging = true;
upgrades.machineGun.snapInterval = 0.001;
upgrades.machineGun.minimum = 0;
upgrades.machineGun.addEventListener(SliderEvent.CHANGE, onMachineGunChange);
unitStrings[0] = "houseOne";
unitStrings[1] = "houseTwo";
unitStrings[2] = "houseThree";
unitStrings[3] = "tree";
unitStrings[4] = "bush";
unitStrings[5] = "gunner";
unitStrings[7] = "jeep";
unitStrings[6] = "rocketeer";
unitStrings[8] = "tank";
unitStrings[9] = "turret";
trace("cc");
i = 0;
while (i < 5) {
j = 0;
while (j < 4) {
_local4 = getDefinitionByName((unitStrings[i] + String(j)));
_local5 = new (_local4);
_buildingBDs[((i * 4) + j)] = new BitmapData(50, 50, true, 0);
_buildingBDs[((i * 4) + j)].draw(_local5);
j++;
};
i++;
};
i = 5;
while (i < 10) {
j = 0;
while (j < 4) {
if (i < 7){
_local3 = new AnimatedSprite((unitStrings[i] + String(j)), "start", 25, 25);
} else {
_local3 = new AnimatedSprite((unitStrings[i] + String(j)), "start", 50, 50);
};
_unitsASs[((i * 4) + j)] = _local3;
j++;
};
i++;
};
_gunnerBulletAS = new AnimatedSprite("gunnerBulletMC", "start", 5, 5);
_jeepBulletAS = new AnimatedSprite("jeepBulletMC", "start", 5, 5);
_rocketeerBulletAS = new AnimatedSprite("rocketeerBulletMC", "start", 5, 5);
_tankBulletAS = new AnimatedSprite("tankBulletMC", "start", 5, 5);
_turretBulletAS = new AnimatedSprite("turretBulletMC", "start", 5, 5);
_gunnerBloodAS = new AnimatedSprite("gunnerBloodMC", "start", 25, 25);
_jeepBloodAS = new AnimatedSprite("jeepBloodMC", "start", 50, 50);
_rocketeerBloodAS = new AnimatedSprite("rocketeerBloodMC", "start", 25, 25);
_tankBloodAS = new AnimatedSprite("tankBloodMC", "start", 50, 50);
_turretBloodAS = new AnimatedSprite("turretBloodMC", "start", 50, 50);
_lifeAS = new AnimatedSprite("LifeMC", "start", 10, 100);
_helipad = new AnimatedSprite("helipadMC", "start", 0x0100, 75);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMoveMouse);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDownMouse);
stage.addEventListener(MouseEvent.MOUSE_UP, onUpMouse);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onDownKey);
_gameTimer = new Timer(PERIOD);
_gameTimer.addEventListener(TimerEvent.TIMER, runGame);
_fps = new FrameTimer(this, 0, 0, _bd);
menu.startBtnHard.addEventListener(MouseEvent.CLICK, onStartHard);
finalScore.replay.addEventListener(MouseEvent.CLICK, onReplay);
upgrades.nextBtn.addEventListener(MouseEvent.CLICK, onNextLevel);
txtFmt.align = TextFormatAlign.RIGHT;
txtFmt.color = 14877186;
txtFmt.size = 14;
txtFmt.bold = true;
txtFmt.font = "Bookman Old Style";
_rocketsCntTF.defaultTextFormat = txtFmt;
_bombsCntTF.defaultTextFormat = txtFmt;
txtFmt.align = TextFormatAlign.LEFT;
txtFmt.color = 14877186;
txtFmt.size = 24;
txtFmt.bold = false;
txtFmt.font = "Bloodgutter 99";
_levelTF.defaultTextFormat = txtFmt;
txtFmt.align = TextFormatAlign.LEFT;
txtFmt.color = 16589346;
txtFmt.size = 12;
_helpTF.defaultTextFormat = txtFmt;
_helpTF.text = "Controls: 1,2,3-change weapon , M-mute , P-pause";
txtFmt.align = TextFormatAlign.RIGHT;
txtFmt.bold = true;
txtFmt.font = "Bookman Old Style";
txtFmt.size = 18;
_scoreCntTF.defaultTextFormat = txtFmt;
st = new soundtrack();
clutch = new clutchSnd();
stChn = st.play(0, int.MAX_VALUE);
}
public function addFinished(){
trace("add finished");
play();
}
private function onMoveMouse(_arg1:MouseEvent){
_mouseX = _arg1.stageX;
_mouseY = _arg1.stageY;
}
private function onNextLevel(_arg1:MouseEvent){
_afterTime = getTimer();
_player._thisTime = getTimer();
upgrades.visible = false;
bPause = false;
_player.setForNextLevel();
i = 0;
while (i < _enemyBullets.length) {
_enemyBullets[i].bDead = true;
i++;
};
upgrades.straight.value = 0;
upgrades.bomb.value = 0;
upgrades.machineGun.value = 0;
trace("LST");
_levelStartTime = getTimer();
Mouse.hide();
}
public function runInit(_arg1:Event){
if (currentFrame == 3){
stage.removeEventListener(Event.ENTER_FRAME, runInit);
init();
};
}
private function draw(){
if (bPause){
return;
};
_bd.lock();
var _local1:Matrix = new Matrix();
_bkg.draw(_bd);
if (_heliY < 600){
_helipad.drawAndPlay(_bd, _heliX, _heliY);
};
_local1.identity();
_local1.translate((_mouseX - 2), (_mouseY - 2));
_bd.draw(_mouseRct, _local1);
i = 0;
while (i < _enemies.length) {
_enemies[i].draw();
i++;
};
i = 0;
while (i < _buildings.length) {
_buildings[i].draw();
i++;
};
i = 0;
while (i < _enemyBlood.length) {
_enemyBlood[i].draw();
i++;
};
i = 0;
while (i < _enemyBullets.length) {
_enemyBullets[i].draw();
i++;
};
_player.draw();
_rocketsCntTF.text = String(_player._nRockets);
_local1.identity();
_local1.translate(400, 135);
_bd.draw(_rocketsCntTF, _local1);
_bombsCntTF.text = String(_player._nBombs);
_local1.identity();
_local1.translate(400, 182);
_bd.draw(_bombsCntTF, _local1);
_scoreCntTF.text = String(_player._score);
_local1.identity();
_local1.translate(400, 5);
_bd.draw(_scoreCntTF, _local1);
_lifeValueShape.graphics.clear();
_lifeValueShape.graphics.lineStyle(20, 0xFF0000, 0.7, false, "normal", CapsStyle.NONE);
_lifeValueShape.graphics.moveTo(10, 200);
_lifeValueShape.graphics.lineTo(10, (200 - _player.life));
_local1.identity();
_local1.translate(470, 220);
_bd.draw(_lifeValueShape, _local1);
_lifeAS.drawFrame(_bd, 0, 480, 320);
if (_nLevel < 3){
_local1.identity();
_local1.translate(130, 30);
_bd.draw(_helpTF, _local1);
};
_local1.identity();
_local1.translate(220, 5);
_bd.draw(_levelTF, _local1);
_bd.unlock();
}
public function onStartHard(_arg1:Event){
bPause = false;
menu.visible = false;
resetGame();
_afterTime = getTimer();
_gameTimer.start();
}
private function calcUnitPercentsSum(){
unitPercentsSum = 0;
i = 0;
while (i < unitPercents.length) {
unitPercentsSum = (unitPercentsSum + unitPercents[i]);
i++;
};
buildingPercentsSum = 0;
i = 0;
while (i < 5) {
buildingPercentsSum = (buildingPercentsSum + unitPercents[i]);
i++;
};
}
function frame3(){
stop();
trace("three");
}
private function onDownKey(_arg1:KeyboardEvent){
if (_arg1.keyCode == 80){
if (bPause == false){
_pauseTime = getTimer();
} else {
_pauseTime = (getTimer() - _pauseTime);
};
bPause = !(bPause);
};
if (_arg1.keyCode == 77){
bMute = !(bMute);
if (bMute){
stChn.stop();
} else {
stChn = st.play(0, int.MAX_VALUE);
};
};
if (_arg1.keyCode == 49){
_player._currentWeapon = 0;
};
if (_arg1.keyCode == 50){
_player._currentWeapon = 1;
};
if (_arg1.keyCode == 51){
_player._currentWeapon = 2;
};
}
function fTrace(){
trace("victory");
}
function frame1(){
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
MindJoltAPI.service.connect("RBOIQVCKW6TLHKOP", this);
MindJoltAPI.ad.showPreGameAd({clip:this, ad_finished:addFinished});
}
private function onMachineGunChange(_arg1:SliderEvent){
var _local3:Number;
var _local2:Number = ((upgrades.straight.value + upgrades.bomb.value) + upgrades.machineGun.value);
if (_local2 > upgradeTotal){
_local3 = ((_local2 - upgradeTotal) / 2);
upgrades.straight.value = (upgrades.straight.value - (_local2 - upgradeTotal));
upgrades.bomb.value = (upgrades.bomb.value - _local3);
};
}
private function updateEnemyBullets(){
i = 0;
while (i < _enemyBullets.length) {
_enemyBullets[i].update();
i++;
};
}
public function onReplay(_arg1:Event){
finalScore.visible = false;
}
public function changeLevel(){
var _local1:int;
_nLevel++;
upgrades.scoreBefore.text = String(_player._score);
_local1 = (_player._nRockets * 150);
_player._score = (_player._score + _local1);
upgrades.rockets.text = ((("+" + _player._nRockets) + " rockets=") + String(_local1));
_local1 = (_player._nBombs * 450);
_player._score = (_player._score + _local1);
upgrades.bombs.text = ((("+" + _player._nBombs) + " bombs=") + String(_local1));
_local1 = ((Math.floor((_player.life / 2)) * 15) * _nLevel);
_player._score = (_player._score + _local1);
upgrades.repairs.text = ((("+" + Math.floor((_player.life / 2))) + " life=") + String(_local1));
upgrades.scoreAfter.text = String(_player._score);
_player._score = (_player._score + (5555 * _nLevel));
trace(_player._score);
_player._currentWeapon = 0;
if (_nLevel == 2){
_levelStartTime = getTimer();
_levelTime = 91000;
unitPercents[0] = 2;
unitPercents[1] = 2;
unitPercents[2] = 0;
unitPercents[3] = 2;
unitPercents[4] = 4;
unitPercents[5] = 3;
unitValues[5] = 450;
unitPercents[6] = 7;
unitValues[6] = 1050;
unitPercents[7] = 10;
unitValues[7] = 850;
unitPercents[8] = 0;
unitValues[8] = 4550;
unitPercents[9] = 0;
unitValues[9] = 5550;
upgradeTotal = 0.3;
};
if (_nLevel == 3){
_levelStartTime = getTimer();
_levelTime = 111000;
unitPercents[0] = 0;
unitPercents[1] = 1;
unitPercents[2] = 1;
unitPercents[3] = 2;
unitPercents[4] = 3;
unitPercents[5] = 2;
unitValues[5] = 550;
unitPercents[6] = 3;
unitValues[6] = 1150;
unitPercents[7] = 5;
unitValues[7] = 950;
unitPercents[8] = 6;
unitValues[8] = 5550;
unitPercents[9] = 0;
unitValues[9] = 6550;
upgradeTotal = 0.31;
};
if (_nLevel == 4){
_levelStartTime = getTimer();
_levelTime = 131000;
unitPercents[0] = 1;
unitPercents[1] = 1;
unitPercents[2] = 1;
unitPercents[3] = 2;
unitPercents[4] = 3;
unitPercents[5] = 2;
unitValues[5] = 650;
unitPercents[6] = 4;
unitValues[6] = 1250;
unitPercents[7] = 7;
unitValues[7] = 1050;
unitPercents[8] = 4;
unitValues[8] = 6550;
unitPercents[9] = 4;
unitValues[9] = 7550;
upgradeTotal = 0.32;
};
if (_nLevel == 5){
_levelStartTime = getTimer();
_levelTime = 141000;
unitPercents[0] = 0;
unitPercents[1] = 1;
unitPercents[2] = 1;
unitPercents[3] = 1;
unitPercents[4] = 2;
unitPercents[5] = 1;
unitValues[5] = 750;
unitPercents[6] = 2;
unitValues[6] = 1350;
unitPercents[7] = 5;
unitValues[7] = 1150;
unitPercents[8] = 6;
unitValues[8] = 7550;
unitPercents[9] = 6;
unitValues[9] = 8550;
upgradeTotal = 0.33;
};
if (_nLevel == 6){
bPause = true;
finalScore.score.text = String(_player._score);
MindJoltAPI.service.submitScore(_player._score);
bPause = true;
finalScore.score.text = String(_player._score);
finalScore.visible = true;
menu.visible = true;
Mouse.show();
resetGame();
_player.reset();
Mouse.show();
return;
};
calcUnitPercentsSum();
_levelTF.text = ("Level " + String(_nLevel));
upgrades.visible = true;
bPause = true;
upgrades.straight.maximum = upgradeTotal;
upgrades.bomb.maximum = upgradeTotal;
upgrades.machineGun.maximum = upgradeTotal;
Mouse.show();
}
private function update(){
if (bPause){
return;
};
random.randomize();
if (((getTimer() - _levelStartTime) - _pauseTime) > _levelTime){
_levelTime = int.MAX_VALUE;
_bLevelOver = true;
_heliY = -450;
};
if (_bLevelOver){
if (Math.abs((_player._y - _heliY)) < 300){
_player._spd = 0.05;
_mouseX = _heliX;
_mouseY = _heliY;
if (Math.abs((_player._y - _heliY)) < 10){
_bLevelOver = false;
changeLevel();
};
};
};
_bkg.update();
if (_heliY < 600){
_heliY = (_heliY + _bkgSpd);
};
_player.move(_mouseX, _mouseY, getTimer(), bMouseDown);
updateEnemyBullets();
updateEnemies();
i = 0;
while (i < _enemyBlood.length) {
_enemyBlood[i].update();
i++;
};
}
public function resetGame(){
trace("reset");
_levelTF.text = "Level 1";
Mouse.hide();
_nLevel = 1;
_bLevelOver = false;
_enemies.splice(0, _enemies.length);
_deadEnemiesIdxs.splice(0, _deadEnemiesIdxs.length);
_enemyBullets.splice(0, _enemyBullets.length);
_deadEnemyBullets.splice(0, _deadEnemyBullets.length);
_buildings.splice(0, _buildings.length);
_deadBuildingIdxs.splice(0, _deadBuildingIdxs.length);
_enemyBlood.splice(0, _enemyBlood.length);
_deadEnemyBlood.splice(0, _deadEnemyBlood.length);
var _local1 = 8;
i = 0;
while (i < _local1) {
j = 0;
while (j < _local1) {
_zones[i][j] = new Zone(i, j, _local1);
j++;
};
i++;
};
enemySpaces = 4;
enemySpacing = (_stgX / enemySpaces);
spaceMoved = (enemySpacing + 1);
_bLevelOver = false;
_levelStartTime = getTimer();
_heliX = 0x0100;
_heliY = 300;
_levelTime = 60000;
unitPercents[0] = 5;
unitPercents[1] = 0;
unitPercents[2] = 0;
unitPercents[3] = 5;
unitPercents[4] = 8;
unitPercents[5] = 10;
unitValues[5] = 350;
unitPercents[6] = 3;
unitValues[6] = 950;
unitPercents[7] = 2;
unitValues[7] = 750;
unitPercents[8] = 0;
unitValues[8] = 3550;
unitPercents[9] = 0;
unitValues[9] = 4550;
calcUnitPercentsSum();
_player.reset();
_player._thisTime = getTimer();
}
}
}//package
Section 68
//menuMC (menuMC)
package {
import flash.display.*;
public dynamic class menuMC extends MovieClip {
public var startBtnHard:SimpleButton;
}
}//package
Section 69
//MindJoltAPI (MindJoltAPI)
package {
import flash.display.*;
import flash.events.*;
import flash.system.*;
import flash.net.*;
public class MindJoltAPI {
public static var ad:Object = {showPreGameAd:showPreGameAd};
private static var callback:Function;
private static var gameKey:String;
private static var clip:MovieClip;
public static var service:Object = {connect:load_service};
private static var version:String = "1.0.4";
private static var options:Object;
private static function load_service_complete(_arg1:Event):void{
if (((!((_arg1.currentTarget.content == null))) && (!((_arg1.currentTarget.content.service == null))))){
service = _arg1.currentTarget.content.service;
trace("[MindJoltAPI] service successfully loaded");
service.connect(gameKey, clip, callback);
if (options != null){
service.showPreGameAd(options);
};
service.getLogger().info((("MindJoltAPI loader version [" + version) + "]"));
} else {
trace("[MindJoltAPI] failed to load");
};
}
private static function load_service(_arg1:String, _arg2:MovieClip, _arg3:Function=null):void{
var _local4:Object;
var _local5:Loader;
MindJoltAPI.gameKey = _arg1;
MindJoltAPI.clip = _arg2;
MindJoltAPI.callback = _arg3;
if (service.submitScore == null){
Security.allowDomain("static.mindjolt.com");
_local4 = LoaderInfo(_arg2.root.loaderInfo).parameters;
_local5 = new Loader();
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, load_service_complete);
_local5.load(new URLRequest(((_local4.mjPath) || ("http://static.mindjolt.com/api/as3/api_local_as3.swf"))));
_arg2.addChild(_local5);
};
}
public static function showPreGameAd(_arg1:Object=null):void{
if (clip == null){
trace("[MindJoltAPI] You must call MindJoltAPI.service.connect before MindJoltAPI.ad.showPreGameAd.");
};
if (_arg1 == null){
_arg1 = {};
};
if (service.showPreGameAd != undefined){
service.showPreGameAd(_arg1);
} else {
MindJoltAPI.options = _arg1;
if (_arg1["ad_started"] == null){
_arg1["clip"].stop();
};
};
}
}
}//package
Section 70
//Player (Player)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.ui.*;
public class Player {
public const half:int = 50;
private var _strght:PlayerStraightRocket;
public var _y:Number;
private var bBombFromLeft:Boolean;// = true
public var _weaponSelect:AnimatedSprite;
private var _bombs:Array;
public var _powerStraight:Number;
private var _bllt:Bullet;
private var _blltBD:BitmapData;
public var _nRockets:int;// = 38
private var neighZone:Zone;
private var _zones:Array;
private var debug:int;// = 0
private var _straight:Array;
public var _powerGun:Number;
private var _deadStraight:Array;
public var _nBombs:int;// = 8
public var nOffsetElice:int;// = 0
private var dXY:Point;
private var _bombSpd:Number;
private var j:int;
private var i;
public var _mouseX;
public var _mouseY;
private var _trailAS:AnimatedSprite;
private var _reloadBomb:int;// = 0
private var _bullets:Array;
private var _trailBD:BitmapData;
private var _deadBombs:Array;
private var _explosionsAS:AnimatedSprite;
public var _score:Number;// = 0
public var _main:Main;
public var _explosions:Array;
private var _bkgSpd:Number;
private var zone;
public var _animSpriteElice:AnimatedSprite;
private var _reload:int;// = 0
private var _bmb:Bomb;
public var _powerBomb:Number;
private var _bulletSpd:Number;
public var _animSprite:AnimatedSprite;
private var _reloadStraight:int;// = 0
private var bShootFromLeft:Boolean;// = true
private var _bd:BitmapData;
public var _lastTime;
private var _enemies:Array;
public var _spd:Number;
public var _thisTime:int;
private var _deadBullets:Array;
private var _enemyBullets:Array;
public var _currentWeapon:int;// = 0
public var _x;
private var _bmbBD:BitmapData;
public var life:Number;// = 200
public function Player(_arg1:Number, _arg2:Number, _arg3:BitmapData, _arg4:int, _arg5:Main){
_straight = new Array();
_deadStraight = new Array();
_bombs = new Array();
_deadBombs = new Array();
_explosions = new Array();
super();
_x = _arg1;
_y = _arg2;
_bd = _arg3;
_mouseX = _x;
_mouseY = _y;
dXY = new Point(0, 0);
_spd = 0.33;
_lastTime = _arg4;
_thisTime = _arg4;
_animSprite = new AnimatedSprite("playerMC", "start", half, half);
_animSpriteElice = new AnimatedSprite("eliceMC", "start", half, half);
_animSprite.bLoop = false;
_animSpriteElice.bLoop = true;
_zones = Main._zones;
_enemyBullets = Main._enemyBullets;
_enemies = Main._enemies;
_bulletSpd = 25;
_bombSpd = 5;
_bkgSpd = Main._bkgSpd;
var _local6:Object = getDefinitionByName("playerBulletMC");
var _local7:* = new (_local6);
_blltBD = new BitmapData(_local7.width, _local7.height);
_blltBD.draw(_local7);
_local6 = getDefinitionByName("playerBombMC");
var _local8:* = new (_local6);
_bmbBD = new BitmapData(_local8.width, _local8.height, true, 0);
_bmbBD.draw(_local8);
_trailAS = new AnimatedSprite("trailMC", "start", 3, 6);
_weaponSelect = new AnimatedSprite("weaponsMC", "start", 50, 95);
_explosionsAS = new AnimatedSprite("explosionMC", "start", 128, 128);
_main = _arg5;
reset();
}
public function setForNextLevel(){
life = 200;
_spd = 0.33;
_nRockets = 38;
_nBombs = 8;
_bullets = new Array();
_deadBullets = new Array();
_powerStraight = (_powerStraight + (_powerStraight * _main.upgrades.straight.value));
_powerBomb = (_powerBomb + (_powerBomb * _main.upgrades.bomb.value));
trace("bef", _powerGun);
_powerGun = (_powerGun + (_powerGun * _main.upgrades.machineGun.value));
trace("aft", _powerGun);
}
public function shootBombs(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:*;
var _local5:int;
var _local6:int;
_local2 = (_y - 15);
_reloadBomb--;
if (_reloadBomb < 0){
_reloadBomb = 60;
_nBombs--;
bShootFromLeft = !(bShootFromLeft);
if (bShootFromLeft){
_local1 = (_x - 25);
} else {
_local1 = (_x + 25);
};
if (_deadBombs.length > 0){
_local6 = _deadBombs.pop();
_bmb = _bombs[_local6];
_bmb.bDead = false;
_bmb._x = _local1;
_bmb._y = _local2;
_bmb.scl = 1;
_bmb._cntr = 0;
} else {
_bmb = new Bomb();
_bmb._x = _local1;
_bmb._y = _local2;
_bmb._idx = _bombs.length;
_bombs[_bombs.length] = _bmb;
};
};
}
public function draw(){
var _local1:Matrix;
var _local2:int;
while (_local2 < _bullets.length) {
if (_bullets[_local2].bDead == false){
_local1 = new Matrix();
_local1.translate(_bullets[_local2]._x, _bullets[_local2]._y);
_bd.draw(_blltBD, _local1);
};
_local2++;
};
_local2 = 0;
while (_local2 < _bombs.length) {
if (_bombs[_local2].bDead == false){
_local1 = new Matrix();
_local1.translate(_bombs[_local2]._x, _bombs[_local2]._y);
_bd.draw(_bmbBD, _local1);
};
_local2++;
};
_local2 = 0;
while (_local2 < _straight.length) {
_straight[_local2].draw();
_local2++;
};
_animSprite.drawAndPlay(_bd, _x, _y);
_animSpriteElice.drawAndPlay(_bd, (_x + nOffsetElice), _y);
_local2 = 0;
while (_local2 < _explosions.length) {
_explosionsAS.scl = _explosions[_local2]._scl;
_explosionsAS.sclY = _explosions[_local2]._scl;
_explosionsAS.drawFrame(_bd, _explosions[_local2]._frm, _explosions[_local2]._x, _explosions[_local2]._y);
_local2++;
};
_weaponSelect.drawFrame(_bd, _currentWeapon, 500, 150);
}
public function reset(){
life = 200;
_spd = 0.33;
_powerStraight = 751;
_powerBomb = 1751;
_powerGun = 81;
_nRockets = 38;
_nBombs = 8;
_bullets = new Array();
_deadBullets = new Array();
_score = 0;
_currentWeapon = 0;
}
public function damage(_arg1:int){
life = (life - _arg1);
}
public function shootBullets(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:*;
var _local5:*;
var _local6:int;
var _local7:*;
var _local8:*;
var _local9:Enemy;
var _local10:*;
var _local11:int;
var _local12:*;
var _local13:int;
_local1 = (_y - 15);
_local4 = (_x >> 6);
_local5 = (_y >> 6);
_local3 = Number.MAX_VALUE;
_local7 = null;
_local9 = null;
j = _local5;
while (j >= 0) {
_local10 = (_local4 - 1);
_local11 = (_local4 + 1);
if (_local10 < 0){
_local10 = 0;
};
if (_local11 > 7){
_local11 = 7;
};
i = _local10;
while (i <= _local11) {
zone = _zones[i][j];
for (_local12 in zone._enemies) {
_local6 = zone._enemies[_local12];
_local8 = _enemies[_local6];
if ((((Math.abs((_local8._x - _x)) < _local8._radius)) && ((_local8._y < _local1)))){
_local2 = Math.abs((_local8._y - _y));
if (_local2 < _local3){
_local6 = zone._enemies[_local12];
_local7 = _enemies[_local6];
_local3 = _local2;
_local9 = _local7;
};
};
};
i++;
};
if (_local9 != null){
break;
};
j--;
};
_reload--;
if (_reload < 0){
_reload = 5;
if (_deadBullets.length > 0){
_local13 = _deadBullets.pop();
_bllt = _bullets[_local13];
_bllt.bDead = false;
if (_local7 != null){
_bllt._x = _x;
_bllt._y = _local1;
_bllt._ty = _local7._y;
_bllt.bHasEnemy = true;
_bllt._enemyIdx = _local7._idx;
} else {
_bllt._x = _x;
_bllt._y = _local1;
_bllt._ty = -100;
_bllt.bHasEnemy = false;
};
} else {
_bllt = new Bullet();
if (_local7 != null){
_bllt._x = _x;
_bllt._y = _local1;
_bllt._ty = _local7._y;
_bllt.bHasEnemy = true;
_bllt._enemyIdx = _local7._idx;
} else {
_bllt._x = _x;
_bllt._y = _local1;
_bllt._ty = -100;
_bllt.bHasEnemy = false;
};
_bllt._idx = _bullets.length;
_bullets[_bullets.length] = _bllt;
};
};
}
public function moveBullets(){
i = 0;
while (i < _bullets.length) {
if (_bullets[i].bDead == false){
_bllt = _bullets[i];
_bllt._y = (_bllt._y - _bulletSpd);
if (Math.abs((_bllt._y - _bllt._ty)) < _bulletSpd){
if (_bllt.bHasEnemy){
_enemies[_bllt._enemyIdx].damage(_powerGun);
};
_bllt.bDead = true;
_deadBullets.push(_bllt._idx);
};
};
i++;
};
}
public function shootStraightRockets(){
var _local1:*;
var _local2:Number;
var _local3:int;
_local2 = (_y - 15);
_reloadStraight--;
if (_reloadStraight < 0){
_reloadStraight = 15;
_nRockets--;
bShootFromLeft = !(bShootFromLeft);
if (bShootFromLeft){
_local1 = ((_x - 18) + _animSprite._frm);
} else {
_local1 = ((_x + 18) - _animSprite._frm);
};
if (_deadStraight.length > 0){
_local3 = _deadStraight.pop();
_strght = _straight[_local3];
_strght.reset(_local1, _local2);
_strght._power = _powerStraight;
} else {
_strght = new PlayerStraightRocket(_deadStraight, "playerStraightMC", "start", _straight.length, 10, 30, _local1, _local2, _bd, _trailAS, _powerStraight);
_strght._idx = _straight.length;
_straight[_strght._idx] = _strght;
};
};
}
public function moveBombs(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Explosion;
i = 0;
while (i < _bombs.length) {
if (_bombs[i].bDead == false){
_bmb = _bombs[i];
_bmb._y = (_bmb._y - _bombSpd);
_bmb.scl = (_bmb.scl - 1);
_bmb._cntr++;
if (_bmb._cntr > 20){
j = 0;
while (j < _enemies.length) {
_local1 = Math.abs((_enemies[j]._x - _bmb._x));
_local2 = Math.abs((_enemies[j]._y - _bmb._y));
_local4 = (1 - ((_local1 + _local2) / 0x0200));
_local4 = Math.pow(_local4, 2);
_enemies[j].damage((_powerBomb * _local4));
j++;
};
_bmb.bDead = true;
if (_bmb._y > 0){
_local5 = new Explosion();
_local5._x = _bmb._x;
_local5._y = _bmb._y;
_local5._scl = (_powerBomb / 668);
_local5._frm = 1;
_explosions[_explosions.length] = _local5;
};
_deadBombs.push(_bmb._idx);
};
};
i++;
};
}
public function move(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Boolean){
var _local5:*;
var _local6:int;
var _local7:*;
var _local8:*;
var _local9:int;
var _local10:*;
var _local11:Number;
var _local12:int;
var _local13:Number;
var _local14:*;
if (life < 0){
trace("score bef", _score);
if (_score > 5000){
_local12 = (_nRockets * 150);
_score = (_score + _local12);
_local12 = (_nBombs * 450);
_score = (_score + _local12);
_local12 = ((Math.floor((life / 2)) * 15) * _main._nLevel);
_score = (_score + _local12);
};
trace("score aft", _score);
MindJoltAPI.service.submitScore(_score);
Mouse.show();
_main.bPause = true;
_main.finalScore.score.text = String(_score);
_main.finalScore.visible = true;
_main.menu.visible = true;
Mouse.show();
life = 200;
trace(" before reset");
reset();
_main.resetGame();
Mouse.show();
};
_lastTime = _thisTime;
_thisTime = _arg3;
if (_arg4 == false){
_reload = 0;
};
if (_reloadBomb >= 0){
_reloadBomb--;
};
if (_reloadStraight >= 0){
_reloadStraight--;
};
if (((!((_arg1 == 0))) && (!((_arg2 == 0))))){
_mouseX = _arg1;
_mouseY = _arg2;
};
if (((!((_mouseX == _x))) || (!((_mouseY == _y))))){
dXY.x = (_mouseX - _x);
dXY.y = (_mouseY - _y);
if ((((Math.abs(dXY.x) < 5)) && ((Math.abs(dXY.y) < 5)))){
_x = _mouseX;
_y = _mouseY;
dXY.x = 0;
dXY.y = 0;
} else {
dXY.normalize(((_thisTime - _lastTime) * _spd));
_x = (_x + dXY.x);
_y = (_y + dXY.y);
};
if (_x < (half - 35)){
_x = (half - 35);
};
if (_x > ((Main._stgX + 35) - half)){
_x = ((Main._stgX + 35) - half);
};
if (_y < half){
_y = half;
};
if (_y > (Main._stgY - half)){
_y = (Main._stgY - half);
};
};
if (Math.abs(dXY.x) > 2){
_animSprite.bForward = true;
if (dXY.x < 0){
_animSprite.scl = 1;
};
if (dXY.x > 0){
_animSprite.scl = -1;
};
} else {
_animSprite.bForward = false;
};
_animSprite.sclY = Math.max((1 - (Math.abs(dXY.y) / 50)), 0.8);
_animSpriteElice.scl = Math.max((1 - (Math.abs(dXY.x) / 50)), 0.8);
_animSpriteElice.sclY = Math.max((1 - (Math.abs(dXY.y) / 50)), 0.8);
if (dXY.x > 2){
nOffsetElice = 14;
} else {
nOffsetElice = 0;
};
if (_arg4){
if ((((_nBombs <= 0)) && ((_currentWeapon == 2)))){
_currentWeapon = 0;
};
if ((((_nRockets <= 0)) && ((_currentWeapon == 1)))){
_currentWeapon = 0;
};
if (_currentWeapon == 0){
shootBullets();
};
if (_currentWeapon == 1){
shootStraightRockets();
};
if (_currentWeapon == 2){
shootBombs();
};
};
moveBullets();
moveBombs();
_local5 = (_x >> 6);
_local6 = (_y >> 6);
zone = _zones[_local5][_local6];
_local9 = zone._neigh.length;
i = 0;
while (i < _local9) {
_local7 = zone._neigh[i][0];
_local8 = zone._neigh[i][1];
neighZone = _zones[_local7][_local8];
for (_local14 in neighZone._enemyBullets) {
_local10 = _enemyBullets[_local14]._x;
_local11 = _enemyBullets[_local14]._y;
_local13 = (((half * Math.min(_animSpriteElice.scl, _animSpriteElice.sclY)) + _enemyBullets[_local14]._radius) - 13);
if ((((Math.abs((_local10 - _x)) < _local13)) && ((Math.abs((_local11 - _y)) < _local13)))){
_enemyBullets[_local14].die();
};
};
i++;
};
i = 0;
while (i < _straight.length) {
_straight[i].update();
i++;
};
i = 0;
while (i < _explosions.length) {
_explosions[i]._y = (_explosions[i]._y + _bkgSpd);
_explosions[i]._frm++;
if (_explosions[i]._frm > 9){
_explosions.splice(i, 1);
};
i++;
};
}
}
}//package
class Bomb {
public var bDead:Boolean;// = false
public var _cntr:int;// = 0
public var _x;
public var _y:Number;
public var scl:Number;// = 1
public var _idx:int;
private function Bomb(){
}
}
class Bullet {
public var _ty:Number;
public var bDead:Boolean;// = false
public var bHasEnemy:Boolean;// = false
public var _enemyIdx;
public var _x;
public var _y;
public var _idx:int;
private function Bullet(){
}
}
Section 71
//playerBombMC (playerBombMC)
package {
import flash.display.*;
public dynamic class playerBombMC extends MovieClip {
}
}//package
Section 72
//playerBulletMC (playerBulletMC)
package {
import flash.display.*;
public dynamic class playerBulletMC extends MovieClip {
}
}//package
Section 73
//playerMC (playerMC)
package {
import flash.display.*;
public dynamic class playerMC extends MovieClip {
}
}//package
Section 74
//playerStraightMC (playerStraightMC)
package {
import flash.display.*;
public dynamic class playerStraightMC extends MovieClip {
}
}//package
Section 75
//PlayerStraightRocket (PlayerStraightRocket)
package {
import flash.display.*;
import flash.utils.*;
public class PlayerStraightRocket {
public var nFrms:int;
public var _power:Number;
public var _x;
private var neighNeighZone:Zone;
private var _player:Player;
private var aS:AnimatedSprite;
private var zone;
private var _zI;
private var _zJ:int;
public var _radius:Number;
private var neighZone;
private var _zones;
public var _trailCntr;
private var _deadStraight:Array;
private var _bd:BitmapData;
public var bDead:Boolean;
private var _enemies;
public var _spd;
private var i;
private var j:int;
private var _trailAS:AnimatedSprite;
public var _y;
public var _idx;
public function PlayerStraightRocket(_arg1:Array, _arg2:String, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Number, _arg8:Number, _arg9:BitmapData, _arg10:AnimatedSprite, _arg11:Number){
reset(_arg7, _arg8);
aS = new AnimatedSprite(_arg2, _arg3, _arg5, _arg6);
_power = _arg11;
_deadStraight = _arg1;
_idx = _arg4;
_radius = _arg6;
_bd = _arg9;
_zones = Main._zones;
_enemies = Main._enemies;
_trailAS = _arg10;
_trailCntr = 0;
nFrms = 0;
_player = Main._player;
}
public function die(){
var _local1:Explosion;
bDead = true;
_deadStraight.push(_idx);
if (_zI != int.MAX_VALUE){
removeFromOldZone();
_zI = int.MAX_VALUE;
_zJ = int.MAX_VALUE;
};
if (_y > 0){
_local1 = new Explosion();
_local1._x = _x;
_local1._y = _y;
_local1._frm = 1;
_local1._scl = (_power / 668);
_player._explosions[_player._explosions.length] = _local1;
};
}
public function draw(){
if (bDead){
return;
};
aS.drawAndPlay(_bd, (_x + 5), _y);
_trailCntr++;
if (_trailCntr > 2){
_trailCntr = 0;
nFrms++;
};
if (nFrms > 19){
nFrms = 0;
};
_trailAS.drawVertical(_bd, nFrms, _x, (_y + 25));
}
private function removeFromOldZone(){
var _local1:*;
zone = _zones[_zI][_zJ];
for (_local1 in zone._playerStraight) {
if (_local1 == _idx){
delete zone._playerStraight[_local1];
};
};
}
public function update(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:int;
var _local5:*;
var _local6:int;
var _local7:*;
var _local8:Number;
var _local9:*;
var _local10:*;
var _local11:Number;
if (bDead){
return;
};
_y = (_y - _spd);
if (((((_x >> 9) == 0)) && (((_y >> 9) == 0)))){
_local5 = (_x >> 6);
_local6 = (_y >> 6);
if (((!((_local5 == _zI))) || (!((_local6 == _zJ))))){
if (_zI != int.MAX_VALUE){
removeFromOldZone();
};
_zI = _local5;
_zJ = _local6;
zone = _zones[_zI][_zJ];
zone._playerStraight[String(_idx)] = _idx;
};
} else {
die();
};
i = 0;
while (i < zone._neigh.length) {
_local1 = zone._neigh[i][0];
_local2 = zone._neigh[i][1];
neighZone = _zones[_local1][_local2];
for (_local9 in neighZone._enemies) {
if ((((Math.abs((_enemies[_local9]._y - _y)) < 45)) && ((Math.abs((_enemies[_local9]._x - _x)) < 45)))){
for (_local10 in _enemies) {
_local7 = Math.abs((_enemies[_local10]._y - _y));
_local8 = Math.abs((_enemies[_local10]._x - _x));
_local11 = (1 - ((_local7 + _local8) / 0x0200));
_local11 = Math.pow(_local11, 3);
_enemies[_local10].damage((_power * _local11));
};
die();
break;
};
};
i++;
};
}
public function reset(_arg1:Number, _arg2:Number){
bDead = false;
_spd = 7;
_zI = int.MAX_VALUE;
_zJ = int.MAX_VALUE;
_x = _arg1;
_y = _arg2;
nFrms = 0;
}
}
}//package
Section 76
//ProgressBar_barSkin (ProgressBar_barSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_barSkin extends MovieClip {
}
}//package
Section 77
//ProgressBar_indeterminateSkin (ProgressBar_indeterminateSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_indeterminateSkin extends MovieClip {
}
}//package
Section 78
//ProgressBar_trackSkin (ProgressBar_trackSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_trackSkin extends MovieClip {
}
}//package
Section 79
//Random (Random)
package {
public class Random {
private var randoms:Array;
private var crt:int;
public function Random(){
randoms = new Array();
super();
crt = 0;
var _local1:* = 0;
while (_local1 < 10000) {
randoms[randoms.length] = Math.random();
_local1++;
};
}
public function randomize(){
crt = Math.floor((Math.random() * randoms.length));
}
public function get():Number{
crt++;
if (crt >= randoms.length){
crt = 0;
};
return (randoms[crt]);
}
}
}//package
Section 80
//rocketeer0 (rocketeer0)
package {
import flash.display.*;
public dynamic class rocketeer0 extends MovieClip {
}
}//package
Section 81
//rocketeer1 (rocketeer1)
package {
import flash.display.*;
public dynamic class rocketeer1 extends MovieClip {
}
}//package
Section 82
//rocketeer2 (rocketeer2)
package {
import flash.display.*;
public dynamic class rocketeer2 extends MovieClip {
}
}//package
Section 83
//rocketeer3 (rocketeer3)
package {
import flash.display.*;
public dynamic class rocketeer3 extends MovieClip {
}
}//package
Section 84
//rocketeerBloodMC (rocketeerBloodMC)
package {
import flash.display.*;
public dynamic class rocketeerBloodMC extends MovieClip {
}
}//package
Section 85
//rocketeerBulletMC (rocketeerBulletMC)
package {
import flash.display.*;
public dynamic class rocketeerBulletMC extends MovieClip {
}
}//package
Section 86
//sandMC (sandMC)
package {
import flash.display.*;
public dynamic class sandMC extends MovieClip {
}
}//package
Section 87
//ScrollDownBackground (ScrollDownBackground)
package {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class ScrollDownBackground {
private var _srcMc:MovieClip;
private var tlMtrx:Array;
private var _bkgSpd:Number;
private var _nX;
private var _nY:int;
private var i;
private var j:int;// = 0
private var nTls:int;
private var _W;
private var _cachedBtm:Array;
private var mtrx:Matrix;
public static var _y:int = 0;
public function ScrollDownBackground(_arg1:String){
var _local3:BitmapData;
_cachedBtm = new Array();
mtrx = new Matrix();
super();
_nX = 3;
_nY = 4;
_bkgSpd = Main._bkgSpd;
var _local2:Object = getDefinitionByName(_arg1);
_srcMc = new (_local2);
_srcMc.gotoAndStop(1);
_W = _srcMc.width;
_y = -(_W);
while (_srcMc.currentLabel != "stop") {
_local3 = new BitmapData(_W, _W, true, 0);
_local3.draw(_srcMc);
_cachedBtm[_cachedBtm.length] = _local3;
_srcMc.nextFrame();
};
nTls = _cachedBtm.length;
tlMtrx = new Array(_nX);
i = 0;
while (i < _nX) {
tlMtrx[i] = new Array(_nY);
i++;
};
i = 0;
while (i < _nX) {
j = 0;
while (j < _nY) {
tlMtrx[i][j] = Math.floor((Math.random() * nTls));
j++;
};
i++;
};
}
public function draw(_arg1:BitmapData){
var _local2:*;
var _local3:int;
var _local4:int;
if ((_y + (3 * _W)) > 0x0200){
_local2 = 0;
while (_local2 < _nX) {
tlMtrx[_local2].pop();
tlMtrx[_local2].unshift(Math.floor((Math.random() * nTls)));
_local2++;
};
_y = (_y - _W);
};
_local2 = 0;
while (_local2 < _nX) {
_local3 = 0;
while (_local3 < _nY) {
mtrx.identity();
mtrx.translate((_local2 * _W), ((_local3 * _W) + _y));
_local4 = tlMtrx[_local2][_local3];
_arg1.draw(_cachedBtm[_local4], mtrx);
_local3++;
};
_local2++;
};
}
public function update(){
_y = (_y + _bkgSpd);
}
}
}//package
Section 88
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 89
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 90
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 91
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 92
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 93
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 94
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 95
//soundtrack (soundtrack)
package {
import flash.media.*;
public dynamic class soundtrack extends Sound {
}
}//package
Section 96
//startMaskMC (startMaskMC)
package {
import flash.display.*;
public dynamic class startMaskMC extends MovieClip {
}
}//package
Section 97
//tank0 (tank0)
package {
import flash.display.*;
public dynamic class tank0 extends MovieClip {
}
}//package
Section 98
//tank1 (tank1)
package {
import flash.display.*;
public dynamic class tank1 extends MovieClip {
}
}//package
Section 99
//tank2 (tank2)
package {
import flash.display.*;
public dynamic class tank2 extends MovieClip {
}
}//package
Section 100
//tank3 (tank3)
package {
import flash.display.*;
public dynamic class tank3 extends MovieClip {
}
}//package
Section 101
//tankBloodMC (tankBloodMC)
package {
import flash.display.*;
public dynamic class tankBloodMC extends MovieClip {
}
}//package
Section 102
//tankBulletMC (tankBulletMC)
package {
import flash.display.*;
public dynamic class tankBulletMC extends MovieClip {
}
}//package
Section 103
//trailMC (trailMC)
package {
import flash.display.*;
public dynamic class trailMC extends MovieClip {
}
}//package
Section 104
//tree0 (tree0)
package {
import flash.display.*;
public dynamic class tree0 extends MovieClip {
}
}//package
Section 105
//tree1 (tree1)
package {
import flash.display.*;
public dynamic class tree1 extends MovieClip {
}
}//package
Section 106
//tree2 (tree2)
package {
import flash.display.*;
public dynamic class tree2 extends MovieClip {
}
}//package
Section 107
//tree3 (tree3)
package {
import flash.display.*;
public dynamic class tree3 extends MovieClip {
}
}//package
Section 108
//turret0 (turret0)
package {
import flash.display.*;
public dynamic class turret0 extends MovieClip {
}
}//package
Section 109
//turret1 (turret1)
package {
import flash.display.*;
public dynamic class turret1 extends MovieClip {
}
}//package
Section 110
//turret2 (turret2)
package {
import flash.display.*;
public dynamic class turret2 extends MovieClip {
}
}//package
Section 111
//turret3 (turret3)
package {
import flash.display.*;
public dynamic class turret3 extends MovieClip {
}
}//package
Section 112
//turretBloodMC (turretBloodMC)
package {
import flash.display.*;
public dynamic class turretBloodMC extends MovieClip {
}
}//package
Section 113
//turretBulletMC (turretBulletMC)
package {
import flash.display.*;
public dynamic class turretBulletMC extends MovieClip {
}
}//package
Section 114
//upgradesMC (upgradesMC)
package {
import fl.controls.*;
import flash.display.*;
import flash.text.*;
public dynamic class upgradesMC extends MovieClip {
public var bomb:Slider;
public var repairs:TextField;
public var scoreAfter:TextField;
public var nextBtn:SimpleButton;
public var scoreBefore:TextField;
public var bombs:TextField;
public var machineGun:Slider;
public var straight:Slider;
public var rockets:TextField;
}
}//package
Section 115
//weaponsMC (weaponsMC)
package {
import flash.display.*;
public dynamic class weaponsMC extends MovieClip {
}
}//package
Section 116
//Zone (Zone)
package {
public class Zone {
public var _playerBullets:Object;
public var _enemies:Object;
public var _enemyBullets:Object;
public var _playerStraight:Object;
public var _neigh:Array;
public function Zone(_arg1:int, _arg2:int, _arg3:int){
var _local4:*;
var _local5:*;
var _local6:int;
_enemies = new Object();
_enemyBullets = new Object();
_playerBullets = new Object();
_playerStraight = new Object();
_neigh = new Array();
super();
_neigh[0] = new Array(2);
_neigh[0][0] = _arg1;
_neigh[0][1] = _arg2;
_local4 = (_arg1 - 1);
_local5 = (_arg2 - 1);
_local6 = 1;
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = _arg1;
_local5 = (_arg2 - 1);
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = (_arg1 + 1);
_local5 = (_arg2 - 1);
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = (_arg1 - 1);
_local5 = _arg2;
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = (_arg1 + 1);
_local5 = _arg2;
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = (_arg1 - 1);
_local5 = (_arg2 + 1);
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = _arg1;
_local5 = (_arg2 + 1);
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
_local4 = (_arg1 + 1);
_local5 = (_arg2 + 1);
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < _arg3)))) && ((_local5 < _arg3)))){
_neigh[_local6] = new Array(2);
_neigh[_local6][0] = _local4;
_neigh[_local6][1] = _local5;
_local6++;
};
}
}
}//package