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
//ColorPicker (fl.controls.ColorPicker)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.geom.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class ColorPicker extends UIComponent implements IFocusManagerComponent {
protected var paletteBG:DisplayObject;
protected var customColors:Array;
protected var palette:Sprite;
protected var isOpen:Boolean;// = false
protected var swatchButton:BaseButton;
protected var selectedSwatch:Sprite;
protected var textFieldBG:DisplayObject;
protected var colorWell:DisplayObject;
protected var rollOverColor:int;// = -1
protected var colorHash:Object;
protected var swatchSelectedSkin:DisplayObject;
protected var _showTextField:Boolean;// = true
protected var currRowIndex:int;
protected var doOpen:Boolean;// = false
protected var currColIndex:int;
protected var swatchMap:Array;
protected var _selectedColor:uint;
protected var _editable:Boolean;// = true
public var textField:TextField;
protected var swatches:Sprite;
protected static const SWATCH_STYLES:Object = {disabledSkin:"swatchSkin", downSkin:"swatchSkin", overSkin:"swatchSkin", upSkin:"swatchSkin"};
protected static const POPUP_BUTTON_STYLES:Object = {disabledSkin:"disabledSkin", downSkin:"downSkin", overSkin:"overSkin", upSkin:"upSkin"};
public static var defaultColors:Array;
private static var defaultStyles:Object = {upSkin:"ColorPicker_upSkin", disabledSkin:"ColorPicker_disabledSkin", overSkin:"ColorPicker_overSkin", downSkin:"ColorPicker_downSkin", colorWell:"ColorPicker_colorWell", swatchSkin:"ColorPicker_swatchSkin", swatchSelectedSkin:"ColorPicker_swatchSelectedSkin", swatchWidth:10, swatchHeight:10, columnCount:18, swatchPadding:1, textFieldSkin:"ColorPicker_textFieldSkin", textFieldWidth:null, textFieldHeight:null, textPadding:3, background:"ColorPicker_backgroundSkin", backgroundPadding:5, textFormat:null, focusRectSkin:null, focusRectPadding:null, embedFonts:false};
public function ColorPicker(){
rollOverColor = -1;
_editable = true;
_showTextField = true;
isOpen = false;
doOpen = false;
super();
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
protected function drawSwatchHighlight():void{
var _local1:Object;
var _local2:Number;
cleanUpSelected();
_local1 = getStyleValue("swatchSelectedSkin");
_local2 = (getStyleValue("swatchPadding") as Number);
if (_local1 != null){
swatchSelectedSkin = getDisplayObjectInstance(_local1);
swatchSelectedSkin.x = 0;
swatchSelectedSkin.y = 0;
swatchSelectedSkin.width = ((getStyleValue("swatchWidth") as Number) + 2);
swatchSelectedSkin.height = ((getStyleValue("swatchHeight") as Number) + 2);
};
}
protected function setColorWellColor(_arg1:ColorTransform):void{
if (!colorWell){
return;
};
colorWell.transform.colorTransform = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
public function open():void{
var _local1:IFocusManager;
if (!_enabled){
return;
};
doOpen = true;
_local1 = focusManager;
if (_local1){
_local1.defaultButtonEnabled = false;
};
invalidate(InvalidationType.STATE);
}
protected function setTextEditable():void{
if (!showTextField){
return;
};
textField.type = (editable) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = editable;
}
protected function createSwatch(_arg1:uint):Sprite{
var _local2:Sprite;
var _local3:BaseButton;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Graphics;
_local2 = new Sprite();
_local3 = new BaseButton();
_local3.focusEnabled = false;
_local4 = (getStyleValue("swatchWidth") as Number);
_local5 = (getStyleValue("swatchHeight") as Number);
_local3.setSize(_local4, _local5);
_local3.transform.colorTransform = new ColorTransform(0, 0, 0, 1, (_arg1 >> 16), ((_arg1 >> 8) & 0xFF), (_arg1 & 0xFF), 0);
copyStylesToChild(_local3, SWATCH_STYLES);
_local3.mouseEnabled = false;
_local3.drawNow();
_local3.name = "color";
_local2.addChild(_local3);
_local6 = (getStyleValue("swatchPadding") as Number);
_local7 = _local2.graphics;
_local7.beginFill(0);
_local7.drawRect(-(_local6), -(_local6), (_local4 + (_local6 * 2)), (_local5 + (_local6 * 2)));
_local7.endFill();
_local2.addEventListener(MouseEvent.CLICK, onSwatchClick, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_OVER, onSwatchOver, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_OUT, onSwatchOut, false, 0, true);
return (_local2);
}
protected function onSwatchOut(_arg1:MouseEvent):void{
var _local2:ColorTransform;
_local2 = _arg1.target.transform.colorTransform;
dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OUT, _local2.color));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:ColorTransform;
var _local3:Sprite;
switch (_arg1.keyCode){
case Keyboard.SHIFT:
case Keyboard.CONTROL:
return;
};
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.DOWN:
open();
break;
case Keyboard.UP:
close();
break;
};
return;
};
if (!isOpen){
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.LEFT:
case Keyboard.RIGHT:
case Keyboard.SPACE:
open();
return;
};
};
textField.maxChars = ((((_arg1.keyCode == "#".charCodeAt(0))) || ((textField.text.indexOf("#") > -1)))) ? 7 : 6;
switch (_arg1.keyCode){
case Keyboard.TAB:
_local3 = findSwatch(_selectedColor);
setSwatchHighlight(_local3);
return;
case Keyboard.HOME:
currColIndex = (currRowIndex = 0);
break;
case Keyboard.END:
currColIndex = (swatchMap[(swatchMap.length - 1)].length - 1);
currRowIndex = (swatchMap.length - 1);
break;
case Keyboard.PAGE_DOWN:
currRowIndex = (swatchMap.length - 1);
break;
case Keyboard.PAGE_UP:
currRowIndex = 0;
break;
case Keyboard.ESCAPE:
if (isOpen){
selectedColor = _selectedColor;
};
close();
return;
case Keyboard.ENTER:
return;
case Keyboard.UP:
currRowIndex = Math.max(-1, (currRowIndex - 1));
if (currRowIndex == -1){
currRowIndex = (swatchMap.length - 1);
};
break;
case Keyboard.DOWN:
currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1));
if (currRowIndex == swatchMap.length){
currRowIndex = 0;
};
break;
case Keyboard.RIGHT:
currColIndex = Math.min(swatchMap[currRowIndex].length, (currColIndex + 1));
if (currColIndex == swatchMap[currRowIndex].length){
currColIndex = 0;
currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1));
if (currRowIndex == swatchMap.length){
currRowIndex = 0;
};
};
break;
case Keyboard.LEFT:
currColIndex = Math.max(-1, (currColIndex - 1));
if (currColIndex == -1){
currColIndex = (swatchMap[currRowIndex].length - 1);
currRowIndex = Math.max(-1, (currRowIndex - 1));
if (currRowIndex == -1){
currRowIndex = (swatchMap.length - 1);
};
};
break;
default:
return;
};
_local2 = swatchMap[currRowIndex][currColIndex].getChildByName("color").transform.colorTransform;
rollOverColor = _local2.color;
setColorWellColor(_local2);
setSwatchHighlight(swatchMap[currRowIndex][currColIndex]);
setColorText(_local2.color);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
setIMEMode(true);
}
protected function onStageClick(_arg1:MouseEvent):void{
if (((!(contains((_arg1.target as DisplayObject)))) && (!(palette.contains((_arg1.target as DisplayObject)))))){
selectedColor = _selectedColor;
close();
};
}
protected function onSwatchOver(_arg1:MouseEvent):void{
var _local2:BaseButton;
var _local3:ColorTransform;
_local2 = (_arg1.target.getChildByName("color") as BaseButton);
_local3 = _local2.transform.colorTransform;
setColorWellColor(_local3);
setSwatchHighlight((_arg1.target as Sprite));
setColorText(_local3.color);
dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OVER, _local3.color));
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
if (!_arg1){
close();
};
swatchButton.enabled = _arg1;
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:ColorTransform;
var _local4:String;
var _local5:Sprite;
if (!isOpen){
return;
};
_local3 = new ColorTransform();
if (((editable) && (showTextField))){
_local4 = textField.text;
if (_local4.indexOf("#") > -1){
_local4 = _local4.replace(/^\s+|\s+$/g, "");
_local4 = _local4.replace(/#/g, "");
};
_local2 = parseInt(_local4, 16);
_local5 = findSwatch(_local2);
setSwatchHighlight(_local5);
_local3.color = _local2;
setColorWellColor(_local3);
} else {
_local2 = rollOverColor;
_local3.color = _local2;
};
if (_arg1.keyCode != Keyboard.ENTER){
return;
};
dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ENTER, _local2));
_selectedColor = rollOverColor;
setColorText(_local3.color);
rollOverColor = _local3.color;
dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor));
close();
}
protected function drawBG():void{
var _local1:Object;
var _local2:Number;
_local1 = getStyleValue("background");
if (_local1 != null){
paletteBG = (getDisplayObjectInstance(_local1) as Sprite);
};
if (paletteBG == null){
return;
};
_local2 = Number(getStyleValue("backgroundPadding"));
paletteBG.width = (Math.max((showTextField) ? textFieldBG.width : 0, swatches.width) + (_local2 * 2));
paletteBG.height = ((swatches.y + swatches.height) + _local2);
palette.addChildAt(paletteBG, 0);
}
protected function positionTextField():void{
var _local1:Number;
var _local2:Number;
if (!showTextField){
return;
};
_local1 = (getStyleValue("backgroundPadding") as Number);
_local2 = (getStyleValue("textPadding") as Number);
textFieldBG.x = (paletteBG.x + _local1);
textFieldBG.y = (paletteBG.y + _local1);
textField.x = (textFieldBG.x + _local2);
textField.y = (textFieldBG.y + _local2);
}
protected function setEmbedFonts():void{
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function set showTextField(_arg1:Boolean):void{
invalidate(InvalidationType.STYLES);
_showTextField = _arg1;
}
protected function addStageListener(_arg1:Event=null):void{
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
protected function drawPalette():void{
if (isOpen){
stage.removeChild(palette);
};
palette = new Sprite();
drawTextField();
drawSwatches();
drawBG();
}
protected function showPalette():void{
var _local1:Sprite;
if (isOpen){
positionPalette();
return;
};
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
stage.addChild(palette);
isOpen = true;
positionPalette();
dispatchEvent(new Event(Event.OPEN));
stage.focus = textField;
_local1 = selectedSwatch;
if (_local1 == null){
_local1 = findSwatch(_selectedColor);
};
setSwatchHighlight(_local1);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
invalidate(InvalidationType.STATE);
}
public function set colors(_arg1:Array):void{
customColors = _arg1;
invalidate(InvalidationType.DATA);
}
protected function drawTextField():void{
var _local1:Number;
var _local2:Number;
var _local3:Object;
var _local4:TextFormat;
var _local5:TextFormat;
if (!showTextField){
return;
};
_local1 = (getStyleValue("backgroundPadding") as Number);
_local2 = (getStyleValue("textPadding") as Number);
textFieldBG = getDisplayObjectInstance(getStyleValue("textFieldSkin"));
if (textFieldBG != null){
palette.addChild(textFieldBG);
textFieldBG.x = (textFieldBG.y = _local1);
};
_local3 = UIComponent.getStyleDefinition();
_local4 = (enabled) ? (_local3.defaultTextFormat as TextFormat) : (_local3.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local4);
_local5 = (getStyleValue("textFormat") as TextFormat);
if (_local5 != null){
textField.setTextFormat(_local5);
} else {
_local5 = _local4;
};
textField.defaultTextFormat = _local5;
setEmbedFonts();
textField.restrict = "A-Fa-f0-9#";
textField.maxChars = 6;
palette.addChild(textField);
textField.text = " #888888 ";
textField.height = (textField.textHeight + 3);
textField.width = (textField.textWidth + 3);
textField.text = "";
textField.x = (textField.y = (_local1 + _local2));
textFieldBG.width = (textField.width + (_local2 * 2));
textFieldBG.height = (textField.height + (_local2 * 2));
setTextEditable();
}
protected function setColorText(_arg1:uint):void{
if (textField == null){
return;
};
textField.text = ("#" + colorToString(_arg1));
}
protected function colorToString(_arg1:uint):String{
var _local2:String;
_local2 = _arg1.toString(16);
while (_local2.length < 6) {
_local2 = ("0" + _local2);
};
return (_local2);
}
public function get imeMode():String{
return (_imeMode);
}
public function set selectedColor(_arg1:uint):void{
var _local2:ColorTransform;
if (!_enabled){
return;
};
_selectedColor = _arg1;
rollOverColor = -1;
currColIndex = (currRowIndex = 0);
_local2 = new ColorTransform();
_local2.color = _arg1;
setColorWellColor(_local2);
invalidate(InvalidationType.DATA);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
if (_arg1.relatedObject == textField){
setFocus();
return;
};
if (isOpen){
close();
};
super.focusOutHandler(_arg1);
setIMEMode(false);
}
protected function onPopupButtonClick(_arg1:MouseEvent):void{
if (isOpen){
close();
} else {
open();
};
}
protected function positionPalette():void{
var _local1:Point;
var _local2:Number;
_local1 = swatchButton.localToGlobal(new Point(0, 0));
_local2 = (getStyleValue("backgroundPadding") as Number);
if ((_local1.x + palette.width) > stage.stageWidth){
palette.x = ((_local1.x - palette.width) << 0);
} else {
palette.x = (((_local1.x + swatchButton.width) + _local2) << 0);
};
palette.y = (Math.max(0, Math.min(_local1.y, (stage.stageHeight - palette.height))) << 0);
}
public function get hexValue():String{
if (colorWell == null){
return (colorToString(0));
};
return (colorToString(colorWell.transform.colorTransform.color));
}
override public function get enabled():Boolean{
return (super.enabled);
}
protected function setSwatchHighlight(_arg1:Sprite):void{
var _local2:Number;
var _local3:*;
if (_arg1 == null){
if (palette.contains(swatchSelectedSkin)){
palette.removeChild(swatchSelectedSkin);
};
return;
} else {
if (((!(palette.contains(swatchSelectedSkin))) && ((colors.length > 0)))){
palette.addChild(swatchSelectedSkin);
} else {
if (!colors.length){
return;
};
};
};
_local2 = (getStyleValue("swatchPadding") as Number);
palette.setChildIndex(swatchSelectedSkin, (palette.numChildren - 1));
swatchSelectedSkin.x = ((swatches.x + _arg1.x) - 1);
swatchSelectedSkin.y = ((swatches.y + _arg1.y) - 1);
_local3 = _arg1.getChildByName("color").transform.colorTransform.color;
currColIndex = colorHash[_local3].col;
currRowIndex = colorHash[_local3].row;
}
protected function onSwatchClick(_arg1:MouseEvent):void{
var _local2:ColorTransform;
_local2 = _arg1.target.getChildByName("color").transform.colorTransform;
_selectedColor = _local2.color;
dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor));
close();
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.DATA)){
setStyles();
drawPalette();
setEmbedFonts();
invalidate(InvalidationType.DATA, false);
invalidate(InvalidationType.STYLES, false);
};
if (isInvalid(InvalidationType.DATA)){
drawSwatchHighlight();
setColorDisplay();
};
if (isInvalid(InvalidationType.STATE)){
setTextEditable();
if (doOpen){
doOpen = false;
showPalette();
};
colorWell.visible = enabled;
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
swatchButton.setSize(width, height);
swatchButton.drawNow();
colorWell.width = width;
colorWell.height = height;
};
super.draw();
}
protected function drawSwatches():void{
var _local1:Number;
var _local2:Number;
var _local3:uint;
var _local4:uint;
var _local5:Number;
var _local6:Number;
var _local7:uint;
var _local8:int;
var _local9:uint;
var _local10:Sprite;
_local1 = (getStyleValue("backgroundPadding") as Number);
_local2 = (showTextField) ? ((textFieldBG.y + textFieldBG.height) + _local1) : _local1;
swatches = new Sprite();
palette.addChild(swatches);
swatches.x = _local1;
swatches.y = _local2;
_local3 = (getStyleValue("columnCount") as uint);
_local4 = (getStyleValue("swatchPadding") as uint);
_local5 = (getStyleValue("swatchWidth") as Number);
_local6 = (getStyleValue("swatchHeight") as Number);
colorHash = {};
swatchMap = [];
_local7 = Math.min(0x0400, colors.length);
_local8 = -1;
_local9 = 0;
while (_local9 < _local7) {
_local10 = createSwatch(colors[_local9]);
_local10.x = ((_local5 + _local4) * (_local9 % _local3));
if (_local10.x == 0){
swatchMap.push([_local10]);
_local8++;
} else {
swatchMap[_local8].push(_local10);
};
colorHash[colors[_local9]] = {swatch:_local10, row:_local8, col:(swatchMap[_local8].length - 1)};
_local10.y = (Math.floor((_local9 / _local3)) * (_local6 + _local4));
swatches.addChild(_local10);
_local9++;
};
}
override protected function configUI():void{
var _local1:uint;
super.configUI();
tabChildren = false;
if (_slot1.defaultColors == null){
_slot1.defaultColors = [];
_local1 = 0;
while (_local1 < 216) {
_slot1.defaultColors.push(((((((((_local1 / 6) % 3) << 0) + (((_local1 / 108) << 0) * 3)) * 51) << 16) | (((_local1 % 6) * 51) << 8)) | ((((_local1 / 18) << 0) % 6) * 51)));
_local1++;
};
};
colorHash = {};
swatchMap = [];
textField = new TextField();
textField.tabEnabled = false;
swatchButton = new BaseButton();
swatchButton.focusEnabled = false;
swatchButton.useHandCursor = false;
swatchButton.autoRepeat = false;
swatchButton.setSize(25, 25);
swatchButton.addEventListener(MouseEvent.CLICK, onPopupButtonClick, false, 0, true);
addChild(swatchButton);
palette = new Sprite();
palette.tabChildren = false;
palette.cacheAsBitmap = true;
}
public function get showTextField():Boolean{
return (_showTextField);
}
public function get colors():Array{
return (((customColors)!=null) ? customColors : _slot1.defaultColors);
}
protected function findSwatch(_arg1:uint):Sprite{
var _local2:Object;
if (!swatchMap.length){
return (null);
};
_local2 = colorHash[_arg1];
if (_local2 != null){
return (_local2.swatch);
};
return (null);
}
protected function setColorDisplay():void{
var _local1:ColorTransform;
var _local2:Sprite;
if (!swatchMap.length){
return;
};
_local1 = new ColorTransform(0, 0, 0, 1, (_selectedColor >> 16), ((_selectedColor >> 8) & 0xFF), (_selectedColor & 0xFF), 0);
setColorWellColor(_local1);
setColorText(_selectedColor);
_local2 = findSwatch(_selectedColor);
setSwatchHighlight(_local2);
if (((swatchMap.length) && ((colorHash[_selectedColor] == undefined)))){
cleanUpSelected();
};
}
protected function cleanUpSelected():void{
if (((swatchSelectedSkin) && (palette.contains(swatchSelectedSkin)))){
palette.removeChild(swatchSelectedSkin);
};
}
public function get selectedColor():uint{
if (colorWell == null){
return (0);
};
return (colorWell.transform.colorTransform.color);
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
addStageListener();
}
protected function removeStageListener(_arg1:Event=null):void{
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false);
}
protected function setStyles():void{
var _local1:DisplayObject;
var _local2:Object;
_local1 = colorWell;
_local2 = getStyleValue("colorWell");
if (_local2 != null){
colorWell = (getDisplayObjectInstance(_local2) as DisplayObject);
};
addChildAt(colorWell, getChildIndex(swatchButton));
copyStylesToChild(swatchButton, POPUP_BUTTON_STYLES);
swatchButton.drawNow();
if (((((!((_local1 == null))) && (contains(_local1)))) && (!((_local1 == colorWell))))){
removeChild(_local1);
};
}
public function close():void{
var _local1:IFocusManager;
if (isOpen){
stage.removeChild(palette);
isOpen = false;
dispatchEvent(new Event(Event.CLOSE));
};
_local1 = focusManager;
if (_local1){
_local1.defaultButtonEnabled = true;
};
removeStageListener();
cleanUpSelected();
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 5
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 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.utils.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 9
//ColorPickerEvent (fl.events.ColorPickerEvent)
package fl.events {
import flash.events.*;
public class ColorPickerEvent extends Event {
protected var _color:uint;
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const CHANGE:String = "change";
public static const ENTER:String = "enter";
public function ColorPickerEvent(_arg1:String, _arg2:uint){
super(_arg1, true);
_color = _arg2;
}
override public function toString():String{
return (formatToString("ColorPickerEvent", "type", "bubbles", "cancelable", "color"));
}
public function get color():uint{
return (_color);
}
override public function clone():Event{
return (new ColorPickerEvent(type, color));
}
}
}//package fl.events
Section 10
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 11
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 12
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 13
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 14
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 15
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 16
//didi_source_tgamesmc_135 (forest_fla.didi_source_tgamesmc_135)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class didi_source_tgamesmc_135 extends MovieClip {
public var logo_btn:SimpleButton;
public function didi_source_tgamesmc_135(){
addFrameScript(0, frame1);
}
function frame1(){
logo_btn.addEventListener(MouseEvent.CLICK, linkHandler);
}
public function linkHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.didigames.com"), "_blank");
}
}
}//package forest_fla
Section 17
//igirlsgames_loading_4 (forest_fla.igirlsgames_loading_4)
package forest_fla {
import flash.display.*;
public dynamic class igirlsgames_loading_4 extends MovieClip {
public function igirlsgames_loading_4(){
addFrameScript(99, frame100);
}
function frame100(){
stop();
}
}
}//package forest_fla
Section 18
//igirlsgames_loading_6 (forest_fla.igirlsgames_loading_6)
package forest_fla {
import flash.display.*;
public dynamic class igirlsgames_loading_6 extends MovieClip {
public var k28:MovieClip;
public var k23:MovieClip;
public var k30:MovieClip;
public var k31:MovieClip;
public var k33:MovieClip;
public var k22:MovieClip;
public var k36:MovieClip;
public var k35:MovieClip;
public var k32:MovieClip;
public var k4:MovieClip;
public var k6:MovieClip;
public var k7:MovieClip;
public var k8:MovieClip;
public var k2:MovieClip;
public var k5:MovieClip;
public var k9:MovieClip;
public var k1:MovieClip;
public var k34:MovieClip;
public var k3:MovieClip;
public var k10:MovieClip;
public var k12:MovieClip;
public var k13:MovieClip;
public var k14:MovieClip;
public var k15:MovieClip;
public var k16:MovieClip;
public var k17:MovieClip;
public var k19:MovieClip;
public var k18:MovieClip;
public var k11:MovieClip;
public var k20:MovieClip;
public var k24:MovieClip;
public var k25:MovieClip;
public var k26:MovieClip;
public var k21:MovieClip;
public var k29:MovieClip;
public var k27:MovieClip;
}
}//package forest_fla
Section 19
//igirlsgames_loadingyj6_2 (forest_fla.igirlsgames_loadingyj6_2)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class igirlsgames_loadingyj6_2 extends MovieClip {
public var logo_btn:SimpleButton;
public function igirlsgames_loadingyj6_2(){
addFrameScript(0, frame1);
}
function frame1(){
logo_btn.addEventListener(MouseEvent.CLICK, linkHandler);
}
public function linkHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.igirlsgames.com"), "_blank");
}
}
}//package forest_fla
Section 20
//igirlsgames_logo_126 (forest_fla.igirlsgames_logo_126)
package forest_fla {
import flash.display.*;
public dynamic class igirlsgames_logo_126 extends MovieClip {
public function igirlsgames_logo_126(){
addFrameScript(142, frame143);
}
function frame143(){
gotoAndPlay(44);
}
}
}//package forest_fla
Section 21
//igirlsgames_logo_128 (forest_fla.igirlsgames_logo_128)
package forest_fla {
import flash.display.*;
public dynamic class igirlsgames_logo_128 extends MovieClip {
public function igirlsgames_logo_128(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package forest_fla
Section 22
//igirlsgames_logo_130 (forest_fla.igirlsgames_logo_130)
package forest_fla {
import flash.display.*;
public dynamic class igirlsgames_logo_130 extends MovieClip {
public function igirlsgames_logo_130(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package forest_fla
Section 23
//igirlsgames_logo_mc_121 (forest_fla.igirlsgames_logo_mc_121)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class igirlsgames_logo_mc_121 extends MovieClip {
public var logo_btn:SimpleButton;
public function igirlsgames_logo_mc_121(){
addFrameScript(0, frame1);
}
function frame1(){
logo_btn.addEventListener(MouseEvent.CLICK, linkHandler);
}
public function linkHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.igirlsgames.com"), "_blank");
}
}
}//package forest_fla
Section 24
//igirlsgamesload_mc_1 (forest_fla.igirlsgamesload_mc_1)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class igirlsgamesload_mc_1 extends MovieClip {
public var loading:MovieClip;
public var a;
public var percent_mc:MovieClip;
public var play_btn:SimpleButton;
public function igirlsgamesload_mc_1(){
addFrameScript(0, frame1, 1, frame2);
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:Number;
var _local3:*;
_local2 = int(((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100));
if (percent_mc.currentFrame < _local2){
percent_mc.play();
} else {
percent_mc.stop();
};
_local3 = 1;
while (_local3 <= 36) {
if (_local3 <= Math.ceil(((percent_mc.currentFrame * 36) / 100))){
loading[("k" + _local3)].visible = true;
};
_local3++;
};
if (((loading.k36.visible) && ((percent_mc.currentFrame >= 100)))){
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
goNext();
};
}
function frame1(){
stop();
a = 1;
while (a <= 36) {
loading[("k" + a)].gotoAndStop(a);
loading[("k" + a)].visible = false;
a++;
};
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function playHandler(_arg1:MouseEvent):void{
play_btn.removeEventListener(MouseEvent.CLICK, playHandler);
MovieClip(root).play();
}
function frame2(){
stop();
play_btn.addEventListener(MouseEvent.CLICK, playHandler);
}
public function goNext():void{
this.play();
}
}
}//package forest_fla
Section 25
//Timeline_111 (forest_fla.Timeline_111)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_111 extends MovieClip {
public var a1:MovieClip;
}
}//package forest_fla
Section 26
//Timeline_114 (forest_fla.Timeline_114)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_114 extends MovieClip {
public function Timeline_114(){
addFrameScript(32, frame33);
}
function frame33(){
gotoAndPlay(17);
}
}
}//package forest_fla
Section 27
//Timeline_14 (forest_fla.Timeline_14)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_14 extends MovieClip {
public var b1:MovieClip;
public var b2:MovieClip;
public var b4:MovieClip;
public var b5:MovieClip;
public var b9:MovieClip;
public var b3:MovieClip;
public var b6:MovieClip;
public var b8:MovieClip;
public var b7:MovieClip;
public var p10:MovieClip;
public var p11:MovieClip;
public var p12:MovieClip;
public var p16:MovieClip;
public var p17:MovieClip;
public var p18:MovieClip;
public var p19:MovieClip;
public var p14:MovieClip;
public var p15:MovieClip;
public var p13:MovieClip;
public var p20:MovieClip;
public var p21:MovieClip;
public var p22:MovieClip;
public var p23:MovieClip;
public var p25:MovieClip;
public var p27:MovieClip;
public var p29:MovieClip;
public var p24:MovieClip;
public var p26:MovieClip;
public var p28:MovieClip;
public var p30:MovieClip;
public var p31:MovieClip;
public var p32:MovieClip;
public var p33:MovieClip;
public var p34:MovieClip;
public var p35:MovieClip;
public var p36:MovieClip;
public var p37:MovieClip;
public var p38:MovieClip;
public var p39:MovieClip;
public var p40:MovieClip;
public var p41:MovieClip;
public var p42:MovieClip;
public var p43:MovieClip;
public var p45:MovieClip;
public var p49:MovieClip;
public var p44:MovieClip;
public var p46:MovieClip;
public var p50:MovieClip;
public var p52:MovieClip;
public var p53:MovieClip;
public var p55:MovieClip;
public var p57:MovieClip;
public var p51:MovieClip;
public var p59:MovieClip;
public var p47:MovieClip;
public var p58:MovieClip;
public var p54:MovieClip;
public var p56:MovieClip;
public var p61:MovieClip;
public var p63:MovieClip;
public var p65:MovieClip;
public var p60:MovieClip;
public var p68:MovieClip;
public var p69:MovieClip;
public var p64:MovieClip;
public var p67:MovieClip;
public var p48:MovieClip;
public var p62:MovieClip;
public var p66:MovieClip;
public var p70:MovieClip;
public var p72:MovieClip;
public var p71:MovieClip;
public var p1:MovieClip;
public var p2:MovieClip;
public var p3:MovieClip;
public var p5:MovieClip;
public var p8:MovieClip;
public var p9:MovieClip;
public var p6:MovieClip;
public var p7:MovieClip;
public var p4:MovieClip;
}
}//package forest_fla
Section 28
//Timeline_156 (forest_fla.Timeline_156)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_156 extends MovieClip {
public function Timeline_156(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package forest_fla
Section 29
//Timeline_159 (forest_fla.Timeline_159)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_159 extends MovieClip {
public function Timeline_159(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package forest_fla
Section 30
//Timeline_163 (forest_fla.Timeline_163)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_163 extends MovieClip {
public function Timeline_163(){
addFrameScript(227, frame228);
}
function frame228(){
stop();
}
}
}//package forest_fla
Section 31
//Timeline_167 (forest_fla.Timeline_167)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_167 extends MovieClip {
public function Timeline_167(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package forest_fla
Section 32
//Timeline_169 (forest_fla.Timeline_169)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class Timeline_169 extends MovieClip {
public var logo_btn:SimpleButton;
public function Timeline_169(){
addFrameScript(0, frame1);
}
function frame1(){
logo_btn.addEventListener(MouseEvent.CLICK, linkHandler);
}
public function linkHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.igirlsgames.com"), "_blank");
}
}
}//package forest_fla
Section 33
//Timeline_171 (forest_fla.Timeline_171)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_171 extends MovieClip {
public function Timeline_171(){
addFrameScript(3, frame4);
}
function frame4(){
stop();
}
}
}//package forest_fla
Section 34
//Timeline_175 (forest_fla.Timeline_175)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_175 extends MovieClip {
public var main_mc:MovieClip;
}
}//package forest_fla
Section 35
//Timeline_52 (forest_fla.Timeline_52)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_52 extends MovieClip {
public var a2:MovieClip;
public var a3:MovieClip;
public var a1:MovieClip;
public function Timeline_52(){
addFrameScript(32, frame33);
}
function frame33(){
gotoAndPlay(17);
}
}
}//package forest_fla
Section 36
//Timeline_59 (forest_fla.Timeline_59)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_59 extends MovieClip {
public function Timeline_59(){
addFrameScript(32, frame33);
}
function frame33(){
gotoAndPlay(17);
}
}
}//package forest_fla
Section 37
//Timeline_69 (forest_fla.Timeline_69)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_69 extends MovieClip {
public var a2:MovieClip;
public var a1:MovieClip;
public function Timeline_69(){
addFrameScript(32, frame33);
}
function frame33(){
gotoAndPlay(17);
}
}
}//package forest_fla
Section 38
//Timeline_75 (forest_fla.Timeline_75)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_75 extends MovieClip {
public function Timeline_75(){
addFrameScript(32, frame33);
}
function frame33(){
gotoAndPlay(17);
}
}
}//package forest_fla
Section 39
//Timeline_84 (forest_fla.Timeline_84)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_84 extends MovieClip {
public var a1:MovieClip;
}
}//package forest_fla
Section 40
//Timeline_86 (forest_fla.Timeline_86)
package forest_fla {
import flash.display.*;
public dynamic class Timeline_86 extends MovieClip {
public var a1:MovieClip;
}
}//package forest_fla
Section 41
//twitter_logo_mc_133 (forest_fla.twitter_logo_mc_133)
package forest_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class twitter_logo_mc_133 extends MovieClip {
public var logo_btn:SimpleButton;
public function twitter_logo_mc_133(){
addFrameScript(0, frame1);
}
function frame1(){
logo_btn.addEventListener(MouseEvent.CLICK, linkHandler);
}
public function linkHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://twitter.com/igirlsgames"), "_blank");
}
}
}//package forest_fla
Section 42
//bg_music (bg_music)
package {
import flash.media.*;
public dynamic class bg_music extends Sound {
}
}//package
Section 43
//ColorPicker_backgroundSkin (ColorPicker_backgroundSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_backgroundSkin extends MovieClip {
}
}//package
Section 44
//ColorPicker_colorWell (ColorPicker_colorWell)
package {
import flash.display.*;
public dynamic class ColorPicker_colorWell extends MovieClip {
}
}//package
Section 45
//ColorPicker_disabledSkin (ColorPicker_disabledSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_disabledSkin extends MovieClip {
}
}//package
Section 46
//ColorPicker_downSkin (ColorPicker_downSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_downSkin extends MovieClip {
}
}//package
Section 47
//ColorPicker_overSkin (ColorPicker_overSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_overSkin extends MovieClip {
}
}//package
Section 48
//ColorPicker_swatchSelectedSkin (ColorPicker_swatchSelectedSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_swatchSelectedSkin extends MovieClip {
}
}//package
Section 49
//ColorPicker_swatchSkin (ColorPicker_swatchSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_swatchSkin extends Sprite {
}
}//package
Section 50
//ColorPicker_textFieldSkin (ColorPicker_textFieldSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_textFieldSkin extends MovieClip {
}
}//package
Section 51
//ColorPicker_upSkin (ColorPicker_upSkin)
package {
import flash.display.*;
public dynamic class ColorPicker_upSkin extends MovieClip {
}
}//package
Section 52
//Main (Main)
package {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.ui.*;
public dynamic class Main extends MovieClip {
public var begin_mc:MovieClip;
public var main_mc:MovieClip;
public var green:uint;// = 0
public var show_btn:SimpleButton;
public var replay_btn:SimpleButton;
public var volumeSize:Number;// = 1
public var blue:uint;// = 0
var st:SoundTransform;
public var sss_mc:ColorPicker;
public var red:uint;// = 0
public var sb_mc:sbClass;
public var sb_click:Boolean;// = true
public var reset_btn:SimpleButton;
public var load_mc:MovieClip;
public var a_btn:MovieClip;
public var myChannel:SoundChannel;
public var play_btn:SimpleButton;
public var bgMusic:bg_music;
public var music_mc:MovieClip;
public function Main(){
red = 0;
green = 0;
blue = 0;
sb_click = true;
bgMusic = new bg_music();
volumeSize = 1;
st = new SoundTransform(volumeSize, 0);
super();
addFrameScript(0, frame0, 1, frame1);
}
private function mouseClick(_arg1:MouseEvent):void{
var _local2:SoundTransform;
if (volumeSize){
volumeSize = 0;
_arg1.currentTarget.gotoAndStop(2);
} else {
volumeSize = 1;
_arg1.currentTarget.gotoAndStop(1);
};
_local2 = new SoundTransform(volumeSize, 0);
myChannel.soundTransform = _local2;
}
private function refurbish(_arg1:Number):void{
var _local2:uint;
var _local3:uint;
if (_arg1 == 1){
_local2 = 1;
while (_local2 <= 80) {
if (main_mc[("p" + _local2)]){
main_mc[("p" + _local2)].gotoAndStop(1);
((main_mc[("p" + _local2)].a1) && (main_mc[("p" + _local2)].a1.gotoAndStop(1)));
((main_mc[("p" + _local2)].a2) && (main_mc[("p" + _local2)].a2.gotoAndStop(1)));
((main_mc[("p" + _local2)].a3) && (main_mc[("p" + _local2)].a3.gotoAndStop(1)));
main_mc[("p" + _local2)].addEventListener(MouseEvent.MOUSE_DOWN, colorUp);
};
_local2++;
};
_local3 = 1;
while (_local3 <= 80) {
if (main_mc[("b" + _local3)]){
((main_mc[("b" + _local3)].a1) && (main_mc[("b" + _local3)].a1.gotoAndStop(1)));
main_mc[("b" + _local3)].gotoAndStop(1);
};
_local3++;
};
} else {
if (_arg1 == 2){
_local2 = 1;
while (_local2 <= 80) {
if (main_mc[("p" + _local2)]){
main_mc[("p" + _local2)].gotoAndPlay(1);
((main_mc[("p" + _local2)].a1) && (main_mc[("p" + _local2)].a1.gotoAndPlay(1)));
((main_mc[("p" + _local2)].a2) && (main_mc[("p" + _local2)].a2.gotoAndPlay(1)));
((main_mc[("p" + _local2)].a3) && (main_mc[("p" + _local2)].a3.gotoAndPlay(1)));
main_mc[("p" + _local2)].removeEventListener(MouseEvent.MOUSE_DOWN, colorUp);
};
_local2++;
};
_local3 = 1;
while (_local3 <= 80) {
if (main_mc[("b" + _local3)]){
((main_mc[("b" + _local3)].a1) && (main_mc[("b" + _local3)].a1.gotoAndPlay(1)));
main_mc[("b" + _local3)].gotoAndPlay(1);
};
_local3++;
};
};
};
}
private function frame0():void{
stop();
}
private function colorChange(_arg1:Event):void{
var _local2:ColorTransform;
_local2 = new ColorTransform();
_local2.color = _arg1.target.selectedColor;
sb_mc.c_mc.main_mc.transform.colorTransform = _local2;
_local2.color = (0xFFFFFF - _arg1.target.selectedColor);
red = (_local2.color / 65536);
green = ((_local2.color % 65536) / 0x0100);
blue = (_local2.color % 0x0100);
mouseClose();
}
private function Open(_arg1:MouseEvent):void{
sss_mc.open();
mouseShow();
}
private function frame1():void{
stop();
if (!myChannel){
myChannel = bgMusic.play(0, 9999);
myChannel.soundTransform = st;
};
music_mc.gotoAndStop((2 - volumeSize));
music_mc.buttonMode = true;
music_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick);
sb_mc.gotoAndStop(1);
reset_btn.visible = false;
show_btn.visible = false;
replay_btn.visible = false;
a_btn.visible = false;
a_btn.addEventListener(MouseEvent.MOUSE_DOWN, Open);
sb_mc.mouseEnabled = false;
sss_mc.addEventListener(Event.CHANGE, colorChange);
reset_btn.addEventListener(MouseEvent.MOUSE_DOWN, resetGame);
show_btn.addEventListener(MouseEvent.MOUSE_DOWN, showGame);
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, playGame);
replay_btn.addEventListener(MouseEvent.MOUSE_DOWN, replayGame);
refurbish(1);
}
private function colorUp(_arg1:MouseEvent):void{
var _local2:ColorTransform;
if (sb_click){
_local2 = new ColorTransform(1, 1, 1, 1, -(red), -(green), -(blue));
_arg1.currentTarget.transform.colorTransform = _local2;
sb_click = false;
sb_mc.play();
};
}
private function playGame(_arg1:MouseEvent):void{
mouseClose();
begin_mc.gotoAndStop(229);
a_btn.visible = true;
play_btn.visible = false;
reset_btn.visible = true;
show_btn.visible = true;
}
private function replayGame(_arg1:MouseEvent):void{
refurbish(1);
red = 0;
green = 0;
blue = 0;
colorDown();
begin_mc.gotoAndPlay(1);
reset_btn.visible = false;
show_btn.visible = false;
replay_btn.visible = false;
play_btn.visible = true;
}
private function colorDown():void{
var _local1:*;
var _local2:ColorTransform;
_local1 = 1;
while (_local1 <= 80) {
if (main_mc[("p" + _local1)]){
_local2 = new ColorTransform(1, 1, 1, 1, 0, 0, 0);
main_mc[("p" + _local1)].transform.colorTransform = _local2;
};
_local1++;
};
}
private function showGame(_arg1:MouseEvent):void{
refurbish(2);
a_btn.visible = false;
reset_btn.visible = false;
show_btn.visible = false;
replay_btn.visible = true;
mouseShow();
}
private function mouseShow(){
Mouse.show();
sb_mc.stopDrag();
sb_mc.x = -100;
}
private function mouseClose(){
Mouse.hide();
sb_mc.startDrag(true);
}
private function resetGame(_arg1:MouseEvent):void{
colorDown();
}
}
}//package
Section 53
//sbClass (sbClass)
package {
import flash.display.*;
public dynamic class sbClass extends MovieClip {
public var m_mc:MovieClip;
public var c_mc:MovieClip;
public function sbClass(){
addFrameScript(6, frame);
}
private function frame():void{
MovieClip(parent).sb_click = true;
gotoAndStop(1);
}
}
}//package