Section 1
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 2
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 3
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 4
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 5
//TextInput (fl.controls.TextInput)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
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();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 6
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 7
//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 8
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import flash.utils.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 9
//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 10
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 11
//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 12
//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 13
//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 14
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 15
//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 16
//ArrowAnim_46 (Hexiom_fla.ArrowAnim_46)
package Hexiom_fla {
import flash.display.*;
public dynamic class ArrowAnim_46 extends MovieClip {
public function ArrowAnim_46(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Hexiom_fla
Section 17
//charge_27 (Hexiom_fla.charge_27)
package Hexiom_fla {
import flash.display.*;
public dynamic class charge_27 extends MovieClip {
public var ball1:MovieClip;
public var ball2:MovieClip;
public var ball3:MovieClip;
public var ball4:MovieClip;
}
}//package Hexiom_fla
Section 18
//charge2_26 (Hexiom_fla.charge2_26)
package Hexiom_fla {
import flash.display.*;
public dynamic class charge2_26 extends MovieClip {
public var charge:MovieClip;
}
}//package Hexiom_fla
Section 19
//circleBands_23 (Hexiom_fla.circleBands_23)
package Hexiom_fla {
import flash.display.*;
public dynamic class circleBands_23 extends MovieClip {
public var spinner:MovieClip;
}
}//package Hexiom_fla
Section 20
//Dump_31 (Hexiom_fla.Dump_31)
package Hexiom_fla {
import flash.display.*;
public dynamic class Dump_31 extends MovieClip {
public function Dump_31(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Hexiom_fla
Section 21
//load_barMC_18 (Hexiom_fla.load_barMC_18)
package Hexiom_fla {
import flash.display.*;
public dynamic class load_barMC_18 extends MovieClip {
public var bar:MovieClip;
}
}//package Hexiom_fla
Section 22
//loadingBar_16 (Hexiom_fla.loadingBar_16)
package Hexiom_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
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 loadingBar_16 extends MovieClip {
public var playButton:SimpleButton;
public var loadBar:MovieClip;
public var playButtonClick;
public function loadingBar_16(){
addFrameScript(0, frame1, 111, frame112, 112, frame113);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
}
function frame112(){
gotoAndPlay(1);
}
function frame113(){
mouseEnabled = true;
mouseChildren = true;
playButtonClick = function (_arg1:MouseEvent){
_arg1.target.removeEventListener(MouseEvent.CLICK, playButtonClick);
_arg1.target.parent.parent.play();
};
playButton.addEventListener(MouseEvent.CLICK, playButtonClick);
}
}
}//package Hexiom_fla
Section 23
//MainTimeline (Hexiom_fla.MainTimeline)
package Hexiom_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
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 MainTimeline extends MovieClip {
public var cMenu;
public function MainTimeline(){
addFrameScript(0, frame1);
}
function frame1(){
cMenu = new ContextMenu();
cMenu.hideBuiltInItems();
this.contextMenu = cMenu;
}
}
}//package Hexiom_fla
Section 24
//swoosh1_22 (Hexiom_fla.swoosh1_22)
package Hexiom_fla {
import flash.display.*;
public dynamic class swoosh1_22 extends MovieClip {
public function swoosh1_22(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Hexiom_fla
Section 25
//TGLettersAnim_13 (Hexiom_fla.TGLettersAnim_13)
package Hexiom_fla {
import flash.display.*;
public dynamic class TGLettersAnim_13 extends MovieClip {
public function TGLettersAnim_13(){
addFrameScript(61, frame62);
}
function frame62(){
stop();
}
}
}//package Hexiom_fla
Section 26
//TGLogo_1 (Hexiom_fla.TGLogo_1)
package Hexiom_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
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 TGLogo_1 extends MovieClip {
public var tgLink;
public var spinner;
public var loading:MovieClip;
public var updateLoadBar;
public var preloader;
public var tgClicker:SimpleButton;
public var lb;
public var swoosh:MovieClip;
public var spinnerUpdate;
public function TGLogo_1(){
addFrameScript(0, frame1, 35, frame36, 143, frame144, 144, frame145);
}
function frame144(){
spinner.removeEventListener(Event.ENTER_FRAME, spinnerUpdate);
tgClicker.removeEventListener(MouseEvent.CLICK, tgLink);
}
function frame1(){
MovieClip(parent).stop();
MovieClip(this).stop();
preloader = this;
lb = loading.loadBar;
tgLink = function (_arg1:MouseEvent){
var _local2:*;
_local2 = ExternalInterface.call("window.open", "http://www.turbogames.com", "_blank", "");
if (!_local2){
navigateToURL(new URLRequest("http://www.turbogames.com"), "_blank");
};
};
updateLoadBar = function (_arg1:Event){
var _local2:*;
var _local3:*;
_local2 = stage.loaderInfo.bytesTotal;
_local3 = stage.loaderInfo.bytesLoaded;
lb.bar.scaleX = (_local3 / _local2);
if (lb.bar.scaleX == 1){
lb.parent.gotoAndStop(113);
};
};
lb.addEventListener(Event.ENTER_FRAME, updateLoadBar);
tgClicker.addEventListener(MouseEvent.CLICK, tgLink);
}
function frame36(){
spinner = swoosh.spinner;
spinner.rotation = -45;
spinner.speed = 3;
spinnerUpdate = function (_arg1:Event){
spinner.rotation = (spinner.rotation - spinner.speed);
};
spinner.addEventListener(Event.ENTER_FRAME, spinnerUpdate);
}
function frame145(){
MovieClip(parent).gotoAndStop(2);
Game.init(MovieClip(parent));
}
}
}//package Hexiom_fla
Section 27
//TGManAnim_25 (Hexiom_fla.TGManAnim_25)
package Hexiom_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
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 TGManAnim_25 extends MovieClip {
public var balls;
public var c;
public var i;
public var chargeUpdate;
public var charge:MovieClip;
public function TGManAnim_25(){
addFrameScript(20, frame21, 72, frame73);
}
function frame73(){
c.removeEventListener(Event.ENTER_FRAME, chargeUpdate);
}
function frame21(){
c = charge;
balls = new Array();
balls.push(charge.charge.ball1);
balls.push(charge.charge.ball2);
balls.push(charge.charge.ball3);
balls.push(charge.charge.ball4);
c.scaleX = 0.1;
c.scaleY = 0.1;
i = 0;
while (i < balls.length) {
balls[i].speed = (1 + (Math.random() * 10));
i++;
};
chargeUpdate = function (_arg1:Event){
if (c.scaleX < 1.2){
c.scaleX = (c.scaleX + 0.01);
c.scaleY = (c.scaleY + 0.01);
};
i = 0;
while (i < balls.length) {
balls[i].rotation = (balls[i].rotation + balls[i].speed);
balls[i].scaleX = (balls[i].scaleY = ((Math.random() * 0.5) + 0.5));
balls[i].alpha = ((Math.random() * 0.5) + 0.5);
i++;
};
};
c.addEventListener(Event.ENTER_FRAME, chargeUpdate);
}
}
}//package Hexiom_fla
Section 28
//Title_63 (Hexiom_fla.Title_63)
package Hexiom_fla {
import flash.display.*;
public dynamic class Title_63 extends MovieClip {
public function Title_63(){
addFrameScript(25, frame26);
}
function frame26(){
stop();
}
}
}//package Hexiom_fla
Section 29
//AdvancedOptionsDialog (AdvancedOptionsDialog)
package {
import flash.display.*;
public dynamic class AdvancedOptionsDialog extends MovieClip {
public var okButton:WideButton;
public var tileSlider:BarSlider;
public var cancelButton:WideButton;
public var removedSlider:BarSlider;
public var emptySlider:BarSlider;
public var lockedSlider:BarSlider;
public var defaultButton:WideButton;
public var randomButton:WideButton;
public function AdvancedOptionsDialog(){
__setProp_randomButton_AdvancedOptionsDialog_Buttons_1();
__setProp_okButton_AdvancedOptionsDialog_Buttons_1();
__setProp_cancelButton_AdvancedOptionsDialog_Buttons_1();
__setProp_defaultButton_AdvancedOptionsDialog_Buttons_1();
}
function __setProp_randomButton_AdvancedOptionsDialog_Buttons_1(){
try {
randomButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
randomButton.text = "Random";
try {
randomButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_defaultButton_AdvancedOptionsDialog_Buttons_1(){
try {
defaultButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
defaultButton.text = "Default";
try {
defaultButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_okButton_AdvancedOptionsDialog_Buttons_1(){
try {
okButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
okButton.text = "OK";
try {
okButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_cancelButton_AdvancedOptionsDialog_Buttons_1(){
try {
cancelButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cancelButton.text = "Cancel";
try {
cancelButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 30
//Babow (Babow)
package {
import flash.media.*;
public dynamic class Babow extends Sound {
}
}//package
Section 31
//Background (Background)
package {
import flash.display.*;
import fl.motion.*;
import flash.geom.*;
public class Background extends MovieClip {
public var progress:Number;// = 1
public var targetSpeed:Number;
public var speed:Number;
public var stars:Array;
public var to:ColorTransform;
public var lq:Boolean;// = false
public var current:ColorTransform;
public var from:ColorTransform;
public var matrix:Matrix;
public static var RED:ColorTransform;
public static var GREEN:ColorTransform;
public static var BLUE:ColorTransform;
public static var YELLOW:ColorTransform;
public static var ORANGE:ColorTransform;
public function Background(){
var _local1:*;
var _local2:*;
var _local3:*;
lq = false;
progress = 1;
super();
from = new ColorTransform();
to = new ColorTransform();
current = new ColorTransform();
BLUE = new ColorTransform();
RED = new ColorTransform();
GREEN = new ColorTransform();
YELLOW = new ColorTransform();
ORANGE = new ColorTransform();
BLUE.color = 73095;
RED.color = 0x880000;
GREEN.color = 2254370;
YELLOW.color = 11184725;
ORANGE.color = 11162914;
from.color = (to.color = (current.color = BLUE.color));
speed = 1;
targetSpeed = 1;
stars = new Array();
_local1 = 0;
while (_local1 < 10) {
_local3 = new StarField();
_local3.scaleX = (_local3.scaleY = ((_local1 / 10) * 3));
_local3.rotation = (Math.random() * 360);
_local3.x = (_local3.y = 200);
stars.push(_local3);
addChild(_local3);
_local1++;
};
matrix = new Matrix();
_local2 = (400 * Math.sqrt(2));
matrix.createGradientBox(_local2, _local2, 0, ((400 - _local2) / 2), ((400 - _local2) / 2));
draw();
}
public function updateColor(){
current.color = Color.interpolateColor(from.color, to.color, progress);
draw();
}
public function setColor(_arg1:ColorTransform){
progress = 0;
from.color = current.color;
to.color = _arg1.color;
targetSpeed = 1;
updateColor();
}
public function draw(){
var _local1:*;
_local1 = this.graphics;
_local1.clear();
_local1.beginGradientFill("radial", [current.color, 0], [1, 1], [0, 0xFF], matrix);
_local1.moveTo(0, 0);
_local1.lineTo(0, 400);
_local1.lineTo(400, 400);
_local1.lineTo(400, 0);
_local1.lineTo(0, 0);
_local1.endFill();
}
public function setDifficulty(_arg1:Number){
progress = 0;
from.color = current.color;
if (_arg1 < 0){
to.color = GREEN.color;
} else {
to.color = Color.interpolateColor(BLUE.color, RED.color, _arg1);
};
targetSpeed = Math.max(1, (1 + (_arg1 * 2)));
updateColor();
}
public function update(){
var _local1:*;
var _local2:*;
if (speed != targetSpeed){
if (speed < targetSpeed){
speed = Math.min(targetSpeed, (speed + 0.05));
} else {
speed = Math.max(targetSpeed, (speed - 0.05));
};
};
if (progress < 1){
progress = (progress + 0.05);
updateColor();
};
if (lq){
return;
};
_local1 = 0;
while (_local1 < stars.length) {
_local2 = stars[_local1];
_local2.rotation = (_local2.rotation + (0.01 * speed));
_local2.scaleX = (_local2.scaleX - (0.003 * speed));
_local2.scaleY = (_local2.scaleY - (0.003 * speed));
if (_local2.scaleX < 0.05){
_local2.scaleX = (_local2.scaleY = 3);
};
_local1++;
};
}
}
}//package
Section 32
//BarSlider (BarSlider)
package {
import flash.display.*;
import flash.events.*;
public class BarSlider extends MovieClip {
public var bar:Sprite;
public var value:Number;// = 1
public var onUpdate:Function;// = null
public function BarSlider(){
onUpdate = null;
value = 1;
super();
enable();
}
function setValue(_arg1:Number){
value = Math.max(0, Math.min(1, _arg1));
bar.scaleX = value;
}
function drag(_arg1:MouseEvent){
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
stage.addEventListener(MouseEvent.MOUSE_MOVE, update);
update();
}
function enable(){
bar.addEventListener(MouseEvent.MOUSE_DOWN, drag);
this.addEventListener(MouseEvent.MOUSE_DOWN, drag);
}
function update(_arg1:MouseEvent=null){
setValue((this.mouseX / 100));
if (onUpdate != null){
onUpdate(value);
};
}
function disable(){
bar.removeEventListener(MouseEvent.MOUSE_DOWN, drag);
this.removeEventListener(MouseEvent.MOUSE_DOWN, drag);
}
function drop(_arg1:MouseEvent){
stage.removeEventListener(MouseEvent.MOUSE_UP, drop);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, update);
update();
}
}
}//package
Section 33
//Board (Board)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
public class Board extends MovieClip {
public var size:int;// = 4
public var dragTile:Tile;// = null
public var background:Sprite;
public var showVictoryScreen:Boolean;// = true
public var slots:Array;// = null
public var timer:Timer;
public var tileHeight:Number;// = 30
public var scale:Number;// = 1
public var TILE_SPACING;// = 28
public var tiles:Array;// = null
public var secondsPassed:int;// = 0
public var tileWidth:Number;// = 25
private var _growth:Number;// = 1
public static var levelStrings:Array = new Array(null, "lltjtye", "lktyLrfqxQc", "mplLuyuiypiwypapayprptypypyyypfyfprypdpxyrpdyxpuydpb", "mutdsfutfpayfpyffprrfpdxfpido", "mxyqtypuKuuyptpfyprpruph", "ffulrpryutypayyptfypuxypidtpfpMpxpxpfpz", "miltqrKpxpayprpQpfpLipdyuputwpith", "mpmdsrutrpayrpyfrprrrpdxrpidtwutipSptpLpfpKpxpdtpupb", "fxwLyfxdtwariKptptypfpyfpapffuprfpipxypxpdtpupuptpv", "fdutwptpypfpupiysypxyyijfutypsdpKxpdo", "ffpalyxQuyuiypapaypypQfpLrpryprpxypdpdypiputdpipapc", "mwarpdafpiyfpxffpfxmdtxpSrpLprpdtpupb", "mpsrpQfpayfpyfrpurfpdxfpidyiiywwypfpfypxpz", "muarqfpuyfiffprxmdypyptypxpv", "mpqfpdaritfprffpxxfpyuypiiyuwlpyLpfyptpxydpc", "mpmxpKjyfxffpddfyuruirpuwfrparfptypapldpktpdypxpb", "frpsyfxdypitypdrypauMiyptpSprptypuprfrpxypypdtupv", "ffpflrprfLrpayrwffuxxidffwyptpardptfpypyypxpMxpxfpdpufpipipypb", "mpmyqfMmrydufuwtxpaypxptyipyfprpfyypKpfpdywpuyrpb", "fypafyxysxitxrdfpxuffirpawLpSptptypupufdpiaptpv", "mpmtpuafpdtLufpxiyipayyptydpyyfpfypipryrpxyxpdlputwpb", "kemyglyexyypdxrpxparipdLpwyeyeayuetmeyyweffpaerferexypredypyeuypfeiydewyfgayrgtfgfgyfptgffpugrygrgxypigc", "rpypjuiwpaptpypfprpxpdpupitejterxspwtgdeLefefygferygrexyededtgyeutewewteugSgtgLetgMeigxygagc", "mpmktrparxptxxpudfuuyiirpiwywpffprprrypxfpdpdrdpufpypb", "mplrpLrpdyrprflrrpixrpadLiyrwffptypxpyypfpdfxpv", "fypmuprrpmrpQrpdfrxrrpxdydifpawtypaywpyfrpfypupJpipdLpb", "mprfxpiadpSryyfrrrfxdpydfuufptirdwyipQpxpyqprfxpufpdpiyrv", "rxelpypfprpxpdreryfeffypirfeyxrgddypwiyuwrgrpaxwptxipuredpifgfexfeuedypteuyeteiypaewygxgayeagtypugyyexgffeigrfgygz", "kpwaruarexyreufreaxrpudretpadeyptrrpyrgrpddgxpurwpiyierrewexrgaedypxeuygygfrptgrrpfgxyygc", "keffrsxpQxpffxpurxgrdrxufpiidexwypapargfptxpwpyrgxpfxeaprrfpxypdpdfetpureipifefetfeueffewedyieuLgafdgqpapc", "mpkrpkxpJxpfyxurfpdxfpiurxiyptwfdpafpuptypapyfipffrprfypz", "rfefkergfMyfpyxrptuxfiygxwrpfparrptrxpyfexpfreyprfwpxfgypdrewpuripiypwpwrueafgreyfdedyeueufpiewygagafeigxygdgdpweugagc", "kedursrQrpifxrrfefxxuurptireiwfdparedpydgdpfxprprfypdyeypiypwpwfewetfeueyygyerypfeurpueirexewfgagafetgtfxgyywgMgxgdSruprpwgo", "ripwayfxdwpapfpdygqfpJfexrreyurpwiypyptyefpyrgrprreupxyeapuyeipiypipwrgaeayedeyyeredypugargdgtyprgyygfgz", "kpiademdeJdpiyrgffrptrrgxxdudfxuKirgywfeapafiptredprfwpufgrpiypuewfpfgaypagp", "kedarMMyfwfrptrfpdxfetdfgaifiwrpxpfrgrpxygypwyeieaygxeQeaeryerexypuedleufgfeifgtewypigafpygtfugyyefgfypwgryeugJeygc", "kedyxejxgryrffrearxxxrgfdretiydwdipaxwptfeiprfrpdrprpuypapwfgyeaypietredeyfgaerkexfpfedtgxeuypuewypdgSpwgfyygJergdfz", "jhidxzJxgyyxzufxhxrxzwxxpydreiurpwirerwrgwparzrptrgipyrpupfkprrgdpxreupdrxpurrpirzfpwrexerrzteurgxgargtgfrpagdfgugufhdgifeagwypfhayeyhtfhwhyfhahffhrhrfuhxywhdfgfhufhihiffhwyhuzafetztfzyzyfhyzfyhfzrfzazxfzdzdfzizuyizifgrzwfcacaguhrhizyzdco", "xigwrpapypdpieyefeigyxpwtrdyrgxfxhxrfzfxfzxddeaurerirziwreuptkpfdguprrzypxfhypwrzdeargtetMerrgiexrcaedffeurgdewfzugarhugtfexgffxgrfztgxfhdgdyhahayhthtyrhyygfhfyihxygrhuygahwyzazayzrzrypuzxyedzuyuzwhahtzazh", "davjdhuaxeQxhyyxgffxgdrxvyxxhddxefurzyirxptrcxpfxbwprrgupddexpurcfpixcipwxzxeargaetfpiefrbyexrbfedxpdewxigarewgtfedgyxvigrxcrgxxzugudgrgixgtharbahtryhyxvdhrxzthxdbxhdxhwhuxbuhircthwxhtzadeiztxpyzyrrzrrpwzudzwzirprzwfvrctrucyfzrcfrbrcrfwcxrgxcdfzacurerciybdcwfvuvarvxvtrfvyrpuvfrhavrfcwvxrhivdreuvurbtvircuvwfzfbafcdbtfvwbyfcybfygibryeabxfdbdKburgwbifbibwypxno");
public function Board(){
size = 4;
scale = 1;
tileWidth = 25;
tileHeight = 30;
TILE_SPACING = 28;
slots = null;
tiles = null;
dragTile = null;
_growth = 1;
showVictoryScreen = true;
secondsPassed = 0;
super();
scaleX = 0;
scaleY = 0;
growth = 0;
slots = new Array();
tiles = new Array();
timer = new Timer(1000);
}
function playMode(){
if (!buildLevel(print())){
trace("Error switching modes");
};
}
function shrink(){
this.addEventListener(Event.ENTER_FRAME, shrinkStep);
this.removeEventListener(Event.ENTER_FRAME, growStep);
if (growth > 0){
Game.playSound("Exit Level");
};
}
function startTimer(){
timer.addEventListener(TimerEvent.TIMER, updateTime);
timer.start();
}
function upsize(_arg1:MouseEvent=null){
if (size > 5){
return;
};
setSize((size + 1));
fillTiles();
editUpdate();
}
public function updateTime(_arg1:TimerEvent=null){
var _local2:*;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:String;
_local2 = secondsPassed;
_local3 = Math.floor((secondsPassed / 3600));
_local2 = (_local2 - (_local3 * 3600));
_local4 = Math.floor((secondsPassed / 60));
_local2 = (_local2 - (_local4 * 60));
_local5 = _local2;
_local6 = "";
if (_local3 > 0){
_local6 = ((_local6 + _local3) + ":");
};
if (_local4 < 10){
_local6 = (_local6 + "0");
};
_local6 = ((_local6 + _local4) + ":");
if (_local5 < 10){
_local6 = (_local6 + "0");
};
_local6 = (_local6 + _local5);
Game.levelDisplay.timeLabel.text = _local6;
if (!Game.paused){
secondsPassed++;
};
}
public function clearTiles(){
while (tiles.length > 0) {
if (tiles[0].slot != null){
tiles[0].slot.tile = null;
tiles[0].slot = null;
};
tiles[0].parent.removeChild(tiles[0]);
tiles.shift();
};
}
function loadLevel(_arg1:int):Boolean{
var _local2:*;
if ((((_arg1 < 1)) || ((_arg1 >= levelStrings.length)))){
trace("Invalid level number");
return (false);
};
_local2 = Game.decryptLevelString(levelStrings[_arg1]);
if (_local2 == ""){
trace("Level is empty");
return (false);
};
if (!buildLevel(_local2)){
trace("Error loading level");
return (false);
};
return (true);
}
function solve(_arg1:MouseEvent=null){
var _local2:*;
_local2 = 0;
while (_local2 < slots.length) {
slots[_local2].tile = null;
_local2++;
};
_local2 = 0;
while (_local2 < tiles.length) {
tiles[_local2].slot = null;
tiles[_local2].solutionSlot.insert(tiles[_local2]);
_local2++;
};
}
function mixMode(){
if (!buildLevel(print())){
trace("Error switching modes");
};
}
public function plant(_arg1:Object, _arg2:Number, _arg3:Number){
if (_arg1.planted){
return;
};
_arg1.planted = true;
_arg1.slot.x = _arg2;
_arg1.slot.y = _arg3;
_arg1.slot.setMode(Game.mode);
this.addChild(_arg1.slot);
if (_arg1.a != null){
_arg1.slot.neighbours.push(_arg1.a.slot);
if (!_arg1.a.planted){
plant(_arg1.a, _arg2, (_arg3 - tileHeight));
};
};
if (_arg1.b != null){
_arg1.slot.neighbours.push(_arg1.b.slot);
if (!_arg1.b.planted){
plant(_arg1.b, (_arg2 + tileWidth), (_arg3 - (tileHeight / 2)));
};
};
if (_arg1.c != null){
_arg1.slot.neighbours.push(_arg1.c.slot);
if (!_arg1.c.planted){
plant(_arg1.c, (_arg2 + tileWidth), (_arg3 + (tileHeight / 2)));
};
};
if (_arg1.d != null){
_arg1.slot.neighbours.push(_arg1.d.slot);
if (!_arg1.d.planted){
plant(_arg1.d, _arg2, (_arg3 + tileHeight));
};
};
if (_arg1.e != null){
_arg1.slot.neighbours.push(_arg1.e.slot);
if (!_arg1.e.planted){
plant(_arg1.e, (_arg2 - tileWidth), (_arg3 + (tileHeight / 2)));
};
};
if (_arg1.f != null){
_arg1.slot.neighbours.push(_arg1.f.slot);
if (!_arg1.f.planted){
plant(_arg1.f, (_arg2 - tileWidth), (_arg3 - (tileHeight / 2)));
};
};
}
function testMode(){
if (!buildLevel(print())){
trace("Error switching modes");
};
}
public function reset(_arg1:MouseEvent=null){
var _local2:int;
Game.playSound("Reset");
if (Game.mode == Game.EDIT_MODE){
_local2 = 0;
while (_local2 < slots.length) {
slots[_local2].removed = false;
slots[_local2].alpha = 1;
_local2++;
};
_local2 = 0;
while (_local2 < tiles.length) {
tiles[_local2].visible = false;
if (tiles[_local2].locked){
tiles[_local2].unlock();
};
_local2++;
};
} else {
_local2 = 0;
while (_local2 < tiles.length) {
tiles[_local2].slot.tile = null;
tiles[_local2].slot = null;
_local2++;
};
_local2 = 0;
while (_local2 < tiles.length) {
if (Game.mode == Game.MIX_MODE){
tiles[_local2].solutionSlot.insert(tiles[_local2]);
tiles[_local2].startSlot = tiles[_local2].solutionSlot;
} else {
tiles[_local2].startSlot.insert(tiles[_local2]);
};
_local2++;
};
};
}
function grow(){
var _local1:*;
visible = true;
this.addEventListener(Event.ENTER_FRAME, growStep);
this.removeEventListener(Event.ENTER_FRAME, shrinkStep);
this.update();
_local1 = 0;
while (_local1 < tiles.length) {
tiles[_local1].background.transform.colorTransform = (tiles[_local1].oldColor = tiles[_local1].color);
tiles[_local1].flashing = false;
_local1++;
};
if (growth < 1){
Game.playSound("Enter Level");
};
timer.stop();
secondsPassed = 0;
updateTime();
}
function shrinkStep(_arg1:Event){
growth = Math.max((growth - 0.1), 0);
if (growth == 0){
this.removeEventListener(Event.ENTER_FRAME, shrinkStep);
visible = false;
};
}
function growStep(_arg1:Event){
var _local2:*;
growth = Math.min((growth + 0.1), 1);
if (growth == 1){
this.removeEventListener(Event.ENTER_FRAME, growStep);
_local2 = 0;
while (_local2 < tiles.length) {
tiles[_local2].flash();
_local2++;
};
startTimer();
};
}
function setSize(_arg1:int=-1){
var _local2:*;
var _local3:*;
if (_arg1 > 0){
this.size = _arg1;
};
clear();
slots = new Array();
scale = Math.min(2, ((350 / 30) / ((_arg1 * 2) - 1)));
tileHeight = TILE_SPACING;
tileWidth = Math.floor(Math.sqrt((((tileHeight * tileHeight) * 3) / 4)));
_local2 = {layer:1, a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
_local3 = 1;
while (_local3 < _arg1) {
expand(_local2, _local3);
_local3++;
};
plant(_local2, 0, 0);
background.scaleX = (((_arg1 * 2) + 0.75) - Math.sqrt(_arg1));
background.scaleY = (((_arg1 * 2) + 0.75) - Math.sqrt(_arg1));
if (Game.mode == Game.EDIT_MODE){
_local3 = 0;
while (_local3 < slots.length) {
slots[_local3].setMode(Game.EDIT_MODE);
_local3++;
};
};
updateGrowth();
}
function stopTimer(){
timer.removeEventListener(TimerEvent.TIMER, updateTime);
}
public function set growth(_arg1:Number){
_growth = _arg1;
updateGrowth();
}
public function expand(_arg1:Object, _arg2:int){
if (_arg1.layer == _arg2){
if (_arg1.a == null){
_arg1.a = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
if (_arg1.b == null){
_arg1.b = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
if (_arg1.c == null){
_arg1.c = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
if (_arg1.d == null){
_arg1.d = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
if (_arg1.e == null){
_arg1.e = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
if (_arg1.f == null){
_arg1.f = {layer:(_arg1.layer + 1), a:null, b:null, c:null, d:null, e:null, f:null, planted:false, slot:newSlot()};
};
_arg1.a.d = _arg1;
_arg1.b.e = _arg1;
_arg1.c.f = _arg1;
_arg1.d.a = _arg1;
_arg1.e.b = _arg1;
_arg1.f.c = _arg1;
_arg1.a.c = _arg1.b;
_arg1.b.d = _arg1.c;
_arg1.c.e = _arg1.d;
_arg1.d.f = _arg1.e;
_arg1.e.a = _arg1.f;
_arg1.f.b = _arg1.a;
_arg1.a.e = _arg1.f;
_arg1.b.f = _arg1.a;
_arg1.c.a = _arg1.b;
_arg1.d.b = _arg1.c;
_arg1.e.c = _arg1.d;
_arg1.f.d = _arg1.e;
} else {
if (_arg1.layer < _arg2){
if (_arg1.a.layer > _arg1.layer){
expand(_arg1.a, _arg2);
};
if (_arg1.b.layer > _arg1.layer){
expand(_arg1.b, _arg2);
};
if (_arg1.c.layer > _arg1.layer){
expand(_arg1.c, _arg2);
};
if (_arg1.d.layer > _arg1.layer){
expand(_arg1.d, _arg2);
};
if (_arg1.e.layer > _arg1.layer){
expand(_arg1.e, _arg2);
};
if (_arg1.f.layer > _arg1.layer){
expand(_arg1.f, _arg2);
};
};
};
}
public function clear(){
clearTiles();
while (slots.length > 0) {
if (slots[0].tile != null){
slots[0].tile.slot = null;
slots[0].tile = null;
};
if (slots[0].parent != null){
slots[0].parent.removeChild(slots[0]);
};
slots.shift();
};
}
function randomize(){
var _local1:Array;
var _local2:*;
var _local3:*;
_local1 = new Array();
_local2 = 0;
while (_local2 < slots.length) {
if (((!((slots[_local2].tile == null))) && (!(slots[_local2].tile.locked)))){
slots[_local2].tile.slot = null;
slots[_local2].tile = null;
};
if (((!(slots[_local2].removed)) && ((slots[_local2].tile == null)))){
_local1.push(slots[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < tiles.length) {
if (!tiles[_local2].locked){
_local3 = Math.floor((Math.random() * _local1.length));
_local1[_local3].insert(tiles[_local2]);
_local1.splice(_local3, 1);
};
_local2++;
};
}
public function removeSlotByIndex(_arg1:int):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = 0;
while (_local2 < slots.length) {
if (slots[_local2].index == _arg1){
_local3 = slots[_local2];
_local3.removed = true;
if (Game.mode == Game.EDIT_MODE){
_local3.alpha = 0.1;
} else {
_local4 = 0;
while (_local4 < _local3.neighbours.length) {
_local5 = _local3.neighbours[_local4];
_local6 = 0;
while (_local6 < _local5.neighbours) {
if (_local5.neighbours[_local6] == _local3){
_local5.neighbours.splice(_local6, 1);
};
_local6++;
};
_local4++;
};
if (_local3.parent == this){
removeChild(_local3);
};
};
return (true);
};
_local2++;
};
return (false);
}
function downsize(_arg1:MouseEvent=null){
if (size < 3){
return;
};
setSize((size - 1));
fillTiles();
editUpdate();
}
function buildLevel(_arg1:String):Boolean{
var _local2:*;
var _local3:*;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
_local2 = _arg1.split(",");
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = int(_local2[_local3]);
_local3++;
};
if (_local2.length < 4){
return (false);
};
_local4 = _local2[1];
_local5 = _local2[2];
_local6 = _local2[3];
if (_local2.length < (((4 + _local4) + (_local5 * 3)) + _local6)){
return (false);
};
setSize(_local2[0]);
_local3 = 0;
while (_local3 < _local4) {
_local7 = _local2[(4 + _local3)];
if (_local7 >= slots.length){
return (false);
};
if (!removeSlotByIndex(_local7)){
return (false);
};
_local3++;
};
_local3 = 0;
while (_local3 < _local5) {
_local8 = _local2[((4 + _local4) + (_local3 * 3))];
_local9 = _local2[(((4 + _local4) + (_local3 * 3)) + 1)];
_local10 = _local2[(((4 + _local4) + (_local3 * 3)) + 2)];
if ((((_local9 >= slots.length)) || ((_local10 >= slots.length)))){
return (false);
};
_local11 = generateTile(_local8);
_local11.startSlot = slots[_local9];
_local11.solutionSlot = slots[_local10];
slots[_local9].insert(_local11);
_local3++;
};
_local3 = 0;
while (_local3 < _local6) {
_local7 = _local2[(((4 + _local4) + (_local5 * 3)) + _local3)];
if (_local7 >= slots.length){
return (false);
};
if (slots[_local7].tile == null){
return (false);
};
slots[_local7].tile.lock();
_local3++;
};
return (true);
}
public function newSlot():Slot{
var _local1:*;
_local1 = new Slot(this, slots.length);
_local1.setMode(Game.mode);
slots.push(_local1);
return (_local1);
}
function fillTiles(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_local1 = 0;
while (_local1 < slots.length) {
if (slots[_local1].tile == null){
_local5 = generateTile(1);
slots[_local1].insert(_local5);
_local5.startSlot = slots[_local1];
_local5.solutionSlot = slots[_local1];
_local5.visible = false;
};
slots[_local1].tile.setMode(Game.EDIT_MODE);
_local1++;
};
_local4 = new Array();
_local1 = 0;
while (_local1 < slots.length) {
_local6 = false;
_local2 = 0;
while (_local2 < tiles.length) {
if (tiles[_local2].startSlot == slots[_local1]){
_local6 = true;
break;
};
_local2++;
};
if (!_local6){
_local4.push(slots[_local1]);
};
_local1++;
};
if (_local4.length == 0){
return;
};
_local1 = 0;
while (_local1 < tiles.length) {
_local2 = (_local1 + 1);
while (_local2 < tiles.length) {
if (tiles[_local1].startSlot == tiles[_local2].startSlot){
_local7 = tiles[_local1];
_local8 = tiles[_local2];
if (tiles[_local1].visible){
_local8 = tiles[_local1];
_local7 = tiles[_local2];
};
_local9 = false;
_local3 = 0;
while (_local3 < _local4.length) {
if (_local8.solutionSlot == _local4[_local3]){
_local9 = true;
break;
};
_local3++;
};
if (_local9){
_local7.startSlot = _local8.solutionSlot;
_local4.splice(_local3, 1);
} else {
_local7.startSlot = _local4[0];
_local4.shift();
};
};
_local2++;
};
_local1++;
};
}
public function generateTile(_arg1):Tile{
var _local2:Tile;
_local2 = new Tile(this, _arg1);
tiles.push(_local2);
_local2.setMode(Game.mode);
addChild(_local2);
return (_local2);
}
public function print():String{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:String;
var _local6:String;
var _local7:*;
var _local8:int;
var _local9:int;
var _local10:String;
var _local11:*;
_local4 = "";
_local5 = "";
_local6 = "";
_local7 = 0;
_local1 = 0;
while (_local1 < slots.length) {
if (slots[_local1].removed){
_local7++;
_local4 = _local4.concat(",", _local1);
};
_local1++;
};
_local8 = 0;
_local9 = 0;
_local1 = 0;
while (_local1 < tiles.length) {
_local11 = tiles[_local1];
if (_local11.visible){
_local8++;
_local5 = _local5.concat(",", _local11.req, ",", _local11.startSlot.index, ",", _local11.solutionSlot.index);
if (_local11.locked){
_local9++;
_local6 = _local6.concat(",", _local11.startSlot.index);
};
};
_local1++;
};
_local10 = "";
_local10 = _local10.concat(size, ",", _local7, ",", _local8, ",", _local9, _local4, _local5, _local6);
return (_local10);
}
public function update(){
var _local1:*;
_local1 = 0;
while (_local1 < tiles.length) {
tiles[_local1].update();
_local1++;
};
}
function editMode(_arg1:MouseEvent=null){
var _local2:*;
if (!buildLevel(print())){
trace("Error switching modes");
};
_local2 = 0;
while (_local2 < slots.length) {
slots[_local2].tile = null;
_local2++;
};
_local2 = 0;
while (_local2 < tiles.length) {
tiles[_local2].slot = null;
tiles[_local2].solutionSlot.insert(tiles[_local2]);
_local2++;
};
fillTiles();
editUpdate();
}
public function get growth():Number{
return (_growth);
}
public function editUpdate(){
var _local1:*;
var _local2:*;
var _local3:int;
var _local4:*;
_local1 = 0;
while (_local1 < tiles.length) {
_local2 = tiles[_local1];
_local3 = 0;
_local4 = 0;
while (_local4 < _local2.slot.neighbours.length) {
if (((!((_local2.slot.neighbours[_local4].tile == null))) && (_local2.slot.neighbours[_local4].tile.visible))){
_local3++;
};
_local4++;
};
_local2.req = _local3;
_local2.label.text = ("" + _local3);
_local1++;
};
}
function randomFill(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:*;
var _local6:*;
_local5 = 0;
while (_local5 < slots.length) {
_local6 = Math.random();
if (_local6 < _arg4){
slots[_local5].removed = true;
slots[_local5].tile.visible = false;
} else {
if (_local6 < ((_arg4 + _arg1) + _arg2)){
slots[_local5].tile.visible = true;
if (_local6 < (_arg4 + _arg2)){
slots[_local5].tile.lock();
};
};
};
_local5++;
};
editUpdate();
}
public function checkVictory(){
var _local1:*;
if (!showVictoryScreen){
return;
};
if ((((Game.mode == Game.EDIT_MODE)) || ((Game.mode == Game.MIX_MODE)))){
return;
};
_local1 = 0;
while (_local1 < tiles.length) {
if (tiles[_local1].slot == null){
return;
};
if (tiles[_local1].slot.adjacentCount() != tiles[_local1].req){
return;
};
_local1++;
};
Game.victory();
}
function updateGrowth(){
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = growth;
_local2 = 0;
_local3 = ((_local1 * _local1) * scale);
this.transform.matrix = new Matrix(_local3, _local2, _local2, _local3, x, y);
}
}
}//package
Section 34
//ButtonClick (ButtonClick)
package {
import flash.media.*;
public dynamic class ButtonClick extends Sound {
}
}//package
Section 35
//CheatMode (CheatMode)
package {
import flash.media.*;
public dynamic class CheatMode extends Sound {
}
}//package
Section 36
//Click (Click)
package {
import flash.media.*;
public dynamic class Click extends Sound {
}
}//package
Section 37
//Credits (Credits)
package {
import flash.display.*;
public dynamic class Credits extends MovieClip {
public var createdByButton:SimpleButton;
public var musicByButton:SimpleButton;
public var sponsoredByButton:MovieClip;
}
}//package
Section 38
//Drop (Drop)
package {
import flash.media.*;
public dynamic class Drop extends Sound {
}
}//package
Section 39
//EditInstructions (EditInstructions)
package {
import flash.display.*;
public dynamic class EditInstructions extends MovieClip {
}
}//package
Section 40
//EditorButtons (EditorButtons)
package {
import flash.display.*;
public dynamic class EditorButtons extends MovieClip {
public var editButton:WideButton;
public var solveButton:WideButton;
public var testButton:WideButton;
public var plusButton:SquareButton;
public var mixButton:WideButton;
public var minusButton:SquareButton;
public var helpButton:SquareButton;
public var randomButton:WideButton;
public function EditorButtons(){
__setProp_helpButton_EditorButtons_Layer1_1();
__setProp_testButton_EditorButtons_Layer1_1();
__setProp_solveButton_EditorButtons_Layer1_1();
__setProp_minusButton_EditorButtons_Layer1_1();
__setProp_mixButton_EditorButtons_Layer1_1();
__setProp_plusButton_EditorButtons_Layer1_1();
__setProp_editButton_EditorButtons_Layer1_1();
__setProp_randomButton_EditorButtons_Layer1_1();
}
function __setProp_testButton_EditorButtons_Layer1_1(){
try {
testButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
testButton.text = "Test";
try {
testButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_minusButton_EditorButtons_Layer1_1(){
try {
minusButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
minusButton.text = "-";
try {
minusButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_mixButton_EditorButtons_Layer1_1(){
try {
mixButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
mixButton.text = "Mix Mode";
try {
mixButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_editButton_EditorButtons_Layer1_1(){
try {
editButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
editButton.text = "Edit Mode";
try {
editButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_solveButton_EditorButtons_Layer1_1(){
try {
solveButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
solveButton.text = "Solve";
try {
solveButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_helpButton_EditorButtons_Layer1_1(){
try {
helpButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
helpButton.text = "?";
try {
helpButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_randomButton_EditorButtons_Layer1_1(){
try {
randomButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
randomButton.text = "Randomize";
try {
randomButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_plusButton_EditorButtons_Layer1_1(){
try {
plusButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
plusButton.text = "+";
try {
plusButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 41
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 42
//Game (Game)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import fl.events.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import flash.external.*;
import flash.filters.*;
public class Game extends MovieClip {
public static var pauseScreen:PauseScreen;
public static var MENU_MODE:uint = 0;
public static var soundBar:SoundBar;
public static var currentLevel:int = -1;
public static var cheatMode:Boolean = false;
public static var levelsClear:Array;
public static var showMix:Boolean;
public static var lockedRatio:Number = 0.1;
public static var mode:uint = PLAY_MODE;
public static var levelDisplay:LevelDisplay;
public static var paused:Boolean = false;
public static var MIDX:Number = 200;
public static var MIDY:Number = 200;
public static var editorOpened:Boolean = false;
public static var TEST_MODE:uint = 4;
public static var EDIT_MODE:uint = 2;
public static var bg:Background;
public static var MIX_MODE:uint = 3;
public static var PLAY_MODE:uint = 1;
public static var base:MovieClip = null;
public static var editorButtons:EditorButtons;
public static var gapRatio:Number = 0.1;
public static var emptyRatio:Number = 0.2;
public static var titleScreen:TitleScreen;
public static var board:Board;
public static var cookie:SharedObject;
public static var tileRatio:Number = 0.6;
public static function unpause(_arg1:Event=null){
if (pauseScreen.parent == base){
base.removeChild(pauseScreen);
};
paused = false;
}
public static function togglePause(){
if (paused){
unpause();
} else {
pause();
};
}
public static function generateLevel(_arg1:int){
titleScreen.hide();
board.setSize(_arg1);
currentLevel = -2;
bg.setDifficulty(((_arg1 - 3) / 4));
mode = EDIT_MODE;
board.editMode();
board.randomFill(tileRatio, lockedRatio, emptyRatio, gapRatio);
mode = MIX_MODE;
board.mixMode();
board.randomize();
setMode(PLAY_MODE);
board.grow();
}
public static function init(_arg1:MovieClip){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
base = _arg1;
base.scrollRect = new Rectangle(0, 0, 400, 400);
_local2 = new ContextMenu();
_local2.hideBuiltInItems();
_local3 = new ContextMenuItem("Created by Matthew Stradwick");
_local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, emailLink);
_local2.customItems.push(_local3);
_local4 = new ContextMenuItem("Music by RigAudio");
_local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, musicLink);
_local2.customItems.push(_local4);
_local5 = new ContextMenuItem("Sponsored by Turbo Games");
_local5.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, sponsorLink);
_local2.customItems.push(_local5);
base.contextMenu = _local2;
cookie = SharedObject.getLocal("Hex");
if (cookie.data.levelsClear == undefined){
cookie.data.levelsClear = new Array();
_local7 = 0;
while (_local7 <= 40) {
cookie.data.levelsClear.push(false);
_local7++;
};
};
levelsClear = cookie.data.levelsClear;
cookie.flush();
base.addEventListener(Event.ENTER_FRAME, enterFrame);
base.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress);
base.stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease);
base.stage.stageFocusRect = false;
bg = new Background();
base.addChild(bg);
pauseScreen = new PauseScreen();
pauseScreen.tabEnabled = false;
pauseScreen.addEventListener(MouseEvent.CLICK, unpause);
board = new Board();
board.x = MIDX;
board.y = MIDY;
base.addChild(board);
editorButtons = new EditorButtons();
editorButtons.x = MIDX;
editorButtons.editButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.testButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.mixButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.randomButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.solveButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.plusButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.minusButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
editorButtons.helpButton.addEventListener(MouseEvent.CLICK, editorButtonsClick);
base.addChild(editorButtons);
levelDisplay = new LevelDisplay();
levelDisplay.x = MIDX;
levelDisplay.resetButton.tabEnabled = false;
levelDisplay.resetButton.addEventListener(MouseEvent.CLICK, levelDisplayClick);
levelDisplay.backButton.tabEnabled = false;
levelDisplay.backButton.addEventListener(MouseEvent.CLICK, levelDisplayClick);
levelDisplay.saveButton.tabEnabled = false;
levelDisplay.saveButton.addEventListener(MouseEvent.CLICK, levelDisplayClick);
levelDisplay.saveButton.visible = false;
base.addChild(levelDisplay);
soundBar = new SoundBar();
soundBar.x = MIDX;
soundBar.y = 400;
base.addChild(soundBar);
titleScreen = new TitleScreen();
titleScreen.x = MIDX;
titleScreen.y = MIDY;
setMode(MENU_MODE);
playMusic("Music");
_local6 = new DropShadowFilter(2, 45, 0, 0.2, 3, 3, 1);
editorButtons.filters = [_local6];
levelDisplay.filters = [_local6];
soundBar.filters = [_local6];
titleScreen.filters = [_local6];
setQuality("best");
}
public static function levelDisplayClick(_arg1:MouseEvent){
switch (_arg1.target){
case levelDisplay.resetButton:
board.reset();
break;
case levelDisplay.backButton:
quit();
break;
case levelDisplay.saveButton:
saveLevelDialog();
break;
default:
return;
};
Game.playSound("Button Click", (_arg1.target.x / Game.MIDX));
}
public static function advancedOptionsDialog(_arg1:MouseEvent=null){
var dialog:*;
var removeDialog:*;
var randomFunc:*;
var defaultFunc:*;
var accept:*;
var cancel:*;
var e = _arg1;
dialog = new AdvancedOptionsDialog();
base.addChild(dialog);
removeDialog = function (_arg1:MouseEvent){
dialog.cancelButton.removeEventListener(MouseEvent.CLICK, cancel);
dialog.okButton.removeEventListener(MouseEvent.CLICK, accept);
dialog.randomButton.removeEventListener(MouseEvent.CLICK, randomFunc);
dialog.defaultButton.removeEventListener(MouseEvent.CLICK, defaultFunc);
dialog.tileSlider.disable();
dialog.lockedSlider.disable();
dialog.emptySlider.disable();
dialog.removedSlider.disable();
dialog.parent.removeChild(dialog);
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
randomFunc = function (_arg1:MouseEvent){
dialog.tileSlider.setValue((tileRatio = Math.random()));
dialog.lockedSlider.setValue((lockedRatio = (Math.random() * (1 - tileRatio))));
dialog.emptySlider.setValue((emptyRatio = (Math.random() * ((1 - tileRatio) - lockedRatio))));
dialog.removedSlider.setValue((gapRatio = (Math.random() * (((1 - tileRatio) - lockedRatio) - emptyRatio))));
};
defaultFunc = function (_arg1:MouseEvent){
dialog.tileSlider.setValue((tileRatio = 0.6));
dialog.lockedSlider.setValue((lockedRatio = 0.1));
dialog.emptySlider.setValue((emptyRatio = 0.2));
dialog.removedSlider.setValue((gapRatio = 0.1));
};
accept = function (_arg1:MouseEvent){
removeDialog(_arg1);
};
cancel = function (_arg1:MouseEvent){
tileRatio = dialog.tileRatio;
lockedRatio = dialog.lockedRatio;
emptyRatio = dialog.emptyRatio;
gapRatio = dialog.gapRatio;
removeDialog(_arg1);
};
dialog.cancelButton.tabEnabled = false;
dialog.cancelButton.addEventListener(MouseEvent.CLICK, cancel);
dialog.okButton.tabEnabled = false;
dialog.okButton.addEventListener(MouseEvent.CLICK, accept);
dialog.randomButton.tabEnabled = false;
dialog.randomButton.addEventListener(MouseEvent.CLICK, randomFunc);
dialog.defaultButton.tabEnabled = false;
dialog.defaultButton.addEventListener(MouseEvent.CLICK, defaultFunc);
dialog.tileRatio = tileRatio;
dialog.lockedRatio = lockedRatio;
dialog.emptyRatio = emptyRatio;
dialog.gapRatio = gapRatio;
dialog.tileSlider.setValue(tileRatio);
dialog.lockedSlider.setValue(lockedRatio);
dialog.emptySlider.setValue(emptyRatio);
dialog.removedSlider.setValue(gapRatio);
dialog.tileSlider.onUpdate = function (_arg1:Number){
var _local2:*;
if (tileRatio == 1){
dialog.lockedSlider.setValue((lockedRatio = ((1 - _arg1) / 3)));
dialog.emptySlider.setValue((emptyRatio = ((1 - _arg1) / 3)));
dialog.removedSlider.setValue((gapRatio = ((1 - _arg1) / 3)));
} else {
_local2 = ((1 - _arg1) / (1 - tileRatio));
dialog.lockedSlider.setValue((lockedRatio = (lockedRatio * _local2)));
dialog.emptySlider.setValue((emptyRatio = (emptyRatio * _local2)));
dialog.removedSlider.setValue((gapRatio = (gapRatio * _local2)));
};
tileRatio = _arg1;
};
dialog.lockedSlider.onUpdate = function (_arg1:Number){
var _local2:*;
if (lockedRatio == 1){
dialog.tileSlider.setValue((tileRatio = ((1 - _arg1) / 3)));
dialog.emptySlider.setValue((emptyRatio = ((1 - _arg1) / 3)));
dialog.removedSlider.setValue((gapRatio = ((1 - _arg1) / 3)));
} else {
_local2 = ((1 - _arg1) / (1 - lockedRatio));
dialog.tileSlider.setValue((tileRatio = (tileRatio * _local2)));
dialog.emptySlider.setValue((emptyRatio = (emptyRatio * _local2)));
dialog.removedSlider.setValue((gapRatio = (gapRatio * _local2)));
};
lockedRatio = _arg1;
};
dialog.emptySlider.onUpdate = function (_arg1:Number){
var _local2:*;
if (emptyRatio == 1){
dialog.tileSlider.setValue((tileRatio = ((1 - _arg1) / 3)));
dialog.lockedSlider.setValue((lockedRatio = ((1 - _arg1) / 3)));
dialog.removedSlider.setValue((gapRatio = ((1 - _arg1) / 3)));
} else {
_local2 = ((1 - _arg1) / (1 - emptyRatio));
dialog.tileSlider.setValue((tileRatio = (tileRatio * _local2)));
dialog.lockedSlider.setValue((lockedRatio = (lockedRatio * _local2)));
dialog.removedSlider.setValue((gapRatio = (gapRatio * _local2)));
};
emptyRatio = _arg1;
};
dialog.removedSlider.onUpdate = function (_arg1:Number){
var _local2:*;
if (gapRatio == 1){
dialog.tileSlider.setValue((tileRatio = ((1 - _arg1) / 3)));
dialog.lockedSlider.setValue((lockedRatio = ((1 - _arg1) / 3)));
dialog.emptySlider.setValue((emptyRatio = ((1 - _arg1) / 3)));
} else {
_local2 = ((1 - _arg1) / (1 - gapRatio));
dialog.tileSlider.setValue((tileRatio = (tileRatio * _local2)));
dialog.lockedSlider.setValue((lockedRatio = (lockedRatio * _local2)));
dialog.emptySlider.setValue((emptyRatio = (emptyRatio * _local2)));
};
gapRatio = _arg1;
};
}
public static function editorButtonsClick(_arg1:MouseEvent){
switch (_arg1.target){
case editorButtons.editButton:
setMode(EDIT_MODE);
break;
case editorButtons.testButton:
setMode(TEST_MODE);
break;
case editorButtons.mixButton:
setMode(MIX_MODE);
break;
case editorButtons.randomButton:
board.randomize();
break;
case editorButtons.solveButton:
board.solve();
break;
case editorButtons.plusButton:
board.upsize();
break;
case editorButtons.minusButton:
board.downsize();
break;
case editorButtons.helpButton:
showEditInstructions();
break;
default:
return;
};
Game.playSound("Button Click", (_arg1.target.x / Game.MIDX));
}
public static function playNextLevel(_arg1:Event=null){
var _local2:*;
if (currentLevel == (levelsClear.length - 1)){
if (mode == MENU_MODE){
currentLevel = 0;
playNextLevel();
return;
};
quit();
} else {
if (currentLevel == -2){
generateLevel(board.size);
} else {
if (currentLevel < 1){
_local2 = 1;
while (_local2 <= (levelsClear.length - 1)) {
if (!levelsClear[_local2]){
playLevel(_local2);
return;
};
_local2++;
};
if (mode != MENU_MODE){
quit();
};
} else {
if (!levelsClear[currentLevel]){
playLevel(currentLevel);
} else {
playLevel((currentLevel + 1));
};
};
};
};
}
public static function encryptLevelString(_arg1:String):String{
_arg1 = stringReplace(_arg1, " ", "");
_arg1 = stringReplace(_arg1, "0,", "a");
_arg1 = stringReplace(_arg1, "1,", "t");
_arg1 = stringReplace(_arg1, "2,", "y");
_arg1 = stringReplace(_arg1, "3,", "f");
_arg1 = stringReplace(_arg1, "4,", "r");
_arg1 = stringReplace(_arg1, "5,", "x");
_arg1 = stringReplace(_arg1, "6,", "d");
_arg1 = stringReplace(_arg1, "7,", "u");
_arg1 = stringReplace(_arg1, "8,", "i");
_arg1 = stringReplace(_arg1, "9,", "w");
_arg1 = stringReplace(_arg1, "0", "o");
_arg1 = stringReplace(_arg1, "1", "p");
_arg1 = stringReplace(_arg1, "2", "e");
_arg1 = stringReplace(_arg1, "3", "g");
_arg1 = stringReplace(_arg1, "4", "h");
_arg1 = stringReplace(_arg1, "5", "z");
_arg1 = stringReplace(_arg1, "6", "c");
_arg1 = stringReplace(_arg1, "7", "v");
_arg1 = stringReplace(_arg1, "8", "b");
_arg1 = stringReplace(_arg1, "9", "n");
_arg1 = stringReplace(_arg1, "aa", "s");
_arg1 = stringReplace(_arg1, "ta", "q");
_arg1 = stringReplace(_arg1, "ya", "l");
_arg1 = stringReplace(_arg1, "fa", "m");
_arg1 = stringReplace(_arg1, "ra", "k");
_arg1 = stringReplace(_arg1, "xa", "j");
_arg1 = stringReplace(_arg1, "at", "S");
_arg1 = stringReplace(_arg1, "tt", "Q");
_arg1 = stringReplace(_arg1, "yt", "L");
_arg1 = stringReplace(_arg1, "ft", "M");
_arg1 = stringReplace(_arg1, "rt", "K");
_arg1 = stringReplace(_arg1, "xt", "J");
return (_arg1);
}
public static function victory(){
var _local1:*;
Game.playSound("Victory");
board.stopTimer();
_local1 = 0;
while (_local1 < board.tiles.length) {
board.tiles[_local1].flash();
_local1++;
};
if (mode == PLAY_MODE){
showVictoryScreen();
if ((((currentLevel > 0)) && ((currentLevel < levelsClear.length)))){
levelsClear[currentLevel] = true;
cookie.flush();
};
};
}
public static function clocking(){
}
public static function keyPress(_arg1:KeyboardEvent){
var _local2:*;
if ((((_arg1.keyCode == 19)) && ((((mode == PLAY_MODE)) || ((mode == TEST_MODE)))))){
togglePause();
};
switch (String.fromCharCode(_arg1.charCode)){
case "s":
if (((cheatMode) && ((mode == PLAY_MODE)))){
board.solve();
};
break;
case "p":
if (mode == EDIT_MODE){
trace(board.print());
} else {
if ((((mode == PLAY_MODE)) || ((mode == TEST_MODE)))){
togglePause();
};
};
break;
case " ":
if ((((((mode == MIX_MODE)) || ((mode == TEST_MODE)))) || (((cheatMode) || ((mode == PLAY_MODE)))))){
showMix = true;
_local2 = 0;
while (_local2 < board.tiles.length) {
board.tiles[_local2].checkColor = true;
_local2++;
};
};
break;
};
}
public static function loadLevelDialog(_arg1:MouseEvent=null){
var dialog:*;
var removeClick:*;
var acceptClick:*;
var removeDialog:*;
var accept:*;
var format:TextFormat;
var e = _arg1;
dialog = new LoadDialog();
base.addChild(dialog);
dialog.stop();
removeClick = function (_arg1:MouseEvent){
removeDialog();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
acceptClick = function (_arg1:MouseEvent){
accept();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
removeDialog = function (){
dialog.input.removeEventListener(ComponentEvent.ENTER, accept);
dialog.cancelButton.removeEventListener(MouseEvent.CLICK, removeClick);
dialog.okButton.removeEventListener(MouseEvent.CLICK, acceptClick);
dialog.parent.removeChild(dialog);
};
accept = function (_arg1:Event=null){
if (dialog.input.text == ""){
removeDialog();
return;
};
if (dialog.input.text.toLowerCase() == "moonkey"){
cheatMode = true;
playSound("Cheat Mode");
titleScreen.update();
dialog.gotoAndStop(3);
dialog.input.text = "";
return;
};
if (board.buildLevel(decryptLevelString(dialog.input.text))){
if (Game.mode == MENU_MODE){
setMode(PLAY_MODE);
} else {
setMode(EDIT_MODE);
};
board.grow();
currentLevel = -1;
removeDialog();
titleScreen.hide();
bg.setColor(Background.YELLOW);
} else {
dialog.gotoAndStop(2);
};
};
format = new TextFormat();
format.font = "Myriad Web Pro";
format.size = 14;
format.color = 0xAAAAAA;
dialog.input.setStyle("textFormat", format);
dialog.input.setStyle("fontFamily", "Myriad");
dialog.input.setStyle("embedFonts", true);
dialog.input.setFocus();
dialog.input.addEventListener(ComponentEvent.ENTER, accept);
dialog.input.restrict = "1234567890abcdefghijklmnopqrstuvwxyzSQLMKJ";
dialog.contextMenu = new ContextMenu();
dialog.cancelButton.tabEnabled = false;
dialog.cancelButton.addEventListener(MouseEvent.CLICK, removeClick);
dialog.okButton.tabEnabled = false;
dialog.okButton.addEventListener(MouseEvent.CLICK, acceptClick);
}
public static function keyRelease(_arg1:KeyboardEvent){
var _local2:*;
switch (String.fromCharCode(_arg1.charCode)){
case " ":
showMix = false;
if ((((((mode == MIX_MODE)) || ((mode == TEST_MODE)))) || (((cheatMode) || ((mode == PLAY_MODE)))))){
_local2 = 0;
while (_local2 < board.tiles.length) {
board.tiles[_local2].checkColor = true;
_local2++;
};
};
break;
case "q":
if (base.stage.quality == "LOW"){
setQuality("MEDIUM");
} else {
if (base.stage.quality == "MEDIUM"){
setQuality("HIGH");
} else {
if (base.stage.quality == "HIGH"){
setQuality("BEST");
} else {
setQuality("LOW");
};
};
};
break;
};
}
public static function setMode(_arg1:uint){
mode = _arg1;
if (mode == MENU_MODE){
};
if ((((mode == PLAY_MODE)) || ((mode == MENU_MODE)))){
if (editorButtons.parent == base){
base.removeChild(editorButtons);
};
} else {
base.addChildAt(editorButtons, base.getChildIndex(soundBar));
};
editorButtons.randomButton.visible = (mode == MIX_MODE);
editorButtons.solveButton.visible = (mode == TEST_MODE);
editorButtons.plusButton.visible = (mode == EDIT_MODE);
editorButtons.minusButton.visible = (mode == EDIT_MODE);
levelDisplay.saveButton.visible = true;
levelDisplay.levelLabel.visible = false;
levelDisplay.timeLabel.visible = false;
switch (mode){
case MENU_MODE:
if (levelDisplay.parent == base){
base.removeChild(levelDisplay);
};
board.shrink();
titleScreen.update();
titleScreen.show();
break;
case PLAY_MODE:
levelDisplay.saveButton.visible = false;
levelDisplay.levelLabel.visible = true;
levelDisplay.timeLabel.visible = true;
base.addChildAt(levelDisplay, base.getChildIndex(soundBar));
board.playMode();
break;
case EDIT_MODE:
bg.setColor(Background.GREEN);
base.addChildAt(levelDisplay, base.getChildIndex(soundBar));
board.editMode();
break;
case MIX_MODE:
bg.setColor(Background.ORANGE);
base.addChildAt(levelDisplay, base.getChildIndex(soundBar));
board.mixMode();
break;
case TEST_MODE:
bg.setColor(Background.YELLOW);
base.addChildAt(levelDisplay, base.getChildIndex(soundBar));
board.testMode();
break;
};
if (currentLevel == -1){
levelDisplay.levelLabel.text = "Custom";
} else {
if (currentLevel == -2){
levelDisplay.levelLabel.text = "Random";
levelDisplay.saveButton.visible = true;
} else {
levelDisplay.levelLabel.text = ("Level " + currentLevel);
};
};
}
public static function showVictoryScreen(){
var victoryScreen:VictoryScreen;
var playClick:*;
var replayClick:*;
var menuClick:*;
var sponsorClick:*;
var hideVictory:*;
var fadeIn:*;
victoryScreen = new VictoryScreen();
playClick = function (_arg1:MouseEvent){
playNextLevel();
hideVictory();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
replayClick = function (_arg1:MouseEvent){
board.reset();
board.grow();
hideVictory();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
menuClick = function (_arg1:MouseEvent){
quit();
hideVictory();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
sponsorClick = function (_arg1:MouseEvent){
sponsorLink();
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
hideVictory = function (){
victoryScreen.nextButton.removeEventListener(MouseEvent.MOUSE_UP, playClick);
victoryScreen.replayButton.removeEventListener(MouseEvent.MOUSE_UP, replayClick);
victoryScreen.menuButton.removeEventListener(MouseEvent.MOUSE_UP, menuClick);
victoryScreen.moreGamesButton.removeEventListener(MouseEvent.MOUSE_UP, sponsorClick);
if (base.contains(victoryScreen)){
base.removeChild(victoryScreen);
};
};
victoryScreen.stop();
victoryScreen.nextButton.addEventListener(MouseEvent.MOUSE_UP, playClick);
victoryScreen.replayButton.addEventListener(MouseEvent.MOUSE_UP, replayClick);
victoryScreen.menuButton.addEventListener(MouseEvent.MOUSE_UP, menuClick);
victoryScreen.moreGamesButton.addEventListener(MouseEvent.MOUSE_UP, sponsorClick);
base.addChild(victoryScreen);
victoryScreen.ticks = 0;
victoryScreen.alpha = 0;
fadeIn = function (_arg1:Event){
victoryScreen.ticks++;
if (victoryScreen.ticks > 10){
victoryScreen.alpha = (victoryScreen.alpha + 0.1);
if (victoryScreen.alpha >= 1){
victoryScreen.alpha = 1;
victoryScreen.removeEventListener(Event.ENTER_FRAME, fadeIn);
};
};
};
victoryScreen.addEventListener(Event.ENTER_FRAME, fadeIn);
}
public static function emailLink(_arg1:Event=null){
navigateToURL(new URLRequest("mailto:moonkeyproductions@gmail.com"), "_blank");
}
public static function playSound(_arg1:String, _arg2:Number=0){
soundBar.playSound(_arg1, Math.max(-1, Math.min(1, _arg2)));
}
public static function setQuality(_arg1:String){
base.stage.quality = _arg1;
if ((((_arg1 == "LOW")) || ((_arg1 == "MEDIUM")))){
bg.lq = true;
} else {
bg.lq = false;
};
}
public static function playLevel(_arg1:int):Boolean{
if (board.loadLevel(_arg1)){
titleScreen.hide();
bg.setDifficulty((_arg1 / 40));
currentLevel = _arg1;
setMode(PLAY_MODE);
board.growth = 0;
board.grow();
return (true);
};
return (false);
}
public static function sizeDialog(_arg1:MouseEvent=null){
var dialog:*;
var removeDialog:*;
var tileClickFunc:*;
var showAdvanced:*;
var e = _arg1;
dialog = new SizeDialog();
base.addChild(dialog);
removeDialog = function (_arg1:MouseEvent){
dialog.backButton.removeEventListener(MouseEvent.CLICK, removeDialog);
dialog.tile3.removeEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile4.removeEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile5.removeEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile6.removeEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.advancedButton.removeEventListener(MouseEvent.CLICK, showAdvanced);
dialog.parent.removeChild(dialog);
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
tileClickFunc = function (_arg1:MouseEvent){
if ((!(_arg1.target) is Tile)){
return;
};
Game.generateLevel(Tile(_arg1.target).req);
removeDialog(_arg1);
};
showAdvanced = function (_arg1:MouseEvent){
advancedOptionsDialog();
};
dialog.backButton.tabEnabled = false;
dialog.backButton.addEventListener(MouseEvent.CLICK, removeDialog);
dialog.advancedButton.buttonMode = true;
dialog.advancedButton.tabEnabled = false;
dialog.advancedButton.addEventListener(MouseEvent.CLICK, showAdvanced);
dialog.tile3.req = 3;
dialog.tile3.label.text = "3";
dialog.tile3.buttonMode = true;
dialog.tile3.tabEnabled = false;
dialog.tile3.addEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile3.background.transform.colorTransform = Tile.COLOR_GREEN;
dialog.tile4.req = 4;
dialog.tile4.label.text = "4";
dialog.tile4.buttonMode = true;
dialog.tile4.tabEnabled = false;
dialog.tile4.addEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile4.background.transform.colorTransform = Tile.COLOR_BLUE;
dialog.tile5.req = 5;
dialog.tile5.label.text = "5";
dialog.tile5.buttonMode = true;
dialog.tile5.tabEnabled = false;
dialog.tile5.addEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile5.background.transform.colorTransform = Tile.COLOR_RED;
dialog.tile6.req = 6;
dialog.tile6.label.text = "6";
dialog.tile6.buttonMode = true;
dialog.tile6.tabEnabled = false;
dialog.tile6.addEventListener(MouseEvent.CLICK, tileClickFunc);
dialog.tile6.background.transform.colorTransform = Tile.COLOR_BLACK;
}
public static function saveLevelDialog(_arg1:MouseEvent=null){
var dialog:*;
var format:TextFormat;
var copyFunc:*;
var removeDialog:*;
var e = _arg1;
dialog = new SaveDialog();
base.addChild(dialog);
format = new TextFormat();
format.font = "Myriad Web Pro";
format.size = 14;
format.color = 0xAAAAAA;
dialog.input.setStyle("textFormat", format);
dialog.input.setStyle("fontFamily", "Myriad");
dialog.input.setStyle("embedFonts", true);
dialog.input.setFocus();
dialog.input.text = encryptLevelString(board.print());
dialog.input.setSelection(0, dialog.input.length);
dialog.contextMenu = new ContextMenu();
copyFunc = function (_arg1:MouseEvent){
System.setClipboard(dialog.input.text);
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
removeDialog = function (_arg1:MouseEvent){
dialog.parent.removeChild(dialog);
dialog.copyButton.removeEventListener(MouseEvent.CLICK, copyFunc);
dialog.okButton.removeEventListener(MouseEvent.CLICK, removeDialog);
Game.playSound("Button Click", ((_arg1.target.x / Game.MIDX) - 1));
};
dialog.copyButton.tabEnabled = false;
dialog.copyButton.addEventListener(MouseEvent.CLICK, copyFunc);
dialog.okButton.tabEnabled = false;
dialog.okButton.addEventListener(MouseEvent.CLICK, removeDialog);
}
public static function showInstructions(_arg1:MouseEvent=null){
var instructions:Instructions;
var boardHolder:MovieClip;
var board:Board;
var mover:*;
var removeInstructions:*;
var advance:Function;
var e = _arg1;
instructions = new Instructions();
base.addChild(instructions);
boardHolder = new MovieClip();
boardHolder.x = 200;
boardHolder.y = 150;
boardHolder.scaleX = (boardHolder.scaleY = 0.5);
instructions.addChild(boardHolder);
mode = PLAY_MODE;
board = new Board();
board.setSize(3);
boardHolder.addChild(board);
board.slots[8].insert(board.generateTile(2));
board.slots[10].insert(board.generateTile(2));
board.slots[5].insert(board.generateTile(2));
board.slots[16].insert(board.generateTile(1));
board.slots[17].insert(board.generateTile(2));
board.slots[18].insert(board.generateTile(1));
board.grow();
board.showVictoryScreen = false;
mover = board.slots[5].tile;
instructions.setChildIndex(instructions.arrow, (instructions.numChildren - 1));
instructions.arrow.stop();
removeInstructions = function (_arg1:MouseEvent){
var e = _arg1;
if ((e.target is Instructions)){
mode = EDIT_MODE;
board.removeEventListener(Event.ENTER_FRAME, function (_arg1:Event){
board.update();
});
board.stopTimer();
instructions.removeEventListener(Event.ENTER_FRAME, advance);
instructions.removeEventListener(MouseEvent.CLICK, removeInstructions);
if (instructions.parent != null){
instructions.parent.removeChild(instructions);
};
};
};
advance = function (_arg1:Event){
var _local2:*;
var _local3:*;
instructions.frame++;
board.update();
if (instructions.frame <= 10){
instructions.alpha = (instructions.frame / 10);
} else {
if (instructions.frame == 50){
instructions.arrow.play();
} else {
if ((((instructions.frame >= 120)) && ((instructions.frame < 150)))){
_local2 = ((instructions.frame - 120) / 30);
mover.x = (mover.slot.x + ((board.slots[2].x - mover.slot.x) * _local2));
mover.y = (mover.slot.y + ((board.slots[2].y - mover.slot.y) * _local2));
} else {
if (instructions.frame == 150){
mover.slot.tile = null;
board.slots[2].insert(mover);
} else {
if (instructions.frame == 200){
mover.slot.tile = null;
board.slots[5].insert(mover);
_local3 = 0;
while (_local3 < 20) {
board.update();
_local3++;
};
instructions.frame = 11;
};
};
};
};
};
};
instructions.alpha = 0;
instructions.frame = 0;
instructions.addEventListener(MouseEvent.CLICK, removeInstructions);
instructions.addEventListener(Event.ENTER_FRAME, advance);
instructions.mouseChildren = false;
}
public static function musicLink(_arg1:Event=null){
var _local2:Boolean;
_local2 = ExternalInterface.call("window.open", "http://rigaudio.newgrounds.com", "_blank", "");
if (!_local2){
navigateToURL(new URLRequest("http://rigaudio.newgrounds.com"), "_blank");
};
}
public static function playMusic(_arg1:String){
soundBar.playMusic(_arg1);
}
public static function showCredits(_arg1:MouseEvent=null){
var credits:Credits;
var appear:Function;
var removeCredits:*;
var e = _arg1;
credits = new Credits();
base.addChild(credits);
appear = function (_arg1:Event){
credits.alpha = (credits.alpha + 0.15);
if (credits.alpha > 0.9){
credits.alpha = 1;
credits.removeEventListener(Event.ENTER_FRAME, appear);
};
};
credits.alpha = 0;
credits.addEventListener(Event.ENTER_FRAME, appear);
removeCredits = function (_arg1:Event){
credits.removeEventListener(MouseEvent.CLICK, removeCredits);
credits.createdByButton.removeEventListener(MouseEvent.CLICK, emailLink);
credits.musicByButton.removeEventListener(MouseEvent.CLICK, musicLink);
credits.sponsoredByButton.removeEventListener(MouseEvent.CLICK, sponsorLink);
if (credits.parent != null){
credits.parent.removeChild(credits);
};
};
credits.addEventListener(MouseEvent.CLICK, removeCredits);
credits.createdByButton.addEventListener(MouseEvent.CLICK, emailLink);
credits.createdByButton.tabEnabled = false;
credits.musicByButton.addEventListener(MouseEvent.CLICK, musicLink);
credits.musicByButton.tabEnabled = false;
credits.sponsoredByButton.addEventListener(MouseEvent.CLICK, sponsorLink);
credits.sponsoredByButton.buttonMode = true;
credits.sponsoredByButton.tabEnabled = false;
}
public static function quit(){
setMode(MENU_MODE);
}
public static function sponsorLink(_arg1:Event=null){
var _local2:Boolean;
_local2 = ExternalInterface.call("window.open", "http://www.turbogames.com", "_blank", "");
if (!_local2){
navigateToURL(new URLRequest("http://www.turbogames.com"), "_blank");
};
}
public static function stringReplace(_arg1:String, _arg2:String, _arg3:String):String{
var _local4:*;
_local4 = 0;
while ((_local4 = _arg1.indexOf(_arg2)) > -1) {
_arg1 = ((_arg1.substr(0, _local4) + _arg3) + _arg1.substr((_local4 + _arg2.length)));
};
return (_arg1);
}
public static function createLevel(){
titleScreen.hide();
bg.setColor(Background.GREEN);
board.setSize(4);
currentLevel = -1;
setMode(EDIT_MODE);
board.grow();
if (!editorOpened){
showEditInstructions();
};
}
public static function decryptLevelString(_arg1:String):String{
_arg1 = stringReplace(_arg1, " ", "");
_arg1 = stringReplace(_arg1, "J", "xt");
_arg1 = stringReplace(_arg1, "K", "rt");
_arg1 = stringReplace(_arg1, "M", "ft");
_arg1 = stringReplace(_arg1, "L", "yt");
_arg1 = stringReplace(_arg1, "Q", "tt");
_arg1 = stringReplace(_arg1, "S", "at");
_arg1 = stringReplace(_arg1, "j", "xa");
_arg1 = stringReplace(_arg1, "k", "ra");
_arg1 = stringReplace(_arg1, "m", "fa");
_arg1 = stringReplace(_arg1, "l", "ya");
_arg1 = stringReplace(_arg1, "q", "ta");
_arg1 = stringReplace(_arg1, "s", "aa");
_arg1 = stringReplace(_arg1, "n", "9");
_arg1 = stringReplace(_arg1, "b", "8");
_arg1 = stringReplace(_arg1, "v", "7");
_arg1 = stringReplace(_arg1, "c", "6");
_arg1 = stringReplace(_arg1, "z", "5");
_arg1 = stringReplace(_arg1, "h", "4");
_arg1 = stringReplace(_arg1, "g", "3");
_arg1 = stringReplace(_arg1, "e", "2");
_arg1 = stringReplace(_arg1, "p", "1");
_arg1 = stringReplace(_arg1, "o", "0");
_arg1 = stringReplace(_arg1, "w", "9,");
_arg1 = stringReplace(_arg1, "i", "8,");
_arg1 = stringReplace(_arg1, "u", "7,");
_arg1 = stringReplace(_arg1, "d", "6,");
_arg1 = stringReplace(_arg1, "x", "5,");
_arg1 = stringReplace(_arg1, "r", "4,");
_arg1 = stringReplace(_arg1, "f", "3,");
_arg1 = stringReplace(_arg1, "y", "2,");
_arg1 = stringReplace(_arg1, "t", "1,");
_arg1 = stringReplace(_arg1, "a", "0,");
return (_arg1);
}
public static function showEditInstructions(_arg1:MouseEvent=null){
var ei:EditInstructions;
var appear:Function;
var removeEI:*;
var e = _arg1;
ei = new EditInstructions();
base.addChild(ei);
appear = function (_arg1:Event){
ei.alpha = (ei.alpha + 0.15);
if (ei.alpha > 0.9){
ei.alpha = 1;
ei.removeEventListener(Event.ENTER_FRAME, appear);
};
};
ei.alpha = 0;
ei.addEventListener(Event.ENTER_FRAME, appear);
removeEI = function (_arg1:Event){
ei.removeEventListener(MouseEvent.CLICK, removeEI);
if (ei.parent != null){
ei.parent.removeChild(ei);
};
};
ei.addEventListener(MouseEvent.CLICK, removeEI);
editorOpened = true;
}
public static function enterFrame(_arg1:Event){
bg.update();
board.update();
}
public static function pause(_arg1:Event=null){
base.addChildAt(pauseScreen, base.getChildIndex(soundBar));
paused = true;
}
}
}//package
Section 43
//Grow (Grow)
package {
import flash.media.*;
public dynamic class Grow extends Sound {
}
}//package
Section 44
//GunCharge (GunCharge)
package {
import flash.media.*;
public dynamic class GunCharge extends Sound {
}
}//package
Section 45
//GunClick (GunClick)
package {
import flash.media.*;
public dynamic class GunClick extends Sound {
}
}//package
Section 46
//GunFire (GunFire)
package {
import flash.media.*;
public dynamic class GunFire extends Sound {
}
}//package
Section 47
//HexButton (HexButton)
package {
import flash.display.*;
import flash.events.*;
public class HexButton extends MovieClip {
public function HexButton(){
stop();
this.buttonMode = true;
this.useHandCursor = true;
this.tabEnabled = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, down);
this.addEventListener(MouseEvent.MOUSE_UP, up);
this.addEventListener(MouseEvent.MOUSE_OUT, up);
this.addEventListener(MouseEvent.MOUSE_OVER, over);
}
public function set text(_arg1:String){
var _local2:*;
_local2 = this["label"];
if (_local2 != null){
_local2.text = _arg1;
_local2.cacheAsBitmap = true;
_local2.mouseEnabled = false;
};
}
public function down(_arg1:MouseEvent){
gotoAndStop("Down");
}
public function up(_arg1:MouseEvent){
gotoAndStop("Up");
}
public function over(_arg1:MouseEvent){
gotoAndStop("Over");
}
}
}//package
Section 48
//Instructions (Instructions)
package {
import flash.display.*;
public dynamic class Instructions extends MovieClip {
public var arrow:MovieClip;
}
}//package
Section 49
//LevelDisplay (LevelDisplay)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelDisplay extends MovieClip {
public var saveButton:SimpleButton;
public var timeLabel:TextField;
public var resetButton:SimpleButton;
public var levelLabel:TextField;
public var backButton:SimpleButton;
}
}//package
Section 50
//Liquidism (Liquidism)
package {
import flash.text.*;
public dynamic class Liquidism extends Font {
}
}//package
Section 51
//LoadDialog (LoadDialog)
package {
import fl.controls.*;
import flash.display.*;
public dynamic class LoadDialog extends MovieClip {
public var okButton:WideButton;
public var cancelButton:WideButton;
public var input:TextInput;
public function LoadDialog(){
__setProp_okButton_LoadDialog_Buttons_1();
__setProp_cancelButton_LoadDialog_Buttons_1();
}
function __setProp_cancelButton_LoadDialog_Buttons_1(){
try {
cancelButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cancelButton.text = "Cancel";
try {
cancelButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_okButton_LoadDialog_Buttons_1(){
try {
okButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
okButton.text = "OK";
try {
okButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 52
//Lock (Lock)
package {
import flash.media.*;
public dynamic class Lock extends Sound {
}
}//package
Section 53
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 54
//PauseScreen (PauseScreen)
package {
import flash.display.*;
public dynamic class PauseScreen extends MovieClip {
}
}//package
Section 55
//SaveDialog (SaveDialog)
package {
import fl.controls.*;
import flash.display.*;
public dynamic class SaveDialog extends MovieClip {
public var copyButton:WideButton;
public var okButton:WideButton;
public var input:TextInput;
public function SaveDialog(){
__setProp_okButton_SaveDialog_Buttons_1();
__setProp_input_SaveDialog_TextField_1();
__setProp_copyButton_SaveDialog_Buttons_1();
}
function __setProp_okButton_SaveDialog_Buttons_1(){
try {
okButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
okButton.text = "OK";
try {
okButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_input_SaveDialog_TextField_1(){
try {
input["componentInspectorSetting"] = true;
} catch(e:Error) {
};
input.displayAsPassword = false;
input.editable = false;
input.enabled = true;
input.maxChars = 0;
input.restrict = "";
input.text = "";
input.visible = true;
try {
input["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_copyButton_SaveDialog_Buttons_1(){
try {
copyButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
copyButton.text = "Copy";
try {
copyButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 56
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 57
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 58
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 59
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 60
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 61
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 62
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 63
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 64
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 65
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 66
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 67
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 68
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 69
//Shrink (Shrink)
package {
import flash.media.*;
public dynamic class Shrink extends Sound {
}
}//package
Section 70
//SizeDialog (SizeDialog)
package {
import flash.display.*;
public dynamic class SizeDialog extends MovieClip {
public var advancedButton:WideButton;
public var tile3:Tile;
public var tile6:Tile;
public var tile5:Tile;
public var tile4:Tile;
public var backButton:SimpleButton;
public function SizeDialog(){
__setProp_advancedButton_SizeDialog_Buttons_1();
}
function __setProp_advancedButton_SizeDialog_Buttons_1(){
try {
advancedButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
advancedButton.text = "Advanced";
try {
advancedButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 71
//Slot (Slot)
package {
import flash.display.*;
import flash.events.*;
public class Slot extends MovieClip {
public var removed:Boolean;// = false
public var tile:Tile;
public var index:int;
public var board:Board;// = null
public var neighbours:Array;
public function Slot(_arg1:Board=null, _arg2:int=0){
removed = false;
board = null;
super();
this.board = _arg1;
this.index = _arg2;
tile = null;
neighbours = new Array();
this.cacheAsBitmap = true;
}
function updateAdjacentTiles(){
var _local1:*;
_local1 = 0;
while (_local1 < neighbours.length) {
if (neighbours[_local1].tile != null){
neighbours[_local1].tile.checkColor = true;
};
_local1++;
};
}
function edit(_arg1:MouseEvent){
if (((_arg1.ctrlKey) || (_arg1.shiftKey))){
Game.playSound("Edit Slot", x);
if (removed){
removed = false;
alpha = 1;
} else {
removed = true;
alpha = 0.01;
};
} else {
Game.playSound("Edit Tile", x);
tile.visible = true;
removed = false;
alpha = 1;
};
board.editUpdate();
}
function setMode(_arg1:uint){
this.removeEventListener(MouseEvent.MOUSE_DOWN, edit);
switch (_arg1){
case Game.EDIT_MODE:
this.addEventListener(MouseEvent.MOUSE_DOWN, edit);
break;
};
}
function isAdjacentTo(_arg1:Slot):Boolean{
var _local2:*;
if (_arg1 == null){
return (false);
};
_local2 = 0;
while (_local2 < neighbours.length) {
if (neighbours[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
function insert(_arg1:Tile){
if (_arg1.slot != null){
_arg1.slot.tile = null;
};
this.tile = _arg1;
_arg1.slot = this;
if (_arg1.oldSlot != null){
_arg1.oldSlot.updateAdjacentTiles();
};
updateAdjacentTiles();
_arg1.oldSlot = this;
if (Game.mode == Game.MIX_MODE){
_arg1.startSlot = this;
};
_arg1.x = x;
_arg1.y = y;
_arg1.checkColor = true;
_arg1.flash();
}
function adjacentCount():int{
var _local1:int;
var _local2:*;
_local1 = 0;
_local2 = 0;
while (_local2 < neighbours.length) {
if (neighbours[_local2].tile != null){
_local1++;
};
_local2++;
};
return (_local1);
}
}
}//package
Section 72
//SoundBar (SoundBar)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class SoundBar extends MovieClip {
public var musicOffButton:SimpleButton;
public var soundOffButton:SimpleButton;
public var musicOnButton:SimpleButton;
public var soundOnButton:SimpleButton;
public var RESET_LEVEL_SOUND:Sound;
public var CHEAT_MODE_SOUND:Sound;
public var musicSlider:VolumeControl;
public var DROP_PLUS_SOUND:Sound;
public var VICTORY_SOUND:Sound;
public var RETURN_SOUND:Sound;
public var PICKUP_SOUND:Sound;
public var DROP_SOUND:Sound;
public var REMOVE_SOUND:Sound;
public var ENTER_LEVEL_SOUND:Sound;
public var EXIT_LEVEL_SOUND:Sound;
public var BUTTON_CLICK_SOUND:Sound;
public var soundSlider:VolumeControl;
public var LOCK_SOUND:Sound;
public var DROP_MINUS_SOUND:Sound;
public static const SOUND_MULTIPLIER = 1.25;
public static var soundMuted:Boolean = false;
public static var music:Sound = null;
public static var musicMuted:Boolean = false;
public static var soundVolume:Number = 1;
public static var currentSong:String = null;
public static var musicChannel:SoundChannel = null;
public static var musicVolume:Number = 1;
public function SoundBar(){
PICKUP_SOUND = new Click();
DROP_MINUS_SOUND = (DROP_PLUS_SOUND = (DROP_SOUND = new Drop()));
RETURN_SOUND = new Babow();
REMOVE_SOUND = new Drop();
LOCK_SOUND = new Lock();
ENTER_LEVEL_SOUND = new Grow();
EXIT_LEVEL_SOUND = new Shrink();
RESET_LEVEL_SOUND = new TooMany();
VICTORY_SOUND = new TooMany();
CHEAT_MODE_SOUND = new CheatMode();
BUTTON_CLICK_SOUND = new ButtonClick();
soundOnButton.addEventListener(MouseEvent.CLICK, toggleSound);
soundOffButton.addEventListener(MouseEvent.CLICK, toggleSound);
musicOnButton.addEventListener(MouseEvent.CLICK, toggleMusic);
musicOffButton.addEventListener(MouseEvent.CLICK, toggleMusic);
soundOnButton.tabEnabled = false;
soundOffButton.tabEnabled = false;
musicOnButton.tabEnabled = false;
musicOffButton.tabEnabled = false;
soundSlider.tabEnabled = false;
musicSlider.tabEnabled = false;
soundOnButton.visible = false;
musicOnButton.visible = false;
soundSlider.callback = setSoundVolume;
musicSlider.callback = setMusicVolume;
soundSlider.slider.x = 80;
musicSlider.slider.x = 80;
setSoundVolume((0.8 * SOUND_MULTIPLIER));
setMusicVolume((0.8 * SOUND_MULTIPLIER));
}
public function toggleSound(_arg1:MouseEvent=null){
soundMuted = !(soundMuted);
soundSlider.slider.visible = !(soundMuted);
if (!soundMuted){
soundOffButton.visible = true;
soundOnButton.visible = false;
} else {
soundOffButton.visible = false;
soundOnButton.visible = true;
};
Game.playSound("Button Click", (_arg1.target.x / Game.MIDX));
}
public function setMusicVolume(_arg1:Number=-1){
if (_arg1 == -1){
return;
};
musicVolume = _arg1;
if (musicChannel != null){
musicChannel.soundTransform = new SoundTransform((musicVolume * SOUND_MULTIPLIER), 0);
};
if (musicMuted){
toggleMusic();
};
}
public function toggleMusic(_arg1:MouseEvent=null){
musicMuted = !(musicMuted);
musicSlider.slider.visible = !(musicMuted);
if (!musicMuted){
musicOffButton.visible = true;
musicOnButton.visible = false;
playMusic(currentSong);
} else {
musicOffButton.visible = false;
musicOnButton.visible = true;
if (musicChannel != null){
musicChannel.stop();
};
};
Game.playSound("Button Click", (_arg1.target.x / Game.MIDX));
}
public function playSound(_arg1:String, _arg2:Number=0){
var _local3:SoundChannel;
if (soundMuted){
return;
};
_local3 = null;
switch (_arg1){
case "Pickup":
_local3 = PICKUP_SOUND.play();
break;
case "Drop":
_local3 = DROP_SOUND.play();
break;
case "Drop+":
_local3 = DROP_PLUS_SOUND.play();
break;
case "Drop-":
_local3 = DROP_MINUS_SOUND.play();
break;
case "Return":
_local3 = RETURN_SOUND.play();
break;
case "Edit Slot":
_local3 = REMOVE_SOUND.play();
break;
case "Edit Tile":
_local3 = PICKUP_SOUND.play();
break;
case "Lock":
_local3 = LOCK_SOUND.play();
break;
case "Enter Level":
_local3 = ENTER_LEVEL_SOUND.play();
break;
case "Exit Level":
_local3 = EXIT_LEVEL_SOUND.play();
break;
case "Reset":
_local3 = RESET_LEVEL_SOUND.play();
break;
case "Victory":
_local3 = VICTORY_SOUND.play();
break;
case "Cheat Mode":
_local3 = CHEAT_MODE_SOUND.play();
break;
case "Button Click":
_local3 = BUTTON_CLICK_SOUND.play();
break;
};
_local3.soundTransform = new SoundTransform((soundVolume * SOUND_MULTIPLIER), _arg2);
}
public function playMusic(_arg1:String){
if ((((_arg1 == null)) || ((_arg1 == "")))){
return;
};
currentSong = _arg1;
switch (_arg1){
case "Music":
music = new Music();
musicChannel = music.play(0, 9999999999999, new SoundTransform((musicVolume * SOUND_MULTIPLIER), 0));
break;
};
}
public function setSoundVolume(_arg1:Number=-1){
if (_arg1 == -1){
return;
};
soundVolume = _arg1;
if (soundMuted){
toggleSound();
};
}
}
}//package
Section 73
//SquareButton (SquareButton)
package {
public dynamic class SquareButton extends HexButton {
}
}//package
Section 74
//StarField (StarField)
package {
import flash.display.*;
public dynamic class StarField extends MovieClip {
}
}//package
Section 75
//SwooshSound (SwooshSound)
package {
import flash.media.*;
public dynamic class SwooshSound extends Sound {
}
}//package
Section 76
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 77
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 78
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 79
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 80
//Tile (Tile)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
public class Tile extends MovieClip {
var slot:Slot;
var solutionSlot:Slot;
var locked:Boolean;
public var label:TextField;
public var background:Sprite;
var checkColor:Boolean;// = false
var color:ColorTransform;
var unflashTime:int;// = 0
var dragging:Boolean;// = false
var oldColor:ColorTransform;
var startSlot:Slot;
var dragY:Number;
var dragX:Number;
var oldSlot:Slot;
var req:int;
var flashTime:int;// = 0
var board:Board;// = null
var flashing:Boolean;// = false
public static var COLOR_BLACK:ColorTransform = new ColorTransform();
static var UNFLASH_TIME = 4;
public static var COLOR_GREEN:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 150, 0);
public static var COLOR_YELLOW:ColorTransform = new ColorTransform(1, 1, 1, 1, 200, 160, 0);
public static var COLOR_RED:ColorTransform = new ColorTransform(1, 1, 1, 1, 200, 0, 0);
public static var COLOR_BLUE:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 200);
static var FLASH_TIME = 6;
public function Tile(_arg1:Board=null, _arg2:int=1){
board = null;
dragging = false;
checkColor = false;
color = COLOR_BLUE;
oldColor = COLOR_BLUE;
flashing = false;
flashTime = 0;
unflashTime = 0;
super();
addFrameScript(0, frame1);
this.cacheAsBitmap = true;
this.hitArea = this.background;
background.mouseEnabled = false;
this.label.mouseEnabled = false;
slot = null;
oldSlot = null;
solutionSlot = null;
startSlot = null;
locked = false;
this.board = _arg1;
this.req = _arg2;
this.label.text = ("" + _arg2);
stop();
}
function flash(){
flashing = true;
flashTime = FLASH_TIME;
unflashTime = UNFLASH_TIME;
}
function updateColor(){
var _local1:*;
var _local2:*;
var _local3:*;
if (Game.mode == Game.EDIT_MODE){
background.transform.colorTransform = (oldColor = (color = COLOR_YELLOW));
return;
};
if (dragging){
_local1 = dropSlot();
if (_local1 == null){
background.transform.colorTransform = COLOR_BLUE;
} else {
if (((!((_local1.tile == null))) && (_local1.tile.locked))){
background.transform.colorTransform = COLOR_BLUE;
} else {
_local2 = _local1.adjacentCount();
if (((!((_local1.tile == null))) && (_local1.isAdjacentTo(oldSlot)))){
_local2++;
};
background.transform.colorTransform = countColor(_local2);
};
};
} else {
_local3 = COLOR_BLUE;
if (slot != null){
_local3 = countColor(slot.adjacentCount());
};
if (_local3 != color){
color = _local3;
oldColor = background.transform.colorTransform;
if (Game.showMix){
background.transform.colorTransform = color;
} else {
flash();
};
};
};
}
function setMode(_arg1:uint){
this.removeEventListener(MouseEvent.MOUSE_DOWN, edit);
this.removeEventListener(MouseEvent.MOUSE_DOWN, pickup);
this.removeEventListener(MouseEvent.MOUSE_MOVE, showSolution);
this.removeEventListener(MouseEvent.MOUSE_OVER, showSolution);
this.removeEventListener(MouseEvent.MOUSE_OUT, clearSolution);
switch (_arg1){
case Game.PLAY_MODE:
this.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
break;
case Game.EDIT_MODE:
this.addEventListener(MouseEvent.MOUSE_DOWN, edit);
break;
case Game.MIX_MODE:
case Game.TEST_MODE:
this.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
this.addEventListener(MouseEvent.MOUSE_MOVE, showSolution);
this.addEventListener(MouseEvent.MOUSE_OVER, showSolution);
this.addEventListener(MouseEvent.MOUSE_OUT, clearSolution);
break;
};
}
function lock(){
if (locked){
return;
};
locked = true;
gotoAndStop("Locked");
this.removeEventListener(MouseEvent.MOUSE_DOWN, pickup);
}
function edit(_arg1:MouseEvent=null){
var _local2:*;
var _local3:*;
if (((_arg1.ctrlKey) || (_arg1.shiftKey))){
playSound("Lock");
if (locked){
unlock();
} else {
lock();
if (startSlot != solutionSlot){
_local2 = 0;
while (_local2 < board.tiles.length) {
_local3 = board.tiles[_local2];
if (_local3.startSlot == this.solutionSlot){
_local3.startSlot = this.startSlot;
this.startSlot = this.solutionSlot;
break;
};
_local2++;
};
};
};
} else {
playSound("Edit Tile");
visible = false;
};
board.editUpdate();
}
function dragUpdate(_arg1:MouseEvent){
x = board.mouseX;
y = board.mouseY;
updateColor();
}
function unlock(){
if (!locked){
return;
};
locked = false;
gotoAndStop("Unlocked");
if (Game.mode != Game.EDIT_MODE){
this.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
};
}
function playSound(_arg1:String){
Game.playSound(_arg1, (x / (board.background.width / 2)));
}
function pickup(_arg1:MouseEvent=null){
if (board.dragTile != null){
return;
};
if (((!((_arg1 == null))) && (_arg1.shiftKey))){
playSound("Return");
returnToOldSlot();
return;
};
playSound("Pickup");
dragX = x;
dragY = y;
dragging = true;
x = board.mouseX;
y = board.mouseY;
stage.addEventListener(MouseEvent.MOUSE_MOVE, this.dragUpdate);
stage.addEventListener(MouseEvent.MOUSE_UP, this.drop);
bringToFront();
board.dragTile = this;
oldSlot = slot;
if (slot != null){
slot.tile = null;
slot = null;
};
dragUpdate(_arg1);
}
function frame1(){
stop();
}
function showSolution(_arg1:MouseEvent=null){
board.removeChild(this);
board.addChild(this);
graphics.clear();
if (_arg1.shiftKey){
graphics.lineStyle(2, 0xFF0000, 0.4);
graphics.moveTo(0, 0);
graphics.lineTo(((solutionSlot.x - x) / scaleX), ((solutionSlot.y - y) / scaleY));
};
}
function returnToOldSlot(){
if ((((oldSlot == null)) || (!((oldSlot.tile == null))))){
return;
};
oldSlot.insert(this);
}
function bringToFront(){
board.removeChild(this);
board.addChild(this);
}
function dropSlot():Slot{
var _local1:*;
var _local2:*;
_local1 = stage.getObjectsUnderPoint(localToGlobal(new Point(0, 0)));
_local2 = 0;
while (_local2 < _local1.length) {
if ((((_local1[_local2].parent is Slot)) && (board.contains(_local1[_local2])))){
return (_local1[_local2].parent);
};
_local2++;
};
return (null);
}
function countColor(_arg1:int):ColorTransform{
var _local2:*;
var _local3:*;
if (Game.showMix){
_local2 = 0;
while (_local2 < board.tiles.length) {
_local3 = board.tiles[_local2];
if (_local3.solutionSlot == this.slot){
if (_local3.req == this.req){
return (COLOR_YELLOW);
};
return (COLOR_BLUE);
};
_local2++;
};
return (COLOR_BLUE);
//unresolved jump
};
if (_arg1 < req){
return (COLOR_GREEN);
};
if (_arg1 > req){
return (COLOR_RED);
};
return (COLOR_YELLOW);
}
function update(){
var _local1:Number;
var _local2:ColorTransform;
if (checkColor){
updateColor();
};
checkColor = false;
if (flashing){
_local2 = new ColorTransform();
if (flashTime > 0){
_local1 = (flashTime / FLASH_TIME);
_local2.redOffset = (0xFF - ((0xFF - oldColor.redOffset) * _local1));
_local2.greenOffset = (0xFF - ((0xFF - oldColor.greenOffset) * _local1));
_local2.blueOffset = (0xFF - ((0xFF - oldColor.blueOffset) * _local1));
background.transform.colorTransform = _local2;
flashTime--;
} else {
if (unflashTime > 0){
_local1 = (unflashTime / UNFLASH_TIME);
_local2.redOffset = (color.redOffset + ((0xFF - color.redOffset) * _local1));
_local2.greenOffset = (color.greenOffset + ((0xFF - color.greenOffset) * _local1));
_local2.blueOffset = (color.blueOffset + ((0xFF - color.blueOffset) * _local1));
background.transform.colorTransform = _local2;
unflashTime--;
} else {
oldColor = color;
background.transform.colorTransform = color;
flashing = false;
};
};
};
if (dragging){
alpha = 0.7;
} else {
alpha = 1;
};
}
function clearSolution(_arg1:MouseEvent=null){
graphics.clear();
}
function drop(_arg1:MouseEvent=null){
var _local2:*;
var _local3:*;
var _local4:*;
dragging = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.dragUpdate);
stage.removeEventListener(MouseEvent.MOUSE_UP, this.drop);
checkColor = true;
_local2 = dropSlot();
if (_local2 == null){
playSound("Return");
returnToOldSlot();
} else {
if (_local2.tile == null){
_local2.insert(this);
_local3 = _local2.adjacentCount();
if (_local3 > req){
playSound("Drop+");
} else {
if (_local3 < req){
playSound("Drop-");
} else {
playSound("Drop");
};
};
} else {
if (_local2.tile.locked){
playSound("Return");
returnToOldSlot();
} else {
_local4 = _local2.tile;
_local2.tile = null;
oldSlot.insert(_local4);
_local2.insert(this);
_local3 = _local2.adjacentCount();
if (_local3 > req){
playSound("Drop+");
} else {
if (_local3 < req){
playSound("Drop-");
} else {
playSound("Drop");
};
};
};
};
};
board.dragTile = null;
board.checkVictory();
}
}
}//package
Section 81
//TitleScreen (TitleScreen)
package {
import flash.display.*;
import flash.events.*;
public class TitleScreen extends MovieClip {
public var editButton:SimpleButton;
public var instructionsButton:HexButton;
private var levelButtons:Array;
public var title:MovieClip;
public var creditsButton:HexButton;
public var playButton:HexButton;
public var moreGamesButton:HexButton;
public var loadButton:SimpleButton;
public var randomButton:SimpleButton;
public function TitleScreen(){
var _local1:int;
var _local2:Tile;
super();
playButton.addEventListener(MouseEvent.CLICK, buttonClick);
instructionsButton.addEventListener(MouseEvent.CLICK, buttonClick);
creditsButton.addEventListener(MouseEvent.CLICK, buttonClick);
moreGamesButton.addEventListener(MouseEvent.CLICK, buttonClick);
editButton.addEventListener(MouseEvent.CLICK, buttonClick);
editButton.tabEnabled = false;
loadButton.addEventListener(MouseEvent.CLICK, buttonClick);
loadButton.tabEnabled = false;
randomButton.addEventListener(MouseEvent.CLICK, buttonClick);
randomButton.tabEnabled = false;
levelButtons = new Array();
_local1 = 1;
while (_local1 <= 40) {
_local2 = new Tile(null, _local1);
levelButtons.push(_local2);
_local2.y = (5 + (25 * int(((_local1 - 1) / 10))));
_local2.x = (-137 + (25 * (((_local1 - 1) % 10) + 1)));
_local2.scaleX = (_local2.scaleY = 0.75);
addChild(_local2);
_local1++;
};
update();
__setProp_creditsButton_TitleScreen_Buttons_1();
__setProp_instructionsButton_TitleScreen_Buttons_1();
__setProp_playButton_TitleScreen_Buttons_1();
__setProp_moreGamesButton_TitleScreen_Buttons_1();
}
function __setProp_instructionsButton_TitleScreen_Buttons_1(){
try {
instructionsButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
instructionsButton.text = "Instructions";
try {
instructionsButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_playButton_TitleScreen_Buttons_1(){
try {
playButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
playButton.text = "Play";
try {
playButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function fadeOut(_arg1:Event){
alpha = (alpha - 0.15);
if (alpha < 0.1){
removeEventListener(Event.ENTER_FRAME, fadeOut);
if (parent != null){
parent.removeChild(this);
};
};
}
function __setProp_creditsButton_TitleScreen_Buttons_1(){
try {
creditsButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
creditsButton.text = "Credits";
try {
creditsButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function buttonClick(_arg1:MouseEvent){
switch (_arg1.target){
case playButton:
Game.playNextLevel();
break;
case instructionsButton:
Game.showInstructions();
break;
case creditsButton:
Game.showCredits();
break;
case moreGamesButton:
Game.sponsorLink();
break;
case editButton:
Game.createLevel();
break;
case loadButton:
Game.loadLevelDialog();
break;
case randomButton:
Game.sizeDialog();
break;
default:
return;
};
Game.playSound("Button Click", (_arg1.target.x / Game.MIDX));
}
function __setProp_moreGamesButton_TitleScreen_Buttons_1(){
try {
moreGamesButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
moreGamesButton.text = "More Games";
try {
moreGamesButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function hide(){
alpha = 1;
scaleX = 1;
scaleY = 1;
addEventListener(Event.ENTER_FRAME, fadeOut);
removeEventListener(Event.ENTER_FRAME, fadeIn);
}
function playLevel(_arg1:MouseEvent){
if (!(_arg1.target is Tile)){
return;
};
if (Game.playLevel(Tile(_arg1.target).req)){
Game.playSound("Button Click", ((Tile(_arg1.target).x - Game.MIDX) / Game.MIDX));
};
}
function fadeIn(_arg1:Event){
alpha = (alpha + 0.15);
if (alpha > 0.9){
alpha = 1;
removeEventListener(Event.ENTER_FRAME, fadeIn);
};
}
function update(){
var _local1:int;
var _local2:*;
var _local3:int;
var _local4:*;
_local1 = 0;
_local2 = 0;
while (_local2 < Game.levelsClear.length) {
if (Game.levelsClear[_local2]){
_local1++;
};
_local2++;
};
if (_local1 == (Game.levelsClear.length - 1)){
Game.clocking();
};
_local3 = (15 + (_local1 * 0.75));
_local2 = 0;
while (_local2 < levelButtons.length) {
_local4 = levelButtons[_local2];
_local4.background.transform.colorTransform = Tile.COLOR_BLACK;
if (((((((Game.cheatMode) || ((_local4.req <= _local3)))) || (Game.levelsClear[_local4.req]))) || (Game.levelsClear[(_local4.req - 1)]))){
_local4.addEventListener(MouseEvent.MOUSE_UP, playLevel);
_local4.tabEnabled = false;
_local4.buttonMode = true;
if (Game.levelsClear[_local4.req]){
_local4.background.transform.colorTransform = Tile.COLOR_YELLOW;
} else {
_local4.background.transform.colorTransform = Tile.COLOR_GREEN;
};
};
_local2++;
};
}
function show(){
alpha = 0;
scaleX = 1;
scaleY = 1;
Game.base.addChildAt(this, Game.base.getChildIndex(Game.soundBar));
addEventListener(Event.ENTER_FRAME, fadeIn);
removeEventListener(Event.ENTER_FRAME, fadeOut);
title.play();
}
}
}//package
Section 82
//TooMany (TooMany)
package {
import flash.media.*;
public dynamic class TooMany extends Sound {
}
}//package
Section 83
//VictoryScreen (VictoryScreen)
package {
import flash.display.*;
public dynamic class VictoryScreen extends MovieClip {
public var nextButton:WideButton;
public var menuButton:WideButton;
public var moreGamesButton:WideButton;
public var replayButton:WideButton;
public function VictoryScreen(){
__setProp_replayButton_VictoryScreen_Buttons_1();
__setProp_menuButton_VictoryScreen_Buttons_1();
__setProp_nextButton_VictoryScreen_Buttons_1();
__setProp_moreGamesButton_VictoryScreen_Buttons_1();
}
function __setProp_nextButton_VictoryScreen_Buttons_1(){
try {
nextButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
nextButton.text = "Next Level";
try {
nextButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_moreGamesButton_VictoryScreen_Buttons_1(){
try {
moreGamesButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
moreGamesButton.text = "More Games";
try {
moreGamesButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_replayButton_VictoryScreen_Buttons_1(){
try {
replayButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
replayButton.text = "Replay";
try {
replayButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_menuButton_VictoryScreen_Buttons_1(){
try {
menuButton["componentInspectorSetting"] = true;
} catch(e:Error) {
};
menuButton.text = "Menu";
try {
menuButton["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 84
//WideButton (WideButton)
package {
public dynamic class WideButton extends HexButton {
}
}//package
Section 85
//VolumeControl (VolumeControl)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class VolumeControl extends MovieClip {
public var callback:Function;// = null
public var slider:Sprite;
public function VolumeControl(){
callback = null;
super();
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_DOWN, this.press);
slider.addEventListener(MouseEvent.MOUSE_DOWN, this.press);
}
function release(_arg1:MouseEvent){
slider.removeEventListener(MouseEvent.MOUSE_UP, this.release);
stage.removeEventListener(MouseEvent.MOUSE_UP, this.release);
slider.removeEventListener(Event.ENTER_FRAME, this.update);
slider.stopDrag();
if (callback != null){
callback((slider.x / 100));
};
Game.playSound("Button Click", ((_arg1.target.localToGlobal(new Point(_arg1.target.mouseX)).x / Game.MIDX) - 1));
}
function press(_arg1:MouseEvent){
slider.addEventListener(MouseEvent.MOUSE_UP, this.release);
stage.addEventListener(MouseEvent.MOUSE_UP, this.release);
slider.addEventListener(Event.ENTER_FRAME, this.update);
slider.startDrag(true, new Rectangle(0, 0, 100, 0));
update();
}
function update(_arg1:Event=null){
if (callback != null){
callback((slider.x / 100));
};
}
}
}//package