Section 1
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
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.events.*;
import flash.display.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 5
//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 6
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import fl.managers.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 7
//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 8
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 9
//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 10
//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 11
//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 12
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 13
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintMultiplier:Number;// = 0
private var _tintColor:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
_tintColor = 0;
_tintMultiplier = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public function setTint(_arg1:uint, _arg2:Number):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
private function deriveTintColor():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
_local1 = (1 / this.tintMultiplier);
_local2 = Math.round((this.redOffset * _local1));
_local3 = Math.round((this.greenOffset * _local1));
_local4 = Math.round((this.blueOffset * _local1));
_local5 = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set brightness(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_local2 = (1 - Math.abs(_arg1));
_local3 = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
private function parseXML(_arg1:XML=null):Color{
var _local2:XML;
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
_local2 = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
_local4 = (1 - _arg3);
_local5 = ((_arg1 >> 24) & 0xFF);
_local6 = ((_arg1 >> 16) & 0xFF);
_local7 = ((_arg1 >> 8) & 0xFF);
_local8 = (_arg1 & 0xFF);
_local9 = ((_arg2 >> 24) & 0xFF);
_local10 = ((_arg2 >> 16) & 0xFF);
_local11 = ((_arg2 >> 8) & 0xFF);
_local12 = (_arg2 & 0xFF);
_local13 = ((_local5 * _local4) + (_local9 * _arg3));
_local14 = ((_local6 * _local4) + (_local10 * _arg3));
_local15 = ((_local7 * _local4) + (_local11 * _arg3));
_local16 = ((_local8 * _local4) + (_local12 * _arg3));
_local17 = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number;
var _local5:ColorTransform;
_local4 = (1 - _arg3);
_local5 = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 14
//DogTekLogo_11 (ZRox_fla.DogTekLogo_11)
package ZRox_fla {
import flash.display.*;
public dynamic class DogTekLogo_11 extends MovieClip {
public var logoEngine:MovieClip;
}
}//package ZRox_fla
Section 15
//highScoreEntry_55 (ZRox_fla.highScoreEntry_55)
package ZRox_fla {
import flash.display.*;
import flash.text.*;
public dynamic class highScoreEntry_55 extends MovieClip {
public var levels:TextField;
public var username:TextField;
}
}//package ZRox_fla
Section 16
//LevelSelectionContainer_57 (ZRox_fla.LevelSelectionContainer_57)
package ZRox_fla {
import flash.display.*;
public dynamic class LevelSelectionContainer_57 extends MovieClip {
public var dummy:MovieClip;
}
}//package ZRox_fla
Section 17
//MainTimeline (ZRox_fla.MainTimeline)
package ZRox_fla {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class MainTimeline extends MovieClip {
public var highscore1:MovieClip;
public var highscore3:MovieClip;
public var highscore5:MovieClip;
public var highscore7:MovieClip;
public var highscore4:MovieClip;
public var highscore6:MovieClip;
public var highscore8:MovieClip;
public var highscore2:MovieClip;
public var levelName:TextField;
public var musicIcon:MovieClip;
public var PreviousLevelButton:SimpleButton;
public var ngButton:SimpleButton;
public var lock1:MovieClip;
public var lock2:MovieClip;
public var lock3:MovieClip;
public var lock4:MovieClip;
public var timeLeft:TextField;
public var container:MovieClip;
public var m_Game:ZRGame;
public var NextLevelButton:SimpleButton;
public var enterNameMessage:MovieClip;
public var completedLevelsMessage:MovieClip;
public var logoEffect:MovieClip;
public var FirstLevelButton:SimpleButton;
public var randomAttackMode:SimpleButton;
public var normalMode:SimpleButton;
public var loadingBar:MovieClip;
public var skipLevel:SimpleButton;
public var LastLevelButton:SimpleButton;
public var extremeLimitedViewMode:SimpleButton;
public var viewLoss:MovieClip;
public var menuButton:SimpleButton;
public var skipButton:SimpleButton;
public var viewsLeft:TextField;
public var symbol:MovieClip;
public var completedLevels:TextField;
public var giveUp:SimpleButton;
public var limitedViewMode:SimpleButton;
public var playButton:SimpleButton;
public var musicButton:SimpleButton;
public var viewAgain:SimpleButton;
public var answer:TextField;
public var totalLevels:TextField;
public var selectLevel:SimpleButton;
public var timeGain:MovieClip;
public var flash:MC_Flash;
public var replayButton:SimpleButton;
public var extremeRandomAttackMode:SimpleButton;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 10, frame11, 30, frame31, 55, frame56, 61, frame62, 201, frame202, 211, frame212, 302, frame303, 305, frame306, 309, frame310, 321, frame322, 411, frame412, 417, frame418, 424, frame425, 425, frame426, 431, frame432, 1678, frame1679, 1693, frame1694, 1699, frame1700, 1700, frame1701, 1707, frame1708, 1712, frame1713, 1713, frame1714, 1723, frame1724, 1728, frame1729, 1729, frame1730, 1737, frame1738, 1743, frame1744, 1744, frame1745, 1753, frame1754, 1758, frame1759, 1759, frame1760, 1767, frame1768, 1773, frame1774, 1774, frame1775, 1787, frame1788, 0x0700, frame1793, 1793, frame1794, 2031, frame2032, 2032, frame2033, 2051, frame2052, 2203, frame2204, 2204, frame2205, 2210, frame2211, 2216, frame2217, 2217, frame2218);
}
function frame2033(){
gotoAndStop((this.currentFrame - 1));
}
function frame1744(){
stop();
}
function frame1745(){
gotoAndStop((this.currentFrame - 1));
}
function frame2032(){
m_Game.EndCinematic();
}
function frame1754(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_HighScoresLimited);
}
function frame1759(){
stop();
}
function frame2052(){
play();
}
function frame1(){
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(2810);
}
function frame11(){
playButton.addEventListener(MouseEvent.MOUSE_DOWN, OnPlayButtonDown);
}
function frame1774(){
stop();
}
function frame1775(){
gotoAndStop((this.currentFrame - 1));
}
function frame1768(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_HighScoresRandom);
}
function frame1760(){
gotoAndStop((this.currentFrame - 1));
}
function frame2(){
stop();
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
function frame31(){
gotoAndPlay("Init");
}
function frame1788(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_HighScoresLimited);
}
function frame1793(){
stop();
}
function frame1794(){
gotoAndStop((this.currentFrame - 1));
}
function frame1679(){
m_Game.EndCinematic();
}
function frame412(){
m_Game.EndCinematic();
}
function frame56(){
stop();
m_Game = new ZRGame(this);
m_Game.Init();
m_Game.Start();
addEventListener(Event.ENTER_FRAME, EnterFrameRunHandler);
}
function frame418(){
play();
}
function frame425(){
stop();
}
function frame426(){
gotoAndPlay("Menu");
}
function frame1694(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_Normal);
}
function frame306(){
play();
}
function frame62(){
play();
}
function frame310(){
m_Game.EndCinematic();
}
function frame432(){
play();
}
function frame303(){
m_Game.EndCinematic();
}
function frame322(){
play();
}
function frame2205(){
gotoAndStop((this.currentFrame - 1));
}
public function OnPlayButtonDown(_arg1:MouseEvent){
play();
}
function frame2204(){
m_Game.EndCinematic();
}
function frame202(){
m_Game.EndCinematic();
}
function frame212(){
play();
}
function frame2217(){
stop();
}
function frame2211(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_LevelSelection);
}
function frame2218(){
gotoAndPlay("NormalMode");
}
function frame1708(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_Random);
}
function frame1701(){
gotoAndPlay("NormalMode");
}
public function EnterFrameRunHandler(_arg1:Event){
m_Game.Run();
}
function frame1700(){
stop();
}
function frame1714(){
gotoAndPlay("RandomAttackMode");
}
function frame1713(){
stop();
}
function frame1724(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_Limited);
}
function frame1729(){
stop();
}
function frame1730(){
gotoAndPlay("LimitedViewMode");
}
function frame1738(){
play();
m_Game.InitGameModeDisplay(ZRGame.GameMode_HighScoresRandom);
}
public function EnterFrameHandler(_arg1:Event){
var _local2:Number;
_local2 = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
loadingBar.scaleX = _local2;
if (loaderInfo.bytesLoaded == loaderInfo.bytesTotal){
removeEventListener(Event.ENTER_FRAME, EnterFrameHandler);
gotoAndStop("PreloaderReady");
};
}
}
}//package ZRox_fla
Section 18
//MusicIconAnimated_37 (ZRox_fla.MusicIconAnimated_37)
package ZRox_fla {
import flash.display.*;
public dynamic class MusicIconAnimated_37 extends MovieClip {
public function MusicIconAnimated_37(){
addFrameScript(40, frame41);
}
function frame41(){
gotoAndPlay(2);
}
}
}//package ZRox_fla
Section 19
//NG_AD_OBJECT_3 (ZRox_fla.NG_AD_OBJECT_3)
package ZRox_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
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 NG_AD_OBJECT_3 extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT_3(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
public function startAd(_arg1){
var _local2:URLLoader;
_local2 = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function frame1(){
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
};
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
NG_Button.addEventListener(MouseEvent.CLICK, loadNGSite);
stop();
}
public function ad_Loaded(_arg1:Event){
var _local2:*;
var _local3:Loader;
_local2 = String(_arg1.target.data);
_local3 = new Loader();
_local3.load(new URLRequest(_local2));
ng_ad.addChild(_local3);
}
}
}//package ZRox_fla
Section 20
//NG_TANK_5 (ZRox_fla.NG_TANK_5)
package ZRox_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_5 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_5(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package ZRox_fla
Section 21
//NGI_INTRO_18 (ZRox_fla.NGI_INTRO_18)
package ZRox_fla {
import flash.display.*;
public dynamic class NGI_INTRO_18 extends MovieClip {
public var parentMC:MovieClip;
public function NGI_INTRO_18(){
addFrameScript(0, frame1, 0x0100, frame257);
}
function frame1(){
parentMC = (this.parent as MovieClip);
parentMC.stop();
}
function frame257(){
parentMC.play();
}
}
}//package ZRox_fla
Section 22
//NGI_MASK_CUBE_22 (ZRox_fla.NGI_MASK_CUBE_22)
package ZRox_fla {
import flash.display.*;
public dynamic class NGI_MASK_CUBE_22 extends MovieClip {
public function NGI_MASK_CUBE_22(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package ZRox_fla
Section 23
//NGI_MASK_IN_21 (ZRox_fla.NGI_MASK_IN_21)
package ZRox_fla {
import flash.display.*;
public dynamic class NGI_MASK_IN_21 extends MovieClip {
public function NGI_MASK_IN_21(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
}
}
}//package ZRox_fla
Section 24
//ScrollingSymbol_44 (ZRox_fla.ScrollingSymbol_44)
package ZRox_fla {
import flash.display.*;
public dynamic class ScrollingSymbol_44 extends MovieClip {
public var symbol:MovieClip;
public function ScrollingSymbol_44(){
addFrameScript(54, frame55);
}
function frame55(){
ZRGame.Instance.OnScrollDone(this);
}
}
}//package ZRox_fla
Section 25
//SoundContainer_8 (ZRox_fla.SoundContainer_8)
package ZRox_fla {
import flash.display.*;
public dynamic class SoundContainer_8 extends MovieClip {
public function SoundContainer_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package ZRox_fla
Section 26
//symbolSelection_45 (ZRox_fla.symbolSelection_45)
package ZRox_fla {
import flash.display.*;
public dynamic class symbolSelection_45 extends MovieClip {
public function symbolSelection_45(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package ZRox_fla
Section 27
//TimeGainAnimated_46 (ZRox_fla.TimeGainAnimated_46)
package ZRox_fla {
import flash.display.*;
public dynamic class TimeGainAnimated_46 extends MovieClip {
public function TimeGainAnimated_46(){
addFrameScript(0, frame1, 22, frame23);
}
function frame1(){
gotoAndStop(23);
}
function frame23(){
stop();
}
}
}//package ZRox_fla
Section 28
//ViewLossAnimated_50 (ZRox_fla.ViewLossAnimated_50)
package ZRox_fla {
import flash.display.*;
public dynamic class ViewLossAnimated_50 extends MovieClip {
public function ViewLossAnimated_50(){
addFrameScript(0, frame1, 22, frame23);
}
function frame1(){
gotoAndStop(23);
}
function frame23(){
stop();
}
}
}//package ZRox_fla
Section 29
//BasicGame (BasicGame)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class BasicGame extends BasicObject {
var m_iLanguage:int;
var m_szCurrentCinematic:String;
var m_RootMC:MovieClip;
var m_bMouseOutProcessed:Boolean;
var m_bMouseUpProcessed:Boolean;
var m_szPendingCinematic:String;
var m_iLastTime:uint;
var m_bIsCinematicSkipable:Boolean;
var m_bKeyUpProcessed:Boolean;
var m_CurrentMusicClass:Class;
var m_bMouseDownProcessed:Boolean;
var m_Viewport:Viewport;
var m_bKeyDownProcessed:Boolean;
var m_bPaused:Boolean;
var m_bMouseOverProcessed:Boolean;
var m_iGameTick:uint;
var m_iGameState:int;
var m_CurrentMusic:DTSound;
static var GameState_Init:int = -1;
static var Instance:BasicGame;
static var GameState_MainMenu:int = 0;
static var GameState_Game:int = 1;
static var GameState_Cinematic:int = 2;
public function BasicGame(_arg1:MovieClip){
m_RootMC = _arg1;
Instance = this;
m_iGameState = GameState_Init;
m_iGameTick = 0;
m_iLastTime = getTimer();
m_szPendingCinematic = "";
m_RootMC.stage.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
m_RootMC.stage.addEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
m_RootMC.stage.addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
m_RootMC.stage.addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
m_RootMC.stage.addEventListener(KeyboardEvent.KEY_DOWN, OnKeyDown);
m_RootMC.stage.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp);
}
public function EndCinematic(){
m_szCurrentCinematic = "";
SetGameState(GameState_Game);
}
function IsPlayingMusic():Boolean{
return (((m_CurrentMusic) && (m_CurrentMusic.IsPlaying())));
}
function OnMouseOut(_arg1:MouseEvent){
m_bMouseOutProcessed = false;
}
function OnKeyUp(_arg1:KeyboardEvent){
m_bKeyUpProcessed = false;
}
function OnMouseUp(_arg1:MouseEvent){
m_bMouseUpProcessed = false;
}
function OnKeyDown(_arg1:KeyboardEvent){
m_bKeyDownProcessed = false;
}
function StopMusic(_arg1:Number=0){
if (m_CurrentMusic){
m_CurrentMusic.Stop(_arg1);
m_CurrentMusic = null;
m_CurrentMusicClass = null;
};
}
function OnMouseDown(_arg1:MouseEvent){
m_bMouseDownProcessed = false;
if ((((m_iGameState == GameState_Cinematic)) && (m_bIsCinematicSkipable))){
EndCinematic();
m_bMouseDownProcessed = true;
};
}
function SetGameState(_arg1){
if (_arg1 == m_iGameState){
return;
};
EndGameState(m_iGameState);
m_iGameState = _arg1;
BeginGameState(m_iGameState);
}
function StartPendingCinematic(){
m_szCurrentCinematic = m_szPendingCinematic;
m_szPendingCinematic = "";
SetGameState(GameState_Cinematic);
m_RootMC.gotoAndPlay(m_szCurrentCinematic);
}
function Render(){
}
public function Init(){
m_Viewport = new Viewport(m_RootMC.stage.stageWidth, m_RootMC.stage.stageHeight);
}
function PlayMusic(_arg1:Class, _arg2:Number=0){
if (_arg1 == m_CurrentMusicClass){
return;
};
StopMusic(_arg2);
m_CurrentMusicClass = _arg1;
if (_arg1){
m_CurrentMusic = new DTSound(_arg1);
m_CurrentMusic.Play(true, _arg2);
};
}
function Tick(_arg1:Number){
if (m_iGameState == GameState_Game){
if (m_szPendingCinematic != ""){
StartPendingCinematic();
return;
};
};
SoundSystem.Update(_arg1);
m_iGameTick++;
}
function BeginGameState(_arg1:int){
}
function EndGameState(_arg1:int){
}
public function Start(){
StartCinematic("EngineIntro", true);
}
function StartCinematic(_arg1:String, _arg2:Boolean){
m_szPendingCinematic = _arg1;
m_bIsCinematicSkipable = _arg2;
if (m_iGameState != GameState_Game){
StartPendingCinematic();
};
}
function OnMouseOver(_arg1:MouseEvent){
m_bMouseOverProcessed = false;
}
public function Run(){
var _local1:int;
var _local2:uint;
_local1 = getTimer();
_local2 = (_local1 - m_iLastTime);
m_iLastTime = _local1;
Tick((m_bPaused) ? 0 : (_local2 / 1000));
Render();
}
function Pause(_arg1:Boolean){
m_bPaused = _arg1;
}
function GetCurrentCinematic():String{
return (((m_iGameState == GameState_Cinematic)) ? m_szCurrentCinematic : "");
}
}
}//package
Section 30
//BasicObject (BasicObject)
package {
import flash.events.*;
class BasicObject extends EventDispatcher {
var m_szName:String;
var m_properties:Array;
static var PropertyType_String:int = 2;
static var PropertyType_Boolean:int = 3;
static var PropertyType_Number:int = 1;
static var PropertyType_Int:int = 0;
function BasicObject(){
m_szName = "Unnamed";
m_properties = new Array();
}
function DispatchEvent(_arg1:String){
dispatchEvent(new Event(_arg1));
}
function GetProperties():Array{
return (m_properties);
}
function GetName():String{
return (m_szName);
}
function RegisterProperties(_arg1:String, _arg2:int, _arg3:Function, _arg4:Function){
var _local5:Object;
_local5 = new Object();
_local5.m_szName = _arg1;
_local5.m_iType = _arg2;
_local5.m_setterFunction = _arg3;
_local5.m_getterFunction = _arg4;
m_properties.push(_local5);
}
}
}//package
Section 31
//DTSound (DTSound)
package {
import flash.events.*;
import flash.media.*;
class DTSound extends BasicObject {
var m_bLooping:Boolean;
var m_fFadeVolumeEnd:Number;
var m_fFadeVolumeStart:Number;
var m_Sound:Sound;
var m_SoundChannel:SoundChannel;
var m_fVolume:Number;
var m_SoundClass:Class;
var m_SoundGroup:DTSoundGroup;
var m_fFadeDuration:Number;
var m_fPan:Number;
var m_fMaxVolume:Number;
var m_bFading:Boolean;
var m_SoundCompleteCallback:Function;
var m_fFadeTimer:Number;
function DTSound(_arg1:Class, _arg2:DTSoundGroup=null){
m_fVolume = 1;
m_fMaxVolume = 1;
m_fPan = 0;
m_bLooping = false;
m_SoundClass = _arg1;
m_Sound = new m_SoundClass();
m_SoundGroup = _arg2;
if (m_SoundGroup != null){
m_SoundGroup.AddSound(this);
};
m_SoundCompleteCallback = null;
m_bFading = false;
m_fFadeVolumeStart = 0;
m_fFadeVolumeEnd = 0;
m_fFadeDuration = 0;
m_fFadeTimer = 0;
}
function SetPan(_arg1:Number){
m_fPan = _arg1;
}
function SetMaxVolume(_arg1:Number){
m_fMaxVolume = _arg1;
UpdateVolume();
}
function IsPlaying():Boolean{
return (!((m_SoundChannel == null)));
}
function GetPan():Number{
if (m_SoundGroup){
return (Math.max(-1, Math.min((m_fPan + m_SoundGroup.GetPan()), 1)));
};
return (m_fPan);
}
function OnSoundComplete(_arg1:Event){
m_SoundChannel.removeEventListener(Event.SOUND_COMPLETE, OnSoundComplete);
m_SoundChannel = null;
}
function SetSoundCompleteCallback(_arg1:Function){
if (((!((m_SoundChannel == null))) && (!((m_SoundCompleteCallback == null))))){
m_SoundChannel.removeEventListener(Event.SOUND_COMPLETE, m_SoundCompleteCallback);
};
m_SoundCompleteCallback = _arg1;
if (((!((m_SoundCompleteCallback == null))) && (!((m_SoundChannel == null))))){
m_SoundChannel.addEventListener(Event.SOUND_COMPLETE, m_SoundCompleteCallback);
};
}
public function Stop(_arg1:Number=0){
if (m_SoundChannel != null){
if (_arg1 > 0){
m_bFading = true;
m_fFadeVolumeStart = 1;
m_fFadeVolumeEnd = 0;
m_fFadeDuration = _arg1;
m_fFadeTimer = 0;
SoundSystem.AddSound(this);
} else {
m_SoundChannel.stop();
if (m_SoundCompleteCallback != null){
m_SoundChannel.removeEventListener(Event.SOUND_COMPLETE, m_SoundCompleteCallback);
};
m_SoundChannel = null;
};
};
}
public function Play(_arg1:Boolean=false, _arg2:Number=0){
var _local3:SoundTransform;
Stop();
if (_arg2 > 0){
m_bFading = true;
m_fFadeVolumeStart = 0;
m_fFadeVolumeEnd = 1;
m_fFadeDuration = _arg2;
m_fFadeTimer = 0;
SoundSystem.AddSound(this);
SetVolume(0);
};
m_SoundChannel = m_Sound.play(0, (_arg1) ? 9999 : 0);
m_bLooping = _arg1;
if (m_SoundChannel){
_local3 = new SoundTransform(GetVolume(), GetPan());
m_SoundChannel.soundTransform = _local3;
if (!m_bLooping){
m_SoundChannel.addEventListener(Event.SOUND_COMPLETE, OnSoundComplete);
};
if (m_SoundCompleteCallback != null){
m_SoundChannel.addEventListener(Event.SOUND_COMPLETE, m_SoundCompleteCallback);
};
};
}
function UpdateVolume(){
var _local1:SoundTransform;
if (m_SoundChannel != null){
_local1 = new SoundTransform(GetVolume(), GetPan());
m_SoundChannel.soundTransform = _local1;
};
}
function GetVolume():Number{
if (m_SoundGroup != null){
return (((m_fVolume * m_SoundGroup.GetVolume()) * m_fMaxVolume));
};
return ((m_fVolume * m_fMaxVolume));
}
function Update(_arg1:Number){
var _local2:Number;
if (m_bFading){
m_fFadeTimer = Math.min((m_fFadeTimer + _arg1), m_fFadeDuration);
_local2 = (m_fFadeTimer / m_fFadeDuration);
SetVolume((((1 - _local2) * m_fFadeVolumeStart) + (_local2 * m_fFadeVolumeEnd)));
UpdateVolume();
if (_local2 == 1){
m_bFading = false;
if (m_fFadeVolumeEnd == 0){
Stop();
};
SoundSystem.RemoveSound(this);
};
};
}
function GetDuration():Number{
return ((m_Sound.length / 1000));
}
function SetVolume(_arg1:Number){
m_fVolume = _arg1;
UpdateVolume();
}
}
}//package
Section 32
//DTSoundGroup (DTSoundGroup)
package {
class DTSoundGroup {
var m_SoundGroup:DTSoundGroup;
var m_Groups:Array;
var m_fPan:Number;
var m_fVolume:Number;
var m_Sounds:Array;
function DTSoundGroup(_arg1:DTSoundGroup=null){
m_fVolume = 1;
m_fPan = 0;
m_SoundGroup = _arg1;
if (m_SoundGroup != null){
m_SoundGroup.AddGroup(this);
};
m_Sounds = new Array();
m_Groups = new Array();
}
function SetVolume(_arg1:Number){
m_fVolume = _arg1;
UpdateVolume();
}
function UpdateVolume(){
var _local1:int;
_local1 = 0;
while (_local1 < m_Sounds.length) {
m_Sounds[_local1].UpdateVolume();
_local1++;
};
_local1 = 0;
while (_local1 < m_Groups.length) {
m_Groups[_local1].UpdateVolume();
_local1++;
};
}
function GetVolume():Number{
if (m_SoundGroup){
return ((m_fVolume * m_SoundGroup.GetVolume()));
};
return (m_fVolume);
}
function GetPan():Number{
if (m_SoundGroup){
return (Math.max(-1, Math.min((m_fPan + m_SoundGroup.GetPan()), 1)));
};
return (m_fPan);
}
function AddSound(_arg1:DTSound){
m_Sounds.push(_arg1);
}
function SetPan(_arg1:Number){
var _local2:int;
m_fPan = _arg1;
_local2 = 0;
while (_local2 < m_Sounds.length) {
m_Sounds[_local2].UpdateVolume();
_local2++;
};
}
function AddGroup(_arg1:DTSoundGroup){
m_Groups.push(_arg1);
}
function GetAbsoluteVolume():Number{
return (m_fVolume);
}
}
}//package
Section 33
//Input (Input)
package {
class Input {
static var Key_PgUp:int = 33;
static var Key_Equal:int = 187;
static var Key_NumPlus:int = 107;
static var Key_Left:int = 37;
static var Key_NumDown:int = 40;
static var Key_0:int = 48;
static var Key_1:int = 49;
static var Key_2:int = 50;
static var Key_3:int = 51;
static var Key_4:int = 52;
static var Key_5:int = 53;
static var Key_6:int = 54;
static var Key_7:int = 55;
static var Key_8:int = 56;
static var Key_9:int = 57;
static var Key_AccentGrave:int = 222;
static var Key_BackSpace:int = 8;
static var Key_A:int = 65;
static var Key_B:int = 66;
static var Key_C:int = 67;
static var Key_D:int = 68;
static var Key_E:int = 69;
static var Key_F:int = 70;
static var Key_G:int = 71;
static var Key_H:int = 72;
static var Key_I:int = 73;
static var Key_J:int = 74;
static var Key_K:int = 75;
static var Key_L:int = 76;
static var Key_M:int = 77;
static var Key_N:int = 78;
static var Key_O:int = 79;
static var Key_Minus:int = 189;
static var Key_Q:int = 81;
static var Key_R:int = 82;
static var Key_S:int = 83;
static var Key_T:int = 84;
static var Key_U:int = 85;
static var Key_V:int = 86;
static var Key_OpeningBracket:int = 219;
static var Key_X:int = 88;
static var Key_Y:int = 89;
static var Key_Z:int = 90;
static var Key_W:int = 87;
static var Key_P:int = 80;
static var Key_NumRight:int = 39;
static var Key_None:int = -1;
static var Key_Shift:int = 16;
static var Key_ClosingBracket:int = 221;
static var Key_SemiColon:int = 186;
static var Key_Quotation:int = 192;
static var Key_Slash:int = 191;
static var Key_Ctrl:int = 17;
static var Key_NumLeft:int = 37;
static var Key_Num5:int = 101;
static var Key_Num7:int = 103;
static var Key_Num6:int = 102;
static var Key_Num8:int = 104;
static var Key_NumUp:int = 38;
static var Key_Num1:int = 97;
static var Key_Num3:int = 99;
static var Key_Num9:int = 105;
static var Key_NumMinus:int = 109;
static var Key_Comma:int = 188;
static var Key_BackSlash:int = 220;
static var Key_NumSlash:int = 111;
static var Key_Enter:int = 13;
static var Key_Up:int = 38;
static var Key_PgDown:int = 34;
static var Key_NumCenter:int = 12;
static var Key_Down:int = 40;
static var Key_Num0:int = 96;
static var Key_Num2:int = 98;
static var Key_NumPeriod:int = 110;
static var Key_End:int = 35;
static var Key_Delete:int = 46;
static var Key_CapsLock:int = 20;
static var Key_Num4:int = 100;
static var Key_Insert:int = 45;
static var m_keyNames:Array = new Array(Key_A, "A", Key_B, "B", Key_C, "C", Key_D, "D", Key_E, "E", Key_F, "F", Key_G, "G", Key_H, "H", Key_I, "I", Key_J, "J", Key_K, "K", Key_L, "L", Key_M, "M", Key_N, "N", Key_O, "O", Key_P, "P", Key_Q, "Q", Key_R, "R", Key_S, "S", Key_T, "T", Key_U, "U", Key_V, "V", Key_W, "W", Key_X, "X", Key_Y, "Y", Key_Z, "Z", Key_1, "1", Key_2, "2", Key_3, "3", Key_4, "4", Key_5, "5", Key_6, "6", Key_7, "7", Key_8, "8", Key_9, "9", Key_0, "0", Key_CapsLock, "Caps Lock", Key_Shift, "Shift", Key_Ctrl, "Ctrl", Key_Space, "Space", Key_Left, "Left Arrow", Key_Down, "Down Arrow", Key_Right, "Right Arrow", Key_Up, "Up Arrow", Key_SemiColon, ";", Key_Quotation, "'", Key_AccentGrave, "`", Key_Minus, "-", Key_Equal, "=", Key_OpeningBracket, "[", Key_BackSlash, "\\", Key_ClosingBracket, "]", Key_BackSpace, "Backspace", Key_Enter, "Enter", Key_Slash, "/", Key_Comma, ",", Key_Period, ".", Key_NumSlash, "Numpad /", Key_NumStar, "Numpad *", Key_NumMinus, "Numpad -", Key_NumPlus, "Numpad +", Key_Home, "Home", Key_NumUp, "Numpad Up", Key_PgUp, "Page Up", Key_NumLeft, "Numpad Left", Key_NumCenter, "Numpad Center", Key_NumRight, "Numpad Right", Key_End, "End", Key_NumDown, "Numpad Down", Key_PgDown, "Page Down", Key_Insert, "Insert", Key_Delete, "Delete", Key_NumPeriod, "Numpad .", Key_Num1, "Numpad 1", Key_Num2, "Numpad 2", Key_Num3, "Numpad 3", Key_Num4, "Numpad 4", Key_Num5, "Numpad 5", Key_Num6, "Numpad 6", Key_Num7, "Numpad 7", Key_Num8, "Numpad 8", Key_Num9, "Numpad 9", Key_Num0, "Numpad 0", Key_None, "None");
static var Key_NumStar:int = 106;
static var Key_Period:int = 190;
static var Key_Space:int = 32;
static var Key_Right:int = 39;
static var Key_Home:int = 36;
static function GetKeyName(_arg1:int):String{
var _local2:int;
_local2 = 0;
while (_local2 < m_keyNames.length) {
if (m_keyNames[_local2] == _arg1){
return (m_keyNames[(_local2 + 1)]);
};
_local2 = (_local2 + 2);
};
return ("");
}
}
}//package
Section 34
//Maths (Maths)
package {
class Maths {
static var EPSILON:Number = 1E-5;
static var TWO_PI:Number = 6.28318530717959;
static var PI_ON_180:Number = 0.01745329252;
static function DegToRad(_arg1:Number):Number{
return (((_arg1 * Math.PI) / 180));
}
static function DeltaInterpolateTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg3 == 0){
return (_arg1);
};
if (Math.abs((_arg2 - _arg1)) < 0.001){
return (_arg2);
};
_local5 = (_arg2 - _arg1);
_local6 = (_arg4 * _local5);
_local7 = (_local6 * _arg3);
if (((_local6 * _arg3) * _local7) > (_local5 * _local5)){
_local7 = _local5;
};
if (Math.abs(_local7) > 0.001){
return ((_arg1 + _local7));
};
return (_arg2);
}
static function QuickSort(_arg1:Array, _arg2:int, _arg3:int, _arg4:Function){
var _local5:Object;
var _local6:int;
var _local7:int;
var _local8:int;
_local6 = _arg2;
_local7 = _arg3;
_local5 = _arg1[_arg2];
while (_arg2 < _arg3) {
while (((_arg4(_arg1[_arg3], _local5)) && ((_arg2 < _arg3)))) {
_arg3--;
};
if (_arg2 != _arg3){
_arg1[_arg2] = _arg1[_arg3];
_arg2++;
};
while (((_arg4(_local5, _arg1[_arg2])) && ((_arg2 < _arg3)))) {
_arg2++;
};
if (_arg2 != _arg3){
_arg1[_arg3] = _arg1[_arg2];
_arg3--;
};
};
_arg1[_arg2] = _local5;
_local8 = _arg2;
_arg2 = _local6;
_arg3 = _local7;
if (_arg2 < _local8){
QuickSort(_arg1, _arg2, (_local8 - 1), _arg4);
};
if (_arg3 > _local8){
QuickSort(_arg1, (_local8 + 1), _arg3, _arg4);
};
}
static function Random(_arg1:int):int{
return (Math.floor((Math.random() * _arg1)));
}
static function GetZAngleFromDir(_arg1:Vector3D):Number{
var _local2:Number;
_local2 = Maths.RadToDeg(Math.acos(_arg1.X));
if (_arg1.Y < 0){
_local2 = (360 - _local2);
};
return (_local2);
}
static function GetShortestAngleBetween(_arg1:Number, _arg2:Number):Number{
_arg1 = (_arg1 % 360);
_arg2 = (_arg2 % 360);
if ((_arg1 - _arg2) < -180){
_arg1 = (_arg1 + 360);
} else {
if ((_arg1 - _arg2) > 180){
_arg1 = (_arg1 - 360);
};
};
return ((_arg2 - _arg1));
}
static function RadToDeg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
}
}//package
Section 35
//MC_Flash (MC_Flash)
package {
import flash.display.*;
public dynamic class MC_Flash extends MovieClip {
public function MC_Flash(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 36
//MC_LevelSelectionButton (MC_LevelSelectionButton)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_LevelSelectionButton extends MovieClip {
public var levelName:TextField;
}
}//package
Section 37
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var XML_Loaded:Function;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
XML_Loaded = function (_arg1:Event){
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
_local2 = XML(_arg1.target.data);
_local3 = new Object();
_local4 = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1){
_arg1.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var sw:*;
var sh:*;
var tw:*;
var th:*;
var mg:*;
var _root:*;
var overlay:MovieClip;
var overlay_x:*;
var overlay_y:*;
var close_x:*;
var blankarea:TextField;
var header:TextField;
var header_format:TextFormat;
var msgtext:TextField;
var msgtext_format:TextFormat;
var msgtext_link:TextFormat;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
sw = bridge.stage.stageWidth;
sh = bridge.stage.stageHeight;
tw = 350;
th = 160;
mg = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
overlay_x = Math.round(((sw - tw) / 2));
overlay_y = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
close_x = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
blankarea = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
header = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
msgtext = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
msgtext_format = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
msgtext_link = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:MovieClip;
var _local10:TextField;
var _local11:TextField;
var _local12:TextFormat;
var _local13:TextField;
var _local14:TextFormat;
var _local15:TextFormat;
_local4 = bridge.stage.stageWidth;
_local5 = bridge.stage.stageHeight;
_local6 = 350;
_local7 = 160;
_local8 = bridge.root;
_local9 = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
_local10 = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
_local11 = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
_local12 = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
_local13 = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
_local14 = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
_local15 = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 38
//RandomHat (RandomHat)
package {
class RandomHat {
var m_Values:Array;
var m_HatValues:Array;
function RandomHat(){
m_Values = new Array();
m_HatValues = new Array();
}
function AddValue(_arg1:Object){
m_Values.push(_arg1);
}
function GetRandomValue():Object{
var _local1:int;
var _local2:Object;
var _local3:int;
if (m_HatValues.length == 0){
_local3 = 0;
while (_local3 < m_Values.length) {
m_HatValues.push(m_Values[_local3]);
_local3++;
};
};
_local1 = Math.floor((Math.random() * m_HatValues.length));
_local2 = m_HatValues[_local1];
m_HatValues.splice(_local1, 1);
return (_local2);
}
function Reset(){
var _local1:int;
m_HatValues.splice(0, m_HatValues.length);
_local1 = 0;
while (_local1 < m_Values.length) {
m_HatValues.push(m_Values[_local1]);
_local1++;
};
}
}
}//package
Section 39
//SND_FailureCue (SND_FailureCue)
package {
import flash.media.*;
public dynamic class SND_FailureCue extends Sound {
}
}//package
Section 40
//SND_GameMusic (SND_GameMusic)
package {
import flash.media.*;
public dynamic class SND_GameMusic extends Sound {
}
}//package
Section 41
//SND_MenuSound (SND_MenuSound)
package {
import flash.media.*;
public dynamic class SND_MenuSound extends Sound {
}
}//package
Section 42
//SND_SuccessCue (SND_SuccessCue)
package {
import flash.media.*;
public dynamic class SND_SuccessCue extends Sound {
}
}//package
Section 43
//SND_TimeOutSound (SND_TimeOutSound)
package {
import flash.media.*;
public dynamic class SND_TimeOutSound extends Sound {
}
}//package
Section 44
//SoundSystem (SoundSystem)
package {
class SoundSystem {
static var m_SoundsToUpdate:Array = new Array();
static function Update(_arg1:Number){
var _local2:int;
var _local3:DTSound;
_local2 = 0;
while (_local2 < m_SoundsToUpdate.length) {
_local3 = (m_SoundsToUpdate[_local2] as DTSound);
if (_local3){
_local3.Update(_arg1);
};
_local2++;
};
}
static function RemoveSound(_arg1:DTSound){
var _local2:int;
var _local3:DTSound;
_local2 = 0;
while (_local2 < m_SoundsToUpdate.length) {
_local3 = (m_SoundsToUpdate[_local2] as DTSound);
if (_local3 == _arg1){
m_SoundsToUpdate.splice(_local2, 1);
return;
};
_local2++;
};
}
static function AddSound(_arg1:DTSound){
var _local2:int;
var _local3:DTSound;
_local2 = 0;
while (_local2 < m_SoundsToUpdate.length) {
_local3 = (m_SoundsToUpdate[_local2] as DTSound);
if (_local3 == _arg1){
return;
};
_local2++;
};
m_SoundsToUpdate.push(_arg1);
}
}
}//package
Section 45
//Vector3D (Vector3D)
package {
class Vector3D {
var X:Number;
var Z:Number;
var Y:Number;
function Vector3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
X = _arg1;
Y = _arg2;
Z = _arg3;
}
function Set(_arg1:Vector3D){
X = _arg1.X;
Y = _arg1.Y;
Z = _arg1.Z;
}
function SetValues(_arg1:Number, _arg2:Number, _arg3:Number){
X = _arg1;
Y = _arg2;
Z = _arg3;
}
function Add(_arg1:Vector3D){
X = (X + _arg1.X);
Y = (Y + _arg1.Y);
Z = (Z + _arg1.Z);
}
function Multiply(_arg1:Number){
X = (X * _arg1);
Y = (Y * _arg1);
Z = (Z * _arg1);
}
function ToString():String{
return ((((((("(" + X) + ", ") + Y) + ", ") + Z) + ")"));
}
function IsZero():Boolean{
return ((((((X == 0)) && ((Y == 0)))) && ((Z == 0))));
}
function Divide(_arg1:Number){
X = (X / _arg1);
Y = (Y / _arg1);
Z = (Z / _arg1);
}
function Equals(_arg1:Vector3D):Boolean{
return ((((((Math.abs((X - _arg1.X)) <= Maths.EPSILON)) && ((Math.abs((Y - _arg1.Y)) <= Maths.EPSILON)))) && ((Math.abs((Z - _arg1.Z)) <= Maths.EPSILON))));
}
function Cross(_arg1:Vector3D):Vector3D{
var _local2:Vector3D;
_local2 = new Vector3D();
_local2.X = ((Y * _arg1.Z) - (Z * _arg1.Y));
_local2.Y = ((Z * _arg1.X) - (X * _arg1.Z));
_local2.Z = ((X * _arg1.Y) - (Y * _arg1.X));
return (_local2);
}
function Size():Number{
return (Math.sqrt((((X * X) + (Y * Y)) + (Z * Z))));
}
function DistanceFrom(_arg1:Vector3D):Number{
var _local2:Vector3D;
_local2 = new Vector3D();
_local2.Set(this);
_local2.Subtract(_arg1);
return (_local2.Size());
}
function SquaredSize():Number{
return ((((X * X) + (Y * Y)) + (Z * Z)));
}
function Dot(_arg1:Vector3D):Number{
return ((((X * _arg1.X) + (Y * _arg1.Y)) + (Z * _arg1.Z)));
}
function IsNear(_arg1:Vector3D):Boolean{
return ((DistanceFrom(_arg1) < 1));
}
function Normalize():Number{
var _local1:Number;
_local1 = Size();
if (_local1 > Maths.EPSILON){
X = (X / _local1);
Y = (Y / _local1);
Z = (Z / _local1);
} else {
X = 0;
Y = 0;
Z = 0;
};
return (_local1);
}
function Invert(){
X = -(X);
Y = -(Y);
Z = -(Z);
}
function Subtract(_arg1:Vector3D){
X = (X - _arg1.X);
Y = (Y - _arg1.Y);
Z = (Z - _arg1.Z);
}
static function Zero():Vector3D{
return (new Vector3D(0, 0, 0));
}
}
}//package
Section 46
//Viewport (Viewport)
package {
class Viewport {
var m_iHalfHeight:int;
var m_iHalfWidth:int;
var m_iEightHeight:int;
var m_iEightWidth:int;
var m_iQuarterWidth:int;
var m_iQuarterHeight:int;
var m_iWidth:int;
var m_iHeight:int;
function Viewport(_arg1:int, _arg2:int){
m_iWidth = _arg1;
m_iHalfWidth = (m_iWidth / 2);
m_iQuarterWidth = (m_iWidth / 4);
m_iEightWidth = (m_iWidth / 8);
m_iHeight = _arg2;
m_iHalfHeight = (m_iHeight / 2);
m_iQuarterHeight = (m_iHeight / 4);
m_iEightHeight = (m_iHeight / 8);
}
}
}//package
Section 47
//ZRGame (ZRGame)
package {
import flash.events.*;
import flash.display.*;
import fl.motion.*;
import fl.managers.*;
import flash.text.*;
import flash.net.*;
public class ZRGame extends BasicGame {
var m_TimeOutSound:DTSound;
var m_ExtremeLevelRandomHat:RandomHat;
var m_bWaitHighScoreName:Boolean;
var m_iLevelIndex:int;
var m_bLevelSelectionCreated:Boolean;
var m_HighScoresExtremeLimited:Array;
var m_HighScoresLimited:Array;
var m_iMaxLevelIndex:int;
var m_iViewsLeft:Number;
var m_FailureSound:DTSound;
var m_iTotalLevels:int;
var m_FocusManager:FocusManager;
var m_SuccessSound:DTSound;
var m_MusicClass:Class;
var m_fDisplayScoreTimer:Number;
var m_MenuSound:DTSound;
var m_fTimeLeft:Number;
var m_bMusicOn:Boolean;
var m_HighScoresRandom:Array;
var m_iDisplayedLevelIndex:int;
var m_iBeepedSecond:int;
var m_iGameMode:int;
var m_LevelRandomHat:RandomHat;
var m_HighScoresExtremeRandom:Array;
var m_bShowingScore:Boolean;
public static var GameMode_None:int = 0;
static var LevelSelectionXOffset:Number = 30;
public static var GameMode_ExtremeRandom:int = 4;
static var RandomAttackTimeReward:Number = 3;
public static var GameMode_Random:int = 2;
public static var GameMode_Limited:int = 3;
static var LevelSelectionY:Number = 115;
static var SaveDataName:String = "ZRoxDataFinal02";
static var RandomAttackStartTime:Number = 20;
public static var GameMode_HighScoresRandom:int = 6;
public static var GameMode_ExtremeLimited:int = 5;
public static var GameMode_HighScoresExtremeLimited:int = 9;
static var DisplayScoreDuration:Number = 5;
static var NbLevels:int = 100;
static var LevelSelectionYOffset:Number = 15;
static var NbLimitedViews:Number = 10;
public static var GameMode_HighScoresLimited:int = 7;
public static var GameMode_Normal:int = 1;
public static var GameMode_LevelSelection:int = 10;
public static var Instance:ZRGame;
static var LevelAnswers:Array = new Array("L", "F", "V", "H", "X", "E", "Y", "+,plus,plus sign,plussign", "=,equal,equalsign,equal sign", "!,exclamation,exclamation point,exclamationpoint,exclamationsign,exclamation sign,exclamationmark,exclamation mark", "square", "/,slash,forwardslash,forward slash,frontslash,front slash", "triangle", "A", "K", "\\,backslash,back slash,backward slash,backwardslash", "1,one", "circle", "U", "N", "B", "O,0,zero", "rhombus,diamond,kite", "trapeze,trapezoid,trapezium", "7,seven", "P", "C", "Z", "8,eight", "PI,pie", "pentagon", "M", "squareroot,square root,root,radical,root symbol", "9,nine", "hexagon", "W", "D", "6,six", "4,four", "J", "2,two", "R", "octagon,octogon", "?,interrogation,interrogationmark,interrogation mark,interrogationsign,interrogation sign,interrogationpoint,interrogation point,question,questionmark,question mark,questionsign,question sign,questionpoint,question point", "#,pound,poundsign,pound sign", "3,three", "S", "G", "5,five", "%,percent,percentsign,percent sign,percentage,percentagesign,percentage sign,percentsymbol,percent symbol,percentagesymbol,percentage symbol", "arrow,right,rightarrow,right arrow", "tear,drop,waterdrop,water drop,droplet,drip,teardrop,tear drop", "cent,centime,penny", "ladder", "enveloppe,envelope", "chess,chessboard,chess board,checker,checkerboard,checker board", "$,dollar,dollarsign,dollar sign,dollar symbol,dollarsymbol", "bullseye,bull's eye,bulls eye,target", "lock", "infinity,infinite", "heart,love", "moon,crescent", "magnet", "dice,die", "candle", "glass,wineglass,wine glass", "house,cabin,home", "parking,parkingsign,parking sign", "anchor", "star", "bulb,lightbulb,light,light bulb", "eye", "pine,tree,pine tree,pinetree,spruce", "spade", "bowling,bowlingbowl,bowling bowl,bowlingball,bowling ball", "lightning", "hook,fish hook,fishhook", "pin,tack,thumbtack,thumb tack", "clover,club", "note,music,music note,quarternote,quarter note", "smily,smile,smiley,smileyface,smiley face,smilyface,smily face", "floppydisk,floppy,disk,floppy disk,diskette,diskfloppy,disk floppy", "phone,telephone,receiver", "lips,lip,mouth", "peace,peacesign,peacesymbol,peace sign,peace symbol", "bomb,explosive", "umbrella", "plane,airplane,aeroplane,aircraft", "boy,male,man,men", "hourglass", "globe,earthglobe,earth globe", "radioactive,radioactive symbol", "watch", "anarchy,anarchysign,anarchy sign,anachy symbol,anarchysymbol,anarchist", "balance,scale,scales,justice,balance of justice,weighing scale,weighingscale", "apple", "yinyan,yin yan,yin and yan,yin yang, ying yang,yingyang,yinyang,ying yan,ying yan", "female,female sign,female symbol,girl,woman,woman symbol,women symbol", "car,vehicle", "david star,davids star,david's star,star of david");
public static var GameMode_HighScoresExtremeRandom:int = 8;
static var LevelSelectionX:Number = 25;
public function ZRGame(_arg1:MovieClip){
var _local2:int;
super(_arg1);
Instance = this;
m_bMusicOn = true;
m_SuccessSound = new DTSound(SND_SuccessCue);
m_FailureSound = new DTSound(SND_FailureCue);
m_MenuSound = new DTSound(SND_MenuSound);
m_TimeOutSound = new DTSound(SND_TimeOutSound);
m_FocusManager = new FocusManager(m_RootMC);
InitHighScores();
m_iMaxLevelIndex = -1;
LoadProgress();
m_iGameMode = GameMode_None;
m_LevelRandomHat = new RandomHat();
_local2 = 0;
while (_local2 < (NbLevels / 2)) {
m_LevelRandomHat.AddValue(_local2);
_local2++;
};
m_ExtremeLevelRandomHat = new RandomHat();
_local2 = 0;
while (_local2 < NbLevels) {
m_ExtremeLevelRandomHat.AddValue(_local2);
_local2++;
};
}
public function InitGameModeDisplay(_arg1:int){
if (_arg1 == GameMode_LevelSelection){
InitLevelSelection();
} else {
if ((((((((m_iGameMode == GameMode_HighScoresRandom)) || ((m_iGameMode == GameMode_HighScoresLimited)))) || ((m_iGameMode == GameMode_HighScoresExtremeRandom)))) || ((m_iGameMode == GameMode_HighScoresExtremeLimited)))){
if (m_RootMC.answer != null){
m_RootMC.answer.text = "";
};
} else {
UpdateSymbolDisplay(true);
};
};
}
function DoFlash(){
if (m_RootMC.flash){
m_RootMC.flash.gotoAndPlay(1);
};
}
function GameOver(_arg1:int){
SaveProgress();
if (_arg1 == GameMode_Random){
SetGameMode(GameMode_HighScoresRandom);
} else {
if (_arg1 == GameMode_Limited){
SetGameMode(GameMode_HighScoresLimited);
} else {
if (_arg1 == GameMode_ExtremeRandom){
SetGameMode(GameMode_HighScoresExtremeRandom);
} else {
if (_arg1 == GameMode_ExtremeLimited){
SetGameMode(GameMode_HighScoresExtremeLimited);
};
};
};
};
}
function UpdateArrowDisplay(){
if (m_RootMC.NextLevelButton){
m_RootMC.NextLevelButton.visible = (m_iLevelIndex < m_iMaxLevelIndex);
};
if (m_RootMC.FirstLevelButton){
m_RootMC.FirstLevelButton.visible = (m_iLevelIndex > -1);
};
if (m_RootMC.LastLevelButton){
m_RootMC.LastLevelButton.visible = (m_iLevelIndex < m_iMaxLevelIndex);
};
}
function SetGameMode(_arg1:int){
m_iGameMode = _arg1;
m_iViewsLeft = NbLimitedViews;
m_fTimeLeft = RandomAttackStartTime;
m_iBeepedSecond = 0;
m_LevelRandomHat.Reset();
SetGameState(GameState_Game);
if (m_iGameMode == GameMode_Normal){
m_RootMC.gotoAndPlay("NormalMode");
} else {
if ((((m_iGameMode == GameMode_Random)) || ((m_iGameMode == GameMode_ExtremeRandom)))){
m_iTotalLevels = 0;
m_RootMC.gotoAndPlay("RandomAttackMode");
if (m_iGameMode == GameMode_Random){
SetLevelIndex((m_LevelRandomHat.GetRandomValue() as int));
} else {
SetLevelIndex((m_ExtremeLevelRandomHat.GetRandomValue() as int));
};
} else {
if ((((m_iGameMode == GameMode_Limited)) || ((m_iGameMode == GameMode_ExtremeLimited)))){
m_iTotalLevels = 0;
m_RootMC.gotoAndPlay("LimitedViewMode");
if (m_iGameMode == GameMode_Limited){
SetLevelIndex((m_LevelRandomHat.GetRandomValue() as int));
} else {
SetLevelIndex((m_ExtremeLevelRandomHat.GetRandomValue() as int));
};
} else {
if ((((((((m_iGameMode == GameMode_HighScoresRandom)) || ((m_iGameMode == GameMode_HighScoresLimited)))) || ((m_iGameMode == GameMode_HighScoresExtremeRandom)))) || ((m_iGameMode == GameMode_HighScoresExtremeLimited)))){
m_fDisplayScoreTimer = DisplayScoreDuration;
m_bShowingScore = true;
m_bWaitHighScoreName = CanEnterHighScore(m_iGameMode, m_iTotalLevels);
if (m_iGameMode == GameMode_HighScoresRandom){
m_RootMC.gotoAndPlay("HighScoresRandom");
} else {
if (m_iGameMode == GameMode_HighScoresLimited){
m_RootMC.gotoAndPlay("HighScoresLimited");
} else {
if (m_iGameMode == GameMode_HighScoresExtremeRandom){
m_RootMC.gotoAndPlay("HighScoresExtremeRandom");
} else {
if (m_iGameMode == GameMode_HighScoresExtremeLimited){
m_RootMC.gotoAndPlay("HighScoresExtremeLimited");
};
};
};
};
} else {
if (m_iGameMode == GameMode_LevelSelection){
m_bLevelSelectionCreated = false;
m_RootMC.gotoAndPlay("LevelSelection");
};
};
};
};
};
}
function GetFormatedTime(_arg1:Number):String{
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:String;
_local2 = _arg1;
_local3 = Math.floor((_arg1 / 60));
_arg1 = (_arg1 - (_local3 * 60));
_local4 = Math.floor(_arg1);
_arg1 = (_arg1 - _local4);
_local5 = Math.floor((_arg1 * 100));
_local6 = ("" + ((_local3 < 10)) ? ("0" + _local3) : _local3);
if (_local6.length == 1){
_local6 = (_local6 + "0");
};
_local6 = (_local6 + (":" + ((_local4 < 10)) ? ("0" + _local4) : _local4));
if (_local6.length == 4){
_local6 = (_local6 + "0");
};
_local6 = (_local6 + (":" + ((_local5 < 10)) ? ("0" + _local5) : _local5));
if (_local6.length == 7){
_local6 = (_local6 + "0");
};
return (_local6);
}
override public function Init(){
super.Init();
m_MusicClass = SND_GameMusic;
}
override function BeginGameState(_arg1:int){
if (_arg1 == GameState_Game){
DoFlash();
m_SuccessSound.Play();
} else {
if (_arg1 == GameState_MainMenu){
DoFlash();
m_SuccessSound.Play();
m_RootMC.gotoAndPlay("Menu");
};
};
}
function EnterHighScore(_arg1:int, _arg2:String, _arg3:int){
var _local4:Object;
_local4 = CreateHighScoreEntry(_arg2, _arg3);
if (_arg1 == GameMode_HighScoresRandom){
m_HighScoresRandom.push(_local4);
Maths.QuickSort(m_HighScoresRandom, 0, (m_HighScoresRandom.length - 1), CompareHighScore);
m_HighScoresRandom.splice(8, 1);
} else {
if (_arg1 == GameMode_HighScoresLimited){
m_HighScoresLimited.push(_local4);
Maths.QuickSort(m_HighScoresLimited, 0, (m_HighScoresLimited.length - 1), CompareHighScore);
m_HighScoresLimited.splice(8, 1);
} else {
if (_arg1 == GameMode_HighScoresExtremeRandom){
m_HighScoresExtremeRandom.push(_local4);
Maths.QuickSort(m_HighScoresExtremeRandom, 0, (m_HighScoresExtremeRandom.length - 1), CompareHighScore);
m_HighScoresExtremeRandom.splice(8, 1);
} else {
if (_arg1 == GameMode_HighScoresExtremeLimited){
m_HighScoresExtremeLimited.push(_local4);
Maths.QuickSort(m_HighScoresExtremeLimited, 0, (m_HighScoresExtremeLimited.length - 1), CompareHighScore);
m_HighScoresExtremeLimited.splice(8, 1);
};
};
};
};
}
function EnableAnswerField(_arg1:Boolean){
if (((m_RootMC.answer) && (!((_arg1 == m_RootMC.answer.visible))))){
m_RootMC.answer.visible = _arg1;
m_RootMC.answer.y = (m_RootMC.answer.y + (_arg1) ? 1000 : -1000);
};
}
override public function Start(){
PlayMusic(m_MusicClass);
StartCinematic("ZRoxIntro", true);
}
public function OnScrollDone(_arg1:MovieClip){
if ((((m_iGameMode == GameMode_Limited)) || ((m_iGameMode == GameMode_ExtremeLimited)))){
_arg1.stop();
};
}
function LoadProgress(){
var _local1:SharedObject;
var _local2:int;
_local1 = SharedObject.getLocal(SaveDataName, "/");
if (_local1.data.m_HighScoresRandom){
m_iMaxLevelIndex = _local1.data.m_iMaxLevelIndex;
m_iLevelIndex = _local1.data.m_iLevelIndex;
_local2 = 0;
while (_local2 < 8) {
m_HighScoresRandom[_local2] = _local1.data.m_HighScoresRandom[_local2];
m_HighScoresLimited[_local2] = _local1.data.m_HighScoresLimited[_local2];
m_HighScoresExtremeRandom[_local2] = _local1.data.m_HighScoresExtremeRandom[_local2];
m_HighScoresExtremeLimited[_local2] = _local1.data.m_HighScoresExtremeLimited[_local2];
_local2++;
};
};
}
override public function EndCinematic(){
if (GetCurrentCinematic() == "ZRoxIntro"){
StartCinematic("DogTekIntro", true);
} else {
if (GetCurrentCinematic() == "DogTekIntro"){
StartCinematic("NGIntro", true);
} else {
if (GetCurrentCinematic() == "NGIntro"){
StartCinematic("Credits", true);
} else {
if (GetCurrentCinematic() == "Credits"){
SetGameState(GameState_MainMenu);
} else {
if (GetCurrentCinematic() == "Tutorial"){
SetLevelIndex(0);
SetGameMode(GameMode_Normal);
} else {
if (GetCurrentCinematic() == "HalfEnding"){
SetLevelIndex((NbLevels / 2));
SetGameMode(GameMode_Normal);
} else {
if (GetCurrentCinematic() == "Ending"){
m_RootMC.stop();
} else {
super.EndCinematic();
};
};
};
};
};
};
};
}
function DisplayHighScore(_arg1:int, _arg2:int, _arg3:MovieClip, _arg4:Boolean){
_arg3.visible = _arg4;
if (_arg1 == GameMode_HighScoresRandom){
_arg3.username.text = m_HighScoresRandom[_arg2].username;
_arg3.levels.text = (m_HighScoresRandom[_arg2].levels + " Levels");
} else {
if (_arg1 == GameMode_HighScoresLimited){
_arg3.username.text = m_HighScoresLimited[_arg2].username;
_arg3.levels.text = (m_HighScoresLimited[_arg2].levels + " Levels");
} else {
if (_arg1 == GameMode_HighScoresExtremeRandom){
_arg3.username.text = m_HighScoresExtremeRandom[_arg2].username;
_arg3.levels.text = (m_HighScoresExtremeRandom[_arg2].levels + " Levels");
} else {
if (_arg1 == GameMode_HighScoresExtremeLimited){
_arg3.username.text = m_HighScoresExtremeLimited[_arg2].username;
_arg3.levels.text = (m_HighScoresExtremeLimited[_arg2].levels + " Levels");
};
};
};
};
}
override function OnMouseOut(_arg1:MouseEvent){
var _local2:Color;
if (_arg1.target == m_RootMC.musicButton){
_local2 = new Color();
_local2.brightness = 0.5;
m_RootMC.musicIcon.transform.colorTransform = _local2;
};
super.OnMouseOut(_arg1);
}
function OnLevelSelectionMouseOver(_arg1:MouseEvent){
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.color = 0;
_arg1.target.levelName.setTextFormat(_local2);
m_MenuSound.Play();
}
function UpdateGame(_arg1:Number){
var _local2:Boolean;
var _local3:int;
var _local4:Boolean;
var _local5:Boolean;
UpdateArrowDisplay();
UpdateSymbolDisplay();
if (m_RootMC.skipButton != null){
m_RootMC.skipButton.visible = (((m_iGameState == GameState_Cinematic)) && (m_bIsCinematicSkipable));
};
if (m_RootMC.answer != null){
m_FocusManager.setFocus(m_RootMC.answer);
if (((((((!((m_iGameMode == GameMode_HighScoresRandom))) && (!((m_iGameMode == GameMode_HighScoresLimited))))) && (!((m_iGameMode == GameMode_HighScoresExtremeRandom))))) && (!((m_iGameMode == GameMode_HighScoresExtremeLimited))))){
m_RootMC.answer.text = m_RootMC.answer.text.toUpperCase();
};
};
if (m_iGameState == GameState_Game){
if (m_iGameMode == GameMode_Normal){
if (m_RootMC.levelName != null){
m_RootMC.levelName.text = ("Level " + (m_iLevelIndex + 1));
EnableAnswerField(true);
};
} else {
if ((((m_iGameMode == GameMode_Random)) || ((m_iGameMode == GameMode_ExtremeRandom)))){
if (m_RootMC.timeLeft != null){
m_fTimeLeft = (m_fTimeLeft - _arg1);
_local3 = Math.ceil(m_fTimeLeft);
if ((((((_local3 > 0)) && ((_local3 <= 5)))) && (!((_local3 == m_iBeepedSecond))))){
m_TimeOutSound.Play();
m_iBeepedSecond = _local3;
};
m_RootMC.timeLeft.text = GetFormatedTime(m_fTimeLeft);
m_RootMC.totalLevels.text = m_iTotalLevels;
EnableAnswerField(true);
if (m_fTimeLeft <= 0){
DoFlash();
m_FailureSound.Play();
GameOver(m_iGameMode);
};
};
} else {
if ((((m_iGameMode == GameMode_Limited)) || ((m_iGameMode == GameMode_ExtremeLimited)))){
if (m_RootMC.viewsLeft != null){
m_RootMC.viewsLeft.text = m_iViewsLeft;
m_RootMC.totalLevels.text = m_iTotalLevels;
m_RootMC.viewAgain.visible = (m_iViewsLeft > 0);
m_RootMC.giveUp.visible = (m_iViewsLeft == 0);
EnableAnswerField(true);
};
} else {
if ((((((((m_iGameMode == GameMode_HighScoresRandom)) || ((m_iGameMode == GameMode_HighScoresLimited)))) || ((m_iGameMode == GameMode_HighScoresExtremeRandom)))) || ((m_iGameMode == GameMode_HighScoresExtremeLimited)))){
if (m_RootMC.enterNameMessage != null){
if (!m_bWaitHighScoreName){
m_fDisplayScoreTimer = (m_fDisplayScoreTimer - _arg1);
};
_local2 = ((m_bWaitHighScoreName) || ((m_fDisplayScoreTimer > 0)));
if (_local2 != m_bShowingScore){
DoFlash();
m_SuccessSound.Play();
m_bShowingScore = _local2;
};
m_RootMC.enterNameMessage.visible = m_bWaitHighScoreName;
EnableAnswerField(m_bWaitHighScoreName);
m_RootMC.completedLevelsMessage.visible = _local2;
m_RootMC.completedLevels.visible = _local2;
m_RootMC.completedLevels.text = m_iTotalLevels;
m_RootMC.replayButton.visible = !(_local2);
DisplayHighScore(m_iGameMode, 0, m_RootMC.highscore1, !(_local2));
DisplayHighScore(m_iGameMode, 1, m_RootMC.highscore2, !(_local2));
DisplayHighScore(m_iGameMode, 2, m_RootMC.highscore3, !(_local2));
DisplayHighScore(m_iGameMode, 3, m_RootMC.highscore4, !(_local2));
DisplayHighScore(m_iGameMode, 4, m_RootMC.highscore5, !(_local2));
DisplayHighScore(m_iGameMode, 5, m_RootMC.highscore6, !(_local2));
DisplayHighScore(m_iGameMode, 6, m_RootMC.highscore7, !(_local2));
DisplayHighScore(m_iGameMode, 7, m_RootMC.highscore8, !(_local2));
};
};
};
};
};
} else {
if (m_iGameState == GameState_MainMenu){
if (m_RootMC.randomAttackMode){
_local4 = (m_iMaxLevelIndex >= (NbLevels / 2));
_local5 = (m_iMaxLevelIndex == NbLevels);
m_RootMC.randomAttackMode.mouseEnabled = _local4;
m_RootMC.limitedViewMode.mouseEnabled = _local4;
m_RootMC.lock1.visible = !(_local4);
m_RootMC.lock2.visible = !(_local4);
m_RootMC.extremeRandomAttackMode.mouseEnabled = _local5;
m_RootMC.extremeLimitedViewMode.mouseEnabled = _local5;
m_RootMC.lock3.visible = !(_local5);
m_RootMC.lock4.visible = !(_local5);
};
};
};
}
function ValidateAnswer(){
var _local1:String;
var _local2:String;
var _local3:Array;
var _local4:Boolean;
var _local5:int;
var _local6:String;
var _local7:String;
if (m_RootMC.answer){
if ((((((((m_iGameMode == GameMode_HighScoresRandom)) || ((m_iGameMode == GameMode_HighScoresLimited)))) || ((m_iGameMode == GameMode_HighScoresExtremeRandom)))) || ((m_iGameMode == GameMode_HighScoresExtremeLimited)))){
if (m_bWaitHighScoreName){
_local1 = m_RootMC.answer.text;
_local1 = _local1.replace(" ", "");
if (_local1 != ""){
m_fDisplayScoreTimer = 0;
m_bWaitHighScoreName = false;
EnterHighScore(m_iGameMode, _local1, m_iTotalLevels);
DoFlash();
m_SuccessSound.Play();
} else {
m_FailureSound.Play();
};
};
} else {
_local2 = LevelAnswers[m_iLevelIndex];
_local3 = _local2.split(",");
_local4 = false;
_local5 = 0;
while (_local5 < _local3.length) {
_local6 = _local3[_local5];
_local7 = m_RootMC.answer.text;
if (_local7.toLowerCase() == _local6.toLowerCase()){
_local4 = true;
break;
};
_local5++;
};
if (_local4){
m_SuccessSound.Play();
DoFlash();
if (m_iGameMode == GameMode_Normal){
if (m_iLevelIndex == (NbLevels - 1)){
SetLevelIndex(NbLevels);
StartCinematic("Ending", false);
} else {
if (m_iLevelIndex == ((NbLevels / 2) - 1)){
SetLevelIndex((NbLevels / 2));
StartCinematic("HalfEnding", true);
} else {
SetLevelIndex((m_iLevelIndex + 1));
};
};
} else {
if ((((m_iGameMode == GameMode_Random)) || ((m_iGameMode == GameMode_ExtremeRandom)))){
m_iTotalLevels++;
m_fTimeLeft = (m_fTimeLeft + RandomAttackTimeReward);
m_RootMC.timeGain.gotoAndPlay(2);
if (m_iGameMode == GameMode_Random){
SetLevelIndex((m_LevelRandomHat.GetRandomValue() as int));
} else {
SetLevelIndex((m_ExtremeLevelRandomHat.GetRandomValue() as int));
};
} else {
if ((((m_iGameMode == GameMode_Limited)) || ((m_iGameMode == GameMode_ExtremeLimited)))){
m_iTotalLevels++;
if (m_iGameMode == GameMode_Limited){
SetLevelIndex((m_LevelRandomHat.GetRandomValue() as int));
} else {
SetLevelIndex((m_ExtremeLevelRandomHat.GetRandomValue() as int));
};
};
};
};
} else {
m_FailureSound.Play();
if ((((m_iGameMode == GameMode_Limited)) || ((m_iGameMode == GameMode_ExtremeLimited)))){
DoFlash();
m_RootMC.symbol.gotoAndPlay(1);
m_iViewsLeft--;
m_RootMC.viewLoss.gotoAndPlay(2);
if (m_iViewsLeft == -1){
GameOver(m_iGameMode);
};
};
};
};
m_RootMC.answer.text = "";
};
}
function OnLevelSelectionMouseDown(_arg1:MouseEvent){
DoFlash();
m_SuccessSound.Play();
if (_arg1.target.levelIndex == -1){
SetLevelIndex(-1);
StartCinematic("Tutorial", false);
} else {
if (_arg1.target.levelIndex == NbLevels){
SetLevelIndex(NbLevels);
StartCinematic("Ending", false);
} else {
SetLevelIndex(_arg1.target.levelIndex);
SetGameMode(GameMode_Normal);
};
};
}
function SetLevelIndex(_arg1:int){
m_iDisplayedLevelIndex = -10;
m_iLevelIndex = _arg1;
m_iMaxLevelIndex = Math.max(m_iMaxLevelIndex, m_iLevelIndex);
SaveProgress();
}
function UpdateSymbolDisplay(_arg1:Boolean=false){
if (((m_RootMC.symbol) && (((_arg1) || (!((m_iDisplayedLevelIndex == m_iLevelIndex))))))){
m_iDisplayedLevelIndex = m_iLevelIndex;
m_RootMC.symbol.symbol.gotoAndStop((m_iDisplayedLevelIndex + 1));
m_RootMC.symbol.gotoAndPlay(1);
if (m_RootMC.answer){
m_RootMC.answer.text = "";
};
};
}
override function OnKeyDown(_arg1:KeyboardEvent){
if (m_iGameState == GameState_Game){
if (_arg1.keyCode == Input.Key_Enter){
ValidateAnswer();
};
};
}
override function OnMouseDown(_arg1:MouseEvent){
if (_arg1.target == m_RootMC.menuButton){
DoFlash();
SetGameState(GameState_MainMenu);
} else {
if (_arg1.target == m_RootMC.normalMode){
DoFlash();
m_SuccessSound.Play();
SetLevelIndex(-1);
StartCinematic("Tutorial", false);
} else {
if (_arg1.target == m_RootMC.randomAttackMode){
DoFlash();
SetGameMode(GameMode_Random);
} else {
if (_arg1.target == m_RootMC.limitedViewMode){
DoFlash();
SetGameMode(GameMode_Limited);
} else {
if (_arg1.target == m_RootMC.extremeRandomAttackMode){
DoFlash();
SetGameMode(GameMode_ExtremeRandom);
} else {
if (_arg1.target == m_RootMC.extremeLimitedViewMode){
DoFlash();
SetGameMode(GameMode_ExtremeLimited);
} else {
if (_arg1.target == m_RootMC.NextLevelButton){
m_SuccessSound.Play();
DoFlash();
if (GetCurrentCinematic() == "Tutorial"){
SetLevelIndex(0);
SetGameMode(GameMode_Normal);
} else {
if (GetCurrentCinematic() == "HalfEnding"){
SetLevelIndex((NbLevels / 2));
SetGameMode(GameMode_Normal);
} else {
if (m_iLevelIndex == (NbLevels - 1)){
SetLevelIndex(NbLevels);
StartCinematic("Ending", false);
} else {
SetLevelIndex((m_iLevelIndex + 1));
};
};
};
} else {
if (_arg1.target == m_RootMC.PreviousLevelButton){
m_SuccessSound.Play();
DoFlash();
if (m_iLevelIndex == 0){
SetLevelIndex(-1);
StartCinematic("Tutorial", false);
} else {
if (GetCurrentCinematic() == "HalfEnding"){
SetLevelIndex(((NbLevels / 2) - 1));
SetGameMode(GameMode_Normal);
} else {
if (GetCurrentCinematic() == "Ending"){
SetLevelIndex((NbLevels - 1));
SetGameMode(GameMode_Normal);
} else {
SetLevelIndex((m_iLevelIndex - 1));
};
};
};
} else {
if (_arg1.target == m_RootMC.FirstLevelButton){
m_SuccessSound.Play();
DoFlash();
SetLevelIndex(-1);
StartCinematic("Tutorial", false);
} else {
if (_arg1.target == m_RootMC.LastLevelButton){
m_SuccessSound.Play();
DoFlash();
SetLevelIndex(m_iMaxLevelIndex);
if (m_iMaxLevelIndex == NbLevels){
SetLevelIndex(NbLevels);
StartCinematic("Ending", false);
} else {
if (m_iGameState == GameState_Cinematic){
SetLevelIndex(m_iMaxLevelIndex);
SetGameMode(GameMode_Normal);
};
};
} else {
if (_arg1.target == m_RootMC.selectLevel){
DoFlash();
m_SuccessSound.Play();
SetGameMode(GameMode_LevelSelection);
} else {
if (_arg1.target == m_RootMC.viewAgain){
DoFlash();
m_FailureSound.Play();
m_RootMC.symbol.gotoAndPlay(1);
m_iViewsLeft--;
m_RootMC.viewLoss.gotoAndPlay(2);
} else {
if (_arg1.target == m_RootMC.giveUp){
DoFlash();
m_FailureSound.Play();
m_iViewsLeft--;
GameOver(m_iGameMode);
} else {
if (_arg1.target == m_RootMC.skipLevel){
DoFlash();
m_FailureSound.Play();
SetLevelIndex((m_LevelRandomHat.GetRandomValue() as int));
} else {
if (_arg1.target == m_RootMC.replayButton){
DoFlash();
m_SuccessSound.Play();
if (m_iGameMode == GameMode_HighScoresRandom){
SetGameMode(GameMode_Random);
} else {
if (m_iGameMode == GameMode_HighScoresLimited){
SetGameMode(GameMode_Limited);
} else {
if (m_iGameMode == GameMode_HighScoresExtremeRandom){
SetGameMode(GameMode_ExtremeRandom);
} else {
if (m_iGameMode == GameMode_HighScoresExtremeLimited){
SetGameMode(GameMode_ExtremeLimited);
};
};
};
};
} else {
if (_arg1.target == m_RootMC.musicButton){
m_bMusicOn = !(m_bMusicOn);
if (m_bMusicOn){
m_CurrentMusic.Play(true, 1);
m_RootMC.musicIcon.gotoAndPlay(2);
} else {
m_CurrentMusic.Stop(1);
m_RootMC.musicIcon.gotoAndStop(1);
};
} else {
if (_arg1.target == m_RootMC.skipButton){
if ((((m_iGameState == GameState_Cinematic)) && (m_bIsCinematicSkipable))){
EndCinematic();
};
} else {
if (_arg1.target == m_RootMC.ngButton){
navigateToURL(new URLRequest("http://www.newgrounds.com"), "_BLANK");
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
function InitHighScores(){
m_HighScoresRandom = new Array(CreateHighScoreEntry("Vana", 300), CreateHighScoreEntry("Chantal", 250), CreateHighScoreEntry("Mario", 200), CreateHighScoreEntry("Joel", 150), CreateHighScoreEntry("Alex", 100), CreateHighScoreEntry("Sokheng", 50), CreateHighScoreEntry("Oceane", 25), CreateHighScoreEntry("Marco", 10));
m_HighScoresLimited = new Array(CreateHighScoreEntry("Vana", 300), CreateHighScoreEntry("Kolabe", 250), CreateHighScoreEntry("Sovannak", 200), CreateHighScoreEntry("Vantha", 150), CreateHighScoreEntry("Sokheng", 100), CreateHighScoreEntry("Rock", 50), CreateHighScoreEntry("Saina", 25), CreateHighScoreEntry("Christina", 10));
m_HighScoresExtremeRandom = new Array(CreateHighScoreEntry("Vana", 300), CreateHighScoreEntry("Chantal", 250), CreateHighScoreEntry("Mario", 200), CreateHighScoreEntry("Joel", 150), CreateHighScoreEntry("Oceane", 100), CreateHighScoreEntry("Joan", 50), CreateHighScoreEntry("Carole", 25), CreateHighScoreEntry("Ernest", 10));
m_HighScoresExtremeLimited = new Array(CreateHighScoreEntry("Vana", 300), CreateHighScoreEntry("Richard", 250), CreateHighScoreEntry("Sebastien", 200), CreateHighScoreEntry("Louis", 150), CreateHighScoreEntry("Milene", 100), CreateHighScoreEntry("David", 50), CreateHighScoreEntry("Laura", 25), CreateHighScoreEntry("Christine", 10));
}
override function Tick(_arg1:Number){
super.Tick(_arg1);
UpdateGame(_arg1);
}
function InitLevelSelection(){
var _local1:TextFormat;
var _local2:MC_LevelSelectionButton;
var _local3:int;
if (!m_bLevelSelectionCreated){
while (m_RootMC.container.numChildren > 0) {
m_RootMC.container.removeChildAt(0);
};
_local2 = new MC_LevelSelectionButton();
_local2.levelIndex = -1;
_local2.mouseChildren = false;
_local2.mouseEnabled = true;
_local2.buttonMode = true;
_local2.levelName.text = "Tutorial";
_local2.x = LevelSelectionX;
_local2.y = LevelSelectionY;
_local2.addEventListener(MouseEvent.MOUSE_OVER, OnLevelSelectionMouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, OnLevelSelectionMouseOut);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, OnLevelSelectionMouseDown);
m_RootMC.container.addChild(_local2);
_local3 = 0;
while (_local3 < NbLevels) {
_local2 = new MC_LevelSelectionButton();
_local2.levelIndex = _local3;
_local2.mouseChildren = false;
_local2.mouseEnabled = true;
_local2.levelName.text = ("" + (_local3 + 1));
_local2.x = (LevelSelectionX + ((_local3 % 12) * LevelSelectionXOffset));
_local2.y = (LevelSelectionY + ((1.3 + Math.floor((_local3 / 12))) * LevelSelectionYOffset));
if (_local3 <= m_iMaxLevelIndex){
_local2.buttonMode = true;
_local2.addEventListener(MouseEvent.MOUSE_OVER, OnLevelSelectionMouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, OnLevelSelectionMouseOut);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, OnLevelSelectionMouseDown);
} else {
_local2.buttonMode = false;
_local1 = new TextFormat();
_local1.color = 0xBBBBBB;
_local2.levelName.setTextFormat(_local1);
};
m_RootMC.container.addChild(_local2);
_local3++;
};
m_bLevelSelectionCreated = true;
};
}
function CompareHighScore(_arg1:Object, _arg2:Object):Boolean{
return ((_arg1.levels < _arg2.levels));
}
function CreateHighScoreEntry(_arg1:String, _arg2:int):Object{
var _local3:Object;
_local3 = new Object();
_local3.username = _arg1;
_local3.levels = _arg2;
return (_local3);
}
function OnLevelSelectionMouseOut(_arg1:MouseEvent){
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.color = 0x666666;
_arg1.target.levelName.setTextFormat(_local2);
}
override function OnMouseOver(_arg1:MouseEvent){
var _local2:Color;
if (_arg1.target == m_RootMC.musicButton){
_local2 = new Color();
_local2.brightness = 0;
m_RootMC.musicIcon.transform.colorTransform = _local2;
};
if ((((((((((((((((((((((((((((((((_arg1.target == m_RootMC.menuButton)) || ((_arg1.target == m_RootMC.normalMode)))) || ((_arg1.target == m_RootMC.randomAttackMode)))) || ((_arg1.target == m_RootMC.limitedViewMode)))) || ((_arg1.target == m_RootMC.NextLevelButton)))) || ((_arg1.target == m_RootMC.PreviousLevelButton)))) || ((_arg1.target == m_RootMC.FirstLevelButton)))) || ((_arg1.target == m_RootMC.LastLevelButton)))) || ((_arg1.target == m_RootMC.viewAgain)))) || ((_arg1.target == m_RootMC.giveUp)))) || ((_arg1.target == m_RootMC.skipLevel)))) || ((_arg1.target == m_RootMC.replayButton)))) || ((_arg1.target == m_RootMC.musicButton)))) || ((_arg1.target == m_RootMC.selectLevel)))) || ((_arg1.target == m_RootMC.skipButton)))) || ((_arg1.target == m_RootMC.ngButton)))){
m_MenuSound.Play();
};
super.OnMouseOver(_arg1);
}
function CanEnterHighScore(_arg1:int, _arg2:int):Boolean{
var _local3:int;
if (_arg1 == GameMode_HighScoresRandom){
_local3 = 0;
while (_local3 < m_HighScoresRandom.length) {
if (_arg2 > m_HighScoresRandom[_local3].levels){
return (true);
};
_local3++;
};
} else {
if (_arg1 == GameMode_HighScoresLimited){
_local3 = 0;
while (_local3 < m_HighScoresLimited.length) {
if (_arg2 > m_HighScoresLimited[_local3].levels){
return (true);
};
_local3++;
};
} else {
if (_arg1 == GameMode_HighScoresExtremeRandom){
_local3 = 0;
while (_local3 < m_HighScoresExtremeRandom.length) {
if (_arg2 > m_HighScoresExtremeRandom[_local3].levels){
return (true);
};
_local3++;
};
} else {
if (_arg1 == GameMode_HighScoresExtremeLimited){
_local3 = 0;
while (_local3 < m_HighScoresExtremeLimited.length) {
if (_arg2 > m_HighScoresExtremeLimited[_local3].levels){
return (true);
};
_local3++;
};
};
};
};
};
return (false);
}
function SaveProgress(){
var _local1:SharedObject;
var _local2:int;
_local1 = SharedObject.getLocal(SaveDataName, "/");
_local1.data.m_iMaxLevelIndex = m_iMaxLevelIndex;
_local1.data.m_iLevelIndex = m_iLevelIndex;
_local1.data.m_HighScoresRandom = new Array(8);
_local1.data.m_HighScoresLimited = new Array(8);
_local1.data.m_HighScoresExtremeRandom = new Array(8);
_local1.data.m_HighScoresExtremeLimited = new Array(8);
_local2 = 0;
while (_local2 < 8) {
_local1.data.m_HighScoresRandom[_local2] = m_HighScoresRandom[_local2];
_local1.data.m_HighScoresLimited[_local2] = m_HighScoresLimited[_local2];
_local1.data.m_HighScoresExtremeRandom[_local2] = m_HighScoresExtremeRandom[_local2];
_local1.data.m_HighScoresExtremeLimited[_local2] = m_HighScoresExtremeLimited[_local2];
_local2++;
};
_local1.flush();
}
}
}//package