Section 1
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 2
//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 3
//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 4
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
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 5
//RadioButton (fl.controls.RadioButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.ui.*;
public class RadioButton extends LabelButton implements IFocusManagerGroup {
protected var _value:Object;
protected var defaultGroupName:String;// = "RadioButtonGroup"
protected var _group:RadioButtonGroup;
private static var defaultStyles:Object = {icon:null, upIcon:"RadioButton_upIcon", downIcon:"RadioButton_downIcon", overIcon:"RadioButton_overIcon", disabledIcon:"RadioButton_disabledIcon", selectedDisabledIcon:"RadioButton_selectedDisabledIcon", selectedUpIcon:"RadioButton_selectedUpIcon", selectedDownIcon:"RadioButton_selectedDownIcon", selectedOverIcon:"RadioButton_selectedOverIcon", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
public function RadioButton(){
defaultGroupName = "RadioButtonGroup";
super();
mode = "border";
groupName = defaultGroupName;
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 * 2));
uiFocusRect.height = (background.height + (_local2 * 2));
};
}
private function setThis():void{
var _local1:RadioButtonGroup;
_local1 = _group;
if (_local1 != null){
if (_local1.selection != this){
_local1.selection = this;
};
} else {
super.selected = true;
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
protected function handleClick(_arg1:MouseEvent):void{
if (_group == null){
return;
};
_group.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.DOWN:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.UP:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.RIGHT:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.SPACE:
setThis();
_toggle = false;
default:
super.keyDownHandler(_arg1);
break;
};
}
private function setNext(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local2.numRadioButtons;
_local6 = _local4;
if (_local4 != -1){
do {
_local6++;
_local6 = ((_local6)>(_local2.numRadioButtons - 1)) ? 0 : _local6;
_local7 = _local2.getRadioButtonAt(_local6);
if (((_local7) && (_local7.enabled))){
if (_arg1){
_local2.selection = _local7;
};
_local7.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local6) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local6 != _local4);
};
}
public function get group():RadioButtonGroup{
return (_group);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
super.keyUpHandler(_arg1);
if ((((_arg1.keyCode == Keyboard.SPACE)) && (!(_toggle)))){
_toggle = true;
};
}
override public function get selected():Boolean{
return (super.selected);
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a RadioButtons toggle."));
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
public function set group(_arg1:RadioButtonGroup):void{
groupName = _arg1.name;
}
override public function set selected(_arg1:Boolean):void{
if ((((_arg1 == false)) || (selected))){
return;
};
if (_group != null){
_group.selection = this;
} else {
super.selected = _arg1;
};
}
override protected function draw():void{
super.draw();
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
addEventListener(MouseEvent.CLICK, handleClick, false, 0, true);
}
public function set groupName(_arg1:String):void{
if (_group != null){
_group.removeRadioButton(this);
_group.removeEventListener(Event.CHANGE, handleChange);
};
_group = ((_arg1)==null) ? null : RadioButtonGroup.getGroup(_arg1);
if (_group != null){
_group.addRadioButton(this);
_group.addEventListener(Event.CHANGE, handleChange, false, 0, true);
};
}
public function get value():Object{
return (_value);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (RadioButton.createAccessibilityImplementation != null){
RadioButton.createAccessibilityImplementation(this);
};
}
public function get groupName():String{
return (((_group)==null) ? null : _group.name);
}
private function setPrev(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:int;
var _local6:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local4;
if (_local4 != -1){
do {
--_local5;
_local5 = ((_local5)==-1) ? (_local2.numRadioButtons - 1) : _local5;
_local6 = _local2.getRadioButtonAt(_local5);
if (((_local6) && (_local6.enabled))){
if (_arg1){
_local2.selection = _local6;
};
_local6.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local5) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local5 != _local4);
};
}
protected function handleChange(_arg1:Event):void{
super.selected = (_group.selection == this);
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 6
//RadioButtonGroup (fl.controls.RadioButtonGroup)
package fl.controls {
import flash.events.*;
public class RadioButtonGroup extends EventDispatcher {
protected var _selection:RadioButton;
protected var radioButtons:Array;
protected var _name:String;
private static var groups:Object;
private static var groupCount:uint = 0;
public function RadioButtonGroup(_arg1:String){
_name = _arg1;
radioButtons = [];
registerGroup(this);
}
public function getRadioButtonIndex(_arg1:RadioButton):int{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function get numRadioButtons():int{
return (radioButtons.length);
}
public function get name():String{
return (_name);
}
public function get selection():RadioButton{
return (_selection);
}
public function set selection(_arg1:RadioButton):void{
if ((((((_selection == _arg1)) || ((_arg1 == null)))) || ((getRadioButtonIndex(_arg1) == -1)))){
return;
};
_selection = _arg1;
dispatchEvent(new Event(Event.CHANGE, true));
}
public function set selectedData(_arg1:Object):void{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3.value == _arg1){
selection = _local3;
return;
};
_local2++;
};
}
public function removeRadioButton(_arg1:RadioButton):void{
var _local2:int;
_local2 = getRadioButtonIndex(_arg1);
if (_local2 != -1){
radioButtons.splice(_local2, 1);
};
if (_selection == _arg1){
_selection = null;
};
}
public function addRadioButton(_arg1:RadioButton):void{
if (_arg1.groupName != name){
_arg1.groupName = name;
return;
};
radioButtons.push(_arg1);
if (_arg1.selected){
selection = _arg1;
};
}
public function getRadioButtonAt(_arg1:int):RadioButton{
return (RadioButton(radioButtons[_arg1]));
}
public function get selectedData():Object{
var _local1:RadioButton;
_local1 = _selection;
return (((_local1)==null) ? null : _local1.value);
}
public static function getGroup(_arg1:String):RadioButtonGroup{
var _local2:RadioButtonGroup;
if (groups == null){
groups = {};
};
_local2 = (groups[_arg1] as RadioButtonGroup);
if (_local2 == null){
_local2 = new RadioButtonGroup(_arg1);
if ((++groupCount % 20) == 0){
cleanUpGroups();
};
};
return (_local2);
}
private static function registerGroup(_arg1:RadioButtonGroup):void{
if (groups == null){
groups = {};
};
groups[_arg1.name] = _arg1;
}
private static function cleanUpGroups():void{
var _local1:String;
var _local2:RadioButtonGroup;
for (_local1 in groups) {
_local2 = (groups[_local1] as RadioButtonGroup);
if (_local2.radioButtons.length == 0){
delete groups[_local1];
};
};
}
}
}//package fl.controls
Section 7
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 8
//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 9
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import flash.utils.*;
import fl.events.*;
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 10
//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 11
//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 12
//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 13
//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 14
//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 15
//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 16
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 17
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.2");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace("Unable to invoke callback method.");
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace("Unable to invoke callback method on object.");
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var _local5:MovieClip;
_local5 = new MovieClip();
if (_arg4){
if (((false) && (_arg3))){
_arg1.addChildAt(_local5, _arg3);
} else {
_arg1.addChild(_local5);
};
};
_arg1[_arg2] = _local5;
_local5["_name"] = _arg2;
return (_local5);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 18
//assets_7 (Shooting_fla.assets_7)
package Shooting_fla {
import flash.display.*;
public dynamic class assets_7 extends MovieClip {
public function assets_7(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
stop();
}
}
}//package Shooting_fla
Section 19
//help1_50 (Shooting_fla.help1_50)
package Shooting_fla {
import flash.display.*;
import flash.text.*;
public dynamic class help1_50 extends MovieClip {
public var helpText:TextField;
}
}//package Shooting_fla
Section 20
//Kongintro30fps_80 (Shooting_fla.Kongintro30fps_80)
package Shooting_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class Kongintro30fps_80 extends MovieClip {
public function Kongintro30fps_80(){
addFrameScript(0, frame1, 179, frame180);
}
public function myClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=aliensmustdie"));
}
function frame180(){
MovieClip(parent).play();
stage.removeEventListener(MouseEvent.CLICK, myClick);
}
function frame1(){
MovieClip(parent).stop();
stage.addEventListener(MouseEvent.CLICK, myClick);
}
}
}//package Shooting_fla
Section 21
//levelUpAnim_55 (Shooting_fla.levelUpAnim_55)
package Shooting_fla {
import flash.display.*;
import flash.text.*;
public dynamic class levelUpAnim_55 extends MovieClip {
public var textstring:TextField;
}
}//package Shooting_fla
Section 22
//MainTimeline (Shooting_fla.MainTimeline)
package Shooting_fla {
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var robotjam:MovieClip;
public var adIDLongAnimals;
public var loaderBack:MovieClip;
public var preloaderMC:MovieClip;
public var adIDRobotJam;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 9, frame10, 18, frame19);
}
function frame10(){
stop();
loaderBack.play();
}
function frame1(){
if (Licensors.CanUseMochiAds()){
preloaderMC.visible = false;
adIDLongAnimals = "0067585d608ea9c9";
adIDRobotJam = "0f51714860a20438";
if (Math.random() < 0.25){
MochiAd.showPreGameAd({clip:root, id:adIDRobotJam, res:"640x480", background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
} else {
MochiAd.showPreGameAd({clip:root, id:adIDLongAnimals, res:"640x480", background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
};
};
}
function frame19(){
stop();
}
function frame2(){
preloaderMC.stop();
}
}
}//package Shooting_fla
Section 23
//MillipedeClip_97 (Shooting_fla.MillipedeClip_97)
package Shooting_fla {
import flash.display.*;
public dynamic class MillipedeClip_97 extends MovieClip {
public function MillipedeClip_97(){
addFrameScript(0, frame1, 139, frame140);
}
function frame1(){
MovieClip(parent).stop();
}
function frame140(){
MovieClip(parent).play();
}
}
}//package Shooting_fla
Section 24
//OnClip_107 (Shooting_fla.OnClip_107)
package Shooting_fla {
import flash.display.*;
public dynamic class OnClip_107 extends MovieClip {
public function OnClip_107(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Shooting_fla
Section 25
//orbits_104 (Shooting_fla.orbits_104)
package Shooting_fla {
import flash.display.*;
public dynamic class orbits_104 extends MovieClip {
public function orbits_104(){
addFrameScript(0, frame1, 199, frame200);
}
function frame200(){
this.gotoAndPlay(2);
}
function frame1(){
this.gotoAndPlay(Math.round((Math.random() * 100)));
}
}
}//package Shooting_fla
Section 26
//robologo_100 (Shooting_fla.robologo_100)
package Shooting_fla {
import flash.display.*;
public dynamic class robologo_100 extends MovieClip {
public function robologo_100(){
addFrameScript(0, frame1, 1, frame2, 129, frame130);
}
function frame1(){
MovieClip(parent).stop();
this.visible = false;
}
function frame2(){
this.visible = true;
}
function frame130(){
MovieClip(parent).play();
}
}
}//package Shooting_fla
Section 27
//sun_1 (Shooting_fla.sun_1)
package Shooting_fla {
import flash.display.*;
public dynamic class sun_1 extends MovieClip {
public function sun_1(){
addFrameScript(34, frame35, 65, frame66);
}
function frame35(){
stop();
}
function frame66(){
stop();
MovieClip(parent).play();
}
}
}//package Shooting_fla
Section 28
//Achivements (Achivements)
package {
public class Achivements {
public static const ACH_MAX_TIME_AT_MAX_HEALTH = 1;
public static const ACH_MAX_NO_PICKUP_TIME = 4;
public static const ACH_SURVIVED_METEORSHOWER = 5;
public static const ACH_MAX_KILL_STREAK = 7;
public static const ACH_MAX_PICKUP_STREAK = 3;
public static const ACH_MAX_WAVE = 2;
public static const ACH_MAX_MULTIPLIER = 0;
public static const ACH_DESTROYED_MOTHERSHIP = 6;
public static function Submit(_arg1:int, _arg2:int):void{
if (Licensors.IsHosted() == true){
trace(((("Achievement submitted: " + _arg1) + " : ") + _arg2));
if (_arg1 == ACH_MAX_MULTIPLIER){
LongAnimals_Kongregate.kongregate.stats.submit("MaxMultiplier", _arg2);
};
if (_arg1 == ACH_MAX_TIME_AT_MAX_HEALTH){
LongAnimals_Kongregate.kongregate.stats.submit("MaxTimeAtMaxHealth", _arg2);
};
if (_arg1 == ACH_MAX_WAVE){
LongAnimals_Kongregate.kongregate.stats.submit("MaxWave", _arg2);
};
if (_arg1 == ACH_MAX_PICKUP_STREAK){
LongAnimals_Kongregate.kongregate.stats.submit("PickupStreakWithoutBeingHit", _arg2);
};
if (_arg1 == ACH_MAX_NO_PICKUP_TIME){
LongAnimals_Kongregate.kongregate.stats.submit("MaxTimeWithNoPickups", _arg2);
};
if (_arg1 == ACH_MAX_KILL_STREAK){
LongAnimals_Kongregate.kongregate.stats.submit("KillStreakWithoutBeingHit", _arg2);
};
if (_arg1 == ACH_SURVIVED_METEORSHOWER){
LongAnimals_Kongregate.kongregate.stats.submit("Meteor", _arg2);
};
if (_arg1 == ACH_DESTROYED_MOTHERSHIP){
LongAnimals_Kongregate.kongregate.stats.submit("Mothership", _arg2);
};
};
}
}
}//package
Section 29
//BackgroundFar (BackgroundFar)
package {
import flash.display.*;
public dynamic class BackgroundFar extends MovieClip {
}
}//package
Section 30
//BackgroundImage (BackgroundImage)
package {
import flash.display.*;
public dynamic class BackgroundImage extends MovieClip {
}
}//package
Section 31
//BackgroundMiddle (BackgroundMiddle)
package {
import flash.display.*;
public dynamic class BackgroundMiddle extends MovieClip {
}
}//package
Section 32
//Backgrounds (Backgrounds)
package {
import flash.display.*;
public dynamic class Backgrounds extends MovieClip {
}
}//package
Section 33
//bar_health (bar_health)
package {
import flash.display.*;
public dynamic class bar_health extends MovieClip {
}
}//package
Section 34
//bar_multiplier (bar_multiplier)
package {
import flash.display.*;
public dynamic class bar_multiplier extends MovieClip {
}
}//package
Section 35
//bar_pickup (bar_pickup)
package {
import flash.display.*;
public dynamic class bar_pickup extends MovieClip {
}
}//package
Section 36
//bar_power (bar_power)
package {
import flash.display.*;
public dynamic class bar_power extends MovieClip {
}
}//package
Section 37
//bonus_healthGFX (bonus_healthGFX)
package {
import flash.display.*;
public dynamic class bonus_healthGFX extends MovieClip {
}
}//package
Section 38
//bonus_multiplierGFX (bonus_multiplierGFX)
package {
import flash.display.*;
public dynamic class bonus_multiplierGFX extends MovieClip {
}
}//package
Section 39
//bonus_scoreGFX (bonus_scoreGFX)
package {
import flash.display.*;
public dynamic class bonus_scoreGFX extends MovieClip {
}
}//package
Section 40
//bonus_shieldGFX (bonus_shieldGFX)
package {
import flash.display.*;
public dynamic class bonus_shieldGFX extends MovieClip {
}
}//package
Section 41
//ButtonHighScores (ButtonHighScores)
package {
import flash.display.*;
public dynamic class ButtonHighScores extends SimpleButton {
}
}//package
Section 42
//ButtonMainMenu (ButtonMainMenu)
package {
import flash.display.*;
public dynamic class ButtonMainMenu extends SimpleButton {
}
}//package
Section 43
//ButtonMoreGames (ButtonMoreGames)
package {
import flash.display.*;
public dynamic class ButtonMoreGames extends SimpleButton {
}
}//package
Section 44
//ButtonStart (ButtonStart)
package {
import flash.display.*;
public dynamic class ButtonStart extends SimpleButton {
}
}//package
Section 45
//Checkpoint (Checkpoint)
package {
import flash.display.*;
public dynamic class Checkpoint extends MovieClip {
}
}//package
Section 46
//CloudLayer (CloudLayer)
package {
import flash.display.*;
public dynamic class CloudLayer extends MovieClip {
}
}//package
Section 47
//commetClip (commetClip)
package {
import flash.display.*;
public dynamic class commetClip extends MovieClip {
}
}//package
Section 48
//CrosshairGFX (CrosshairGFX)
package {
import flash.display.*;
public dynamic class CrosshairGFX extends MovieClip {
}
}//package
Section 49
//die1 (die1)
package {
import flash.media.*;
public dynamic class die1 extends Sound {
}
}//package
Section 50
//DisplayObj (DisplayObj)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class DisplayObj {
var frames:Array;
public var frame:int;
public function DisplayObj(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
frame = 0;
CreateBitmapsFromMovieClip(_arg1, _arg2, _arg3);
}
public function GetBitmap():Bitmap{
return (frames[frame].bitmap);
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
frames[frame].RenderAt(_arg1, _arg2, _arg3);
}
public function SetFrame(_arg1:int){
frame = _arg1;
if (frame < 0){
frame = 0;
};
if (frame >= frames.length){
frame = (frames.length - 1);
};
}
public function CreateBitmapsFromMovieClip(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
var _local4:int;
var _local5:*;
var _local6:Rectangle;
var _local7:*;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Bitmap;
var _local13:BitmapData;
frames = new Array();
_local4 = 0;
while (_local4 < _arg1.totalFrames) {
_local5 = new DisplayObjFrame();
_local6 = _arg1.getBounds(null);
_local7 = new Matrix();
if (_arg3 == 0){
_local8 = _local6.left;
_local9 = _local6.top;
_local7.scale(_arg2, _arg2);
_local7.translate((-(_local8) * _arg2), (-(_local9) * _arg2));
_local5.xoffset = (_local8 * _arg2);
_local5.yoffset = (_local9 * _arg2);
} else {
_local10 = _local6.left;
_local11 = _local6.top;
_local7.scale(_arg2, _arg2);
_local7.translate((-(_local10) * _arg2), (-(_local11) * _arg2));
_local5.xoffset = (_local10 * _arg2);
_local5.yoffset = (_local11 * _arg2);
};
if ((((_arg1.width == 0)) || ((_arg1.height == 0)))){
} else {
_local12 = new Bitmap();
_local13 = new BitmapData((_arg1.width * _arg2), (_arg1.height * _arg2), true, 0);
_local13.draw(_arg1, _local7);
_local12.bitmapData = _local13;
_local5.bitmap = _local12;
_local5.mat = new Matrix();
_local5.colTrans = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
frames.push(_local5);
};
_arg1.nextFrame();
_local4++;
};
}
public function GetWidth():Number{
return (frames[frame].bitmap.width);
}
public function GetMaxFrames():int{
return (frames.length);
}
public function GetXOffset():Number{
return (frames[frame].xoffset);
}
public function GetYOffset():Number{
return (frames[frame].yoffset);
}
public function GetFrame():int{
return (frame);
}
public function RenderAtAdditive(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
frames[frame].RenderAtAdditive(_arg1, _arg2, _arg3, _arg4);
}
public function GetHeight():Number{
return (frames[frame].bitmap.height);
}
public function GetFrameWidth(_arg1:int):Number{
return (frames[_arg1].bitmap.width);
}
public function GetScaledBitmap():Bitmap{
return (frames[frame].scaledBitmap);
}
}
}//package
Section 51
//DisplayObjFrame (DisplayObjFrame)
package {
import flash.display.*;
import flash.geom.*;
public class DisplayObjFrame {
public var mat:Matrix;
public var colTrans:ColorTransform;
public var xoffset:Number;
public var yoffset:Number;
public var bitmap:Bitmap;
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
_arg1.copyPixels(bitmap.bitmapData, new Rectangle(0, 0, bitmap.width, bitmap.height), new Point((_arg2 + xoffset), (_arg3 + yoffset)));
}
public function RenderAtAdditive(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local5 = _arg2;
_local6 = _arg3;
_local7 = xoffset;
_local8 = yoffset;
_local5 = (_local5 + _local7);
_local6 = (_local6 + _local8);
if (_local5 < -50){
return;
};
if (_local6 < -50){
return;
};
if (_local5 > 700){
return;
};
if (_local6 > 600){
return;
};
mat.identity();
mat.translate(_local5, _local6);
colTrans.alphaMultiplier = _arg4;
if (bitmap != null){
if (bitmap.bitmapData != null){
_arg1.draw(bitmap.bitmapData, mat, colTrans, "add");
};
};
}
}
}//package
Section 52
//Enemy1 (Enemy1)
package {
import flash.display.*;
public dynamic class Enemy1 extends MovieClip {
}
}//package
Section 53
//Enemy2 (Enemy2)
package {
import flash.display.*;
public dynamic class Enemy2 extends MovieClip {
}
}//package
Section 54
//Enemy3 (Enemy3)
package {
import flash.display.*;
public dynamic class Enemy3 extends MovieClip {
}
}//package
Section 55
//Enemy4 (Enemy4)
package {
import flash.display.*;
public dynamic class Enemy4 extends MovieClip {
}
}//package
Section 56
//Enemy5a (Enemy5a)
package {
import flash.display.*;
public dynamic class Enemy5a extends MovieClip {
}
}//package
Section 57
//Enemy5b (Enemy5b)
package {
import flash.display.*;
public dynamic class Enemy5b extends MovieClip {
}
}//package
Section 58
//Enemy5c (Enemy5c)
package {
import flash.display.*;
public dynamic class Enemy5c extends MovieClip {
}
}//package
Section 59
//Enemy6 (Enemy6)
package {
import flash.display.*;
public dynamic class Enemy6 extends MovieClip {
}
}//package
Section 60
//Enemy7 (Enemy7)
package {
import flash.display.*;
public dynamic class Enemy7 extends MovieClip {
}
}//package
Section 61
//Enemy8a (Enemy8a)
package {
import flash.display.*;
public dynamic class Enemy8a extends MovieClip {
}
}//package
Section 62
//Enemy8b (Enemy8b)
package {
import flash.display.*;
public dynamic class Enemy8b extends MovieClip {
}
}//package
Section 63
//EnemyDef (EnemyDef)
package {
public class EnemyDef {
var hp:int;
var shootTime:Number;
var score:int;
var shootMissileType:int;
var type:int;
public function EnemyDef(_arg1:int, _arg2:int, _arg3:Number, _arg4:int, _arg5:int){
type = _arg1;
hp = _arg2;
shootTime = _arg3;
score = _arg4;
shootMissileType = _arg5;
}
}
}//package
Section 64
//EnemyHitSFX (EnemyHitSFX)
package {
import flash.media.*;
public dynamic class EnemyHitSFX extends Sound {
}
}//package
Section 65
//EnemyKilledSFX (EnemyKilledSFX)
package {
import flash.media.*;
public dynamic class EnemyKilledSFX extends Sound {
}
}//package
Section 66
//ExitMC (ExitMC)
package {
import flash.display.*;
public dynamic class ExitMC extends MovieClip {
}
}//package
Section 67
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 68
//Font20 (Font20)
package {
import flash.text.*;
public dynamic class Font20 extends Font {
}
}//package
Section 69
//gameobj (gameobj)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class gameobj {
public var bonusType:int;
var graphicID:int;
var externyvel:Number;
public var xvel:Number;
var multiplierFrame:int;
var ftime:Number;
var minFrame:int;
var rotVel:Number;
public var speed:Number;
var yoffset:Number;
var startx:Number;
public var ypos2:Number;
var starty:Number;
var shootTimer:Number;
var maxFrame:int;
public var visible:Boolean;
public var yvel:Number;
public var dir:Number;
public var radius:Number;
public var controlMode:int;
public var xpos2:Number;
public var xpos:Number;
var extraInfo:int;
public var enemyType:int;
public var frameVel:Number;
public var xacc:Number;
var xoffset:Number;
public var active:Boolean;
public var count:int;
public var hp:int;
var shootTimerMax:Number;
public var appearingTimer:Number;
public var countable:Boolean;
var flashTimer:Number;
public var type:int;
public var ypos:Number;
public var enemyMissileMode:int;
var timer:Number;
public var bitList:Array;
public var yacc:Number;
var frame:Number;
public var hitTimer:Number;
public var controlIndex:int;
public var subtype:int;
var flashFlag:Boolean;
public var oldxpos:Number;
public var coordListX:Array;
public var coordListY:Array;
var timer1:Number;
public var zpos:Number;
public var toPosX:Number;
public var toPosY:Number;
var dist:Number;
var main:Main;
public var baseID:int;
var externxvel:Number;
var userVarNumber:Number;
public var numBits:int;
public var homingGO:gameobj;
public var pickupType:int;
public var handleRender:Boolean;
var timerMax:Number;
var shootMissileType:int;
public var oldypos:Number;
public var radius2:Number;
public var explosionType:int;
var scoreFrame:int;
var flashTimerMax:Number;
static const gotype_BACKGROUND_OBJ = 5;
static const gotype_ENEMY = 4;
static const gotype_ENEMY_MISSILE = 8;
static const gotype_OVERLAY = 12;
static const gotype_EXPLOSION = 3;
static const gotype_GENERIC = 0;
static const gotype_PLAYER = 7;
static const gotype_POWERUP = 10;
static const gotype_CROSSHAIR = 9;
static const gotype_MISSILE = 2;
static const gotype_BACKGROUND = 1;
static const gotype_BONUS = 11;
static const gotype_PICKUP = 6;
public function gameobj(_arg1, _arg2, _arg3){
xpos = _arg2;
ypos = _arg3;
zpos = 1;
startx = _arg2;
starty = _arg3;
active = false;
main = _arg1;
zpos = 0;
graphicID = 0;
frame = 0;
frameVel = 0;
controlIndex = 0;
timer = 0;
timer1 = 0;
radius = 16;
minFrame = 0;
maxFrame = 0;
handleRender = true;
shootTimer = 0;
shootTimerMax = 0;
shootMissileType = 0;
coordListX = new Array(32);
coordListY = new Array(32);
bitList = new Array(32);
numBits = 0;
countable = true;
flashTimer = 0;
flashFlag = true;
extraInfo = 0;
}
public function LimitVel(_arg1:Number){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = Math.sqrt(((xvel * xvel) + (yvel * yvel)));
_local3 = (xvel / _local2);
_local4 = (yvel / _local2);
if (_local2 > _arg1){
xvel = (_local3 * _arg1);
yvel = (_local4 * _arg1);
};
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public function InitSplitEnemy5(_arg1:Number, _arg2:int){
subtype = Main.enemy_asteroid;
dir = RandCircle();
GetVelFromDir(1);
speed = _arg1;
graphicID = _arg2;
}
function DoExternalVel():void{
var _local1:Number;
xpos = (xpos + (externxvel * ftime));
ypos = (ypos + (externyvel * ftime));
_local1 = 0.9;
externxvel = (externxvel * _local1);
externyvel = (externyvel * _local1);
}
function Anim_AimAtPlayer():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = GetNumFrames();
_local2 = (main.goPlayer.xpos - xpos);
_local3 = (main.goPlayer.ypos - ypos);
_local4 = Math.atan2(_local2, _local3);
frame = ((_local1 / (Math.PI * 2)) * -(_local4));
if (frame < 0){
frame = (frame + _local1);
};
if (frame > _local1){
frame = (frame - _local1);
};
frame = (frame + (_local1 / 2));
if (frame > _local1){
frame = (frame - _local1);
};
}
function LimitNumberToRange(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
_arg1 = _arg2;
};
if (_arg1 > _arg3){
_arg1 = _arg3;
};
return (_arg1);
}
public function InitEnemy(_arg1:int):void{
radius2 = (30 * 30);
if (_arg1 == 0){
InitEnemy0();
} else {
if (_arg1 == 1){
InitEnemy1();
} else {
if (_arg1 == 2){
InitEnemy2();
} else {
if (_arg1 == 3){
InitEnemy3();
} else {
if (_arg1 == 4){
InitEnemy4();
} else {
if (_arg1 == 5){
InitEnemy5();
} else {
if (_arg1 == 6){
InitEnemy6();
} else {
if (_arg1 == 7){
InitEnemy7();
} else {
if (_arg1 == 8){
InitEnemy8();
} else {
if (_arg1 == 9){
InitEnemy9();
} else {
if (_arg1 == 10){
InitEnemy10();
};
};
};
};
};
};
};
};
};
};
};
}
public function InitEnemy10(){
radius2 = (20 * 20);
subtype = Main.enemy_meteor;
ypos = RandBetween(-(main.scrollH), main.scrollH);
speed = RandBetween(3, 6);
graphicID = Main.gfx_enemy10;
if (extraInfo == 0){
xpos = (main.scrollW + 100);
yvel = 1;
xvel = -1;
xvel = (xvel + RandBetween(-0.2, 0.2));
xvel = (xvel - RandBetween(-0.2, 0.2));
};
if (extraInfo == 1){
if (RandBetween(0, 100) > 50){
xpos = (main.scrollW + 100);
yvel = 1;
xvel = -1;
xvel = (xvel + RandBetween(-0.2, 0.2));
xvel = (xvel - RandBetween(-0.2, 0.2));
} else {
xpos = -100;
yvel = 1;
xvel = 1;
xvel = (xvel + RandBetween(-0.2, 0.2));
xvel = (xvel - RandBetween(-0.2, 0.2));
};
};
}
public function InitFromEnemyDef(){
var _local1:EnemyDef;
_local1 = main.enemyDefs[subtype];
hp = _local1.hp;
shootTimerMax = _local1.shootTime;
shootMissileType = _local1.shootMissileType;
}
function UpdateEnemy10():void{
var _local1:Number;
timer = (timer + ftime);
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
frameVel = 0.5;
CycleAnimation();
DoExternalVel();
_local1 = 10;
main.AddParticle((xpos - (xvel * _local1)), (ypos - (yvel * _local1)), Particles.type_meteorExhaust, 0, 1);
if ((ypos > (main.scrollH + 32))){
main.OnEnemyOffMap(this);
active = false;
};
}
function HandleFlash(){
flashTimerMax = 10;
flashTimer = (flashTimer + ftime);
if (flashTimer >= flashTimerMax){
flashTimer = 0.01;
if (flashFlag == false){
flashFlag = true;
} else {
flashFlag = false;
};
};
}
public function PlayAnimation():Boolean{
var _local1:*;
frame = (frame + frameVel);
_local1 = (main.graphicobjs[graphicID].GetMaxFrames() - 1);
if (frame >= _local1){
frame = _local1;
return (true);
};
return (false);
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:*;
_local5 = Math.atan2((_arg3 - _arg1), (_arg4 - _arg2));
return (_local5);
}
public function SetType(_arg1:int):void{
var _local2:int;
var _local3:Number;
_local2 = 0;
_local3 = 0;
type = _arg1;
controlMode = _local2;
xvel = _local3;
frame = _local3;
frameVel = _local3;
timer = _local3;
hitTimer = _local3;
hp = 1;
handleRender = true;
visible = true;
shootTimer = _local3;
shootTimerMax = _local3;
externxvel = _local3;
externyvel = _local3;
appearingTimer = _local3;
countable = true;
flashTimer = _local3;
flashFlag = true;
extraInfo = _local2;
if (type == gotype_PICKUP){
} else {
if (type == gotype_BACKGROUND){
} else {
if (type == gotype_CROSSHAIR){
graphicID = Main.gfx_crosshair;
} else {
if (type == gotype_MISSILE){
} else {
if (type == gotype_ENEMY_MISSILE){
enemyMissileMode = 0;
} else {
if (type == gotype_EXPLOSION){
} else {
if (type == gotype_ENEMY){
graphicID = Main.gfx_enemy1;
} else {
if (type == gotype_BACKGROUND_OBJ){
} else {
if (type == gotype_PLAYER){
graphicID = Main.gfx_player;
} else {
if (type == gotype_BONUS){
graphicID = Main.gfx_bonus_score;
} else {
if (type == gotype_OVERLAY){
graphicID = Main.gfx_levelup;
};
};
};
};
};
};
};
};
};
};
};
}
public function CycleAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + frameVel);
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
frame = (frame - _local2);
_local1 = true;
};
if (frame < minFrame){
frame = (frame + _local2);
_local1 = true;
};
return (_local1);
}
function UpdateBonus(){
frameVel = 0.5;
CycleAnimation();
timer = (timer + ftime);
if (timer > (50 * 10)){
active = false;
};
if (timer > (50 * 7)){
HandleFlash();
};
}
function SetEdgePos():int{
var _local1:Number;
_local1 = 50;
if (RandBetween(0, 100) < 50){
ypos = RandBetween(0, 800);
xpos = (0 - _local1);
if (RandBetween(0, 100) < 50){
xpos = (800 + _local1);
return (1);
};
return (3);
} else {
xpos = RandBetween(0, 800);
ypos = (0 - _local1);
//unresolved if
ypos = (800 + _local1);
};
return (!NULL!);
return (0);
}
function IsInWorld(_arg1:Number):Boolean{
if (xpos < (0 - _arg1)){
return (false);
};
if (ypos < (0 - _arg1)){
return (false);
};
if (xpos > (main.scrollW + _arg1)){
return (false);
};
if (ypos > (main.scrollH + _arg1)){
return (false);
};
return (true);
}
function UpdatePickup(){
timer = (timer - ftime);
if (timer < 0){
active = false;
};
if (timer < (50 * 3)){
HandleFlash();
};
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
DoExternalVel();
frameVel = 0.5;
CycleAnimation();
}
function KillEnemy5(){
var _local1:gameobj;
if (graphicID == Main.gfx_enemy6a){
_local1 = main.objs.AddObj(gotype_ENEMY, xpos, ypos, zpos, 0, 0);
_local1.InitSplitEnemy5((speed * 2), Main.gfx_enemy6b);
_local1.hp = 3;
_local1.countable = false;
_local1.radius2 = (20 * 20);
_local1 = main.objs.AddObj(gotype_ENEMY, xpos, ypos, zpos, 0, 0);
_local1.InitSplitEnemy5((speed * 2), Main.gfx_enemy6b);
_local1.hp = 3;
_local1.countable = false;
_local1.radius2 = (20 * 20);
};
if (graphicID == Main.gfx_enemy6b){
_local1 = main.objs.AddObj(gotype_ENEMY, xpos, ypos, zpos, 0, 0);
_local1.InitSplitEnemy5((speed * 2), Main.gfx_enemy6c);
_local1.countable = false;
_local1.hp = 1;
_local1.radius2 = (10 * 10);
_local1 = main.objs.AddObj(gotype_ENEMY, xpos, ypos, zpos, 0, 0);
_local1.InitSplitEnemy5((speed * 2), Main.gfx_enemy6c);
_local1.countable = false;
_local1.hp = 1;
_local1.radius2 = (10 * 10);
};
}
public function InitBonus(){
if (subtype == Main.bonus_score){
graphicID = Main.gfx_bonus_score;
};
if (subtype == Main.bonus_shield){
graphicID = Main.gfx_bonus_shield;
};
if (subtype == Main.bonus_health){
graphicID = Main.gfx_bonus_health;
};
if (subtype == Main.bonus_multiplier){
graphicID = Main.gfx_bonus_multiplier;
};
}
public function Update():void{
var _local1:int;
ftime = main.ftime;
if (type == gotype_OVERLAY){
frameVel = 0.5;
PlayAnimation();
timer = (timer - ftime);
if (timer < 0){
active = false;
};
} else {
if (type == gotype_PLAYER){
} else {
if (type == gotype_PICKUP){
UpdatePickup();
} else {
if (type == gotype_POWERUP){
UpdatePowerup();
} else {
if (type == gotype_CROSSHAIR){
frameVel = 1;
CycleAnimation();
} else {
if (type == gotype_BACKGROUND_OBJ){
} else {
if (type == gotype_BACKGROUND){
} else {
if (type == gotype_ENEMY_MISSILE){
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
timer = (timer - ftime);
if (IsInWorld(32) == false){
active = false;
};
} else {
if (type == gotype_MISSILE){
if ((((((subtype == 0)) || ((subtype == 1)))) || ((subtype == 2)))){
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
if (IsInWorld(32) == false){
active = false;
};
};
if (subtype == 10){
UpdateHomingMissile();
};
} else {
if (type == gotype_EXPLOSION){
_local1 = frame;
radius = (main.graphicobjs[graphicID].GetFrameWidth(_local1) * 0.5);
if (PlayAnimation() == true){
if (explosionType == 0){
if (count == 0){
main.everyMissileCountsBonus = false;
};
if (count > 1){
main.multiHitBonus = (main.multiHitBonus + (count - 1));
};
};
active = false;
};
} else {
if (type == gotype_BONUS){
UpdateBonus();
} else {
if (type == gotype_ENEMY){
if (appearingTimer > 0){
appearingTimer = (appearingTimer - ftime);
return;
};
if (subtype == 0){
UpdateEnemy0();
} else {
if (subtype == 1){
UpdateEnemy1();
} else {
if (subtype == 2){
UpdateEnemy2();
} else {
if (subtype == 3){
UpdateEnemy3();
} else {
if (subtype == 4){
UpdateEnemy4();
} else {
if (subtype == 5){
UpdateEnemy5();
} else {
if (subtype == 6){
UpdateEnemy6();
} else {
if (subtype == 7){
UpdateEnemy7();
} else {
if (subtype == 8){
UpdateEnemy8();
} else {
if (subtype == 9){
UpdateEnemy9();
} else {
if (subtype == 10){
UpdateEnemy10();
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
function BounceOffWorldEdges(){
if (xpos > main.scrollW){
xpos = main.scrollW;
xvel = -(xvel);
};
if (xpos < 0){
xpos = 0;
xvel = -(xvel);
};
if (ypos > main.scrollH){
ypos = main.scrollH;
yvel = -(yvel);
};
if (ypos < 0){
ypos = 0;
yvel = -(yvel);
};
}
public function InitEnemy1(){
subtype = Main.enemy_moveToPlayerRot;
speed = RandBetween(2, 3.5);
rotVel = RandBetween(0.02, 0.1);
dir = 0;
SetEdgePos();
graphicID = Main.gfx_enemy2;
}
public function InitEnemy2(){
subtype = Main.enemy_hoverAroundPlayer;
speed = RandBetween(3, 5);
rotVel = RandBetween(0.02, 0.1);
dir = RandCircle();
SetEdgePos();
graphicID = Main.gfx_enemy3;
rotVel = RandBetweenRandNeg(0.01, 0.03);
dist = RandBetween(100, 300);
timer = RandBetween(100, 300);
}
public function InitEnemy3(){
subtype = Main.enemy_zigzagToPlayer;
speed = RandBetween(2, 4);
rotVel = RandBetween(0.01, 0.03);
dir = 0;
dir = 0;
SetEdgePos();
graphicID = Main.gfx_enemy4;
timerMax = RandBetween(50, 60);
}
public function InitEnemy4(){
var _local1:int;
var _local2:Number;
subtype = Main.enemy_heavySprayer;
_local1 = SetEdgePos();
_local2 = 1;
graphicID = Main.gfx_enemy5;
frameVel = 0.5;
xvel = (main.goPlayer.xpos - xpos);
yvel = (main.goPlayer.ypos - ypos);
MakeUnitVel();
speed = RandBetween(1, 2);
startx = xpos;
starty = ypos;
}
public function InitEnemy5(){
subtype = Main.enemy_asteroid;
SetRandomMapPos();
dir = RandCircle();
GetVelFromDir(1);
speed = 1;
graphicID = Main.gfx_enemy6a;
}
public function InitEnemy6(){
subtype = Main.enemy_stopGoAroundPlayer;
speed = RandBetween(3, 6);
SetRandomMapPos();
graphicID = Main.gfx_enemy7;
timerMax = RandBetween(50, 60);
Enemy6_SetToPosNearPlayer();
}
public function InitEnemy7(){
subtype = Main.enemy_zippyBulletDodger;
speed = 5;
SetRandomMapPos();
graphicID = Main.gfx_enemy8;
timerMax = RandBetween(50, 60);
SetEdgePos();
xpos2 = RandBetween(-1, 1);
ypos2 = RandBetween(100, 300);
dir = 1;
rotVel = RandBetween(0.03, 0.07);
shootTimer = RandBetween(0, shootTimerMax);
}
public function InitEnemy8(){
var _local1:int;
radius2 = (60 * 60);
subtype = Main.enemy_fatShielded;
speed = RandBetween(0.5, 1.5);
SetRandomMapPos();
graphicID = Main.gfx_enemy9a;
timerMax = RandBetween(50, 60);
dir = 0;
rotVel = RandBetween(0.1, 0.2);
numBits = 8;
_local1 = 0;
while (_local1 < numBits) {
coordListX[_local1] = xpos;
coordListY[_local1] = ypos;
_local1++;
};
xacc = RandBetween(0, 6);
yacc = RandBetweenRandNeg(0.01, 0.03);
}
public function InitEnemy9(){
subtype = Main.enemy_jellyfish;
xpos = RandBetween(0, main.scrollW);
startx = xpos;
speed = RandBetween(3, 6);
graphicID = Main.gfx_enemy4;
xoffset = RandBetween(0, 7);
yoffset = RandBetween(0, 7);
xacc = RandBetween(0.02, 0.08);
yacc = RandBetween(0.02, 0.08);
if (extraInfo == 0){
ypos = (main.scrollH + 32);
yvel = -2;
} else {
if (extraInfo == 1){
if (RandBetween(0, 100) > 50){
ypos = (main.scrollH + 32);
yvel = -2;
} else {
ypos = -32;
yvel = 2;
};
};
};
}
function GetLen(_arg1, _arg2):Number{
var _local3:*;
_local3 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
return (_local3);
}
public function InitPowerup(){
type = gotype_POWERUP;
graphicID = Main.gfx_pickup2;
dir = RandCircle();
GetVelFromDir(1);
speed = RandBetween(4, 8);
externxvel = 0;
externyvel = 0;
timer1 = 0;
controlMode = 0;
}
function RenderEnemy8():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
_local1 = Main.gfx_enemy9b;
main.graphicobjs[_local1].SetFrame(frame);
_local2 = 0;
while (_local2 < numBits) {
_local3 = (coordListX[_local2] - main.scrollX);
_local4 = (coordListY[_local2] - main.scrollY);
main.graphicobjs[_local1].RenderAt(main.screenBD, _local3, _local4);
_local2++;
};
}
public function InitEnemy0():void{
var _local1:Number;
var _local2:Number;
subtype = Main.enemy_accelToPlayer;
SetRandomMapPos();
_local1 = (main.goPlayer.xpos - xpos);
_local2 = (main.goPlayer.ypos - ypos);
dir = Math.atan2(_local1, _local2);
GetVelFromDir(1);
speed = 0;
graphicID = Main.gfx_enemy1;
timer = RandBetween(0, 10);
}
public function RotDistTowards(_arg1:Number, _arg2:Number):Number{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:Number;
_local3 = 3.141592658;
_local4 = (_local3 * 2);
_local5 = Math.sin(_arg1);
_local6 = Math.cos(_arg1);
_local7 = Math.sin(_arg2);
_local8 = Math.cos(_arg2);
_local9 = ((_local5 * _local8) - (_local7 * _local6));
_local9 = Math.abs(_local9);
return (_local9);
}
function AnimFrameFromDir(){
var _local1:*;
_local1 = (main.graphicobjs[graphicID].GetMaxFrames() - 1);
frame = ((_local1 / (Math.PI * 2)) * dir);
}
public function UpdatePlayer(){
}
function GetOffsetToPlayerX():Number{
return ((main.goPlayer.xpos - xpos));
}
public function GetNumFrames():int{
return (main.graphicobjs[graphicID].GetMaxFrames());
}
function UpdatePowerup(){
if (controlMode == 0){
timer = (timer + ftime);
if (timer > (50 * 1)){
controlMode = 2;
};
};
speed = (speed - (ftime * 0.1));
if (speed < 0.5){
speed = 0.5;
};
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
DoExternalVel();
frameVel = 0.5;
CycleAnimation();
timer = (timer + ftime);
if (timer > (50 * 10)){
active = false;
};
if (timer > (50 * 7)){
HandleFlash();
};
if (IsInWorld(32) == false){
active = false;
};
}
public function AddImpulse(_arg1:Number, _arg2:Number, _arg3:Number){
externxvel = (externxvel + (_arg1 * _arg3));
externyvel = (externyvel + (_arg2 * _arg3));
}
function UpdateShootPlayer(){
var _local1:*;
shootTimer = (shootTimer + ftime);
_local1 = (shootTimerMax * 2);
if (shootTimer >= _local1){
shootTimer = 0;
main.EnemyCreateMissile(this, shootMissileType);
};
}
function UpdateHomingMissile(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:*;
var _local8:*;
var _local9:Number;
var _local10:Number;
var _local11:*;
var _local12:*;
if (homingGO == null){
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
homingGO = main.FindClosestEnemyTo(xpos, ypos);
} else {
_local1 = GetDirBetween(xpos, ypos, homingGO.xpos, homingGO.ypos);
_local2 = RotDistTowards(dir, _local1);
_local3 = 0.5;
if (_local2 > _local3){
_local2 = _local3;
};
_local4 = (_local3 - _local2);
_local5 = 1;
_local6 = 6;
_local7 = 0.02;
_local8 = 0.06;
_local9 = ((((_local6 - _local5) / _local3) * _local4) + _local5);
_local10 = ((((_local8 - _local7) / _local3) * _local2) + _local7);
rotVel = _local10;
_local11 = (0.3 * ftime);
if (speed < _local9){
speed = (speed + _local11);
if (speed > _local9){
speed = _local9;
};
} else {
if (speed < _local9){
(speed == _local11);
if (speed < _local9){
speed = _local9;
};
};
};
_local12 = (rotVel * ftime);
dir = RotateTowards(dir, _local1, _local12);
if (Math.abs((dir - _local1)) < _local12){
dir = _local1;
};
GetVelFromDir(speed);
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
};
AnimFrameFromDir();
if (IsInWorld(32) == false){
active = false;
};
}
function Enemy6_SetToPosNearPlayer(){
var _local1:Number;
var _local2:Number;
var _local3:*;
var _local4:*;
_local1 = main.goPlayer.xpos;
_local2 = main.goPlayer.ypos;
_local3 = RandBetween(100, 300);
_local4 = RandCircle();
GetVelFromDir1(_local3, _local4);
_local1 = (_local1 + xvel);
_local2 = (_local2 + yvel);
toPosX = _local1;
toPosY = _local2;
xvel = 0;
yvel = 0;
speed = RandBetween(3, 6);
}
function GetOffsetToPlayerY():Number{
return ((main.goPlayer.ypos - ypos));
}
public function OnKilled(){
if (type == gotype_ENEMY){
if (subtype == Main.enemy_asteroid){
KillEnemy5();
};
};
}
function SetRandomMapPos(){
xpos = RandBetween(100, 700);
ypos = RandBetween(100, 700);
}
public function CycleAnimation():void{
var _local1:*;
frame = (frame + frameVel);
_local1 = (main.graphicobjs[graphicID].GetMaxFrames() - 1);
if (frame > _local1){
frame = (frame - _local1);
};
if (frame < 0){
frame = (frame + _local1);
};
}
public function PlayAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + frameVel);
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
frame = maxFrame;
_local1 = true;
};
if (frame < minFrame){
frame = minFrame;
_local1 = true;
};
return (_local1);
}
function Anim_FromVel():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = GetNumFrames();
_local2 = xvel;
_local3 = yvel;
_local4 = Math.atan2(_local2, _local3);
frame = ((_local1 / (Math.PI * 2)) * -(_local4));
if (frame < 0){
frame = (frame + _local1);
};
if (frame > _local1){
frame = (frame - _local1);
};
frame = (frame + (_local1 / 2));
if (frame > _local1){
frame = (frame - _local1);
};
}
function DistanceToObj(_arg1:gameobj):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (_arg1.xpos - xpos);
_local3 = (_arg1.ypos - ypos);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
return (_local4);
}
function BackgroundCollision(_arg1:int, _arg2:int):Boolean{
var _local3:Bitmap;
var _local4:BitmapData;
var _local5:uint;
_local3 = main.graphicobjs[Main.gfx_backgrounds].GetBitmap();
_local4 = _local3.bitmapData;
_local5 = _local4.getPixel32((xpos + _arg1), (ypos + _arg2));
if (_local5 != 0){
return (true);
};
return (false);
}
function MakeUnitVel():Number{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = GetLen(xvel, yvel);
_local2 = (xvel / _local1);
_local3 = (yvel / _local1);
xvel = _local2;
yvel = _local3;
return (_local1);
}
function RandCircle():Number{
return ((Math.random() * (Math.PI * 2)));
}
function RandBetweenRandNeg(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
if (Math.random() < 0.5){
_local3 = -(_local3);
};
return (_local3);
}
function DistanceToObj1(_arg1:gameobj, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = (_arg1.xpos - _arg2);
_local5 = (_arg1.ypos - _arg3);
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
return (_local6);
}
public function GetVelFromDir1(_arg1:Number, _arg2:Number){
xvel = (Math.sin(_arg2) * _arg1);
yvel = (Math.cos(_arg2) * _arg1);
}
public function Render(_arg1):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
if (visible == false){
return;
};
if (appearingTimer > 0){
return;
};
_local2 = xpos;
_local3 = ypos;
if (type != gotype_BACKGROUND){
_local2 = (_local2 - main.scrollX);
_local3 = (_local3 - main.scrollY);
};
if ((((type == gotype_CROSSHAIR)) || ((type == gotype_OVERLAY)))){
_local2 = xpos;
_local3 = ypos;
};
if (flashFlag == false){
return;
};
main.graphicobjs[graphicID].SetFrame(frame);
main.graphicobjs[graphicID].RenderAt(main.screenBD, _local2, _local3);
if (type == gotype_PLAYER){
main.graphicobjs[Main.gfx_playerturret].SetFrame(main.turretFrame);
main.graphicobjs[Main.gfx_playerturret].RenderAt(main.screenBD, _local2, _local3);
};
if (type == gotype_ENEMY){
if (subtype == 8){
RenderEnemy8();
};
};
if (type == gotype_PLAYER){
if (main.shieldTimer > 0){
_local4 = main.shieldTimer;
_local4 = (_local4 % 5);
if (main.shieldTimer < (2 * 50)){
_local5 = main.shieldTimer;
if ((_local5 % 20) < 10){
main.graphicobjs[Main.gfx_shield].SetFrame(_local4);
main.graphicobjs[Main.gfx_shield].RenderAt(main.screenBD, _local2, _local3);
};
} else {
main.graphicobjs[Main.gfx_shield].SetFrame(_local4);
main.graphicobjs[Main.gfx_shield].RenderAt(main.screenBD, _local2, _local3);
};
};
};
}
public function RotateTowards(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:Number;
var _local11:*;
_local4 = 3.141592658;
_local5 = (_local4 * 2);
_local6 = Math.sin(_arg1);
_local7 = Math.cos(_arg1);
_local8 = Math.sin(_arg2);
_local9 = Math.cos(_arg2);
_local10 = ((_local6 * _local9) - (_local8 * _local7));
_local11 = _arg1;
if (_local10 < 0){
_local11 = (_local11 + _arg3);
} else {
if (_local10 > 0){
_local11 = (_local11 - _arg3);
};
};
if (_local11 > _local5){
_local11 = (_local11 - _local5);
};
if (_local11 < 0){
_local11 = (_local11 + _local5);
};
return (_local11);
}
function UpdateEnemy0():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:*;
var _local6:*;
timer = (timer + ftime);
_local1 = (timer * 0.05);
speed = (7 + (Math.sin(_local1) * 3));
rotVel = 0.03;
oldxpos = xpos;
oldypos = ypos;
Anim_AimAtPlayer();
_local2 = (main.goPlayer.xpos - xpos);
_local3 = (main.goPlayer.ypos - ypos);
_local4 = Math.atan2(_local2, _local3);
_local5 = (rotVel * ftime);
dir = RotateTowards(dir, _local4, _local5);
if (Math.abs((dir - _local4)) < _local5){
dir = _local4;
};
GetVelFromDir(speed);
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
DoExternalVel();
shootTimer = (shootTimer + ftime);
_local6 = 3;
if (shootTimer >= _local6){
shootTimer = 0;
if (speed < 5){
main.EnemyCreateMissile(this, shootMissileType);
};
};
}
public function UpdateEnemy1(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
timer = (timer + ftime);
_local1 = (100 * 20);
_local2 = (3.141592658 * 2);
_local3 = GetDirBetween(xpos, ypos, main.goPlayer.xpos, main.goPlayer.ypos);
_local4 = (rotVel * ftime);
dir = RotateTowards(dir, _local3, _local4);
if (Math.abs((dir - _local3)) < _local4){
dir = _local3;
};
GetVelFromDir(speed);
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
Anim_AimAtPlayer();
UpdateShootPlayer();
DoExternalVel();
if (IsInWorld(128) == false){
main.OnEnemyOffMap(this);
active = false;
};
}
function UpdateEnemy2():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = main.goPlayer.xpos;
_local2 = main.goPlayer.ypos;
timer = (timer - ftime);
if (timer <= 0){
timer = RandBetween(100, 300);
dist = RandBetween(100, 300);
};
dir = (dir + (rotVel * ftime));
GetVelFromDir(dist);
toPosX = (_local1 + xvel);
toPosY = (_local2 + yvel);
_local3 = 0.02;
xpos = (xpos + (((toPosX - xpos) * _local3) * ftime));
ypos = (ypos + (((toPosY - ypos) * _local3) * ftime));
UpdateShootPlayer();
DoExternalVel();
Anim_AimAtPlayer();
}
function UpdateEnemy3():void{
var _local1:*;
var _local2:*;
timer = (timer + ftime);
if (timer >= timerMax){
timerMax = RandBetween(50, 60);
timer = 0;
dir = (dir + RandBetweenRandNeg(1, 2));
};
_local1 = GetDirBetween(xpos, ypos, main.goPlayer.xpos, main.goPlayer.ypos);
_local2 = (rotVel * ftime);
dir = RotateTowards(dir, _local1, _local2);
if (Math.abs((dir - _local1)) < _local2){
dir = _local1;
};
GetVelFromDir(speed);
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
Anim_FromVel();
UpdateShootPlayer();
DoExternalVel();
if (IsInWorld(128) == false){
main.OnEnemyOffMap(this);
active = false;
};
}
function UpdateEnemy4():void{
var _local1:*;
timer = (timer + ftime);
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
CycleAnimation();
shootTimer = (shootTimer + ftime);
_local1 = (shootTimerMax * 3);
if (shootTimer >= _local1){
shootTimer = 0;
main.EnemyCreateMissileDir(this, 0);
main.EnemyCreateMissileDir(this, 1);
main.EnemyCreateMissileDir(this, 2);
main.EnemyCreateMissileDir(this, 3);
main.EnemyCreateMissileDir(this, 4);
main.EnemyCreateMissileDir(this, 5);
};
DoExternalVel();
if (IsInWorld(64) == false){
xpos = startx;
ypos = starty;
xvel = (main.goPlayer.xpos - xpos);
yvel = (main.goPlayer.ypos - ypos);
MakeUnitVel();
};
}
function UpdateEnemy5():void{
timer = (timer + ftime);
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
frameVel = 0.5;
CycleAnimation();
DoExternalVel();
BounceOffWorldEdges();
}
function UpdateEnemy6():void{
var _local1:*;
timer = (timer + ftime);
_local1 = GetDirBetween(xpos, ypos, toPosX, toPosY);
dir = _local1;
GetVelFromDir(speed);
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
Anim_AimAtPlayer();
UpdateShootPlayer();
DoExternalVel();
if (IsInWorld(32) == false){
main.OnEnemyOffMap(this);
active = false;
};
if ((((Math.abs((xpos - toPosX)) <= speed)) && ((Math.abs((ypos - toPosY)) <= speed)))){
speed = 0;
xpos = toPosX;
ypos = toPosY;
};
if (timer >= timerMax){
timer = 0;
timerMax = RandBetween(30, 100);
Enemy6_SetToPosNearPlayer();
};
}
function UpdateEnemy7():void{
var _local1:Number;
var _local2:*;
var _local3:*;
var _local4:Number;
var _local5:Number;
var _local6:Number;
timer = (timer + ftime);
_local1 = main.playerDirToMouse;
_local1 = (_local1 + Math.PI);
_local1 = (_local1 + xpos2);
if (_local1 > (Math.PI * 2)){
_local1 = (_local1 - (Math.PI * 2));
};
speed = 1;
_local2 = (rotVel * ftime);
dir = RotateTowards(dir, _local1, _local2);
if (Math.abs((dir - _local1)) < _local2){
dir = _local1;
};
dist = ypos2;
toPosX = (main.goPlayer.xpos + (Math.sin(dir) * dist));
toPosY = (main.goPlayer.ypos + (Math.cos(dir) * dist));
xvel = (toPosX - xpos);
yvel = (toPosY - ypos);
_local3 = GetLen(xvel, yvel);
_local4 = 5;
_local5 = 200;
_local3 = LimitNumberToRange(_local3, _local4, _local5);
_local3 = (_local3 * 0.1);
_local6 = MakeUnitVel();
xpos = (xpos + (((xvel * speed) * ftime) * _local3));
ypos = (ypos + (((yvel * speed) * ftime) * _local3));
if (_local6 < speed){
xpos = toPosX;
ypos = toPosY;
};
Anim_AimAtPlayer();
UpdateShootPlayer();
DoExternalVel();
if (timer >= timerMax){
timer = 0;
timerMax = RandBetween(30, 100);
xpos2 = RandBetween(-1, 1);
ypos2 = RandBetween(100, 300);
};
}
function UpdateEnemy8():void{
var _local1:Number;
var _local2:int;
var _local3:*;
timer = (timer + ftime);
_local1 = GetDirBetween(xpos, ypos, main.goPlayer.xpos, main.goPlayer.ypos);
dir = RotateTowards(dir, _local1, rotVel);
if (Math.abs((dir - _local1)) < rotVel){
dir = _local1;
};
GetVelFromDir(1);
xpos = (xpos + ((xvel * speed) * ftime));
ypos = (ypos + ((yvel * speed) * ftime));
Anim_AimAtPlayer();
UpdateShootPlayer();
DoExternalVel();
xacc = (xacc + (yacc * ftime));
_local3 = ((Math.PI * 2) / (numBits + 2));
_local2 = 0;
while (_local2 < numBits) {
coordListX[_local2] = (xpos + (Math.sin((xacc + (_local3 * _local2))) * 60));
coordListY[_local2] = (ypos + (Math.cos((xacc + (_local3 * _local2))) * 60));
_local2++;
};
}
function UpdateEnemy9():void{
var _local1:*;
var _local2:*;
timer = (timer + ftime);
xoffset = (xoffset + (xacc * ftime));
yoffset = (yoffset + (yacc * ftime));
_local1 = (Math.sin(xoffset) * 1);
xpos = (xpos + (_local1 * ftime));
ypos = (ypos + (yvel * ftime));
_local2 = (Math.sin(yoffset) * 1);
ypos = (ypos + (_local2 * ftime));
frameVel = 0.5;
CycleAnimation();
DoExternalVel();
if (IsInWorld(40) == false){
main.OnEnemyOffMap(this);
active = false;
};
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.sin(dir) * _arg1);
yvel = (Math.cos(dir) * _arg1);
}
}
}//package
Section 70
//gameobjgroup (gameobjgroup)
package {
import flash.events.*;
class gameobjgroup {
public var numobjs:int;// = 0x0100
var m:Main;
public var zorder:Array;
public var objs:Array;
function gameobjgroup(_arg1){
var _local2:*;
numobjs = 0x0100;
super();
m = _arg1;
objs = new Array();
zorder = new Array(0x0100);
_local2 = 0;
while (_local2 < numobjs) {
objs.push(new gameobj(m, 0, 0));
_local2++;
};
}
public function Update():void{
var _local1:int;
_local1 = 0;
while (_local1 < objs.length) {
if (objs[_local1].active == true){
objs[_local1].Update();
};
_local1++;
};
}
public function GetZOrder():int{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:int;
_local1 = 0;
while (_local1 < numobjs) {
if (objs[_local1].active == true){
if (objs[_local1].handleRender == true){
zorder[_local3] = _local1;
_local3++;
};
};
_local1++;
};
_local4 = _local3;
_local1 = 0;
while (_local1 < (_local4 - 1)) {
_local2 = (_local1 + 1);
while (_local2 < _local4) {
_local5 = objs[zorder[_local1]].zpos;
_local6 = objs[zorder[_local2]].zpos;
if (_local6 > _local5){
_local7 = zorder[_local1];
zorder[_local1] = zorder[_local2];
zorder[_local2] = _local7;
};
_local2++;
};
_local1++;
};
return (_local4);
}
public function AddObj(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int):gameobj{
var _local7:int;
var _local8:gameobj;
_local7 = 0;
while (_local7 < numobjs) {
if (objs[_local7].active == false){
_local8 = objs[_local7];
_local8.active = true;
_local8.zpos = _arg4;
_local8.xpos = _arg2;
_local8.ypos = _arg3;
_local8.startx = _arg2;
_local8.starty = _arg3;
_local8.yvel = 0;
_local8.graphicID = _arg5;
_local8.SetType(_arg1);
_local8.extraInfo = _arg6;
return (objs[_local7]);
};
_local7++;
};
return (null);
}
public function Render():void{
var _local1:int;
var _local2:int;
_local1 = GetZOrder();
_local2 = 0;
while (_local2 < _local1) {
objs[zorder[_local2]].Render(m);
_local2++;
};
}
}
}//package
Section 71
//GameOverClip (GameOverClip)
package {
import flash.display.*;
public dynamic class GameOverClip extends MovieClip {
public var buttonMainMenu:ButtonMainMenu;
public var buttonPlayOnKongregate:SimpleButton;
public function GameOverClip(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package
Section 72
//GogHeadEnemy (GogHeadEnemy)
package {
import flash.display.*;
public dynamic class GogHeadEnemy extends MovieClip {
}
}//package
Section 73
//GroundExplosion (GroundExplosion)
package {
import flash.display.*;
public dynamic class GroundExplosion extends MovieClip {
}
}//package
Section 74
//HealthLowOverlay (HealthLowOverlay)
package {
import flash.display.*;
public dynamic class HealthLowOverlay extends MovieClip {
}
}//package
Section 75
//HelpOverlay (HelpOverlay)
package {
import flash.display.*;
public class HelpOverlay {
var currentType:String;
var displayTimer:Number;
var textQueue:Array;
var overlayMC:MovieClip;
var fps:Number;
var displayedFlags:Array;
var allowHelpFlag:Boolean;
var typeQueue:Array;
var main:MovieClip;
var displayingFlag:Boolean;
public function HelpOverlay(_arg1:MovieClip, _arg2:Number){
var _local3:int;
super();
main = _arg1;
fps = _arg2;
displayingFlag = false;
displayTimer = 0;
overlayMC = null;
currentType = "";
allowHelpFlag = true;
typeQueue = new Array();
textQueue = new Array();
displayedFlags = new Array(0x0100);
_local3 = 0;
while (_local3 < 0x0100) {
displayedFlags[_local3] = 0;
_local3++;
};
}
public function DisplayOnce(_arg1:int, _arg2:String, _arg3:String){
if (_arg1 >= 0x0100){
return;
};
if (displayedFlags[_arg1] == 0){
Display(_arg2, _arg3);
displayedFlags[_arg1] = 1;
};
}
public function IsBeingDisplayed():Boolean{
return (displayingFlag);
}
function AddToQueue(_arg1:String, _arg2:String){
if ((((allowHelpFlag == false)) && ((_arg1 == "standard")))){
return;
};
typeQueue.push(_arg1);
textQueue.push(_arg2);
}
function RemoveMovieClip(_arg1:MovieClip):void{
main.removeChild(_arg1);
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
public function Display(_arg1:String, _arg2:String){
if ((((allowHelpFlag == false)) && ((_arg1 == "standard")))){
return;
};
AddToQueue(_arg1, _arg2);
}
function UpdateQueue():void{
var _local1:String;
var _local2:String;
var _local3:MovieClip;
if (displayingFlag == false){
if (typeQueue.length > 0){
_local1 = typeQueue.shift();
_local2 = textQueue.shift();
displayingFlag = true;
displayTimer = (fps * 4);
currentType = _local1;
if (_local1 == "standard"){
_local3 = new HelpScreen_Pickups();
_local3.helper.helpText.text = _local2;
overlayMC = AddMovieClip(320, 240, _local3);
};
};
};
}
public function Update(_arg1:Number){
UpdateQueue();
if (displayingFlag == true){
displayTimer = (displayTimer - _arg1);
if (displayTimer <= 0){
displayingFlag = false;
displayTimer = 0;
RemoveMovieClip(overlayMC);
overlayMC = null;
};
};
}
}
}//package
Section 76
//HelpScreen_NewEnemy (HelpScreen_NewEnemy)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.media.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class HelpScreen_NewEnemy extends MovieClip {
public var helper:MovieClip;
public function HelpScreen_NewEnemy(){
addFrameScript(0, frame1);
}
function frame1(){
helper.helpText.text = "New enemy encountered";
}
}
}//package
Section 77
//HelpScreen_Pickups (HelpScreen_Pickups)
package {
import flash.display.*;
public dynamic class HelpScreen_Pickups extends MovieClip {
public var helper:MovieClip;
}
}//package
Section 78
//HelpScreen_Powerups (HelpScreen_Powerups)
package {
import flash.display.*;
public dynamic class HelpScreen_Powerups extends MovieClip {
}
}//package
Section 79
//KeyReader (KeyReader)
package {
import flash.display.*;
import flash.events.*;
public class KeyReader {
var keysPressed:Array;
var keysDown:Array;
static const KEY_LEFT = 37;
static const KEY_UP = 38;
static const KEY_DOWN = 40;
static const KEY_A = 65;
static const KEY_B = 66;
static const KEY_C = 67;
static const KEY_E = 69;
static const KEY_F = 70;
static const KEY_G = 71;
static const KEY_H = 72;
static const KEY_I = 73;
static const KEY_J = 74;
static const KEY_D = 68;
static const KEY_M = 77;
static const KEY_N = 78;
static const KEY_O = 79;
static const KEY_P = 80;
static const KEY_Q = 81;
static const KEY_R = 82;
static const KEY_L = 76;
static const KEY_T = 84;
static const KEY_U = 85;
static const KEY_V = 86;
static const KEY_W = 87;
static const KEY_X = 88;
static const KEY_Y = 89;
static const KEY_K = 75;
static const KEY_Z = 90;
static const KEY_S = 83;
static const KEY_SPACE = 32;
static const KEY_RIGHT = 39;
public function KeyReader(_arg1:Stage){
var _local2:int;
super();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
_arg1.focus = _arg1;
keysDown = new Array(0x0100);
keysPressed = new Array(0x0100);
_local2 = 0;
while (_local2 < 0x0100) {
keysDown[_local2] = int(0);
keysPressed[_local2] = Boolean(false);
_local2++;
};
}
public function Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
public function Pressed(_arg1:int):Boolean{
return (keysPressed[_arg1]);
}
function keyDownListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
var _local3 = keysDown;
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
}
public function UpdateOncePerFrame():void{
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
if (keysDown[_local1] == 1){
keysPressed[_local1] = true;
var _local2 = keysDown;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
} else {
keysPressed[_local1] = false;
};
_local1++;
};
}
function keyUpListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
keysDown[_local2] = 0;
}
}
}//package
Section 80
//LevelUpOverlay (LevelUpOverlay)
package {
import flash.display.*;
public dynamic class LevelUpOverlay extends MovieClip {
public var textarea:MovieClip;
}
}//package
Section 81
//Licensors (Licensors)
package {
public class Licensors {
public static const LICENSOR_NONE = 0;
public static const LICENSOR_KONGREGATE = 1;
static var licensor:int = 1;
public static function IsHosted():Boolean{
if (licensor == LICENSOR_NONE){
return (false);
};
if (licensor == LICENSOR_KONGREGATE){
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
};
return (false);
}
public static function CanUseMochiAds():Boolean{
if (licensor == LICENSOR_NONE){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
return (true);
};
return (true);
}
public static function SetLicensor(_arg1:int):void{
licensor = _arg1;
}
public static function GetLicensor():int{
return (licensor);
}
}
}//package
Section 82
//LongAnimals_Kongregate (LongAnimals_Kongregate)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class LongAnimals_Kongregate {
static var kongregate;
static var main:Main;
static var api_url:String;
static var paramObj:Object;
public static function Init(_arg1:Main){
var _local2:URLRequest;
var _local3:Loader;
if (Licensors.IsHosted() == false){
return;
};
Security.allowDomain("*.kongregate.com");
main = _arg1;
paramObj = LoaderInfo(Main.theRoot.loaderInfo).parameters;
trace(Main.theRoot);
trace(paramObj);
api_url = ((paramObj.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + api_url));
_local2 = new URLRequest(api_url);
_local3 = new Loader();
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
_local3.load(_local2);
Main.theStage.addChild(_local3);
}
static function loadComplete(_arg1:Event):void{
trace(_arg1);
kongregate = _arg1.target.content;
trace(kongregate);
kongregate.services.connect();
trace(("\n" + kongregate.services));
trace(("\n" + kongregate.user));
trace(("\n" + kongregate.scores));
trace(("\n" + kongregate.stats));
}
}
}//package
Section 83
//LongAnimalsMochiScores (LongAnimalsMochiScores)
package {
import flash.display.*;
import mochi.*;
public class LongAnimalsMochiScores {
var boardID;// = "23cf3a2263fb80ce"
var connectID;// = "0067585d608ea9c9"
var mochiMovieClip:MovieClip;
public function LongAnimalsMochiScores():void{
boardID = "23cf3a2263fb80ce";
connectID = "0067585d608ea9c9";
super();
}
public function ShowLeaderboard(_arg1:MovieClip){
trace("hiscores: showleaderboard");
_arg1.addChild(mochiMovieClip);
MochiScores.showLeaderboard({boardID:boardID});
}
public function Init(){
trace("hiscores: init");
mochiMovieClip = new MovieClip();
MochiServices.connect(connectID, mochiMovieClip);
MochiScores.setBoardID(boardID);
}
public function EnterHighScores(_arg1:MovieClip, _arg2:Number, _arg3){
_arg1.addChild(mochiMovieClip);
MochiScores.showLeaderboard({boardID:boardID, score:_arg2, onClose:_arg3});
}
}
}//package
Section 84
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.media.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class Main extends MovieClip {
public var keyReader:KeyReader;// = null
var highestMaxHealthTimer:Number;// = 0
var currentWave:int;
var goCrosshair:gameobj;// = null
var musicTimer:Number;
var EnemyList:Array;
var ftime:Number;
var goBackground:gameobj;// = null
var startLevel:Number;
var preWaveTimerMax:Number;// = 100
var overlay:Overlay;
var bm:Bitmap;
var endLevMC:MovieClip;
var preWaveTimer:Number;// = 0
var pauseMenu:PauseMenu;
var adIDLongAnimals;// = "0067585d608ea9c9"
var maxPowerupLevel:int;
var difficultyLevel:int;
var buttonPressed:Boolean;// = false
var currentScore:int;
var waves:Wave;
var gameOverFlag:Boolean;
var ACH_PickupsInARow:int;
public var multiHitBonus:int;
var musicSoundTransform:SoundTransform;
var ACH_MaxPickupsInARow:int;
public var enemyDefs:Array;
var ACH_MaxKillStreak:int;
public var soundPlayer:SoundPlayer;// = null
var musicChannel1:SoundChannel;// = null
var maxHealth:Number;
var currentWaveUnlimited:int;
var mochiMovieClip:MovieClip;
var hitEnemyHealthDrop:Number;
var tf_small:TextFormat;
var powerupLevel:int;
var shootTimerMax:Number;
var cheatMode:Boolean;
public var voiceOver:VoiceOver;// = null
var panelXpos0:int;// = 32
var panelXpos1:int;// = 140
var panelXpos3:int;// = 520
var panelXpos2:int;// = 420
var BonusList:Array;
public var graphicobjs:Array;
private var screenB:Bitmap;
var endLevelTimer:Number;
var PickupList:Array;
var shieldTimer:Number;
var trainAcc:Number;
var killedMothershipFlag:Boolean;// = false
var bmd:BitmapData;
var adRes;// = "640x480"
var goTempGauge:gameobj;// = null
var currentLevel:Number;
var turretPosY:Number;// = 430
var turretPosX:Number;// = 40
public var screenBD:BitmapData;
var multiplier:int;
var helpOverlay:HelpOverlay;
var hitAllEnemiesBonus:Boolean;
var hitMissileHealthDrop:Number;
var waveTimer1:Number;
var goPlayer:gameobj;// = null
var adIDRobotJam;// = "0f51714860a20438"
var titleMC:MovieClip;
var musicSound:Sound;
public var doAutofire:Boolean;// = false
var adClip:MovieClip;
var ACH_KillStreak:int;
var timetaken:Number;
var numPowerupsPickedUp:int;
var scoreAch0:Boolean;
var scoreAch1:Boolean;
var scoreAch2:Boolean;
var levelTimer:Number;
var minFramesBetweenEnemyGen:int;// = 3
var shotCount:int;
var numBunnies:int;
var endLevelSequence:Boolean;
var objs:gameobjgroup;
var maxHealthTimer:Number;// = 0
var health:Number;
var shootTimer:Number;
var gameTimer:Number;
var EnemyMissileList:Array;
public var mochiScores;
var maxWave:int;// = 50
var ACH_hightestMultiplier:int;
public var turretFrame;// = 0
var shootTimer1:Number;
var scoretxt:TextField;
var mouseVelX:Number;// = 0
var mouseVelY:Number;// = 0
var particles:Particles;
public var everyMissileCountsBonus:Boolean;
var displayDebug:Boolean;// = false
var initedScores:Boolean;
var goBackground1:gameobj;// = null
var bonusHealthIncrease:Number;
var maxWaveLoop:int;// = 46
var endLevelText1;
var goBackground2:gameobj;// = null
var MissileList:Array;
var mousePosX:Number;// = 0
var endLevelText2;
var levelEndTimer:Number;
var mousePosY:Number;// = 0
var shootTimer1Max:Number;
var mouseOldPosX:Number;// = 0
var mouseOldPosY:Number;// = 0
var endLevelText3;
var enemyCounts:Array;
var gameOverTimer:Number;
var PowerupList:Array;
var numEnemiesPickedUp:int;
var musicChannel:SoundChannel;// = null
public var scrollH:int;
var debugTxt;
public var trainSpeed:Number;
public var scrollX:Number;// = 0
public var scrollY:Number;// = 0
var tf_large:TextFormat;
var bonusGenTimer:Number;
public var scrollW:int;
var encounteredEnemylist:Array;
public var doSound:Boolean;// = true
public var playerDirToMouse:Number;
var panelYpos:int;// = 440
var regenPointX:Number;
var regenPointY:Number;
var levelUpOverlayMC:TextField;// = null
var musicOverlays:Array;
var jfTimer:Number;// = 0
var panelXposScore:int;// = 320
var levelTimerMax:Number;
var musicSound1:Sound;
var numEnemyPickupsNeeded:int;
var goTracks:gameobj;// = null
var numPowerupsNeededForLevelUp:int;
var framesSinceLastEnemyGen:int;// = 0
var levelUpOverlayTimer:Number;
var gameState:int;// = 0
var enemyKilledCounts:Array;
var waveTimer:Number;
var musicSoundTransform1:SoundTransform;
var currentTime:Number;// = 0
var multiplierMax:int;
var goTurret:gameobj;// = null
var gameOverMC:MovieClip;
public static const gfx_shieldlow = 49;
public static const gfx_enemy9a = 29;
public static const gfx_enemy9b = 30;
public static const gfx_background_far = 1;
public static const gfx_checkpoint = 5;
public static const gfx_playerturret = 50;
public static const gfx_particleplayerexhaust = 41;
public static const enemy_RANDOM1 = 7;
public static const gfx_exit = 9;
public static const enemy_zippyBulletDodger = 7;
static const gameState_LEVEL_COMPLETE = 3;
public static const enemy_meteor = 10;
public static const enemy_EASTEREGG = 100;
static const gameState_GAMEOVER = 4;
public static const gravity = 0.1;
public static const gfx_levelup = 48;
public static const gfx_player = 2;
public static const gfx_bar_powerup = 27;
public static const gfx_pickup1 = 4;
public static const gfx_pickup2 = 15;
public static const bonus_score = 0;
public static const gfx_missile_enemy1 = 10;
public static const bonus_health = 2;
public static const gfx_background_middle = 31;
public static const zpos_ENEMY = 300;
public static const zpos_OVERLAY = 500;
public static const gfx_bar_health = 26;
public static const gfx_bonus_shield = 34;
public static const zpos_EXPLOSION = 100;
public static const sfx_hitpickup = 2;
public static const gfx_groundexplosion = 17;
public static const enemy_heavySprayer = 4;
public static const gfx_bonus_score = 33;
public static const gfx_bar_pickup = 28;
public static const enemy_FAST = 5;
public static const explosionType_MISSILE = 0;
static const gameState_HIGHSCORES = 5;
public static const sfx_bunnyhit = 5;
public static const enemy_stopGoAroundPlayer = 6;
public static const gfx_paneloverlay = 38;
public static const zpos_FAR = 10000;
public static const gfx_crosshair = 13;
public static const gfx_enemy10 = 37;
public static const fps:Number = 50;
public static const gfx_shield = 40;
public static const gfx_bar_multiplier = 39;
public static const enemy_BOMB = 6;
public static const zpos_BACKGROUND = 10000;
public static const enemy_zigzagToPlayer = 3;
static const gameState_LEVEL_GETREADY = 1;
public static const gfx_particleenemyappear = 45;
public static const explosionType_ENEMY = 1;
public static const gfx_particlecollectpickup = 46;
public static const gfx_particle1 = 6;
public static const zpos_PLAYER = 1000;
public static const gfx_particle5 = 16;
public static const sfx_bunnyscared = 4;
public static const gfx_enemy1 = 3;
public static const gfx_enemy2 = 7;
public static const gfx_enemy3 = 8;
public static const gfx_enemy4 = 11;
public static const gfx_enemy5 = 20;
public static const gfx_enemy7 = 24;
public static const gfx_enemy8 = 25;
public static const gfx_backgrounds = 0;
public static const enemy_jellyfish = 9;
public static const sfx_bunny = 3;
static const gameState_PREGAMEAD = 6;
public static const gfx_particleenemykilled2 = 44;
public static const gfx_unused = 18;
public static const gfx_particleenemykilled1 = 43;
public static const zpos_MISSILE = 200;
public static const enemy_BOMBER = 2;
public static const enemy_hoverAroundPlayer = 2;
public static const gfx_bonus_health = 35;
public static const sfx_hitalien = 1;
public static const bonus_shield = 1;
public static const enemy_SWOOPER = 3;
public static const enemy_asteroid = 5;
public static const gfx_particleenemyhit = 42;
public static const enemy_STANDARD = 0;
public static const zpos_CROSSHAIR = 50;
public static const enemy_SPLITTER = 4;
public static const gfx_enemy6a = 21;
public static const gfx_enemy6b = 22;
static const gameState_LEVEL_PLAY = 2;
public static const enemy_moveToPlayerRot = 1;
public static const gfx_particle_powerup = 32;
public static const gfx_enemy6c = 23;
static const gameState_TITLE = 0;
static const gameState_HELP = 7;
public static const enemy_accelToPlayer = 0;
public static const gfx_missile1 = 12;
public static const gfx_missile3 = 19;
public static const gfx_missile4 = 51;
public static const gfx_particlemeteortrail = 47;
public static const gfx_missile2 = 14;
public static const enemy_SMARTBOMB = 1;
public static const bonus_multiplier = 3;
public static const enemy_fatShielded = 8;
public static const sfx_shoot = 0;
public static const gfx_bonus_multiplier = 36;
public static var theRoot:MovieClip;
public static var theStage:Stage;
public function Main(){
adIDLongAnimals = "0067585d608ea9c9";
adIDRobotJam = "0f51714860a20438";
adRes = "640x480";
musicChannel = null;
musicChannel1 = null;
gameState = gameState_TITLE;
doSound = true;
doAutofire = false;
goCrosshair = null;
goTurret = null;
goTempGauge = null;
goTracks = null;
goBackground = null;
goBackground1 = null;
goBackground2 = null;
goPlayer = null;
turretPosX = 40;
turretPosY = (480 - 50);
maxWave = 50;
maxWaveLoop = 46;
displayDebug = false;
panelYpos = (480 - 40);
panelXpos0 = 32;
panelXpos1 = 140;
panelXpos2 = 420;
panelXpos3 = 520;
panelXposScore = 320;
keyReader = null;
soundPlayer = null;
voiceOver = null;
mouseOldPosX = 0;
mouseOldPosY = 0;
mousePosX = 0;
mousePosY = 0;
mouseVelX = 0;
mouseVelY = 0;
buttonPressed = false;
currentTime = 0;
killedMothershipFlag = false;
maxHealthTimer = 0;
highestMaxHealthTimer = 0;
framesSinceLastEnemyGen = 0;
minFramesBetweenEnemyGen = 3;
preWaveTimer = 0;
preWaveTimerMax = (50 * 2);
jfTimer = 0;
scrollX = 0;
scrollY = 0;
levelUpOverlayMC = null;
turretFrame = 0;
super();
theRoot = this;
theStage = this.root.stage;
SetEverythingUp();
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * ((_arg2 + 1) - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
function RunLevelComplete(){
UpdateEndLevelSequence();
}
function CreateMissileList(){
var _local1:gameobj;
var _local2:int;
MissileList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_MISSILE){
MissileList.push(_local1);
};
};
_local2++;
};
}
function InitLevel(){
var _local1:gameobj;
var _local2:Array;
InitStage();
overlay.StartFadeIn(null);
scoretxt = CreateTextField(tf_small, panelXposScore, (panelYpos - 2), "");
debugTxt = CreateTextField(tf_small, 100, 300, "");
particles.Reset();
shootTimer = 0;
shootTimerMax = 10;
shootTimer1 = 0;
shootTimer1Max = 100;
Mouse.hide();
buttonPressed = false;
_local2 = new Array();
levelTimer = 0;
waveTimer = 100;
waveTimer1 = 100;
particles.Reset();
objs = new gameobjgroup(this);
goBackground = objs.AddObj(gameobj.gotype_BACKGROUND, 0, 0, zpos_BACKGROUND, 0, 0);
goBackground.frame = 3;
goBackground.graphicID = gfx_backgrounds;
graphicobjs[gfx_backgrounds].SetFrame(3);
scrollW = graphicobjs[gfx_backgrounds].GetWidth();
scrollH = graphicobjs[gfx_backgrounds].GetHeight();
goBackground1 = objs.AddObj(gameobj.gotype_BACKGROUND, 0, 0, (zpos_BACKGROUND + 1), 0, 0);
goBackground1.frame = 0;
goBackground1.graphicID = gfx_background_middle;
goBackground2 = objs.AddObj(gameobj.gotype_BACKGROUND, 0, 0, (zpos_BACKGROUND + 2), 0, 0);
goBackground2.frame = 0;
goBackground2.graphicID = gfx_background_far;
goPlayer = objs.AddObj(gameobj.gotype_PLAYER, 0, 0, zpos_PLAYER, 0, 0);
goPlayer.xpos = 400;
goPlayer.ypos = 400;
goCrosshair = objs.AddObj(gameobj.gotype_CROSSHAIR, 0, 0, zpos_CROSSHAIR, 0, 0);
goCrosshair.xpos = 320;
goCrosshair.ypos = 240;
numEnemiesPickedUp = 0;
numPowerupsPickedUp = 0;
numEnemyPickupsNeeded = 10;
numPowerupsNeededForLevelUp = 10;
currentScore = 0;
StartGameMusic();
helpOverlay.Display("standard", "Use your mouse to move your cursor and press the left mouse button to shoot. Use arrow keys or A,S,D, and W to move your craft.");
voiceOver.PlayOnce(VoiceOver.vo_welcome);
UpdateEnemyEncounter();
InitGameAchievements();
}
function InitLists(){
PowerupList = new Array(0x0200);
PickupList = new Array(0x0200);
EnemyList = new Array(0x0200);
MissileList = new Array(0x0200);
EnemyMissileList = new Array(0x0200);
BonusList = new Array(0x0200);
}
function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
function InitLevelGetReady(){
}
function ResetMultiplier(){
multiplier = 1;
}
function BonusPickedUp(_arg1:gameobj){
if (_arg1.subtype == bonus_score){
PlaySound(SoundPlayer.SOUND_PICKUP_SCORE);
AddScore(5000);
helpOverlay.DisplayOnce(20, "standard", "You collected a score bonus!");
voiceOver.Play(VoiceOver.vo_score);
};
if (_arg1.subtype == bonus_health){
PlaySound(SoundPlayer.SOUND_PICKUP_HEALTH);
AddScore(100);
AddHealth(bonusHealthIncrease);
helpOverlay.DisplayOnce(21, "standard", "You collected a health bonus. Your health is indicated in the lower left of the screen. Lose all your health and the game will be over.");
voiceOver.Play(VoiceOver.vo_health);
};
if (_arg1.subtype == bonus_shield){
PlaySound(SoundPlayer.SOUND_PICKUP_SHIELD);
AddScore(100);
shieldTimer = (shieldTimer + (50 * 10));
helpOverlay.DisplayOnce(22, "standard", "You collected a shield.");
voiceOver.Play(VoiceOver.vo_shield);
};
if (_arg1.subtype == bonus_multiplier){
PlaySound(SoundPlayer.SOUND_PICKUP_MULTIPLIER);
AddScore(100);
IncreaseMultiplier();
helpOverlay.DisplayOnce(23, "standard", "Your score multiplier is increased. Beware, your multiplier will revert to 1 if you get hit!");
voiceOver.Play(VoiceOver.vo_multiplier);
};
}
function CreatePowerupList(){
var _local1:gameobj;
var _local2:int;
PowerupList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_POWERUP){
PowerupList.push(_local1);
};
};
_local2++;
};
}
function StopTitleMusic(){
if (musicChannel != null){
musicChannel.stop();
};
}
function CreateMissile():void{
var _local1:gameobj;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = goPlayer;
_local2 = _local1.xpos;
_local3 = _local1.ypos;
_local4 = ((1 / 360) * (Math.PI * 2));
_local5 = playerDirToMouse;
if (powerupLevel == 0){
CreateMissileInstance(0, _local2, _local3, _local5);
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 1){
CreateMissileInstance(0, _local2, _local3, (_local5 - (_local4 * 5)));
CreateMissileInstance(0, _local2, _local3, (_local5 + (_local4 * 5)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if ((((powerupLevel == 2)) || ((powerupLevel == 3)))){
CreateMissileInstance(0, _local2, _local3, _local5);
CreateMissileInstance(0, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(0, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 4){
CreateMissileInstance(1, _local2, _local3, _local5);
CreateMissileInstance(0, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(0, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 5){
CreateMissileInstance(0, _local2, _local3, _local5);
CreateMissileInstance(1, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(1, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if ((((powerupLevel == 6)) || ((powerupLevel == 7)))){
CreateMissileInstance(1, _local2, _local3, _local5);
CreateMissileInstance(1, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(1, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 8){
CreateMissileInstance(2, _local2, _local3, _local5);
CreateMissileInstance(1, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(1, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 9){
CreateMissileInstance(1, _local2, _local3, _local5);
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if ((((powerupLevel == 10)) || ((powerupLevel == 11)))){
CreateMissileInstance(2, _local2, _local3, _local5);
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 10)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 12){
CreateMissileInstance(1, _local2, _local3, (_local5 - (_local4 * 6)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 6)));
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 12)));
CreateMissileInstance(1, _local2, _local3, (_local5 + (_local4 * 12)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 13){
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 6)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 6)));
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 12)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 12)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel == 14){
CreateMissileInstance(1, _local2, _local3, _local5);
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 20)));
CreateMissileInstance(1, _local2, _local3, (_local5 + (_local4 * 20)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
if (powerupLevel >= 15){
CreateMissileInstance(2, _local2, _local3, _local5);
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 10)));
CreateMissileInstance(2, _local2, _local3, (_local5 - (_local4 * 20)));
CreateMissileInstance(2, _local2, _local3, (_local5 + (_local4 * 20)));
PlaySound(SoundPlayer.SOUND_PLAYERSHOOT);
};
}
function RenderMultiplierBar(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = panelXpos1;
_local2 = panelYpos;
_local3 = ((50 / multiplierMax) * multiplier);
graphicobjs[gfx_bar_multiplier].SetFrame((50 - _local3));
graphicobjs[gfx_bar_multiplier].RenderAt(screenBD, _local1, _local2);
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
public function hardPressed(_arg1:MouseEvent){
difficultyLevel = 2;
}
function ACH_GetPickup(){
ACH_PickupsInARow++;
}
function InitShield(){
shieldTimer = 0;
}
function ACH_BeenHit(){
if (ACH_PickupsInARow > ACH_MaxPickupsInARow){
ACH_MaxPickupsInARow = ACH_PickupsInARow;
ACH_PickupsInARow = 0;
Achivements.Submit(Achivements.ACH_MAX_PICKUP_STREAK, ACH_MaxPickupsInARow);
};
if (ACH_KillStreak > ACH_MaxKillStreak){
ACH_MaxKillStreak = ACH_KillStreak;
ACH_KillStreak = 0;
Achivements.Submit(Achivements.ACH_MAX_KILL_STREAK, ACH_MaxKillStreak);
};
}
function UpdateMaxHealthAchievement():void{
if (health > 0.99){
maxHealthTimer = (maxHealthTimer + ftime);
};
}
public function buttonMainMenuPressed(_arg1:MouseEvent){
overlay.StartFadeOut(StartMainMenuCallback);
}
function InitPreGameAd(){
InitStage();
adClip = new MovieClip();
addChild(adClip);
if (Math.random() < 0.25){
MochiAd.showPreGameAd({ad_finished:AdFinished, clip:adClip, id:adIDRobotJam, res:adRes, background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
} else {
MochiAd.showPreGameAd({ad_finished:AdFinished, clip:adClip, id:adIDLongAnimals, res:adRes, background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
};
}
public function enterScoreCallback(){
SetGameState(gameState_TITLE);
}
function CreateMissile1():void{
var _local1:gameobj;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = goPlayer;
_local2 = _local1.xpos;
_local3 = _local1.ypos;
_local4 = ((1 / 360) * (Math.PI * 2));
_local5 = playerDirToMouse;
if (powerupLevel >= 3){
CreateHomingMissileInstance(_local2, _local3, _local5, 0);
};
}
public function buttonCredits(_arg1:MouseEvent){
mochiScores.ShowLeaderboard(this);
}
function ClearEnemyKilledCounts(){
var _local1:int;
_local1 = 0;
while (_local1 < 32) {
enemyCounts[_local1] = 0;
enemyKilledCounts[_local1] = 0;
_local1++;
};
}
function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
}
public function soundOnPressed(_arg1:MouseEvent){
if (doSound == true){
return;
};
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
doSound = true;
}
function InitGameOver(){
gameOverFlag = true;
gameOverTimer = 50;
InitStageNoBackground();
gameOverMC = AddMovieClip(0, 0, new GameOverClip());
gameOverMC.buttonMainMenu.addEventListener(MouseEvent.CLICK, buttonMainMenuPressed);
gameOverMC.buttonPlayOnKongregate.addEventListener(MouseEvent.CLICK, buttonPlayOnKongregatePressed);
CreateTextFieldIn(gameOverMC, tf_large, 320, 80, "GAME OVER");
CreateTextFieldIn(gameOverMC, tf_small, 320, 140, ("You scored " + currentScore.toString()));
initedScores = false;
}
public function backPressed(_arg1:MouseEvent){
}
function UpdateMouse(){
}
public function buttonHighScoresPressed(_arg1:MouseEvent){
mochiScores.ShowLeaderboard(this);
}
function InitGame(){
var _local1:int;
waves = new Wave();
waves.InitWaves();
InitWaves();
enemyDefs = new Array();
enemyDefs.push(new EnemyDef(enemy_accelToPlayer, 7, 1, 400, 0));
enemyDefs.push(new EnemyDef(enemy_moveToPlayerRot, 4, 40, 300, 0));
enemyDefs.push(new EnemyDef(enemy_hoverAroundPlayer, 3, 50, 200, 0));
enemyDefs.push(new EnemyDef(enemy_zigzagToPlayer, 6, 60, 100, 0));
enemyDefs.push(new EnemyDef(enemy_heavySprayer, 20, 50, 400, 1));
enemyDefs.push(new EnemyDef(enemy_asteroid, 5, 100, 100, 0));
enemyDefs.push(new EnemyDef(enemy_stopGoAroundPlayer, 2, 100, 100, 0));
enemyDefs.push(new EnemyDef(enemy_zippyBulletDodger, 6, 30, 300, 2));
enemyDefs.push(new EnemyDef(enemy_fatShielded, 50, 5, 500, 2));
enemyDefs.push(new EnemyDef(enemy_jellyfish, 3, 50, 100, 0));
enemyDefs.push(new EnemyDef(enemy_meteor, 3, 50, 100, 0));
InitLists();
InitBonuses();
InitShield();
InitMultiplier();
encounteredEnemylist = new Array(32);
_local1 = 0;
while (_local1 < 32) {
encounteredEnemylist[_local1] = 0;
_local1++;
};
powerupLevel = 1;
maxPowerupLevel = 16;
difficultyLevel = 1;
health = 1;
maxHealth = 1;
bonusHealthIncrease = 0.5;
hitEnemyHealthDrop = -0.05;
hitMissileHealthDrop = -0.05;
gameOverFlag = false;
enemyCounts = new Array(32);
enemyKilledCounts = new Array(32);
ClearEnemyKilledCounts();
levelUpOverlayTimer = 0;
currentWave = 0;
currentWaveUnlimited = 0;
waves.Init(currentWave);
helpOverlay = new HelpOverlay(this, fps);
}
function InitWaves(){
jfTimer = 100;
preWaveTimer = preWaveTimerMax;
}
function ControlWaves(){
var _local1:WaveDef;
var _local2:int;
var _local3:*;
var _local4:int;
if (preWaveTimer > 0){
preWaveTimer = (preWaveTimer - ftime);
return;
};
CountActiveEnemies();
_local1 = waves.GetDef(currentWave);
if (_local1.useTimer == true){
_local1.timer = (_local1.timer + ftime);
if (_local1.timer >= _local1.timerMax){
KillAllBaddies();
ClearEnemyKilledCounts();
currentWave++;
currentWaveUnlimited++;
TestWaveAchievements();
if (currentWave > maxWave){
currentWave = maxWaveLoop;
};
waves.Init(currentWave);
InitWaves();
ShowLevelUp();
UpdateEnemyEncounter();
return;
};
};
_local3 = _local1.GetNumTypes();
_local2 = 0;
while (_local2 < _local3) {
if (_local1.GetActive(_local2)){
_local4 = _local1.GetType(_local2);
if ((((_local4 == enemy_jellyfish)) || ((_local4 == enemy_meteor)))){
ControlWaveJellyfish(_local2, _local1);
} else {
ControlWaveNormal(_local2, _local1);
};
};
_local2++;
};
if (_local1.noDeadCheck == false){
if (AllEnemiesDead() == true){
KillAllBaddies();
ClearEnemyKilledCounts();
currentWave++;
currentWaveUnlimited++;
TestWaveAchievements();
if (currentWave > maxWave){
currentWave = maxWaveLoop;
};
waves.Init(currentWave);
ShowLevelUp();
InitWaves();
UpdateEnemyEncounter();
trace(("next wave (dead) :" + currentWave));
};
};
}
public function buttonMoreGames(_arg1:MouseEvent){
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=aliensmustdie"));
} else {
navigateToURL(new URLRequest("http://www.longanimalsgames.com"));
};
}
function UpdateEndLevelSequence(){
if (endLevelSequence == false){
return;
};
endLevelTimer = (endLevelTimer + ftime);
if (endLevelTimer >= (100 * 15)){
};
}
public function CreateExplosion(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
var _local5:gameobj;
_local5 = objs.AddObj(gameobj.gotype_EXPLOSION, _arg1, _arg2, zpos_EXPLOSION, 0, 0);
if (_local5 != null){
_local5.explosionType = _arg3;
if (_arg3 == 0){
_local5.frameVel = 1;
_local5.count = 0;
};
if (_arg3 == 1){
_local5.frameVel = 1;
};
_local5.hp = _arg4;
};
}
function TestWaveAchievements():void{
if (currentWave == 13){
Achivements.Submit(Achivements.ACH_SURVIVED_METEORSHOWER, 1);
};
Achivements.Submit(Achivements.ACH_MAX_WAVE, (currentWaveUnlimited + 1));
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
Mouse.show();
switch (gameState){
case gameState_PREGAMEAD:
InitPreGameAd();
break;
case gameState_TITLE:
InitTitle();
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_GETREADY:
InitLevelGetReady();
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
case gameState_LEVEL_COMPLETE:
InitLevelComplete();
break;
case gameState_HELP:
break;
case gameState_GAMEOVER:
InitGameOver();
break;
};
}
function InitGameAchievements():void{
killedMothershipFlag = false;
InitMaxHealthAchievement();
InitScoreAchievements();
ACH_PickupsInARow = 0;
ACH_MaxPickupsInARow = 0;
ACH_KillStreak = 0;
ACH_MaxKillStreak = 0;
}
public function helpPressed(_arg1:MouseEvent){
SetGameState(gameState_HELP);
}
function InitLevelComplete(){
InitStage();
}
function Render(){
objs.Render();
particles.Render(this);
RenderPanel();
RenderHealthBar();
RenderMultiplierBar();
RenderPowerupBar();
RenderPickupBar();
RenderLowShieldOverlay();
}
function UpdateShield(){
if (shieldTimer > 0){
shieldTimer = (shieldTimer - ftime);
};
}
function InitBonuses(){
bonusGenTimer = 0;
}
public function FindClosestEnemyTo(_arg1:Number, _arg2:Number):gameobj{
var _local3:Number;
var _local4:gameobj;
var _local5:int;
var _local6:gameobj;
var _local7:Number;
_local3 = (1000 * 1000);
_local4 = null;
_local5 = 0;
while (_local5 < objs.numobjs) {
_local6 = objs.objs[_local5];
if (_local6.active == true){
if (_local6.type == gameobj.gotype_ENEMY){
_local7 = (((_local6.xpos - _arg1) * (_local6.xpos - _arg1)) + ((_local6.ypos - _arg2) * (_local6.ypos - _arg2)));
if (_local7 < _local3){
_local3 = _local7;
_local4 = _local6;
};
};
};
_local5++;
};
return (_local4);
}
function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
}
function IncreaseMultiplier(){
if (multiplier < multiplierMax){
multiplier++;
if (multiplier > ACH_hightestMultiplier){
ACH_hightestMultiplier = multiplier;
Achivements.Submit(Achivements.ACH_MAX_MULTIPLIER, multiplier);
};
};
}
function PlayerPowerupCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:gameobj;
_local1 = goPlayer.xpos;
_local2 = goPlayer.ypos;
_local8 = 30;
_local9 = (30 * _local8);
for each (_local10 in PowerupList) {
if (_local10.active == true){
if (_local10.controlMode != 0){
_local6 = (_local1 - _local10.xpos);
_local7 = (_local2 - _local10.ypos);
_local4 = ((_local6 * _local6) + (_local7 * _local7));
if (_local4 < _local9){
numPowerupsPickedUp++;
_local10.active = false;
AddParticle(_local10.xpos, _local10.ypos, Particles.type_playerPickup, 0, 10);
PlaySound(SoundPlayer.SOUND_PICKUP_POWERUP);
AddScore(50);
helpOverlay.DisplayOnce(5, "standard", "You picked up a Power Pod. Collect enough of these and you will gain new weaponry.");
voiceOver.PlayOnce(VoiceOver.vo_powerpod);
ACH_GetPickup();
};
};
};
};
}
public function buttonStartPressed(_arg1:MouseEvent){
overlay.StartFadeOut(StartGameCallback);
}
function AdFinished(){
SetGameState(gameState_TITLE);
}
public function easyPressed(_arg1:MouseEvent){
difficultyLevel = 0;
}
function PlayerEnemyCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:gameobj;
_local1 = goPlayer.xpos;
_local2 = goPlayer.ypos;
_local8 = 30;
_local9 = (30 * _local8);
for each (_local10 in EnemyList) {
if (_local10.active == true){
_local6 = (_local1 - _local10.xpos);
_local7 = (_local2 - _local10.ypos);
_local4 = ((_local6 * _local6) + (_local7 * _local7));
if (_local4 < (_local10.radius2 + (20 * 20))){
OnEnemyKilled(_local10);
_local10.active = false;
if (shieldTimer <= 0){
AddHealth(hitEnemyHealthDrop);
ResetMultiplier();
PlaySound(SoundPlayer.SOUND_PLAYERHIT);
};
};
};
};
}
function RenderPanel():void{
var _local1:Number;
var _local2:Number;
_local1 = 0;
_local2 = (480 - 46);
graphicobjs[gfx_paneloverlay].SetFrame(0);
graphicobjs[gfx_paneloverlay].RenderAt(screenBD, _local1, _local2);
}
public function EnemyCreateMissile(_arg1:gameobj, _arg2:int):void{
var _local3:gameobj;
var _local4:gameobj;
_local3 = goPlayer;
_local4 = objs.AddObj(gameobj.gotype_ENEMY_MISSILE, _arg1.xpos, _arg1.ypos, zpos_PLAYER, 0, 0);
if (_local4 != null){
_local4.frame = 0;
_local4.graphicID = gfx_missile_enemy1;
_local4.toPosX = _local3.xpos;
_local4.toPosY = _local3.ypos;
_local4.xvel = (_local4.toPosX - _local4.xpos);
_local4.yvel = (_local4.toPosY - _local4.ypos);
_local4.MakeUnitVel();
_local4.speed = (2 + (_arg2 * 2));
};
}
function ControlWaveJellyfish(_arg1:int, _arg2:WaveDef){
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:gameobj;
var _local8:int;
var _local9:Number;
_local3 = _arg2.GetType(_arg1);
_local4 = _arg2.GetMax(_arg1);
_local5 = _arg2.GetNumber(_arg1);
_local6 = _arg2.GetExtraInfo(_arg1);
jfTimer = (jfTimer + ftime);
if (jfTimer > _local4){
jfTimer = RandBetweenFloat(0, _local5);
_local7 = objs.AddObj(gameobj.gotype_ENEMY, 0, 0, zpos_PLAYER, 0, _local6);
if (_local7 != null){
_local7.appearingTimer = 50;
_local7.InitEnemy(_local3);
_local8 = 0;
while (_local8 < 10) {
_local9 = (((Math.PI * 2) / 10) * _local8);
particles.Add(2, _local7.xpos, _local7.ypos, _local9);
_local8++;
};
_local7.InitFromEnemyDef();
};
};
}
function RunPreGameAd(){
}
function EnemyEnemyCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:gameobj;
var _local5:Number;
var _local6:Number;
var _local7:gameobj;
var _local8:Number;
var _local9:Number;
for each (_local4 in EnemyList) {
if (_local4.active == true){
if ((((_local4.subtype == enemy_fatShielded)) || ((_local4.subtype == enemy_accelToPlayer)))){
_local5 = _local4.xpos;
_local6 = _local4.ypos;
for each (_local7 in EnemyList) {
if (_local7.active == true){
if ((((_local7.subtype == enemy_fatShielded)) || ((_local4.subtype == enemy_accelToPlayer)))){
_local1 = (_local7.xpos - _local5);
_local2 = (_local7.ypos - _local6);
_local3 = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
if (_local3 < 100){
_local8 = Math.atan2(_local1, _local2);
_local9 = ((100 - _local3) * 0.1);
_local7.xpos = (_local7.xpos + (Math.sin(_local8) * _local9));
_local7.ypos = (_local7.ypos + (Math.cos(_local8) * _local9));
_local4.xpos = (_local4.xpos - (Math.sin(_local8) * _local9));
_local4.ypos = (_local4.ypos - (Math.cos(_local8) * _local9));
};
};
};
};
};
};
};
}
function SetEverythingUp():void{
var _local1:Font;
addEventListener(Event.ENTER_FRAME, run);
mochiScores = new LongAnimalsMochiScores();
mochiScores.Init();
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
LongAnimals_Kongregate.Init(this);
};
keyReader = new KeyReader(theStage);
soundPlayer = new SoundPlayer(this);
voiceOver = new VoiceOver(this);
pauseMenu = new PauseMenu(this);
tf_large = new TextFormat();
tf_small = new TextFormat();
_local1 = new Font20();
trace(_local1);
trace(_local1.fontName);
tf_large.font = _local1.fontName;
tf_large.size = 45;
tf_large.color = 4294967295;
tf_small.font = _local1.fontName;
tf_small.size = 16;
tf_small.color = 4294967295;
tf_small.color = 0xFFFFFF;
GenerateGraphics();
MochiBot.track(this, "c6304784");
screenBD = new BitmapData(640, 480, false, 0);
screenB = new Bitmap(screenBD);
particles = new Particles(this, 1000);
InitStage();
InitGame();
theStage.addEventListener(MouseEvent.MOUSE_MOVE, MouseHandler);
theStage.addEventListener(MouseEvent.MOUSE_DOWN, MouseClickHandler);
theStage.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
overlay = new Overlay();
overlay.AddClips(this, new revealOut(), new revealIn());
startLevel = 0;
currentLevel = startLevel;
SetGameState(gameState_TITLE);
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField;
_local5 = new TextField();
_local5.selectable = false;
_local5.embedFonts = true;
_local5.autoSize = TextFieldAutoSize.CENTER;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.text = _arg4;
_local5.setTextFormat(_arg1);
addChild(_local5);
return (_local5);
}
function ACH_KillEnemy(){
ACH_KillStreak++;
}
public function PlaySound(_arg1:int):void{
if (doSound == false){
return;
};
if (gameState != gameState_LEVEL_PLAY){
return;
};
soundPlayer.Play(_arg1);
}
public function AddParticle(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Number, _arg5:int){
var _local6:int;
_local6 = 0;
while (_local6 < _arg5) {
particles.Add(_arg3, _arg1, _arg2, _arg4);
_local6++;
};
}
public function soundOffPressed(_arg1:MouseEvent){
if (doSound == false){
return;
};
musicChannel.stop();
doSound = false;
}
function FindObjByType(_arg1:int):gameobj{
var _local2:int;
var _local3:gameobj;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local3 = objs.objs[_local2];
if (_local3.active == true){
if (_local3.type == _arg1){
return (_local3);
};
};
_local2++;
};
return (null);
}
function AddHealth(_arg1:Number){
if ((((health == maxHealth)) && ((_arg1 < 0)))){
if (maxHealthTimer > highestMaxHealthTimer){
Achivements.Submit(Achivements.ACH_MAX_TIME_AT_MAX_HEALTH, int((maxHealthTimer / 50)));
highestMaxHealthTimer = maxHealthTimer;
};
};
if (_arg1 < 0){
helpOverlay.DisplayOnce(3, "standard", "Try not to get hit by aliens or their missiles. You lose health every time you get hit.");
ACH_BeenHit();
};
health = (health + _arg1);
if (health > maxHealth){
health = maxHealth;
};
if (health < 0){
health = 0;
};
}
function Enemy_SetLeftStartPos(_arg1:gameobj):void{
_arg1.xpos = -50;
_arg1.ypos = RandBetween(50, 200);
}
function UpdateGameMusic(){
var _local1:int;
if (doSound == false){
if (musicChannel != null){
musicChannel.stop();
};
if (musicChannel1 != null){
musicChannel1.stop();
};
};
if (doSound == false){
return;
};
musicTimer = (musicTimer + ftime);
if (musicTimer >= (50 * 16)){
musicTimer = 0;
_local1 = RandBetween(0, 8);
if (_local1 == 0){
return;
};
_local1--;
musicSound1 = musicOverlays[_local1];
musicChannel1 = musicSound1.play(0, 1, musicSoundTransform1);
musicChannel.stop();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
}
function UpdateGameplay():void{
levelTimer = (levelTimer + ftime);
UpdateGameAchievements();
SetNumPickupsNeeded();
if (numEnemiesPickedUp > numEnemyPickupsNeeded){
GeneratePowerups();
numEnemiesPickedUp = 0;
};
if (numPowerupsPickedUp >= numPowerupsNeededForLevelUp){
numPowerupsPickedUp = 0;
AdvancePowerup();
};
if (health <= 0.001){
SetGameState(gameState_GAMEOVER);
};
}
public function buttonPlayOnKongregatePressed(_arg1:MouseEvent){
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
navigateToURL(new URLRequest("http://www.kongregate.com/games/robotJAM/aliens-must-die-the-jupiter-wars/?gamereferral=aliensmustdie"));
} else {
navigateToURL(new URLRequest("http://www.longanimalsgames.com"));
};
}
function RemoveMovieClip(_arg1:MovieClip):void{
removeChild(_arg1);
}
function ControlWaveNormal(_arg1:int, _arg2:WaveDef){
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:gameobj;
var _local8:int;
var _local9:Number;
_local3 = _arg2.GetType(_arg1);
_local4 = _arg2.GetMax(_arg1);
_local5 = _arg2.GetNumber(_arg1);
_local6 = _arg2.GetExtraInfo(_arg1);
if (enemyKilledCounts[_local3] < _local5){
if (enemyCounts[_local3] < _local4){
_local7 = objs.AddObj(gameobj.gotype_ENEMY, 0, 0, zpos_PLAYER, 0, _local6);
if (_local7 != null){
_local7.appearingTimer = 50;
_local7.InitEnemy(_local3);
_local8 = 0;
while (_local8 < 10) {
_local9 = (((Math.PI * 2) / 10) * _local8);
particles.Add(2, _local7.xpos, _local7.ypos, _local9);
_local8++;
};
_local7.InitFromEnemyDef();
return;
};
};
};
}
function ControlPlayer():void{
var _local1:*;
var _local2:Number;
var _local3:*;
var _local4:Number;
var _local5:Number;
var _local6:Boolean;
var _local7:gameobj;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:int;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local1 = 0.85;
_local2 = 6;
_local3 = 1;
_local4 = 0;
_local5 = 0;
if (((keyReader.Down(KeyReader.KEY_LEFT)) || (keyReader.Down(KeyReader.KEY_A)))){
_local4 = -(_local3);
};
if (((keyReader.Down(KeyReader.KEY_RIGHT)) || (keyReader.Down(KeyReader.KEY_D)))){
_local4 = _local3;
};
if (((keyReader.Down(KeyReader.KEY_UP)) || (keyReader.Down(KeyReader.KEY_W)))){
_local5 = -(_local3);
};
if (((keyReader.Down(KeyReader.KEY_DOWN)) || (keyReader.Down(KeyReader.KEY_S)))){
_local5 = _local3;
};
_local6 = false;
if (((!((_local4 == 0))) || (!((_local5 == 0))))){
_local6 = true;
};
goCrosshair.xpos = mousePosX;
goCrosshair.ypos = mousePosY;
playerDirToMouse = Math.atan2((mousePosX - (goPlayer.xpos - scrollX)), (mousePosY - (goPlayer.ypos - scrollY)));
shootTimer = (shootTimer - ftime);
if (shootTimer < 0){
shootTimer = 0;
};
if (((buttonPressed) || ((doAutofire == true)))){
if (shootTimer <= 0){
CreateMissile();
shootTimer = shootTimerMax;
};
};
if (powerupLevel >= 3){
shootTimer1Max = 100;
};
if (powerupLevel >= 7){
shootTimer1Max = 66;
};
if (powerupLevel >= 11){
shootTimer1Max = 33;
};
shootTimer1 = (shootTimer1 - ftime);
if (shootTimer1 < 0){
shootTimer1 = 0;
};
if (((buttonPressed) || ((doAutofire == true)))){
if (shootTimer1 <= 0){
CreateMissile1();
shootTimer1 = shootTimer1Max;
};
};
_local7 = goPlayer;
_local9 = -(playerDirToMouse);
_local7.xvel = (_local7.xvel + ((_local4 * ftime) * ftime));
_local7.yvel = (_local7.yvel + ((_local5 * ftime) * ftime));
_local8 = -(Math.atan2(_local7.xvel, _local7.yvel));
_local10 = _local7.GetNumFrames();
_local7.frame = ((_local10 / (Math.PI * 2)) * _local8);
_local7.frame = (_local7.frame - (_local10 / 4));
if (_local7.frame < 0){
_local7.frame = (_local7.frame + _local10);
};
_local11 = graphicobjs[gfx_playerturret].GetMaxFrames();
turretFrame = ((_local11 / (Math.PI * 2)) * _local9);
turretFrame = (turretFrame - (_local11 / 4));
if (turretFrame < 0){
turretFrame = (turretFrame + _local11);
};
if (_local7.xvel > _local2){
_local7.xvel = _local2;
};
if (_local7.xvel < -(_local2)){
_local7.xvel = -(_local2);
};
if (_local7.yvel > _local2){
_local7.yvel = _local2;
};
if (_local7.yvel < -(_local2)){
_local7.yvel = -(_local2);
};
_local7.xpos = (_local7.xpos + (_local7.xvel * ftime));
_local7.ypos = (_local7.ypos + (_local7.yvel * ftime));
_local7.xvel = (_local7.xvel * _local1);
_local7.yvel = (_local7.yvel * _local1);
_local7.xpos = LimitNumber(_local7.xpos, 0, scrollW);
_local7.ypos = LimitNumber(_local7.ypos, 0, (scrollH - 44));
if (_local6){
_local14 = Math.atan2(_local7.xvel, _local7.yvel);
_local15 = 32;
_local12 = (Math.sin(_local14) * _local15);
_local13 = (Math.cos(_local14) * _local15);
AddParticle((_local7.xpos - _local12), (_local7.ypos - _local13), Particles.type_playerExhaust, 0, 2);
_local12 = (Math.sin((_local14 + 0.3)) * _local15);
_local13 = (Math.cos((_local14 + 0.3)) * _local15);
AddParticle((_local7.xpos - _local12), (_local7.ypos - _local13), Particles.type_playerExhaust, 0, 2);
_local12 = (Math.sin((_local14 - 0.3)) * _local15);
_local13 = (Math.cos((_local14 - 0.3)) * _local15);
AddParticle((_local7.xpos - _local12), (_local7.ypos - _local13), Particles.type_playerExhaust, 0, 2);
};
}
function CreateEnemyList(){
var _local1:gameobj;
var _local2:int;
EnemyList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_ENEMY){
if (_local1.appearingTimer <= 0){
EnemyList.push(_local1);
};
};
};
_local2++;
};
}
function AddScore(_arg1:int){
currentScore = (currentScore + (_arg1 * multiplier));
}
function CreateHomingMissileInstance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:gameobj;
var _local6:Number;
var _local7:Number;
_local5 = objs.AddObj(gameobj.gotype_MISSILE, _arg1, _arg2, zpos_PLAYER, 0, 0);
if (_local5 != null){
_local5.subtype = 10;
_local5.frame = 0;
_local5.graphicID = gfx_missile2;
_local5.speed = _arg4;
_local5.dir = _arg3;
_local5.GetVelFromDir(1);
_local5.hp = 2;
_local5.xpos = (_local5.xpos + (_local5.xvel * 20));
_local5.ypos = (_local5.ypos + (_local5.yvel * 20));
_local6 = (mousePosX + scrollX);
_local7 = (mousePosY + scrollY);
_local5.homingGO = FindClosestEnemyTo(_local6, _local7);
};
}
public function OnEnemyKilled(_arg1:gameobj){
var _local2:gameobj;
var _local3:int;
var _local4:gameobj;
if (_arg1.subtype == enemy_fatShielded){
if (killedMothershipFlag == false){
Achivements.Submit(Achivements.ACH_DESTROYED_MOTHERSHIP, 1);
killedMothershipFlag = true;
};
};
ACH_KillEnemy();
helpOverlay.DisplayOnce(0, "standard", "When you destroy an enemy it will leave behind Debris. Collect as much of this as you can.");
voiceOver.PlayOnce(VoiceOver.vo_destroy_enemy);
PlaySound(SoundPlayer.SOUND_ENEMYKILLED);
if (_arg1.countable == true){
var _local5 = enemyKilledCounts;
var _local6 = _arg1.subtype;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
for each (_local2 in MissileList) {
if (_local2.active == true){
if (_arg1.homingGO == _arg1){
_arg1.homingGO = null;
};
};
};
_local3 = enemyDefs[_arg1.subtype].score;
AddScore(_local3);
_local4 = objs.AddObj(gameobj.gotype_PICKUP, _arg1.xpos, _arg1.ypos, zpos_ENEMY, 0, 0);
if (_local4 != null){
_local4.frame = 0;
_local4.graphicID = gfx_pickup1;
_local4.timer = (fps * 10);
_local4.dir = _local4.RandCircle();
_local4.GetVelFromDir(RandBetweenFloat(0.1, 0.3));
};
AddParticle(_arg1.xpos, _arg1.ypos, Particles.type_enemyDie, 0, 20);
AddParticle(_arg1.xpos, _arg1.ypos, Particles.type_enemyDie, 1, 10);
_arg1.OnKilled();
}
function SetNumPickupsNeeded(){
var _local1:*;
_local1 = 0;
_local1 = (8 + (powerupLevel * 5));
numEnemyPickupsNeeded = _local1;
numPowerupsNeededForLevelUp = _local1;
}
function KillAllBaddies(){
var _local1:int;
var _local2:gameobj;
var _local3:int;
_local3 = 0;
_local1 = 0;
while (_local1 < objs.numobjs) {
_local2 = objs.objs[_local1];
if (_local2.active == true){
if ((((_local2.type == gameobj.gotype_ENEMY_MISSILE)) || ((_local2.type == gameobj.gotype_ENEMY)))){
_local2.active = false;
AddParticle(_local2.xpos, _local2.ypos, Particles.type_enemyDie, 0, 6);
AddParticle(_local2.xpos, _local2.ypos, Particles.type_enemyDie, 1, 3);
};
};
_local1++;
};
}
public function CreatePickup():gameobj{
var _local1:int;
var _local2:Number;
var _local3:gameobj;
_local3 = objs.AddObj(gameobj.gotype_PICKUP, 0, 0, zpos_ENEMY, 0, 0);
if (_local3 != null){
_local3.pickupType = 1;
_local3.xpos = 700;
_local3.ypos = 100;
if (_local3.pickupType == 1){
};
return (_local3);
};
return (null);
}
function RunTitle(){
}
function GeneratePowerups(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:*;
var _local6:*;
var _local7:gameobj;
_local1 = 300;
_local2 = goPlayer.xpos;
_local3 = goPlayer.ypos;
_local4 = 0;
while (_local4 < 10) {
_local5 = RandBetweenFloat((_local2 - _local1), (_local2 + _local1));
_local6 = RandBetweenFloat((_local3 - _local1), (_local3 + _local1));
_local7 = objs.AddObj(gameobj.gotype_POWERUP, _local2, _local3, zpos_PLAYER, 0, 0);
if (_local7 != null){
_local7.InitPowerup();
};
_local4++;
};
}
function LimitNumber(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
_arg1 = _arg2;
};
if (_arg1 > _arg3){
_arg1 = _arg3;
};
return (_arg1);
}
function PlayerPickupCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:gameobj;
_local1 = goPlayer.xpos;
_local2 = goPlayer.ypos;
_local8 = 30;
_local9 = (30 * _local8);
for each (_local10 in PickupList) {
if (_local10.active == true){
_local6 = (_local1 - _local10.xpos);
_local7 = (_local2 - _local10.ypos);
_local4 = ((_local6 * _local6) + (_local7 * _local7));
if (_local4 < _local9){
_local10.active = false;
AddParticle(_local10.xpos, _local10.ypos, Particles.type_playerPickup, 0, 10);
numEnemiesPickedUp++;
PlaySound(SoundPlayer.SOUND_PICKUP_PICKUP);
AddScore(50);
helpOverlay.DisplayOnce(4, "standard", "Collect enough Debris to generate Power Pods");
voiceOver.PlayOnce(VoiceOver.vo_collect_debris);
ACH_GetPickup();
};
};
};
}
function RenderPickupBar(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = panelXpos3;
_local2 = panelYpos;
_local3 = ((50 / numPowerupsNeededForLevelUp) * numPowerupsPickedUp);
graphicobjs[gfx_bar_pickup].SetFrame((50 - _local3));
graphicobjs[gfx_bar_pickup].RenderAt(screenBD, _local1, _local2);
}
function Scroll():void{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = (goPlayer.xpos - 320);
_local2 = (goPlayer.ypos - 240);
_local3 = 0.06;
scrollX = (scrollX + (((_local1 - scrollX) * _local3) * ftime));
scrollY = (scrollY + (((_local2 - scrollY) * _local3) * ftime));
scrollX = LimitNumber(scrollX, 0, (scrollW - 640));
scrollY = LimitNumber(scrollY, 0, (scrollH - 480));
goBackground.xpos = -(scrollX);
goBackground.ypos = -(scrollY);
goBackground1.xpos = (-(scrollX) * 0.2);
goBackground1.ypos = (-(scrollY) * 0.2);
goBackground2.xpos = (-(scrollX) * 0.05);
goBackground2.ypos = (-(scrollY) * 0.05);
}
function run(_arg1:Event):void{
if (keyReader != null){
keyReader.UpdateOncePerFrame();
};
if (SoundPlayer != null){
soundPlayer.UpdateOncePerFrame();
};
if (SiteLock.IsLocked()){
return;
};
calcFrameTime();
overlay.Update();
switch (gameState){
case gameState_PREGAMEAD:
RunPreGameAd();
break;
case gameState_TITLE:
RunTitle();
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_GETREADY:
RunLevelGetReady();
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
case gameState_LEVEL_COMPLETE:
RunLevelComplete();
break;
case gameState_HELP:
break;
case gameState_GAMEOVER:
RunGameOver();
break;
};
}
public function mediumPressed(_arg1:MouseEvent){
difficultyLevel = 1;
}
function PlayerAddImpulse(_arg1:Number, _arg2:Number, _arg3:Number){
var _local4:gameobj;
_local4 = goPlayer;
goPlayer.xvel = (_local4.xvel + (_arg1 * _arg3));
_local4.yvel = (_local4.yvel + (_arg2 * _arg3));
}
function RenderHealthBar(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = panelXpos0;
_local2 = panelYpos;
_local3 = ((50 / maxHealth) * health);
graphicobjs[gfx_bar_health].SetFrame((50 - _local3));
graphicobjs[gfx_bar_health].RenderAt(screenBD, _local1, _local2);
}
function StartMusic(_arg1:int){
if (doSound == false){
return;
};
if (musicChannel != null){
musicChannel.stop();
};
if (musicChannel1 != null){
musicChannel1.stop();
};
if (_arg1 == 0){
musicSoundTransform = new SoundTransform(1, 0);
musicSound = new TitleMusic();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 1){
musicSoundTransform = new SoundTransform(1, 0);
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 2){
musicSoundTransform = new SoundTransform(1, 0);
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 3){
musicSoundTransform = new SoundTransform(1, 0);
musicChannel = musicSound.play(0, 0, musicSoundTransform);
};
}
function InitTitle(){
StartMusic(0);
InitStage();
titleMC = AddMovieClip(0, 0, new ShootingTitlePage());
if (Licensors.IsHosted()){
titleMC.buttonStart.addEventListener(MouseEvent.CLICK, buttonStartPressed);
titleMC.removeChild(titleMC.buttonStart1);
titleMC.buttonStart2.addEventListener(MouseEvent.CLICK, buttonMoreGames);
titleMC.buttonPlayOnKongregate.addEventListener(MouseEvent.CLICK, buttonPlayOnKongregatePressed);
} else {
titleMC.buttonStart.addEventListener(MouseEvent.CLICK, buttonStartPressed);
titleMC.buttonStart1.addEventListener(MouseEvent.CLICK, buttonHighScoresPressed);
titleMC.buttonStart2.addEventListener(MouseEvent.CLICK, buttonMoreGames);
titleMC.buttonPlayOnKongregate.addEventListener(MouseEvent.CLICK, buttonPlayOnKongregatePressed);
};
if (doSound == true){
};
if (doSound == false){
};
if (difficultyLevel == 0){
};
if (difficultyLevel == 1){
};
if (difficultyLevel == 2){
};
}
function MouseHandler(_arg1:MouseEvent):void{
mousePosX = _arg1.stageX;
mousePosY = _arg1.stageY;
mouseVelX = (mousePosX - mouseOldPosX);
mouseVelY = (mousePosY - mouseOldPosY);
mouseOldPosX = mousePosX;
mouseOldPosY = mousePosY;
if (gameState != gameState_LEVEL_PLAY){
return;
};
}
function InitMultiplier(){
multiplierMax = 10;
multiplier = 1;
ACH_hightestMultiplier = 0;
}
function Collision():void{
CreatePowerupList();
CreateMissileList();
CreateEnemyMissileList();
CreateEnemyList();
CreatePickupList();
CreateBonusList();
EnemyEnemyCollision();
PlayerBonusCollision();
PlayerEnemyCollision();
PlayerPickupCollision();
PlayerPowerupCollision();
PlayerEnemyMissileCollision();
MissileEnemyCollision();
}
function RunLevelGetReady(){
}
function Enemy_SetTopStartPos(_arg1:gameobj):void{
_arg1.xpos = RandBetween(100, 540);
_arg1.ypos = -20;
}
private function CreateTextFieldIn(_arg1:MovieClip, _arg2:TextFormat, _arg3:Number, _arg4:Number, _arg5:String):TextField{
var _local6:TextField;
_local6 = new TextField();
_local6.selectable = false;
_local6.embedFonts = true;
_local6.autoSize = TextFieldAutoSize.CENTER;
_local6.x = _arg3;
_local6.y = _arg4;
_local6.text = _arg5;
_local6.setTextFormat(_arg2);
_arg1.addChild(_local6);
return (_local6);
}
function calcFrameTime(){
var _local1:Number;
_local1 = currentTime;
currentTime = getTimer();
if (currentTime < _local1){
_local1 = (currentTime - 100);
};
if (currentTime > (_local1 + (100 * 10))){
_local1 = (100 * 10);
};
ftime = ((1 / (1000 / fps)) * (currentTime - _local1));
}
function MissileEnemyCollision():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:gameobj;
var _local10:Number;
var _local11:Number;
var _local12:gameobj;
_local5 = 30;
_local6 = (30 * _local5);
_local7 = 20;
_local8 = (20 * _local7);
for each (_local9 in MissileList) {
if (_local9.active == true){
_local10 = _local9.xpos;
_local11 = _local9.ypos;
for each (_local12 in EnemyList) {
if (_local12.active == true){
_local2 = (_local10 - _local12.xpos);
_local3 = (_local11 - _local12.ypos);
_local4 = ((_local2 * _local2) + (_local3 * _local3));
if (_local4 < _local12.radius2){
_local9.active = false;
_local12.hp = (_local12.hp - _local9.hp);
if (_local12.hp <= 0){
OnEnemyKilled(_local12);
_local12.active = false;
} else {
PlaySound(SoundPlayer.SOUND_ENEMYHIT);
AddParticle(_local9.xpos, _local9.ypos, Particles.type_hitEnemyNoDie, 0, 10);
};
_local12.AddImpulse(_local9.xvel, _local9.yvel, 1);
};
if (_local12.subtype == 8){
_local1 = 0;
while (_local1 < _local12.numBits) {
_local2 = (_local10 - _local12.coordListX[_local1]);
_local3 = (_local11 - _local12.coordListY[_local1]);
_local4 = ((_local2 * _local2) + (_local3 * _local3));
if (_local4 < _local8){
PlaySound(SoundPlayer.SOUND_ENEMYHIT);
_local9.active = false;
break;
};
_local1++;
};
};
};
};
};
};
}
function StartGameMusic(){
StopTitleMusic();
if (doSound == false){
return;
};
musicOverlays = new Array(8);
musicOverlays[0] = new Music1();
musicOverlays[1] = new Music2();
musicOverlays[2] = new Music3();
musicOverlays[3] = new Music4();
musicOverlays[4] = new Music5();
musicOverlays[5] = new Music6();
musicOverlays[6] = new Music7();
musicOverlays[7] = new Music8();
musicSoundTransform1 = new SoundTransform(1, 0);
musicSoundTransform = new SoundTransform(1, 0);
musicSound = new Music0();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
musicTimer = 100000;
}
public function EnemyCreateMissileDir(_arg1:gameobj, _arg2:Number):void{
var _local3:gameobj;
var _local4:gameobj;
_local3 = goPlayer;
_local4 = objs.AddObj(gameobj.gotype_ENEMY_MISSILE, _arg1.xpos, _arg1.ypos, zpos_PLAYER, 0, 0);
if (_local4 != null){
_local4.frame = 0;
_local4.graphicID = gfx_missile_enemy1;
_local4.dir = _arg2;
_local4.GetVelFromDir(1);
_local4.speed = 2;
};
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
function UpdateGameAchievements():void{
UpdateMaxHealthAchievement();
}
function GenerateGraphics(){
graphicobjs = new Array();
graphicobjs.push(new DisplayObj(new Backgrounds(), 1, 0));
graphicobjs.push(new DisplayObj(new BackgroundFar(), 1, 0));
graphicobjs.push(new DisplayObj(new Player(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy1(), 1, 0));
graphicobjs.push(new DisplayObj(new Pickup1(), 1, 0));
graphicobjs.push(new DisplayObj(new Checkpoint(), 1, 0));
graphicobjs.push(new DisplayObj(new Particle1GFX(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy2(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy3(), 1, 0));
graphicobjs.push(new DisplayObj(new ExitMC(), 1, 0));
graphicobjs.push(new DisplayObj(new MissileEnemy1(), 1, 0));
graphicobjs.push(new DisplayObj(new GogHeadEnemy(), 1, 0));
graphicobjs.push(new DisplayObj(new Missile1GFX(), 1, 0));
graphicobjs.push(new DisplayObj(new CrosshairGFX(), 1, 0));
graphicobjs.push(new DisplayObj(new Missile2GFX(), 1, 0));
graphicobjs.push(new DisplayObj(new Pickup2(), 1, 0));
graphicobjs.push(new DisplayObj(new Particle5GFX(), 1, 0));
graphicobjs.push(new DisplayObj(new GroundExplosion(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleEnemyAppear(), 1, 0));
graphicobjs.push(new DisplayObj(new Missile3GFX(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy4(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy5a(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy5b(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy5c(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy6(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy7(), 1, 0));
graphicobjs.push(new DisplayObj(new bar_health(), 1, 0));
graphicobjs.push(new DisplayObj(new bar_power(), 1, 0));
graphicobjs.push(new DisplayObj(new bar_pickup(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy8a(), 1, 0));
graphicobjs.push(new DisplayObj(new Enemy8b(), 1, 0));
graphicobjs.push(new DisplayObj(new BackgroundMiddle(), 1, 0));
graphicobjs.push(new DisplayObj(new Particle_powerup(), 1, 0));
graphicobjs.push(new DisplayObj(new bonus_scoreGFX(), 1, 0));
graphicobjs.push(new DisplayObj(new bonus_shieldGFX(), 1, 0));
graphicobjs.push(new DisplayObj(new bonus_healthGFX(), 1, 0));
graphicobjs.push(new DisplayObj(new bonus_multiplierGFX(), 1, 0));
graphicobjs.push(new DisplayObj(new commetClip(), 1, 0));
graphicobjs.push(new DisplayObj(new PanelOverlay(), 1, 0));
graphicobjs.push(new DisplayObj(new bar_multiplier(), 1, 0));
graphicobjs.push(new DisplayObj(new shieldClip(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticlePlayerExhaust(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleEnemyHit(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleEnemyKilled1(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleEnemyKilled2(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleEnemyAppear(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleCollectPickup(), 1, 0));
graphicobjs.push(new DisplayObj(new ParticleMeteorTrail(), 1, 0));
graphicobjs.push(new DisplayObj(new LevelUpOverlay(), 1, 0));
graphicobjs.push(new DisplayObj(new HealthLowOverlay(), 1, 0));
graphicobjs.push(new DisplayObj(new turret(), 1, 0));
graphicobjs.push(new DisplayObj(new Missile4GFX(), 1, 0));
}
function PlayerBonusCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:gameobj;
_local1 = goPlayer.xpos;
_local2 = goPlayer.ypos;
_local8 = 30;
_local9 = (30 * _local8);
for each (_local10 in BonusList) {
if (_local10.active == true){
_local6 = (_local1 - _local10.xpos);
_local7 = (_local2 - _local10.ypos);
_local4 = ((_local6 * _local6) + (_local7 * _local7));
if (_local4 < _local9){
_local10.active = false;
AddParticle(_local10.xpos, _local10.ypos, Particles.type_playerPickup, 0, 10);
BonusPickedUp(_local10);
ACH_GetPickup();
};
};
};
}
function CreateMissileInstance(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:int;
var _local6:gameobj;
_local6 = objs.AddObj(gameobj.gotype_MISSILE, _arg2, _arg3, zpos_PLAYER, 0, 0);
if (_local6 != null){
_local6.subtype = _arg1;
_local6.frame = 0;
if (_arg1 == 0){
_local6.hp = 1;
_local6.speed = 8;
_local6.graphicID = gfx_missile1;
};
if (_arg1 == 1){
_local6.hp = 2;
_local6.speed = 12;
_local6.graphicID = gfx_missile3;
_local5 = (graphicobjs[gfx_missile3].GetMaxFrames() - 1);
_local6.frame = ((_local5 / (Math.PI * 2)) * _arg4);
if (_local6.frame < 0){
_local6.frame = (_local6.frame + _local5);
};
if (_local6.frame > _local5){
_local6.frame = (_local6.frame - _local5);
};
_local6.frame = (_local6.frame + (_local5 / 2));
if (_local6.frame > _local5){
_local6.frame = (_local6.frame - _local5);
};
};
if (_arg1 == 2){
_local6.hp = 3;
_local6.speed = 15;
_local6.graphicID = gfx_missile4;
_local5 = (graphicobjs[gfx_missile4].GetMaxFrames() - 1);
_local6.frame = ((_local5 / (Math.PI * 2)) * _arg4);
if (_local6.frame < 0){
_local6.frame = (_local6.frame + _local5);
};
if (_local6.frame > _local5){
_local6.frame = (_local6.frame - _local5);
};
_local6.frame = (_local6.frame + (_local5 / 2));
if (_local6.frame > _local5){
_local6.frame = (_local6.frame - _local5);
};
};
_local6.dir = _arg4;
_local6.GetVelFromDir(1);
_local6.xpos = (_local6.xpos + (_local6.xvel * 20));
_local6.ypos = (_local6.ypos + (_local6.yvel * 20));
};
}
function UpdateLevelUpOverlay(){
if (levelUpOverlayTimer > 0){
levelUpOverlayTimer = (levelUpOverlayTimer + ftime);
if (levelUpOverlayTimer > (50 * 3)){
levelUpOverlayTimer = 0;
this.removeChild(levelUpOverlayMC);
};
};
}
function ShowLevelUp():void{
var _local1:int;
var _local2:String;
_local1 = (currentWaveUnlimited + 1);
_local2 = ("Wave " + _local1.toString());
levelUpOverlayMC = CreateTextField(tf_large, 320, 240, _local2);
levelUpOverlayTimer = 0.1;
}
function AllEnemiesDead():Boolean{
var _local1:int;
var _local2:gameobj;
var _local3:int;
_local3 = 0;
_local1 = 0;
while (_local1 < objs.numobjs) {
_local2 = objs.objs[_local1];
if (_local2.active == true){
if (_local2.type == gameobj.gotype_ENEMY){
if (_local2.countable == true){
return (false);
};
};
};
_local1++;
};
return (true);
}
function RunGameOver(){
gameOverTimer = (gameOverTimer - ftime);
if (gameOverTimer <= 0){
if (initedScores == false){
initedScores = true;
if (Licensors.GetLicensor() == Licensors.LICENSOR_NONE){
mochiScores.EnterHighScores(this, currentScore, enterScoreCallback);
} else {
if (Licensors.IsHosted()){
LongAnimals_Kongregate.kongregate.scores.submit(currentScore);
} else {
mochiScores.EnterHighScores(this, currentScore, enterScoreCallback);
};
};
};
};
}
function CreatePickupList(){
var _local1:gameobj;
var _local2:int;
PickupList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_PICKUP){
PickupList.push(_local1);
};
};
_local2++;
};
}
function CreateEnemyMissileList(){
var _local1:gameobj;
var _local2:int;
EnemyMissileList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_ENEMY_MISSILE){
EnemyMissileList.push(_local1);
};
};
_local2++;
};
}
function InitMaxHealthAchievement():void{
maxHealthTimer = 0;
highestMaxHealthTimer = 0;
}
function InitScoreAchievements():void{
scoreAch0 = false;
scoreAch1 = false;
scoreAch2 = false;
}
function RenderLowShieldOverlay():void{
var _local1:Number;
var _local2:Number;
if (health < 0.1){
_local1 = 320;
_local2 = 64;
graphicobjs[gfx_shieldlow].SetFrame(0);
graphicobjs[gfx_shieldlow].RenderAt(screenBD, _local1, _local2);
};
}
function CountActiveEnemies(){
var _local1:int;
var _local2:int;
var _local3:gameobj;
var _local4:int;
_local1 = 0;
while (_local1 < 32) {
enemyCounts[_local1] = 0;
_local1++;
};
_local4 = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local3 = objs.objs[_local2];
if (_local3.active == true){
if (_local3.type == gameobj.gotype_ENEMY){
if (_local3.countable == true){
var _local5 = enemyCounts;
var _local6 = _local3.subtype;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
};
};
_local2++;
};
}
function StartMainMenuCallback(){
SetGameState(gameState_TITLE);
}
public function OnEnemyOffMap(_arg1:gameobj){
var _local2:gameobj;
for each (_local2 in MissileList) {
if (_local2.active == true){
if (_arg1.homingGO == _arg1){
_arg1.homingGO = null;
};
};
};
}
function CreateBonusList(){
var _local1:gameobj;
var _local2:int;
BonusList.length = 0;
_local2 = 0;
while (_local2 < objs.numobjs) {
_local1 = objs.objs[_local2];
if (_local1.active == true){
if (_local1.type == gameobj.gotype_BONUS){
BonusList.push(_local1);
};
};
_local2++;
};
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
}
public function AdvancePowerup():void{
helpOverlay.DisplayOnce(6, "standard", "You have upgraded your weaponry!");
voiceOver.Play(VoiceOver.vo_weapons_upgrade);
powerupLevel++;
if (powerupLevel >= maxPowerupLevel){
powerupLevel = maxPowerupLevel;
};
}
function StartGameCallback(){
InitGame();
powerupLevel = 0;
currentWave = 0;
SetGameState(gameState_LEVEL_PLAY);
}
function TurnAllBaddiesToPickups(){
var _local1:int;
var _local2:gameobj;
var _local3:int;
_local3 = 0;
_local1 = 0;
while (_local1 < objs.numobjs) {
_local2 = objs.objs[_local1];
if (_local2.active == true){
if ((((_local2.type == gameobj.gotype_ENEMY_MISSILE)) || ((_local2.type == gameobj.gotype_ENEMY)))){
_local2.InitPowerup();
};
};
_local1++;
};
}
function PlayerEnemyMissileCollision():void{
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:gameobj;
_local1 = goPlayer.xpos;
_local2 = goPlayer.ypos;
_local8 = 20;
_local9 = (20 * _local8);
if (shieldTimer > 0){
return;
};
for each (_local10 in EnemyMissileList) {
if (_local10.active == true){
_local6 = (_local1 - _local10.xpos);
_local7 = (_local2 - _local10.ypos);
_local4 = ((_local6 * _local6) + (_local7 * _local7));
if (_local4 < _local9){
_local10.active = false;
PlaySound(SoundPlayer.SOUND_PLAYERHIT);
ResetMultiplier();
AddHealth(hitMissileHealthDrop);
PlayerAddImpulse(_local10.xvel, _local10.yvel, 10);
};
};
};
}
function RunLevel(){
var _local1:int;
var _local2:int;
if (keyReader.Pressed(KeyReader.KEY_P)){
if (pauseMenu.IsPaused()){
pauseMenu.Unpause();
} else {
pauseMenu.Pause();
};
};
helpOverlay.Update(ftime);
UpdateGameMusic();
if (pauseMenu.IsPaused() == false){
UpdateLevelUpOverlay();
ControlPlayer();
Scroll();
if (gameOverFlag == false){
UpdateGameplay();
UpdateMouse();
};
objs.Update();
ControlWaves();
UpdateShield();
UpdateBonuses();
particles.Update(ftime);
Collision();
};
Render();
if (overlay.IsActive()){
scoretxt.text = "";
scoretxt.setTextFormat(tf_small);
} else {
scoretxt.text = currentScore.toString();
scoretxt.setTextFormat(tf_small);
};
if (displayDebug){
_local1 = particles.CountActive();
_local2 = particles.GetNextIndex();
debugTxt.text = ("wave " + currentWave);
debugTxt.setTextFormat(tf_small);
} else {
debugTxt.text = "";
debugTxt.setTextFormat(tf_small);
};
}
function UpdateEnemyEncounter(){
var _local1:WaveDef;
var _local2:int;
var _local3:*;
var _local4:int;
var _local5:int;
_local1 = waves.GetDef(currentWave);
_local3 = _local1.GetNumTypes();
_local4 = 0;
_local2 = 0;
while (_local2 < _local3) {
_local5 = _local1.GetType(_local2);
if (encounteredEnemylist[_local5] == 0){
encounteredEnemylist[_local5] = 1;
helpOverlay.Display("standard", "New enemy encountered!");
_local4 = 1;
if (_local5 == enemy_jellyfish){
_local4 = 2;
};
if (_local5 == enemy_meteor){
_local4 = 3;
};
if (_local5 == enemy_fatShielded){
_local4 = 4;
};
};
_local2++;
};
if (_local4 == 4){
voiceOver.Play(VoiceOver.vo_alien_mothership);
};
if (_local4 == 3){
voiceOver.Play(VoiceOver.vo_meteor_shower);
};
if (_local4 == 2){
voiceOver.Play(VoiceOver.vo_space_squids);
};
if (_local4 == 1){
voiceOver.Play(VoiceOver.vo_new_enemy_type);
};
}
function RenderPowerupBar(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = panelXpos2;
_local2 = panelYpos;
_local3 = ((50 / numEnemyPickupsNeeded) * numEnemiesPickedUp);
graphicobjs[gfx_bar_powerup].SetFrame((50 - _local3));
graphicobjs[gfx_bar_powerup].RenderAt(screenBD, _local1, _local2);
}
function UpdateBonuses(){
var _local1:Number;
var _local2:Number;
var _local3:gameobj;
var _local4:*;
bonusGenTimer = (bonusGenTimer + ftime);
if (bonusGenTimer > (50 * 10)){
bonusGenTimer = 0;
_local1 = RandBetweenFloat((0 + 64), (scrollW - 64));
_local2 = RandBetweenFloat((0 + 64), (scrollH - 64));
_local3 = objs.AddObj(gameobj.gotype_BONUS, _local1, _local2, zpos_PLAYER, 0, 0);
if (_local3 != null){
_local4 = RandBetween(0, 3);
_local3.subtype = _local4;
_local3.InitBonus();
};
};
}
public static function StartFromTimeline():void{
}
}
}//package
Section 85
//MarkerGFX (MarkerGFX)
package {
import flash.display.*;
public dynamic class MarkerGFX extends MovieClip {
}
}//package
Section 86
//Missile1GFX (Missile1GFX)
package {
import flash.display.*;
public dynamic class Missile1GFX extends MovieClip {
}
}//package
Section 87
//Missile2GFX (Missile2GFX)
package {
import flash.display.*;
public dynamic class Missile2GFX extends MovieClip {
}
}//package
Section 88
//Missile3GFX (Missile3GFX)
package {
import flash.display.*;
public dynamic class Missile3GFX extends MovieClip {
}
}//package
Section 89
//Missile4GFX (Missile4GFX)
package {
import flash.display.*;
public dynamic class Missile4GFX extends MovieClip {
}
}//package
Section 90
//MissileEnemy1 (MissileEnemy1)
package {
import flash.display.*;
public dynamic class MissileEnemy1 extends MovieClip {
}
}//package
Section 91
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.3");
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local3 = true;
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("5cc6f7dfb67f2f08341c831480f7c2a7".length == 0){
options.ad_started();
options.ad_finished();
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
options.ad_failed();
_local4 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local4 = true;
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 92
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 93
//Music0 (Music0)
package {
import flash.media.*;
public dynamic class Music0 extends Sound {
}
}//package
Section 94
//Music1 (Music1)
package {
import flash.media.*;
public dynamic class Music1 extends Sound {
}
}//package
Section 95
//Music2 (Music2)
package {
import flash.media.*;
public dynamic class Music2 extends Sound {
}
}//package
Section 96
//Music3 (Music3)
package {
import flash.media.*;
public dynamic class Music3 extends Sound {
}
}//package
Section 97
//Music4 (Music4)
package {
import flash.media.*;
public dynamic class Music4 extends Sound {
}
}//package
Section 98
//Music5 (Music5)
package {
import flash.media.*;
public dynamic class Music5 extends Sound {
}
}//package
Section 99
//Music6 (Music6)
package {
import flash.media.*;
public dynamic class Music6 extends Sound {
}
}//package
Section 100
//Music7 (Music7)
package {
import flash.media.*;
public dynamic class Music7 extends Sound {
}
}//package
Section 101
//Music8 (Music8)
package {
import flash.media.*;
public dynamic class Music8 extends Sound {
}
}//package
Section 102
//Overlay (Overlay)
package {
import flash.display.*;
public class Overlay {
var callback:Object;
var parent:MovieClip;
var fadingOut:Boolean;
var mcOut:MovieClip;
var mcIn:MovieClip;
var fadingIn:Boolean;
public function Overlay(){
fadingIn = false;
fadingOut = false;
}
public function AddClips(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip):void{
mcIn = _arg3;
mcOut = _arg2;
parent = _arg1;
}
public function StartFadeIn(_arg1:Object){
callback = _arg1;
parent.addChild(mcIn);
mcIn.gotoAndStop(0);
fadingIn = true;
}
public function Update():void{
if (fadingOut == true){
mcOut.nextFrame();
if (mcOut.currentFrame == mcOut.totalFrames){
fadingOut = false;
parent.removeChild(mcOut);
if (callback != null){
callback();
};
};
};
if (fadingIn == true){
mcIn.nextFrame();
if (mcIn.currentFrame == mcIn.totalFrames){
parent.removeChild(mcIn);
fadingIn = false;
if (callback != null){
callback();
};
};
};
}
public function IsActive():Boolean{
if (fadingIn == true){
return (true);
};
if (fadingOut == true){
return (true);
};
return (false);
}
public function StartFadeOut(_arg1:Object){
callback = _arg1;
parent.addChild(mcOut);
mcOut.gotoAndStop(0);
fadingOut = true;
}
}
}//package
Section 103
//PanelOverlay (PanelOverlay)
package {
import flash.display.*;
public dynamic class PanelOverlay extends MovieClip {
}
}//package
Section 104
//Particle_powerup (Particle_powerup)
package {
import flash.display.*;
public dynamic class Particle_powerup extends MovieClip {
}
}//package
Section 105
//Particle1GFX (Particle1GFX)
package {
import flash.display.*;
public dynamic class Particle1GFX extends MovieClip {
}
}//package
Section 106
//Particle2GFX (Particle2GFX)
package {
import flash.display.*;
public dynamic class Particle2GFX extends MovieClip {
}
}//package
Section 107
//Particle3GFX (Particle3GFX)
package {
import flash.display.*;
public dynamic class Particle3GFX extends MovieClip {
}
}//package
Section 108
//Particle4GFX (Particle4GFX)
package {
import flash.display.*;
public dynamic class Particle4GFX extends MovieClip {
}
}//package
Section 109
//Particle5GFX (Particle5GFX)
package {
import flash.display.*;
public dynamic class Particle5GFX extends MovieClip {
}
}//package
Section 110
//ParticleCollectPickup (ParticleCollectPickup)
package {
import flash.display.*;
public dynamic class ParticleCollectPickup extends MovieClip {
}
}//package
Section 111
//ParticleEnemyAppear (ParticleEnemyAppear)
package {
import flash.display.*;
public dynamic class ParticleEnemyAppear extends MovieClip {
}
}//package
Section 112
//ParticleEnemyHit (ParticleEnemyHit)
package {
import flash.display.*;
public dynamic class ParticleEnemyHit extends MovieClip {
}
}//package
Section 113
//ParticleEnemyKilled1 (ParticleEnemyKilled1)
package {
import flash.display.*;
public dynamic class ParticleEnemyKilled1 extends MovieClip {
}
}//package
Section 114
//ParticleEnemyKilled2 (ParticleEnemyKilled2)
package {
import flash.display.*;
public dynamic class ParticleEnemyKilled2 extends MovieClip {
}
}//package
Section 115
//ParticleMeteorTrail (ParticleMeteorTrail)
package {
import flash.display.*;
public dynamic class ParticleMeteorTrail extends MovieClip {
}
}//package
Section 116
//ParticlePlayerExhaust (ParticlePlayerExhaust)
package {
import flash.display.*;
public dynamic class ParticlePlayerExhaust extends MovieClip {
}
}//package
Section 117
//Particles (Particles)
package {
import flash.geom.*;
public class Particles {
var max:int;
var list:Array;
var main:Main;
var nextIndex:int;
public static const type_hitEnemyNoDie = 0;
public static const type_playerPickup = 3;
public static const type_playerExhaust = 5;
public static const type_enemyAppear = 2;
public static const type_meteorExhaust = 6;
public static const type_enemyDie = 1;
public function Particles(_arg1:Main, _arg2:int):void{
var _local3:int;
super();
main = _arg1;
max = _arg2;
nextIndex = 0;
list = new Array(max);
_local3 = 0;
while (_local3 < max) {
list[_local3] = new Particle();
list[_local3].active = false;
_local3++;
};
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public function GetNextIndex():int{
return (nextIndex);
}
function RandAngle(_arg1:Particle, _arg2:Number, _arg3:Number){
var _local4:Number;
var _local5:Number;
_local4 = RandBetween(_arg2, _arg3);
_local5 = RandBetween(0, (Math.PI * 2));
_arg1.xvel = (Math.sin(_local5) * _local4);
_arg1.yvel = (Math.cos(_local5) * _local4);
}
public function Add(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
var _local6:Number;
var _local7:Particle;
_local7 = list[nextIndex];
nextIndex++;
if (nextIndex >= max){
nextIndex = 0;
};
_local7.active = true;
_local7.timer = 0;
_local7.type = _arg1;
_local7.alpha = 1;
_local7.alphaAdd = 0;
if (_arg1 == type_hitEnemyNoDie){
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local5 = RandBetween(5, 10);
_local6 = RandBetween(0, (Math.PI * 2));
_local7.xvel = (Math.sin(_local6) * _local5);
_local7.yvel = (Math.cos(_local6) * _local5);
_local7.graphicID = Main.gfx_particleenemyhit;
_local7.frame = RandBetween(0, 1);
_local7.alpha = 0.5;
_local7.alphaAdd = -0.02;
} else {
if (_arg1 == type_enemyDie){
RandAngle(_local7, 1, 1);
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.speed = RandBetween(1, 4);
_local7.frame = RandBetween(0, 5);
_local7.graphicID = Main.gfx_particleenemykilled1;
if (_arg4 != 0){
_local7.speed = RandBetween(5, 10);
_local7.frame = RandBetween(0, 5);
_local7.graphicID = Main.gfx_particleenemykilled2;
};
_local7.alphaAdd = -0.05;
} else {
if (_arg1 == type_enemyAppear){
_local5 = 4;
_local7.xvel = (Math.sin(_arg4) * _local5);
_local7.yvel = (Math.cos(_arg4) * _local5);
_local7.xpos = (_arg2 + (_local7.xvel * 50));
_local7.ypos = (_arg3 + (_local7.yvel * 50));
_local7.xvel = -(_local7.xvel);
_local7.yvel = -(_local7.yvel);
_local7.frame = 0;
_local7.frameVel = 0.5;
_local7.graphicID = Main.gfx_particleenemyappear;
_local7.timer = 50;
_local7.alphaAdd = -0.01;
} else {
if (_arg1 == type_playerPickup){
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local5 = RandBetween(1, 10);
_local6 = RandBetween(0, (Math.PI * 2));
_local7.xvel = Math.sin(_local6);
_local7.yvel = Math.cos(_local6);
_local7.xpos = (_arg2 + ((_local7.xvel * 50) * _local5));
_local7.ypos = (_arg3 + ((_local7.yvel * 50) * _local5));
_local7.xvel = (_local7.xvel * _local5);
_local7.yvel = (_local7.yvel * _local5);
_local7.xvel = -(_local7.xvel);
_local7.yvel = -(_local7.yvel);
_local7.timer = 50;
_local7.graphicID = Main.gfx_particlecollectpickup;
_local7.frame = RandBetween(0, 1);
_local7.alphaAdd = -0.02;
_local7.alpha = 1;
_local7.frameVel = 0;
} else {
if (_arg1 == type_playerExhaust){
RandAngle(_local7, 1, 1);
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.speed = RandBetween(0.1, 0.4);
_local7.frame = RandBetween(0, 5);
_local7.graphicID = Main.gfx_particleplayerexhaust;
_local7.alphaAdd = -0.02;
_local7.alpha = 0.7;
} else {
if (_arg1 == type_meteorExhaust){
RandAngle(_local7, 1, 1);
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.speed = RandBetween(0.1, 0.4);
_local7.frame = RandBetween(0, 5);
_local7.graphicID = Main.gfx_particlemeteortrail;
_local7.alphaAdd = -0.03;
_local7.alpha = 0.7;
};
};
};
};
};
};
_local7.maxframe = (main.graphicobjs[_local7.graphicID].GetMaxFrames() - 1);
}
public function CountActive():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < max) {
if (list[_local2].active){
_local1++;
};
_local2++;
};
return (_local1);
}
public function Reset(){
var _local1:int;
nextIndex = 0;
_local1 = 0;
while (_local1 < max) {
list[_local1].active = false;
_local1++;
};
}
public function Update(_arg1:Number){
var _local2:int;
var _local3:Particle;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local3.Update(_arg1);
};
_local2++;
};
}
public function Render(_arg1:Main){
var _local2:int;
var _local3:Particle;
var _local4:Number;
var _local5:Number;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local4 = (_local3.xpos - _arg1.scrollX);
_local5 = (_local3.ypos - _arg1.scrollY);
_arg1.graphicobjs[_local3.graphicID].SetFrame(_local3.frame);
_arg1.graphicobjs[_local3.graphicID].RenderAtAdditive(_arg1.screenBD, _local4, _local5, _local3.alpha);
};
_local2++;
};
}
}
}//package
class Particle {
private var graphicID:int;
private var yvel:Number;
private var timer:Number;
private var active:Boolean;
private var maxframe:int;
private var speed:Number;
private var xpos:Number;
private var alpha:Number;
private var alphaAdd:Number;
private var xvel:Number;
private var m:Main;
private var frame:Number;
private var frameVel:Number;
private var type:int;
private var ypos:Number;
private function Particle(){
}
private function PlayAnimation(_arg1):Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
private function Update(_arg1:Number){
var _local2:Number;
var _local3:Number;
_local3 = 0.02;
if (type == Particles.type_hitEnemyNoDie){
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
} else {
if (type == Particles.type_playerPickup){
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
timer = (timer + _arg1);
frameVel = 0.4;
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
timer = (timer - _arg1);
if (timer <= 0){
active = false;
};
PlayAnimation(m);
} else {
if (type == Particles.type_enemyDie){
xpos = (xpos + ((xvel * speed) * _arg1));
ypos = (ypos + ((yvel * speed) * _arg1));
_local2 = -0.05;
speed = (speed + (_local2 * _arg1));
if (speed < 0){
speed = 0;
};
timer = (timer + _arg1);
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
} else {
if (type == Particles.type_enemyAppear){
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
timer = (timer - _arg1);
if (timer <= 0){
active = false;
};
PlayAnimation(m);
} else {
if (type == Particles.type_playerExhaust){
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
} else {
if (type == Particles.type_meteorExhaust){
if ((((((((xpos < 0)) || ((ypos < 0)))) || ((xpos > 800)))) || ((ypos > 800)))){
active = false;
};
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
timer = (timer + _arg1);
alpha = (alpha + (alphaAdd * _arg1));
if (alpha < 0){
alpha = 0;
active = false;
};
};
};
};
};
};
};
}
}
Section 118
//PauseMenu (PauseMenu)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class PauseMenu {
var active:Boolean;
var main:Main;
var pauseMC:MovieClip;
public function PauseMenu(_arg1:Main):void{
main = _arg1;
active = false;
}
public function buttonSoundPressed(_arg1:MouseEvent){
if (main.doSound == false){
pauseMC.soundToggle.gotoAndStop("on");
main.doSound = true;
} else {
pauseMC.soundToggle.gotoAndStop("off");
main.doSound = false;
};
}
public function buttonAutofirePressed(_arg1:MouseEvent){
if (main.doAutofire == false){
pauseMC.autofireToggle.gotoAndStop("on");
main.doAutofire = true;
} else {
pauseMC.autofireToggle.gotoAndStop("off");
main.doAutofire = false;
};
trace(main.doAutofire);
}
public function IsPaused():Boolean{
return (active);
}
public function Pause():void{
Mouse.show();
pauseMC = AddMovieClip(0, 0, new PauseMenuClip());
main.addChild(pauseMC);
if (main.doSound == false){
pauseMC.soundToggle.gotoAndStop("off");
} else {
pauseMC.soundToggle.gotoAndStop("on");
};
if (main.doAutofire == false){
pauseMC.autofireToggle.gotoAndStop("off");
} else {
pauseMC.autofireToggle.gotoAndStop("on");
};
pauseMC.autofireBtn.addEventListener(MouseEvent.CLICK, buttonAutofirePressed);
pauseMC.soundBtn.addEventListener(MouseEvent.CLICK, buttonSoundPressed);
active = true;
}
public function Unpause():void{
Mouse.hide();
active = false;
main.removeChild(pauseMC);
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
}
}//package
Section 119
//PauseMenuClip (PauseMenuClip)
package {
import flash.display.*;
public dynamic class PauseMenuClip extends MovieClip {
public var autofireToggle:MovieClip;
public var soundToggle:MovieClip;
public var autofireBtn:SimpleButton;
public var soundBtn:SimpleButton;
}
}//package
Section 120
//Pickup1 (Pickup1)
package {
import flash.display.*;
public dynamic class Pickup1 extends MovieClip {
}
}//package
Section 121
//Pickup2 (Pickup2)
package {
import flash.display.*;
public dynamic class Pickup2 extends MovieClip {
}
}//package
Section 122
//PickupHealthSFX (PickupHealthSFX)
package {
import flash.media.*;
public dynamic class PickupHealthSFX extends Sound {
}
}//package
Section 123
//PickupMultiplierSFX (PickupMultiplierSFX)
package {
import flash.media.*;
public dynamic class PickupMultiplierSFX extends Sound {
}
}//package
Section 124
//PickupPickupSFX (PickupPickupSFX)
package {
import flash.media.*;
public dynamic class PickupPickupSFX extends Sound {
}
}//package
Section 125
//PickupPowerupSFX (PickupPowerupSFX)
package {
import flash.media.*;
public dynamic class PickupPowerupSFX extends Sound {
}
}//package
Section 126
//PickupScoreSFX (PickupScoreSFX)
package {
import flash.media.*;
public dynamic class PickupScoreSFX extends Sound {
}
}//package
Section 127
//PickupShieldSFX (PickupShieldSFX)
package {
import flash.media.*;
public dynamic class PickupShieldSFX extends Sound {
}
}//package
Section 128
//Player (Player)
package {
import flash.display.*;
public dynamic class Player extends MovieClip {
}
}//package
Section 129
//PlayerHitSFX (PlayerHitSFX)
package {
import flash.media.*;
public dynamic class PlayerHitSFX extends Sound {
}
}//package
Section 130
//RadioButton_disabledIcon (RadioButton_disabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_disabledIcon extends MovieClip {
}
}//package
Section 131
//RadioButton_downIcon (RadioButton_downIcon)
package {
import flash.display.*;
public dynamic class RadioButton_downIcon extends MovieClip {
}
}//package
Section 132
//RadioButton_overIcon (RadioButton_overIcon)
package {
import flash.display.*;
public dynamic class RadioButton_overIcon extends MovieClip {
}
}//package
Section 133
//RadioButton_selectedDisabledIcon (RadioButton_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDisabledIcon extends MovieClip {
}
}//package
Section 134
//RadioButton_selectedDownIcon (RadioButton_selectedDownIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDownIcon extends MovieClip {
}
}//package
Section 135
//RadioButton_selectedOverIcon (RadioButton_selectedOverIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedOverIcon extends MovieClip {
}
}//package
Section 136
//RadioButton_selectedUpIcon (RadioButton_selectedUpIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedUpIcon extends MovieClip {
}
}//package
Section 137
//RadioButton_upIcon (RadioButton_upIcon)
package {
import flash.display.*;
public dynamic class RadioButton_upIcon extends MovieClip {
}
}//package
Section 138
//revealIn (revealIn)
package {
import flash.display.*;
public dynamic class revealIn extends MovieClip {
}
}//package
Section 139
//revealOut (revealOut)
package {
import flash.display.*;
public dynamic class revealOut extends MovieClip {
}
}//package
Section 140
//shieldClip (shieldClip)
package {
import flash.display.*;
public dynamic class shieldClip extends MovieClip {
}
}//package
Section 141
//ShootingTitlePage (ShootingTitlePage)
package {
import flash.display.*;
public dynamic class ShootingTitlePage extends MovieClip {
public var buttonStart:ButtonStart;
public var buttonPlayOnKongregate:SimpleButton;
public var buttonStart1:ButtonHighScores;
public var buttonStart2:ButtonMoreGames;
public function ShootingTitlePage(){
addFrameScript(99, frame100);
}
function frame100(){
stop();
}
}
}//package
Section 142
//Shot1SFX (Shot1SFX)
package {
import flash.media.*;
public dynamic class Shot1SFX extends Sound {
}
}//package
Section 143
//Shot2SFX (Shot2SFX)
package {
import flash.media.*;
public dynamic class Shot2SFX extends Sound {
}
}//package
Section 144
//SiteLock (SiteLock)
package {
public class SiteLock {
static var sitelockActive:Boolean = false;
public static function GetDomain():String{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local1 = Main.theStage.loaderInfo.url;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
public static function IsLocked():Boolean{
var _local1:String;
if (sitelockActive == false){
return (false);
};
_local1 = GetDomain();
if (((((((!((_local1 == "flashgamelicense.com"))) && (!((_local1 == "longanimalsgames.com"))))) && (!((_local1 == "robotjam.com"))))) && (!((_local1 == "robotjamgames.com"))))){
return (true);
};
return (false);
}
}
}//package
Section 145
//sound1 (sound1)
package {
import flash.media.*;
public dynamic class sound1 extends Sound {
}
}//package
Section 146
//SoundPlayer (SoundPlayer)
package {
import flash.media.*;
public class SoundPlayer {
var playTime:Array;
var sounds:Array;
var main:Main;
var soundTransform:SoundTransform;
public static const SOUND_PLAYERSHOOT1 = 1;
public static const SOUND_PICKUP_POWERUP = 10;
public static const SOUND_PICKUP_PICKUP = 9;
public static const minPlayTime = 3;
public static const SOUND_PICKUP_MULTIPLIER = 8;
public static const SOUND_ENEMYKILLED = 3;
public static const SOUND_ENEMYHIT = 2;
public static const SOUND_PLAYERHIT = 4;
public static const SOUND_PLAYERSHOOT = 0;
public static const SOUND_PICKUP_HEALTH = 7;
public static const SOUND_MAX = 11;
public static const SOUND_PICKUP_SHIELD = 5;
public static const SOUND_PICKUP_SCORE = 6;
public function SoundPlayer(_arg1:Main):void{
var _local2:int;
super();
main = _arg1;
sounds = new Array(SOUND_MAX);
playTime = new Array(SOUND_MAX);
sounds[SOUND_PLAYERSHOOT] = new Shot1SFX();
sounds[SOUND_PLAYERSHOOT1] = new Shot2SFX();
sounds[SOUND_ENEMYHIT] = new EnemyHitSFX();
sounds[SOUND_ENEMYKILLED] = new EnemyKilledSFX();
sounds[SOUND_PLAYERHIT] = new PlayerHitSFX();
sounds[SOUND_PICKUP_SHIELD] = new PickupShieldSFX();
sounds[SOUND_PICKUP_SCORE] = new PickupScoreSFX();
sounds[SOUND_PICKUP_HEALTH] = new PickupHealthSFX();
sounds[SOUND_PICKUP_MULTIPLIER] = new PickupMultiplierSFX();
sounds[SOUND_PICKUP_PICKUP] = new PickupPickupSFX();
sounds[SOUND_PICKUP_POWERUP] = new PickupPowerupSFX();
soundTransform = new SoundTransform(0.5, 0);
_local2 = 0;
while (_local2 < SOUND_MAX) {
playTime[_local2] = int(0);
_local2++;
};
}
public function UpdateOncePerFrame():void{
var _local1:int;
_local1 = 0;
while (_local1 < SOUND_MAX) {
if (playTime[_local1] > 0){
var _local2 = playTime;
var _local3 = _local1;
var _local4 = (_local2[_local3] - 1);
_local2[_local3] = _local4;
};
_local1++;
};
}
public function Play(_arg1:int):void{
var _local2:Sound;
if (main.doSound == false){
return;
};
if (playTime[_arg1] > 0){
return;
};
_local2 = sounds[_arg1];
_local2.play(0, 1, soundTransform);
playTime[_arg1] = minPlayTime;
}
}
}//package
Section 147
//Symbol2 (Symbol2)
package {
import flash.display.*;
public dynamic class Symbol2 extends MovieClip {
}
}//package
Section 148
//Symbol3 (Symbol3)
package {
import flash.display.*;
public dynamic class Symbol3 extends MovieClip {
}
}//package
Section 149
//TitleMusic (TitleMusic)
package {
import flash.media.*;
public dynamic class TitleMusic extends Sound {
}
}//package
Section 150
//turret (turret)
package {
import flash.display.*;
public dynamic class turret extends MovieClip {
}
}//package
Section 151
//Wave (Wave)
package {
public class Wave {
var waveList:Array;
public function Init(_arg1:int):void{
waveList[_arg1].Init();
}
function AddDef(_arg1:WaveDef):void{
waveList.push(_arg1);
}
public function InitWaves():void{
var _local1:WaveDef;
waveList = new Array();
_local1 = new WaveDef();
_local1.SetTimer(20);
_local1.AddEnemy(Main.enemy_asteroid, 3, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 5, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(20);
_local1.SetNoDeadCheck();
_local1.AddEnemy(Main.enemy_jellyfish, 20, 40);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 7, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(20);
_local1.AddEnemy(Main.enemy_asteroid, 4, 4);
_local1.AddEnemy(Main.enemy_jellyfish, 20, 40);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 7);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(30);
_local1.AddEnemy(Main.enemy_asteroid, 8, 8);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 5, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(30);
_local1.SetNoDeadCheck();
_local1.AddEnemy(Main.enemy_jellyfish, 10, 20);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 5, 5);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 7, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 20, 10);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 5, 5);
_local1.AddEnemy(Main.enemy_asteroid, 8, 8);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(30);
_local1.SetNoDeadCheck();
_local1.AddEnemy(Main.enemy_meteor, 10, 20);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 20, 13);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(30);
_local1.AddEnemy(Main.enemy_meteor, 10, 20);
_local1.AddEnemy(Main.enemy_asteroid, 8, 8);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 5, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(30);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 7);
_local1.AddEnemy(Main.enemy_jellyfish, 20, 40);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 15, 10);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 5, 3);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 7);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetNoDeadCheck();
_local1.AddEnemy(Main.enemy_meteor, 5, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_heavySprayer, 10, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 4);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 4);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 4);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemy(Main.enemy_asteroid, 30, 20);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_heavySprayer, 10, 5);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 20, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetNoDeadCheck();
_local1.AddEnemyEx(Main.enemy_meteor, 5, 5, 1);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetNoDeadCheck();
_local1.AddEnemyEx(Main.enemy_jellyfish, 10, 10, 1);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 30, 8);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemy(Main.enemy_heavySprayer, 10, 5);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 20, 4);
_local1.AddEnemy(Main.enemy_asteroid, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_fatShielded, 2, 2);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemyEx(Main.enemy_meteor, 10, 10, 1);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 20, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_fatShielded, 3, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 30, 20);
_local1.AddEnemy(Main.enemy_asteroid, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_fatShielded, 3, 3);
_local1.AddEnemy(Main.enemy_heavySprayer, 10, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 4);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 30, 8);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 2);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemy(Main.enemy_asteroid, 40, 30);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_fatShielded, 3, 3);
_local1.AddEnemyEx(Main.enemy_jellyfish, 20, 40, 0);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_accelToPlayer, 20, 7);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 4);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_accelToPlayer, 30, 5);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 30, 5);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 30, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 4);
_local1.AddEnemyEx(Main.enemy_meteor, 10, 10, 1);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_fatShielded, 3, 3);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 50, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetNoDeadCheck();
_local1.AddEnemyEx(Main.enemy_jellyfish, 2, 4, 1);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_accelToPlayer, 40, 7);
_local1.AddEnemy(Main.enemy_heavySprayer, 20, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 20, 4);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 30, 5);
AddDef(_local1);
_local1 = new WaveDef();
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 100, 20);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetRandom(3);
_local1.AddEnemyEx(Main.enemy_meteor, 30, 40, 1);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 3);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 3);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetRandom(3);
_local1.AddEnemy(Main.enemy_asteroid, 30, 5);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 3);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 3);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetRandom(3);
_local1.AddEnemyEx(Main.enemy_jellyfish, 20, 30, 1);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 3);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 3);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetRandom(3);
_local1.AddEnemy(Main.enemy_heavySprayer, 6, 3);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 3);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 3);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 3);
AddDef(_local1);
_local1 = new WaveDef();
_local1.SetTimer(40);
_local1.SetRandom(3);
_local1.AddEnemy(Main.enemy_fatShielded, 3, 1);
_local1.AddEnemy(Main.enemy_stopGoAroundPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_zippyBulletDodger, 10, 3);
_local1.AddEnemy(Main.enemy_moveToPlayerRot, 10, 3);
_local1.AddEnemy(Main.enemy_accelToPlayer, 10, 3);
_local1.AddEnemy(Main.enemy_hoverAroundPlayer, 10, 3);
AddDef(_local1);
}
public function GetMaxWaves():int{
return (waveList.length);
}
function GetDef(_arg1:int):WaveDef{
return (waveList[_arg1]);
}
}
}//package
Section 152
//WaveDef (WaveDef)
package {
public class WaveDef {
var noDeadCheck:Boolean;
var timer:Number;
var useTimer:Boolean;
var enemyTypes:Array;
var waveID:int;
var selectRandom:Boolean;
var timerMax:Number;
var enemyNumbers:Array;
var enemyActive:Array;
var numRandom:int;
var maxEnemies:Array;
var enemyExtraInfo:Array;
public function WaveDef():void{
enemyTypes = new Array();
enemyNumbers = new Array();
maxEnemies = new Array();
enemyExtraInfo = new Array();
enemyActive = new Array();
timer = 0;
timerMax = 0;
useTimer = false;
selectRandom = false;
numRandom = 0;
noDeadCheck = false;
}
public function GetExtraInfo(_arg1:int):int{
return (enemyExtraInfo[_arg1]);
}
public function AddEnemy(_arg1:int, _arg2:int, _arg3:int):void{
enemyTypes.push(_arg1);
enemyNumbers.push(_arg2);
maxEnemies.push(_arg3);
enemyExtraInfo.push(0);
enemyActive.push(true);
}
public function GetType(_arg1:int):int{
return (enemyTypes[_arg1]);
}
public function GetMax(_arg1:int):int{
return (maxEnemies[_arg1]);
}
public function AddEnemyEx(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
enemyTypes.push(_arg1);
enemyNumbers.push(_arg2);
maxEnemies.push(_arg3);
enemyExtraInfo.push(_arg4);
enemyActive.push(true);
}
public function SetNoDeadCheck():void{
noDeadCheck = true;
}
public function SetTimer(_arg1:int):void{
timerMax = (50 * _arg1);
useTimer = true;
}
public function SetRandom(_arg1:int):void{
selectRandom = true;
numRandom = _arg1;
}
public function GetActive(_arg1:int):Boolean{
return (enemyActive[_arg1]);
}
public function GetNumber(_arg1:int):int{
return (enemyNumbers[_arg1]);
}
public function GetNumTypes():int{
return (enemyTypes.length);
}
public function Init():void{
var _local1:int;
var _local2:int;
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:Boolean;
_local2 = maxEnemies.length;
timer = 0;
_local1 = 0;
while (_local1 < _local2) {
enemyActive[_local1] = true;
_local1++;
};
if (selectRandom == true){
_local3 = new Array(_local2);
_local1 = 0;
while (_local1 < _local2) {
_local3[_local1] = Boolean(false);
_local1++;
};
_local1 = 0;
while (_local1 < (numRandom + 1)) {
_local3[_local1] = true;
_local1++;
};
_local1 = 0;
while (_local1 < 100) {
_local4 = ((Math.random() * 1000) % (_local2 - 1));
_local5 = ((Math.random() * 1000) % (_local2 - 1));
_local4++;
_local5++;
_local6 = _local3[_local4];
_local3[_local4] = _local3[_local5];
_local3[_local5] = _local6;
_local1++;
};
_local1 = 0;
while (_local1 < _local2) {
trace((((" slot " + _local1) + " : ") + _local3[_local1]));
_local1++;
};
_local1 = 0;
while (_local1 < _local2) {
enemyActive[_local1] = _local3[_local1];
_local1++;
};
};
}
}
}//package
Section 153
//VoiceOver (VoiceOver)
package {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class VoiceOver {
var channel:SoundChannel;
var startTimes:Array;
var timer:Timer;
var playingFlag:Boolean;
var lengths:Array;
var sound:Sound;
var soundTransform:SoundTransform;
var playedFlag:Array;
var main:Main;
public static const vo_multiplier = 11;
public static const vo_score = 9;
public static const vo_destroy_enemy = 1;
public static const vo_new_enemy_type = 5;
public static const vo_meteor_shower = 7;
public static const vo_welcome = 0;
public static const vo_space_squids = 6;
public static const vo_powerpod = 3;
public static const vo_health = 10;
public static const vo_energy_low = 13;
public static const vo_weapons_upgrade = 4;
public static const vo_shield = 12;
public static const vo_collect_debris = 2;
public static const vo_alien_mothership = 8;
public function VoiceOver(_arg1:Main){
var _local2:int;
super();
main = _arg1;
sound = new VoiceOverSound();
soundTransform = new SoundTransform(1, 0);
channel = new SoundChannel();
startTimes = new Array();
lengths = new Array();
AddSound(0, 0.45, 6.31);
AddSound(0, 6.89, 5.53);
AddSound(0, 12.74, 3.09);
AddSound(0, 16.3, 4.29);
AddSound(0, 21.09, 2.39);
AddSound(0, 23.85, 3.34);
AddSound(0, 27.77, 3.88);
AddSound(0, 32.14, 3.63);
AddSound(0, 36.94, 4.35);
AddSound(0, 41.69, 1.49);
AddSound(0, 52.1, 1.41);
AddSound(0, 45.22, 2.1);
AddSound(0, 47.78, 1.73);
AddSound(0, 53.68, 2.15);
playedFlag = new Array(lengths.length);
_local2 = 0;
while (_local2 < lengths.length) {
playedFlag[_local2] = Boolean(false);
_local2++;
};
playingFlag = false;
}
function timerHandler(_arg1:TimerEvent):void{
timer.stop();
channel.stop();
playingFlag = false;
}
function AddSound(_arg1:int, _arg2:Number, _arg3:Number){
startTimes.push((_arg2 * 1000));
lengths.push((_arg3 * 1000));
}
public function Play(_arg1:int):Boolean{
if (main.doSound == false){
return (false);
};
if (playingFlag){
return (false);
};
channel = sound.play(startTimes[_arg1], 1, soundTransform);
timer = new Timer(lengths[_arg1]);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
playingFlag = true;
return (true);
}
public function PlayOnce(_arg1:int):void{
if (playedFlag[_arg1]){
return;
};
playedFlag[_arg1] = Play(_arg1);
}
}
}//package
Section 154
//VoiceOverSound (VoiceOverSound)
package {
import flash.media.*;
public dynamic class VoiceOverSound extends Sound {
}
}//package