Section 1
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.geom.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 2
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import fl.controls.*;
import flash.events.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 3
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 4
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 5
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 6
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 7
//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 8
//CheckBox (fl.controls.CheckBox)
package fl.controls {
import flash.display.*;
public class CheckBox extends LabelButton {
private static var defaultStyles:Object = {icon:null, upIcon:"CheckBox_upIcon", downIcon:"CheckBox_downIcon", overIcon:"CheckBox_overIcon", disabledIcon:"CheckBox_disabledIcon", selectedDisabledIcon:"CheckBox_selectedDisabledIcon", focusRectSkin:null, focusRectPadding:null, selectedUpIcon:"CheckBox_selectedUpIcon", selectedDownIcon:"CheckBox_selectedDownIcon", selectedOverIcon:"CheckBox_selectedOverIcon", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 << 1));
uiFocusRect.height = (background.height + (_local2 << 1));
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a CheckBox's toggle."));
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (CheckBox.createAccessibilityImplementation != null){
CheckBox.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 9
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
public class ComboBox extends UIComponent implements IFocusManagerComponent {
protected var _dropdownWidth:Number;
protected var highlightedCell:int;// = -1
protected var _prompt:String;
protected var isOpen:Boolean;// = false
protected var list:List;
protected var _rowCount:uint;// = 5
protected var currentIndex:int;
protected var isKeyDown:Boolean;// = false
protected var _labels:Array;
protected var background:BaseButton;
protected var inputField:TextInput;
protected var listOverIndex:uint;
protected var editableValue:String;
protected var _editable:Boolean;// = false
private var collectionItemImport:SimpleCollectionItem;
protected static const BACKGROUND_STYLES:Object = {overSkin:"overSkin", downSkin:"downSkin", upSkin:"upSkin", disabledSkin:"disabledSkin", repeatInterval:"repeatInterval"};
protected static const LIST_STYLES:Object = {upSkin:"comboListUpSkin", overSkin:"comboListOverSkin", downSkin:"comobListDownSkin", disabledSkin:"comboListDisabledSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval", textFormat:"textFormat", disabledAlpha:"disabledAlpha", skin:"listSkin"};
private static var defaultStyles:Object = {upSkin:"ComboBox_upSkin", downSkin:"ComboBox_downSkin", overSkin:"ComboBox_overSkin", disabledSkin:"ComboBox_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, buttonWidth:24, disabledAlpha:null, listSkin:null};
public static var createAccessibilityImplementation:Function;
public function ComboBox(){
_rowCount = 5;
_editable = false;
isOpen = false;
highlightedCell = -1;
isKeyDown = false;
super();
}
protected function drawList():void{
list.rowCount = Math.max(0, Math.min(_rowCount, list.dataProvider.length));
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function get dropdown():List{
return (list);
}
public function get dropdownWidth():Number{
return (list.width);
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (list.sortItemsOn(_arg1, _arg2));
}
protected function onEnter(_arg1:ComponentEvent):void{
_arg1.stopPropagation();
}
public function removeItemAt(_arg1:uint):void{
list.removeItemAt(_arg1);
invalidate(InvalidationType.DATA);
}
public function open():void{
currentIndex = selectedIndex;
if (((isOpen) || ((length == 0)))){
return;
};
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
public function get selectedItem():Object{
return (list.selectedItem);
}
public function set text(_arg1:String):void{
if (!editable){
return;
};
inputField.text = _arg1;
}
public function get labelField():String{
return (list.labelField);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:uint;
var _local4:Number;
var _local5:int;
isKeyDown = true;
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.UP:
if (highlightedCell > -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
break;
case Keyboard.DOWN:
open();
break;
};
return;
};
_arg1.stopPropagation();
_local2 = Math.max(((calculateAvailableHeight() / list.rowHeight) << 0), 1);
_local3 = selectedIndex;
_local4 = ((highlightedCell)==-1) ? selectedIndex : highlightedCell;
_local5 = -1;
switch (_arg1.keyCode){
case Keyboard.SPACE:
if (isOpen){
close();
} else {
open();
};
return;
case Keyboard.ESCAPE:
if (isOpen){
if (highlightedCell > -1){
selectedIndex = selectedIndex;
};
close();
};
return;
case Keyboard.UP:
_local5 = Math.max(0, (_local4 - 1));
break;
case Keyboard.DOWN:
_local5 = Math.min((length - 1), (_local4 + 1));
break;
case Keyboard.PAGE_UP:
_local5 = Math.max((_local4 - _local2), 0);
break;
case Keyboard.PAGE_DOWN:
_local5 = Math.min((_local4 + _local2), (length - 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.ENTER:
if (((_editable) && ((highlightedCell == -1)))){
editableValue = inputField.text;
selectedIndex = -1;
} else {
if (((isOpen) && ((highlightedCell > -1)))){
editableValue = null;
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
};
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER));
close();
return;
default:
if (editable){
break;
};
_local5 = list.getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), _local4);
break;
};
if (_local5 > -1){
if (isOpen){
highlightCell(_local5);
inputField.text = list.itemToLabel(getItemAt(_local5));
} else {
highlightCell();
selectedIndex = _local5;
dispatchEvent(new Event(Event.CHANGE));
};
};
}
public function set dropdownWidth(_arg1:Number):void{
_dropdownWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
if (editable){
stage.focus = inputField.textField;
};
}
protected function onStageClick(_arg1:MouseEvent):void{
if (!isOpen){
return;
};
if (((!(contains((_arg1.target as DisplayObject)))) && (!(list.contains((_arg1.target as DisplayObject)))))){
if (highlightedCell != -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
invalidate(InvalidationType.DATA);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
isKeyDown = false;
}
protected function onListItemUp(_arg1:MouseEvent):void{
var _local2:*;
stage.removeEventListener(MouseEvent.MOUSE_UP, onListItemUp);
if (((!((_arg1.target is ICellRenderer))) || (!(list.contains((_arg1.target as DisplayObject)))))){
return;
};
editableValue = null;
_local2 = selectedIndex;
selectedIndex = _arg1.target.listData.index;
if (_local2 != selectedIndex){
dispatchEvent(new Event(Event.CHANGE));
};
close();
}
public function removeAll():void{
list.removeAll();
inputField.text = "";
invalidate(InvalidationType.DATA);
}
public function set selectedItem(_arg1:Object):void{
list.selectedItem = _arg1;
invalidate(InvalidationType.SELECTED);
}
protected function highlightCell(_arg1:int=-1):void{
var _local2:ICellRenderer;
if (highlightedCell > -1){
_local2 = list.itemToCellRenderer(getItemAt(highlightedCell));
if (_local2 != null){
_local2.setMouseState("up");
};
};
if (_arg1 == -1){
return;
};
list.scrollToIndex(_arg1);
list.drawNow();
_local2 = list.itemToCellRenderer(getItemAt(_arg1));
if (_local2 != null){
_local2.setMouseState("over");
highlightedCell = _arg1;
};
}
public function itemToLabel(_arg1:Object):String{
if (_arg1 == null){
return ("");
};
return (list.itemToLabel(_arg1));
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
list.addItemAt(_arg1, _arg2);
invalidate(InvalidationType.DATA);
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (list.replaceItemAt(_arg1, _arg2));
}
protected function showPrompt():void{
inputField.text = _prompt;
}
public function set rowCount(_arg1:uint):void{
_rowCount = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get restrict():String{
return (inputField.restrict);
}
protected function setEmbedFonts():void{
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
inputField.textField.embedFonts = _local1;
};
}
public function sortItems(... _args){
return (list.sortItems.apply(list, _args));
}
public function set labelField(_arg1:String):void{
list.labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
drawTextField();
}
public function set prompt(_arg1:String):void{
if (_arg1 == ""){
_prompt = null;
} else {
_prompt = _arg1;
};
invalidate(InvalidationType.STATE);
}
public function get length():int{
return (list.length);
}
protected function drawTextField():void{
inputField.setStyle("upSkin", "");
inputField.setStyle("disabledSkin", "");
inputField.enabled = enabled;
inputField.editable = _editable;
inputField.textField.selectable = ((enabled) && (_editable));
inputField.mouseEnabled = (inputField.mouseChildren = ((enabled) && (_editable)));
inputField.focusEnabled = false;
if (_editable){
inputField.addEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus, false, 0, true);
inputField.addEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut, false, 0, true);
} else {
inputField.removeEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus);
inputField.removeEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut);
};
}
protected function onInputFieldFocusOut(_arg1:FocusEvent):void{
inputField.removeEventListener(ComponentEvent.ENTER, onEnter);
selectedIndex = selectedIndex;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
public function get labelFunction():Function{
return (list.labelFunction);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return ((list.height - (_local1 * 2)));
}
public function get selectedIndex():int{
return (list.selectedIndex);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
isKeyDown = false;
if (isOpen){
if (((!(_arg1.relatedObject)) || (!(list.contains(_arg1.relatedObject))))){
if (((!((highlightedCell == -1))) && (!((highlightedCell == selectedIndex))))){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
};
super.focusOutHandler(_arg1);
}
public function get selectedLabel():String{
if (editableValue != null){
return (editableValue);
};
if (selectedIndex == -1){
return (null);
};
return (itemToLabel(selectedItem));
}
public function get text():String{
return (inputField.text);
}
protected function onListChange(_arg1:Event):void{
editableValue = null;
dispatchEvent(_arg1);
invalidate(InvalidationType.SELECTED);
if (isKeyDown){
return;
};
close();
}
protected function onToggleListVisibility(_arg1:MouseEvent):void{
_arg1.stopPropagation();
dispatchEvent(_arg1);
if (isOpen){
close();
} else {
open();
stage.addEventListener(MouseEvent.MOUSE_UP, onListItemUp, false, 0, true);
};
}
override protected function draw():void{
var _local1:*;
_local1 = selectedIndex;
if ((((_local1 == -1)) && (((((!((prompt == null))) || (editable))) || ((length == 0)))))){
_local1 = Math.max(-1, Math.min(_local1, (length - 1)));
} else {
editableValue = null;
_local1 = Math.max(0, Math.min(_local1, (length - 1)));
};
if (list.selectedIndex != _local1){
list.selectedIndex = _local1;
invalidate(InvalidationType.SELECTED, false);
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFonts();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.STATE)){
drawTextFormat();
drawLayout();
invalidate(InvalidationType.DATA);
};
if (isInvalid(InvalidationType.DATA)){
drawList();
invalidate(InvalidationType.SELECTED, true);
};
if (isInvalid(InvalidationType.SELECTED)){
if ((((_local1 == -1)) && (!((editableValue == null))))){
inputField.text = editableValue;
} else {
if (_local1 > -1){
if (length > 0){
inputField.horizontalScrollPosition = 0;
inputField.text = itemToLabel(list.selectedItem);
};
} else {
if ((((_local1 == -1)) && (!((_prompt == null))))){
showPrompt();
} else {
inputField.text = "";
};
};
};
if (((((editable) && ((selectedIndex > -1)))) && ((stage.focus == inputField.textField)))){
inputField.setSelection(0, inputField.length);
};
};
drawTextField();
super.draw();
}
public function addItem(_arg1:Object):void{
list.addItem(_arg1);
invalidate(InvalidationType.DATA);
}
public function get rowCount():uint{
return (_rowCount);
}
override protected function configUI():void{
super.configUI();
background = new BaseButton();
background.focusEnabled = false;
copyStylesToChild(background, BACKGROUND_STYLES);
background.addEventListener(MouseEvent.MOUSE_DOWN, onToggleListVisibility, false, 0, true);
addChild(background);
inputField = new TextInput();
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(Event.CHANGE, onTextInput, false, 0, true);
addChild(inputField);
list = new List();
list.focusEnabled = false;
copyStylesToChild(list, LIST_STYLES);
list.addEventListener(Event.CHANGE, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_CLICK, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OUT, passEvent, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OVER, passEvent, false, 0, true);
list.verticalScrollBar.addEventListener(Event.SCROLL, passEvent, false, 0, true);
}
protected function positionList():void{
var _local1:Point;
_local1 = localToGlobal(new Point(0, 0));
list.x = _local1.x;
if (((_local1.y + height) + list.height) > stage.stageHeight){
list.y = (_local1.y - list.height);
} else {
list.y = (_local1.y + height);
};
}
public function get value():String{
var _local1:Object;
if (editableValue != null){
return (editableValue);
};
_local1 = selectedItem;
if (((!(_editable)) && (!((_local1.data == null))))){
return (_local1.data);
};
return (itemToLabel(_local1));
}
public function get prompt():String{
return (_prompt);
}
public function set dataProvider(_arg1:DataProvider):void{
_arg1.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
list.dataProvider = _arg1;
invalidate(InvalidationType.DATA);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
if (!_editable){
return;
};
inputField.restrict = _arg1;
}
protected function onTextInput(_arg1:Event):void{
_arg1.stopPropagation();
if (!_editable){
return;
};
editableValue = inputField.text;
selectedIndex = -1;
dispatchEvent(new Event(Event.CHANGE));
}
protected function onInputFieldFocus(_arg1:FocusEvent):void{
inputField.addEventListener(ComponentEvent.ENTER, onEnter, false, 0, true);
close();
}
public function getItemAt(_arg1:uint):Object{
return (list.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (ComboBox.createAccessibilityImplementation != null){
ComboBox.createAccessibilityImplementation(this);
};
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (getStyleValue("buttonWidth") as Number);
_local2 = (getStyleValue("textPadding") as Number);
background.setSize(width, height);
inputField.x = (inputField.y = _local2);
inputField.setSize(((width - _local1) - _local2), (height - _local2));
list.width = (isNaN(_dropdownWidth)) ? width : _dropdownWidth;
background.enabled = enabled;
background.drawNow();
}
public function removeItem(_arg1:Object):Object{
return (list.removeItem(_arg1));
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
public function get dataProvider():DataProvider{
return (list.dataProvider);
}
public function get textField():TextInput{
return (inputField);
}
protected function setStyles():void{
copyStylesToChild(background, BACKGROUND_STYLES);
copyStylesToChild(list, LIST_STYLES);
}
public function set labelFunction(_arg1:Function):void{
list.labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function drawTextFormat():void{
var _local1:TextFormat;
_local1 = (getStyleValue((_enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local1 == null){
_local1 = new TextFormat();
};
inputField.textField.defaultTextFormat = _local1;
inputField.textField.setTextFormat(_local1);
setEmbedFonts();
}
public function set selectedIndex(_arg1:int):void{
list.selectedIndex = _arg1;
highlightCell();
invalidate(InvalidationType.SELECTED);
}
public function close():void{
highlightCell();
highlightedCell = -1;
if (!isOpen){
return;
};
dispatchEvent(new Event(Event.CLOSE));
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick);
isOpen = false;
stage.removeChild(list);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, List.getStyleDefinition()));
}
}
}//package fl.controls
Section 10
//Label (fl.controls.Label)
package fl.controls {
import fl.core.*;
import fl.events.*;
import flash.text.*;
public class Label extends UIComponent {
protected var actualHeight:Number;
protected var _html:Boolean;// = false
protected var actualWidth:Number;
protected var defaultLabel:String;// = "Label"
protected var _savedHTML:String;
public var textField:TextField;
private static var defaultStyles:Object = {textFormat:null, embedFonts:false};
public function Label(){
defaultLabel = "Label";
_html = false;
super();
text = defaultLabel;
actualWidth = _width;
actualHeight = _height;
}
public function get autoSize():String{
return (textField.autoSize);
}
public function get selectable():Boolean{
return (textField.selectable);
}
public function set text(_arg1:String):void{
if (_arg1 == text){
return;
};
if (((componentInspectorSetting) && ((_arg1 == defaultLabel)))){
return;
};
_html = false;
textField.text = _arg1;
if (textField.autoSize != TextFieldAutoSize.NONE){
invalidate(InvalidationType.SIZE);
};
}
public function get wordWrap():Boolean{
return (textField.wordWrap);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
if (textField.autoSize != TextFieldAutoSize.NONE){
invalidate(InvalidationType.SIZE);
};
}
public function set selectable(_arg1:Boolean):void{
textField.selectable = _arg1;
}
public function set autoSize(_arg1:String):void{
textField.autoSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set wordWrap(_arg1:Boolean):void{
textField.wordWrap = _arg1;
if (textField.autoSize != TextFieldAutoSize.NONE){
invalidate(InvalidationType.SIZE);
};
}
override public function get height():Number{
if (((!((textField.autoSize == TextFieldAutoSize.NONE))) && (wordWrap))){
return (_height);
};
return (actualHeight);
}
public function set htmlText(_arg1:String):void{
if (_arg1 == htmlText){
return;
};
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
if (textField.autoSize != TextFieldAutoSize.NONE){
invalidate(InvalidationType.SIZE);
};
}
public function get text():String{
return (textField.text);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
if (textField.autoSize != TextFieldAutoSize.NONE){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
addChild(textField);
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
textField.wordWrap = false;
}
public function get htmlText():String{
return (textField.htmlText);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
actualWidth = _arg1;
actualHeight = _arg2;
super.setSize(_arg1, _arg2);
}
override public function set width(_arg1:Number):void{
actualWidth = _arg1;
super.width = _arg1;
}
protected function drawLayout():void{
var _local1:Boolean;
var _local2:Number;
var _local3:Number;
_local1 = false;
textField.width = width;
textField.height = height;
if (textField.autoSize != TextFieldAutoSize.NONE){
_local2 = textField.width;
_local3 = textField.height;
_local1 = ((!((_width == _local2))) || (!((_height == _local3))));
_width = _local2;
_height = _local3;
switch (textField.autoSize){
case TextFieldAutoSize.CENTER:
textField.x = ((actualWidth / 2) - (textField.width / 2));
break;
case TextFieldAutoSize.LEFT:
textField.x = 0;
break;
case TextFieldAutoSize.RIGHT:
textField.x = -((textField.width - actualWidth));
break;
};
} else {
textField.width = actualWidth;
textField.height = actualHeight;
textField.x = 0;
};
if (_local1){
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, true));
};
}
override public function get width():Number{
if (((!((textField.autoSize == TextFieldAutoSize.NONE))) && (!(wordWrap)))){
return (_width);
};
return (actualWidth);
}
protected function drawTextFormat():void{
var _local1:TextFormat;
var _local2:Object;
_local1 = (getStyleValue("textFormat") as TextFormat);
if (_local1 == null){
_local2 = UIComponent.getStyleDefinition();
_local1 = (enabled) ? (_local2.defaultTextFormat as TextFormat) : (_local2.defaultDisabledTextFormat as TextFormat);
};
textField.defaultTextFormat = _local1;
textField.setTextFormat(_local1);
if (((_html) && (!((_savedHTML == null))))){
htmlText = _savedHTML;
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 11
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 12
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.geom.*;
import flash.utils.*;
import flash.ui.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _iconField:String;// = "icon"
protected var _labelFunction:Function;
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function List(){
_rowHeight = 20;
_labelField = "label";
_iconField = "icon";
super();
}
public function get iconField():String{
return (_iconField);
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override protected function drawList():void{
var _local1:Rectangle;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local7:Dictionary;
var _local8:Dictionary;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
_local1 = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local2 = Math.floor((_verticalScrollPosition / rowHeight));
_local3 = Math.min(length, ((_local2 + rowCount) + 1));
_local7 = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
_local8 = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local6 = (activeCellRenderers.pop() as ICellRenderer);
_local5 = _local6.data;
if ((((_local7[_local5] == null)) || ((invalidItems[_local5] == true)))){
availableCellRenderers.push(_local6);
} else {
_local8[_local5] = _local6;
invalidItems[_local5] = true;
};
list.removeChild((_local6 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local4 = _local2;
while (_local4 < _local3) {
_local9 = false;
_local5 = _dataProvider.getItemAt(_local4);
if (_local8[_local5] != null){
_local9 = true;
_local6 = _local8[_local5];
delete _local8[_local5];
} else {
if (availableCellRenderers.length > 0){
_local6 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local6 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local12 = (_local6 as Sprite);
if (_local12 != null){
_local12.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local12.doubleClickEnabled = true;
_local12.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local12["setStyle"] != null){
for (_local13 in rendererStyles) {
var _local16 = _local12;
_local16["setStyle"](_local13, rendererStyles[_local13]);
};
};
};
};
};
list.addChild((_local6 as Sprite));
activeCellRenderers.push(_local6);
_local6.y = (rowHeight * (_local4 - _local2));
_local6.setSize((availableWidth + _maxHorizontalScrollPosition), rowHeight);
_local10 = itemToLabel(_local5);
_local11 = null;
if (_iconFunction != null){
_local11 = _iconFunction(_local5);
} else {
if (_iconField != null){
_local11 = _local5[_iconField];
};
};
if (!_local9){
_local6.data = _local5;
};
_local6.listData = new ListData(_local10, _local11, this, _local4, _local4, 0);
_local6.selected = !((_selectedIndices.indexOf(_local4) == -1));
if ((_local6 is UIComponent)){
(_local6 as UIComponent).drawNow();
};
_local4++;
};
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
scrollToSelected();
break;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
_arg1.stopPropagation();
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function draw():void{
var _local1:Boolean;
_local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (_cellRenderer != getStyleValue("cellRenderer")){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
};
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:uint;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 13
//NumericStepper (fl.controls.NumericStepper)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class NumericStepper extends UIComponent implements IFocusManagerComponent {
protected var upArrow:BaseButton;
protected var _stepSize:Number;// = 1
protected var downArrow:BaseButton;
protected var _value:Number;// = 1
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var _precision:Number;
protected var inputField:TextInput;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TEXT_INPUT_STYLES:Object = {upSkin:"upSkin", disabledSkin:"disabledSkin", textPadding:"textPadding", textFormat:"textFormat", disabledTextFormat:"disabledTextFormat", embedFonts:"embedFonts"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"NumericStepperDownArrow_disabledSkin", downArrowDownSkin:"NumericStepperDownArrow_downSkin", downArrowOverSkin:"NumericStepperDownArrow_overSkin", downArrowUpSkin:"NumericStepperDownArrow_upSkin", upArrowDisabledSkin:"NumericStepperUpArrow_disabledSkin", upArrowDownSkin:"NumericStepperUpArrow_downSkin", upArrowOverSkin:"NumericStepperUpArrow_overSkin", upArrowUpSkin:"NumericStepperUpArrow_upSkin", upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRect:null, focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35, embedFonts:false};
public function NumericStepper(){
_maximum = 10;
_minimum = 0;
_value = 1;
_stepSize = 1;
super();
setStyles();
stepSize = _stepSize;
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
};
}
public function get minimum():Number{
return (_minimum);
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
if (_value < _minimum){
setValue(_minimum, false);
};
}
public function get maximum():Number{
return (_maximum);
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == inputField)) || (super.isOurFocus(_arg1))));
}
public function get nextValue():Number{
var _local1:Number;
_local1 = (_value + _stepSize);
return ((inRange(_local1)) ? _local1 : _value);
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
if (_value > _maximum){
setValue(_maximum, false);
};
}
protected function setValue(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
if (_arg1 == _value){
return;
};
_local3 = _value;
_value = getValidValue(_arg1);
inputField.text = _value.toString();
if (_arg2){
dispatchEvent(new Event(Event.CHANGE, true));
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:Number;
if (!enabled){
return;
};
_arg1.stopImmediatePropagation();
_local2 = Number(inputField.text);
switch (_arg1.keyCode){
case Keyboard.END:
setValue(maximum);
break;
case Keyboard.HOME:
setValue(minimum);
break;
case Keyboard.UP:
setValue(nextValue);
break;
case Keyboard.DOWN:
setValue(previousValue);
break;
case Keyboard.ENTER:
setValue(_local2);
break;
};
}
override public function set enabled(_arg1:Boolean):void{
if (_arg1 == enabled){
return;
};
super.enabled = _arg1;
upArrow.enabled = (downArrow.enabled = (inputField.enabled = _arg1));
}
protected function onTextChange(_arg1:Event):void{
_arg1.stopImmediatePropagation();
}
public function get previousValue():Number{
var _local1:Number;
_local1 = (_value - _stepSize);
return ((inRange(_local1)) ? _local1 : _value);
}
protected function getValidValue(_arg1:Number):Number{
var _local2:Number;
if (isNaN(_arg1)){
return (_value);
};
_local2 = Number((_stepSize * Math.round((_arg1 / _stepSize))).toFixed(_precision));
if (_local2 > maximum){
return (maximum);
};
if (_local2 < minimum){
return (minimum);
};
return (_local2);
}
public function set value(_arg1:Number):void{
setValue(_arg1, false);
}
public function get stepSize():Number{
return (_stepSize);
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
protected function stepperPressHandler(_arg1:ComponentEvent):void{
setValue(Number(inputField.text), false);
switch (_arg1.currentTarget){
case upArrow:
setValue(nextValue);
break;
case downArrow:
setValue(previousValue);
};
inputField.setFocus();
inputField.textField.setSelection(0, 0);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
if (_arg1.eventPhase == 3){
setValue(Number(inputField.text));
};
super.focusOutHandler(_arg1);
}
protected function inRange(_arg1:Number):Boolean{
return ((((_arg1 >= _minimum)) && ((_arg1 <= _maximum))));
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
validate();
}
override protected function configUI():void{
super.configUI();
upArrow = new BaseButton();
copyStylesToChild(upArrow, UP_ARROW_STYLES);
upArrow.autoRepeat = true;
upArrow.setSize(21, 12);
upArrow.focusEnabled = false;
addChild(upArrow);
downArrow = new BaseButton();
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
downArrow.autoRepeat = true;
downArrow.setSize(21, 12);
downArrow.focusEnabled = false;
addChild(downArrow);
inputField = new TextInput();
copyStylesToChild(inputField, TEXT_INPUT_STYLES);
inputField.restrict = "0-9\\-\\.\\,";
inputField.text = _value.toString();
inputField.setSize(21, 24);
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(FocusEvent.FOCUS_IN, passEvent);
inputField.addEventListener(FocusEvent.FOCUS_OUT, passEvent);
addChild(inputField);
inputField.addEventListener(Event.CHANGE, onTextChange, false, 0, true);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, stepperPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, stepperPressHandler, false, 0, true);
}
public function get value():Number{
return (_value);
}
protected function inStep(_arg1:Number):Boolean{
return ((((_arg1 - _minimum) % _stepSize) == 0));
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (width - upArrow.width);
_local2 = (height / 2);
inputField.setSize(_local1, height);
upArrow.height = _local2;
downArrow.height = Math.floor(_local2);
downArrow.move(_local1, _local2);
upArrow.move(_local1, 0);
downArrow.drawNow();
upArrow.drawNow();
inputField.drawNow();
}
override public function setFocus():void{
if (stage){
stage.focus = inputField.textField;
};
}
protected function getPrecision():Number{
var _local1:String;
_local1 = _stepSize.toString();
if (_local1.indexOf(".") == -1){
return (0);
};
return (_local1.split(".").pop().length);
}
public function get textField():TextInput{
return (inputField);
}
public function set stepSize(_arg1:Number):void{
_stepSize = _arg1;
_precision = getPrecision();
setValue(_value);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
copyStylesToChild(inputField, TEXT_INPUT_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 14
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 15
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 16
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 17
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import fl.containers.*;
import flash.ui.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 18
//Slider (fl.controls.Slider)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 19
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 20
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 21
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 22
//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 23
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 24
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
//unresolved jump
};
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
throw (new TypeError((("Error: Type Coercion failed: cannot convert " + _arg1) + " to Array or DataProvider.")));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (data.length);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 25
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 26
//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 27
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 28
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 29
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 30
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 31
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 32
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 33
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 34
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 35
//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 36
//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 37
//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 38
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 39
//BooleanArray (MathPackage.BooleanArray)
package MathPackage {
public class BooleanArray {
private var array:Array;
private var changedPoints:Array;
private var wid;
private var hei:int;
public function BooleanArray(_arg1:int, _arg2:int){
var _local4:int;
super();
array = new Array();
changedPoints = new Array();
wid = _arg1;
hei = _arg2;
var _local3:int;
while (_local3 < _arg1) {
array[_local3] = new Array();
_local4 = 0;
while (_local4 < _arg2) {
array[_local3][_local4] = false;
_local4++;
};
_local3++;
};
}
public function getBool(_arg1:int, _arg2:int):Boolean{
if (inRange(_arg1, _arg2)){
return (array[_arg1][_arg2]);
};
return (false);
}
public function inRange(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 < 0)) || ((_arg1 >= wid)))) || ((_arg2 < 0)))) || ((_arg2 >= hei)))){
return (false);
};
return (true);
}
public function setBool(_arg1:int, _arg2:int, _arg3:Boolean){
if (inRange(_arg1, _arg2)){
array[_arg1][_arg2] = _arg3;
changedPoints.push(new IntPoint(_arg1, _arg2));
};
}
public function clearChanges(){
var _local1:IntPoint;
while (changedPoints.length > 0) {
_local1 = changedPoints[0];
array[_local1.getIntX()][_local1.getIntY()] = false;
changedPoints.shift();
};
}
}
}//package MathPackage
Section 40
//Calc (MathPackage.Calc)
package MathPackage {
public class Calc {
private static const ranList:RandomList = new RandomList(100000);
public static function distanceCalc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt((Math.pow((_arg3 - _arg1), 2) + Math.pow((_arg4 - _arg2), 2))));
}
public static function nextListRandom():Number{
return (ranList.nextDouble());
}
public static function nextListBool():Boolean{
return (ranList.nextBoolean());
}
public static function compareRadians(_arg1:Number, _arg2:Number):Number{
if (Math.abs((_arg1 - _arg2)) > Math.PI){
return (Math.abs((_arg1 - (Math.PI - (Math.PI - _arg2)))));
};
return (Math.abs((_arg1 - _arg2)));
}
public static function toDegree(_arg1:Number):Number{
return ((_arg1 * (180 / Math.PI)));
}
public static function toRadian(_arg1:Number):Number{
return ((_arg1 * (Math.PI / 180)));
}
public static function bresCircleFill(_arg1:int, _arg2:int, _arg3:int):Array{
var _local6:Array;
var _local4:Array = new Array();
var _local5 = 1;
while (_local5 <= _arg3) {
_local6 = bresCircle(_arg1, _arg2, _local5);
while (_local6.length > 0) {
_local4.push(_local6.pop());
};
_local5++;
};
return (_local4);
}
public static function bresCircle(_arg1:int, _arg2:int, _arg3:int):Array{
var _local4:Array = new Array();
var _local5:int = (1 - _arg3);
var _local6 = 1;
var _local7:int = (-2 * _arg3);
var _local8:int;
var _local9:int = _arg3;
_local4.push(new IntPoint(_arg1, (_arg2 + _arg3)));
_local4.push(new IntPoint(_arg1, (_arg2 - _arg3)));
_local4.push(new IntPoint((_arg1 + _arg3), _arg2));
_local4.push(new IntPoint((_arg1 - _arg3), _arg2));
while (_local8 < _local9) {
if (_local5 >= 0){
_local9--;
_local7 = (_local7 + 2);
_local5 = (_local5 + _local7);
};
_local8++;
_local6 = (_local6 + 2);
_local5 = (_local5 + _local6);
_local4.push(new IntPoint((_arg1 + _local8), (_arg2 + _local9)));
_local4.push(new IntPoint((_arg1 - _local8), (_arg2 + _local9)));
_local4.push(new IntPoint((_arg1 + _local8), (_arg2 - _local9)));
_local4.push(new IntPoint((_arg1 - _local8), (_arg2 - _local9)));
_local4.push(new IntPoint((_arg1 + _local9), (_arg2 + _local8)));
_local4.push(new IntPoint((_arg1 - _local9), (_arg2 + _local8)));
_local4.push(new IntPoint((_arg1 + _local9), (_arg2 - _local8)));
_local4.push(new IntPoint((_arg1 - _local9), (_arg2 - _local8)));
};
return (_local4);
}
public static function bresLine(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Array{
var _local18:int;
var _local19:int;
var _local5:Array = new Array();
var _local6:int = _arg1;
var _local7:int = _arg3;
var _local8:int = _arg2;
var _local9:int = _arg4;
var _local10:Boolean;
var _local11:Boolean;
if (Math.abs((_local9 - _local8)) > Math.abs((_local7 - _local6))){
_local10 = true;
};
if (_local10){
_local6 = _arg2;
_local8 = _arg1;
_local7 = _arg4;
_local9 = _arg3;
};
if (_local6 > _local7){
_local18 = _local6;
_local6 = _local7;
_local7 = _local18;
_local19 = _local8;
_local8 = _local9;
_local9 = _local19;
_local11 = true;
};
var _local12:int = (_local7 - _local6);
var _local13:int = Math.abs((_local9 - _local8));
var _local14:int = (_local12 / 2);
var _local15:int;
var _local16:int = _local8;
if (_local8 < _local9){
_local15 = 1;
} else {
_local15 = -1;
};
var _local17:int = _local6;
while (_local17 <= _local7) {
if (_local10){
_local5.push(new IntPoint(_local16, _local17));
} else {
_local5.push(new IntPoint(_local17, _local16));
};
_local14 = (_local14 - _local13);
if (_local14 < 0){
_local16 = (_local16 + _local15);
_local14 = (_local14 + _local12);
};
_local17++;
};
if (!_local11){
_local5.reverse();
};
return (_local5);
}
}
}//package MathPackage
Section 41
//IntegerArray (MathPackage.IntegerArray)
package MathPackage {
public class IntegerArray {
private var array:Array;
private var wid;
private var hei:int;
public function IntegerArray(_arg1:int, _arg2:int){
var _local4:int;
super();
array = new Array();
wid = _arg1;
hei = _arg2;
var _local3:int;
while (_local3 < wid) {
array[_local3] = new Array();
_local4 = 0;
while (_local4 < hei) {
array[_local3][_local4] = 0;
_local4++;
};
_local3++;
};
}
public function inRange(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 < 0)) || ((_arg1 >= wid)))) || ((_arg2 < 0)))) || ((_arg2 >= hei)))){
return (false);
};
return (true);
}
public function setNumber(_arg1:int, _arg2:int, _arg3:int){
if (inRange(_arg1, _arg2)){
array[_arg1][_arg2] = _arg3;
};
}
public function getNumber(_arg1:int, _arg2:int):int{
if (inRange(_arg1, _arg2)){
return (array[_arg1][_arg2]);
};
return (0);
}
public function getNumber_Point(_arg1:IntPoint):int{
if (inRange(_arg1.getIntX(), _arg1.getIntY())){
return (array[_arg1.getIntX()][_arg1.getIntY()]);
};
return (0);
}
}
}//package MathPackage
Section 42
//IntPoint (MathPackage.IntPoint)
package MathPackage {
public class IntPoint {
private var intX;
private var intY:int;
public function IntPoint(_arg1:int, _arg2:int){
this.intX = _arg1;
this.intY = _arg2;
}
public function equalsPoint(_arg1:IntPoint){
this.intX = _arg1.getNumX();
this.intY = _arg1.getNumY();
}
public function getNumX():int{
return (intX);
}
public function getNumY():int{
return (intY);
}
public function getX():int{
return (intX);
}
public function getY():int{
return (intY);
}
public function getIntX():int{
return (intX);
}
public function getIntY():int{
return (intY);
}
public function addX(_arg1:int){
this.intX = (this.intX + _arg1);
}
public function addY(_arg1:int){
this.intY = (this.intY + _arg1);
}
public function setX(_arg1:int){
this.intX = _arg1;
}
public function setY(_arg1:int){
this.intY = _arg1;
}
}
}//package MathPackage
Section 43
//IntVector (MathPackage.IntVector)
package MathPackage {
public class IntVector {
private var xNum;
private var yNum:Number;
private var intX;
private var intY:int;
public function IntVector(_arg1:Number, _arg2:Number){
xNum = _arg1;
yNum = _arg2;
calculateIntegers();
}
public function addVector(_arg1:IntVector){
xNum = (xNum + _arg1.xNum);
yNum = (yNum + _arg1.yNum);
calculateIntegers();
}
public function setVector(_arg1:IntVector){
xNum = _arg1.xNum;
yNum = _arg1.yNum;
calculateIntegers();
}
public function multiplyVector(_arg1:Number){
xNum = (xNum * _arg1);
yNum = (yNum * _arg1);
calculateIntegers();
}
public function setMagnitude(_arg1:Number){
var _local2:Number = getRotation();
xNum = Math.cos(_local2);
yNum = Math.sin(_local2);
xNum = (xNum * _arg1);
yNum = (yNum * _arg1);
calculateIntegers();
}
public function setRotation(_arg1:Number){
if (_arg1 > (Math.PI * 2)){
_arg1 = (_arg1 - (Math.PI * 2));
};
if (_arg1 < 0){
_arg1 = (_arg1 + (Math.PI * 2));
};
var _local2:Number = getMagnitude();
xNum = Math.cos(_arg1);
yNum = Math.sin(_arg1);
setMagnitude(_local2);
calculateIntegers();
}
public function setDirection(_arg1:Number){
if (_arg1 > (Math.PI * 2)){
_arg1 = (_arg1 - (Math.PI * 2));
};
if (_arg1 < 0){
_arg1 = (_arg1 + (Math.PI * 2));
};
var _local2:Number = getMagnitude();
xNum = Math.cos(_arg1);
yNum = Math.sin(_arg1);
setMagnitude(_local2);
calculateIntegers();
}
public function getMagnitude():Number{
return (Calc.distanceCalc(0, 0, xNum, yNum));
}
public function getRotation():Number{
var _local1:Number = Math.atan2(yNum, xNum);
return (_local1);
}
private function calculateIntegers(){
intX = (Math.round(xNum) as int);
intY = (Math.round(yNum) as int);
}
public function setX(_arg1:Number){
xNum = _arg1;
intX = (Math.round(xNum) as int);
}
public function setY(_arg1:Number){
yNum = _arg1;
intY = (Math.round(yNum) as int);
}
public function getXNum():Number{
return (xNum);
}
public function getYNum():Number{
return (yNum);
}
public function getX():Number{
return (xNum);
}
public function getY():Number{
return (yNum);
}
public function getIntX():int{
return (intX);
}
public function getIntY():int{
return (intY);
}
public function test(){
if (xNum < 0.01){
xNum = 0;
};
if (yNum < 0.01){
yNum = 0;
};
}
}
}//package MathPackage
Section 44
//RandomList (MathPackage.RandomList)
package MathPackage {
public class RandomList {
public var ranArray:Array;
public var arrayLength:int;
public var arrayCount:int;
public var boolArray:Array;
public var boolCount:int;
public function RandomList(_arg1:int){
ranArray = new Array(_arg1);
boolArray = new Array(_arg1);
arrayLength = _arg1;
arrayCount = 0;
boolCount = 0;
var _local2:int;
while (_local2 < arrayLength) {
ranArray[_local2] = Math.random();
if (ranArray[_local2] > 0.5){
boolArray[_local2] = true;
} else {
boolArray[_local2] = false;
};
_local2++;
};
}
public function nextDouble():Number{
if (arrayCount == arrayLength){
arrayCount = 0;
};
arrayCount++;
return (ranArray[(arrayCount - 1)]);
}
public function nextBoolean():Boolean{
if (boolCount == arrayLength){
boolCount = 0;
};
boolCount++;
return (boolArray[(boolCount - 1)]);
}
public function nGausses(_arg1:int, _arg2:Number):void{
var _local3:int;
while (_arg1 > _local3) {
_local3++;
};
}
public function nextGauss(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
if (_arg1 >= 0){
while (true) {
_local2 = nextDouble();
_local3 = ((_local2 - 0.5) * 12);
_local4 = ((1 / Math.sqrt(((2 * Math.PI) * _arg1))) * Math.pow(Math.E, -(((_local3 * _local3) / (2 * _arg1)))));
if (_local4 > nextDouble()){
return (_local2);
};
};
} else {
while (true) {
_local2 = nextDouble();
_local3 = ((_local2 - 0.5) * 12);
_local4 = ((1 / Math.sqrt(((2 * Math.PI) * -(_arg1)))) * Math.pow(Math.E, -(((_local3 * _local3) / (2 * -(_arg1))))));
if (_local4 > nextDouble()){
if (_local2 > 0.5){
return ((_local2 - 0.5));
};
return ((_local2 + 0.5));
};
};
};
return (0);
}
}
}//package MathPackage
Section 45
//Acid (Acid)
package {
import MathPackage.*;
public class Acid extends Liquid {
private static const ACID_SPEC_HEAT = 1.95;
private static const ACID_TRAN_HEAT = 0.53;
private static const DELETE_CHANCE = 0.7;
private static const SELF_DELETE = 0.15;
private static const ACID_COLOR:uint = 14679808;
public function Acid(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.ACID;
pColor = ACID_COLOR;
}
override public function specHeat():Number{
return (ACID_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ACID_TRAN_HEAT);
}
private function dissolve(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if (((((((((!((_local5.phase == SPECIAL))) && (!((_local5.number == ACID))))) && (!((_local5.number == ACIDMAKER))))) && (!(_local5.deleteParticle)))) && (!(created)))){
if (Calc.nextListRandom() < DELETE_CHANCE){
if ((((_local5.phase == Particle.SOLID)) && ((Calc.nextListRandom() > (1 / _local5.strength()))))){
} else {
if ((Calc.nextListRandom() - (_local5.strength() / 10)) < SELF_DELETE){
deleteParticle = true;
};
_local5.deleteParticle = true;
};
};
};
};
_local2++;
};
_local1++;
};
}
override public function simulate(){
transferHeat();
dissolve();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 46
//AcidMaker (AcidMaker)
package {
import MathPackage.*;
public class AcidMaker extends Solid {
private static const ACID_CHANCE = 0.4;
private static const AM_SPEC_HEAT = 30;
private static const AM_TRAN_HEAT = 0.1;
private static const AM_COLOR = 11390208;
public function AcidMaker(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = ACIDMAKER;
pColor = AM_COLOR;
temp = 300;
}
override public function specHeat():Number{
return (AM_SPEC_HEAT);
}
override public function tranHeat():Number{
return (AM_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function pour(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (Calc.nextListRandom() < ACID_CHANCE){
field.addParticle_Par(new Acid(_local2, _local3, field));
};
};
};
_local1++;
};
}
override public function simulate(){
pour();
checkDelete();
drawParticle();
}
}
}//package
Section 47
//Adamantium (Adamantium)
package {
public class Adamantium extends Solid {
private static const AD_COLOR:uint = 6782085;
public function Adamantium(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.ADAMANTIUM;
pColor = AD_COLOR;
}
override public function strength():Number{
return (10000000000);
}
override public function simulate(){
checkDelete();
drawParticle();
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (field.deleteArray.getBool(loc.getIntX(), loc.getIntY())){
deleteParticle = true;
} else {
if (!field.inBounds_Par(this)){
deleteParticle = true;
};
};
};
}
}
}//package
Section 48
//Ant (Ant)
package {
import MathPackage.*;
public class Ant extends Powder {
public var eaten:Boolean;
public var lastEaten;
public var deadTime;
public var dead:Boolean;
private static const ANT_SPEC_HEAT = 2;
private static const ANT_TRAN_HEAT = 0.2;
private static const DEATH_TEMP = 350;
private static const FREEZE_TEMP = 200;
private static const ANT_COLOR:uint = 7875840;
private static const DEAD_ANT_COLOR:uint = 4268800;
private static const EAT_CHANCE = 0.45;
public function Ant(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = ANT;
pColor = ANT_COLOR;
size = 0.15;
eaten = false;
lastEaten = 10;
dead = false;
deadTime = 0;
}
override public function specHeat():Number{
return (ANT_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ANT_TRAN_HEAT);
}
public function beAnt(){
var _local1:Number = Calc.nextListRandom();
var _local2:int;
var _local3:int;
if (_local1 < 0.25){
_local2 = 1;
_local3 = 1;
eatStuff(_local2, _local3);
_local2 = 0;
_local3 = 1;
eatStuff(_local2, _local3);
} else {
if ((((_local1 >= 0.25)) && ((_local1 < 0.5)))){
_local2 = -1;
_local3 = 1;
eatStuff(_local2, _local3);
_local2 = -1;
_local3 = 0;
eatStuff(_local2, _local3);
} else {
if ((((_local1 >= 0.5)) && ((_local1 < 0.75)))){
_local2 = -1;
_local3 = -1;
eatStuff(_local2, _local3);
_local2 = 0;
_local3 = -1;
eatStuff(_local2, _local3);
} else {
_local2 = 1;
_local3 = -1;
eatStuff(_local2, _local3);
_local2 = 1;
_local3 = 0;
eatStuff(_local2, _local3);
};
};
};
}
public function eatStuff(_arg1:int, _arg2:int){
var _local5:Particle;
var _local6:Number;
var _local3:int = (loc.getIntX() + _arg1);
var _local4:int = (loc.getIntY() + _arg2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if ((((((((((((_local5.number == PLANT)) || ((_local5.number == DEAD_PLANT)))) || ((_local5.number == FLOWER)))) || ((_local5.number == LEAF)))) || ((_local5.number == WOOD)))) || ((((_local5.number == SEED)) && (!(eaten)))))){
eaten = true;
lastEaten = 0;
_local6 = EAT_CHANCE;
if (((((((_arg1 + _arg2) == 2)) || (((_arg1 + _arg2) == -2)))) || (((_arg1 + _arg2) == 0)))){
_local6 = (_local6 / 2);
};
if (Calc.nextListRandom() < _local6){
field.particleArray.unwrite(this);
loc.setX(_local3);
loc.setY(_local4);
field.particleArray.write(this);
_local5.deleteParticle = true;
return;
};
};
};
}
override public function simulate(){
if ((((temp > DEATH_TEMP)) || ((temp < FREEZE_TEMP)))){
dead = true;
pColor = DEAD_ANT_COLOR;
number = DEAD_ANT;
eaten = false;
};
transferHeat();
if (!dead){
beAnt();
} else {
deadTime++;
};
if (deadTime > 60){
deleteParticle = true;
};
checkDelete();
if (!eaten){
moveParticle();
};
drawParticle();
lastEaten++;
if (lastEaten > 10){
eaten = false;
};
}
}
}//package
Section 49
//Ash (Ash)
package {
import MathPackage.*;
public class Ash extends Powder {
private var life:int;
private static const ASH_SPEC_HEAT = 1.2;
private static const ASH_TRAN_HEAT = 0.3;
private static const ASH_COLOR:uint = 4999239;
public function Ash(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.ASH;
pColor = ASH_COLOR;
life = (Calc.nextListRandom() * 800);
temp = 400;
size = 0.75;
}
override public function specHeat():Number{
return (ASH_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ASH_TRAN_HEAT);
}
override public function getLife():int{
return (life);
}
override public function setLife(_arg1:int){
life = _arg1;
}
override public function simulate(){
life--;
if (life < 0){
deleteParticle = true;
};
transferHeat();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 50
//AssetHolder (AssetHolder)
package {
import flash.display.*;
public dynamic class AssetHolder extends MovieClip {
}
}//package
Section 51
//Bee (Bee)
package {
import MathPackage.*;
public class Bee extends Powder {
public var dead:Boolean;
public var deadTime:int;
public var foundPlant:Boolean;
private var destX;
private var destY:int;
private static const BEE_SPEC_HEAT = 2;
private static const BEE_TRAN_HEAT = 0.9;
private static const DEATH_TEMP = 350;
private static const FREEZE_TEMP = 200;
private static const BEE_COLOR:uint = 16448000;
private static const DEAD_BEE_COLOR:uint = 11842560;
private static const NEW_DEST:Number = 0.05;
private static const POL_CHANCE = 0.1;
public function Bee(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = BEE;
pColor = BEE_COLOR;
size = 0.25;
dead = false;
deadTime = 0;
findDestination();
foundPlant = false;
if (isTherePlant()){
foundPlant = true;
};
}
private function canPollinate(_arg1:Particle){
if ((((_arg1.number == PLANT)) || ((_arg1.number == LEAF)))){
return (true);
};
return (false);
}
private function isTherePlant():Boolean{
var _local1:Particle = field.particleArray.getParticle(destX, destY);
if ((((_local1.number == PLANT)) || ((_local1.number == LEAF)))){
return (true);
};
return (false);
}
private function nextPoint():IntPoint{
var _local1:int = (destX - getX());
var _local2:int = (destY - getY());
var _local3:Number = Math.atan2(_local2, _local1);
if (_local1 > 1){
_local1 = 1;
};
if (_local1 < -1){
_local1 = -1;
};
if (_local2 > 1){
_local2 = 1;
};
if (_local2 < -1){
_local2 = -1;
};
if (Calc.nextListRandom() > Math.abs(Math.cos(_local3))){
_local1 = 0;
};
if (Calc.nextListRandom() > Math.abs(Math.sin(_local3))){
_local2 = 0;
};
return (new IntPoint(_local1, _local2));
}
private function findDestination(){
destX = (Calc.nextListRandom() * field.fieldWidth);
destY = (Calc.nextListRandom() * field.fieldHeight);
}
override public function specHeat():Number{
return (BEE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (BEE_TRAN_HEAT);
}
public function beBee(){
field.particleArray.unwrite(this);
if (foundPlant){
} else {
if (Calc.nextListRandom() < NEW_DEST){
findDestination();
if (isTherePlant()){
foundPlant = true;
} else {
foundPlant = false;
};
};
};
var _local1:IntPoint = nextPoint();
var _local2:int = (getX() + _local1.getX());
var _local3:int = (getY() + _local1.getY());
var _local4:Particle = field.particleArray.getParticle(_local2, _local3);
if ((((((((_local4.number == PLANT)) || ((_local4.number == FLOWER)))) || ((_local4.number == LEAF)))) || ((_local4.number == WOOD)))){
if (Calc.nextListRandom() < POL_CHANCE){
if (canPollinate(_local4)){
pollinate(_local2, _local3);
findDestination();
if (isTherePlant()){
foundPlant = true;
} else {
foundPlant = false;
};
} else {
loc.setX(_local2);
loc.setY(_local3);
};
} else {
loc.setX(_local2);
loc.setY(_local3);
};
} else {
if (_local4.phase <= 1){
loc.setX(_local2);
loc.setY(_local3);
} else {
findDestination();
if (isTherePlant()){
foundPlant = true;
} else {
foundPlant = false;
};
};
};
if ((((getX() == destX)) && ((getY() == destY)))){
findDestination();
if (isTherePlant()){
foundPlant = true;
} else {
foundPlant = false;
};
};
var _local5:Boolean;
if (getX() < 0){
loc.setX(0);
_local5 = true;
};
if (getX() >= field.fieldWidth){
loc.setX((field.fieldWidth - 1));
_local5 = true;
};
if (getY() < 0){
loc.setY(0);
_local5 = true;
};
if (getY() >= field.fieldHeight){
loc.setY((field.fieldHeight - 1));
_local5 = true;
};
if (_local5){
findDestination();
if (isTherePlant()){
foundPlant = true;
} else {
foundPlant = false;
};
};
field.particleArray.write(this);
}
private function pollinate(_arg1:int, _arg2:int){
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Particle;
var _local3 = -2;
while (_local3 <= 2) {
_local4 = -2;
while (_local4 <= 2) {
_local5 = (loc.getIntX() + _local3);
_local6 = (loc.getIntY() + _local4);
if (field.inBounds(_local5, _local6)){
_local7 = field.particleArray.getParticle(_local5, _local6);
if (_local7.number == FLOWER){
return;
};
};
_local4++;
};
_local3++;
};
field.particleArray.getParticle(_arg1, _arg2).deleteParticle = true;
field.addParticle_Par(new Flower(_arg1, _arg2, field));
}
override public function simulate(){
if ((((temp > DEATH_TEMP)) || ((temp < FREEZE_TEMP)))){
dead = true;
pColor = DEAD_BEE_COLOR;
number = DEAD_BEE;
};
transferHeat();
if (!dead){
beBee();
} else {
deadTime++;
};
if (deadTime > 60){
deleteParticle = true;
};
checkDelete();
if (dead){
moveParticle();
};
drawParticle();
}
}
}//package
Section 52
//BigWaterSound (BigWaterSound)
package {
import flash.media.*;
public dynamic class BigWaterSound extends Sound {
}
}//package
Section 53
//Blood (Blood)
package {
import MathPackage.*;
public class Blood extends Liquid {
private var life:int;
private static const BLOOD_SPEC_HEAT = 12;
private static const BLOOD_TRAN_HEAT = 0.9;
private static const BLOOD_COLOR:uint = 8192000;
public function Blood(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.BLOOD;
pColor = BLOOD_COLOR;
life = (Calc.nextListRandom() * 800);
temp = 300;
MAX_VISC = 5;
}
override public function specHeat():Number{
return (BLOOD_SPEC_HEAT);
}
override public function tranHeat():Number{
return (BLOOD_TRAN_HEAT);
}
override public function getLife():int{
return (life);
}
override public function setLife(_arg1:int){
life = _arg1;
}
override public function simulate(){
life--;
if (life < 0){
deleteParticle = true;
};
transferHeat();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 54
//BlueFire (BlueFire)
package {
import MathPackage.*;
public class BlueFire extends Special {
public const HIGHEST_TEMP = 4000;
public const HIGH_TEMP = 3700;
public const LOW_TEMP = 3500;
public const LOWEST_TEMP = 3000;
private const SPREAD = 1;
private const TRANS = 0.7;
private const DELETE_CHANCE = 0.01;
private const FIRE_SPEC_HEAT = 3;
private const FIRE_TRAN_HEAT = 0.7;
private const FIRE_COLOR_HIGH:uint = 16777215;
private const FIRE_COLOR_MID:uint = 32767;
private const FIRE_COLOR_LOW:uint = 255;
private var life:int;
public function BlueFire(_arg1:int, _arg2:int, _arg3:Field, _arg4:int){
super(_arg1, _arg2, _arg3);
number = BLUE_FIRE;
if (_arg4 == 0){
this.temp = (int(((HIGHEST_TEMP - HIGH_TEMP) * Calc.nextListRandom())) + HIGH_TEMP);
} else {
this.temp = _arg4;
};
setColor();
stuff();
}
public function stuff(){
life = 2;
}
override public function specHeat():Number{
return (FIRE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (FIRE_TRAN_HEAT);
}
private function redirectParticle(_arg1:int, _arg2:int){
life--;
}
public function getMagnitude():Number{
if (temp > HIGHEST_TEMP){
return (((HIGHEST_TEMP - LOWEST_TEMP) / 100));
};
if (((temp - LOWEST_TEMP) / 100) > 1){
return (((temp - LOWEST_TEMP) / 100));
};
return (1);
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Particle;
field.particleArray.unwrite(this);
if (field.inBounds_Par(this)){
_local1 = getMagnitude();
_local2 = 1;
while (_local2 <= _local1) {
_local3 = loc.getIntX();
_local4 = (loc.getIntY() - 1);
_local5 = field.particleArray.getCollision(_local3, _local4);
_local6 = field.particleArray.getParticle(_local3, _local4);
if (_local5 == 0){
loc.addY(-1);
} else {
life--;
if (_local6.temp < temp){
transferHeat_Par(this, _local6);
};
if ((((((_local6.phase == SOLID)) && ((_local6.strength() < 5)))) && (!((_local6.number == MIRROR))))){
if (Calc.nextListRandom() > 0.5){
_local6.deleteParticle = true;
};
};
};
_local2++;
};
} else {
life--;
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
override public function simulate(){
if (life <= 0){
this.deleteParticle = true;
};
checkDelete();
setColor();
handleTemp();
moveParticle();
drawParticle();
}
public function handleTemp(){
temp = int((temp - (0.05 * (temp - field.DEFAULT_TEMP))));
if (temp < LOWEST_TEMP){
deleteParticle = true;
};
}
public function setColor(){
if (temp < LOW_TEMP){
pColor = FIRE_COLOR_LOW;
};
if (temp > HIGH_TEMP){
pColor = FIRE_COLOR_HIGH;
};
if ((((temp < HIGH_TEMP)) && ((temp > LOW_TEMP)))){
pColor = FIRE_COLOR_MID;
};
}
}
}//package
Section 55
//Bullet (Bullet)
package {
import MathPackage.*;
public class Bullet extends Special {
private var destX;
private var destY:int;
private var deltax:int;
private var deltay:int;
private var error:int;
private var ystep:int;
private var steep;
private var reverse:Boolean;
private var x0;
private var y0;
private var x1;
private var y1:int;
private var startX;
private var startY;
private var drawX;
private var drawY:int;
private var hit;
private var kill;
private var sparked:Boolean;
private var hitParticle:Particle;
private var power;
private var speed:int;
private var killCount:int;
private static const BULLET_COLOR:uint = 16777190;
private static const SPARK_MIN = 2000;
private static const SPARK_MAX = 2500;
private static const DRAW_LENGTH = 10;
public function Bullet(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Field){
var _local8:int;
var _local9:int;
power = 40;
speed = (40 + ((Calc.nextListRandom() - 0.5) * 20));
killCount = 0;
kill = true;
sparked = false;
super(_arg1, _arg2, _arg5);
drawX = _arg1;
drawY = _arg2;
number = BULLET;
temp = 300;
pColor = BULLET_COLOR;
hit = false;
startX = _arg1;
startY = _arg2;
var _local6:Number = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
var _local7:IntVector = new IntVector(250, 300);
_local7.setRotation((_local6 + ((Calc.nextListRandom() - 0.5) / 10)));
destX = (_local7.getIntX() + loc.getX());
destY = (_local7.getIntY() + loc.getY());
x0 = destX;
x1 = _arg1;
y0 = destY;
y1 = _arg2;
steep = false;
if (Math.abs((y1 - y0)) > Math.abs((x1 - x0))){
steep = true;
};
if (steep){
x0 = destY;
y0 = destX;
x1 = _arg2;
y1 = _arg1;
};
reverse = true;
if (x0 > x1){
_local8 = x0;
x0 = x1;
x1 = _local8;
_local9 = y0;
y0 = y1;
y1 = _local9;
reverse = false;
};
deltax = (x1 - x0);
deltay = Math.abs((y1 - y0));
error = (deltax / 2);
ystep = 0;
_arg2 = y0;
if (y0 < y1){
ystep = 1;
} else {
ystep = -1;
};
}
override public function setLife(_arg1:int){
power = _arg1;
}
override public function force():Number{
return (power);
}
public function nextBresPoint():IntPoint{
if (!reverse){
error = (error - deltay);
if (error < 0){
y0 = (y0 + ystep);
error = (error + deltax);
};
x0++;
if (steep){
return (new IntPoint(y0, x0));
};
return (new IntPoint(x0, y0));
//unresolved jump
};
error = (error - deltay);
if (error < 0){
y1 = (y1 - ystep);
error = (error + deltax);
};
x1--;
if (steep){
return (new IntPoint(y1, x1));
};
return (new IntPoint(x1, y1));
}
override public function drawParticle(){
if (!deleteParticle){
field.drawLine((drawX * 2), (drawY * 2), (loc.getIntX() * 2), (loc.getIntY() * 2), pColor);
};
}
override public function moveParticle(){
var _local4:int;
var _local5:Particle;
var _local6:IntPoint;
field.particleArray.unwrite(this);
startY = getY();
startX = getX();
sparked = false;
var _local1:int = startY;
var _local2:int = startX;
var _local3:int;
while (((!(hit)) && ((_local3 < speed)))) {
_local3++;
if (_local3 == DRAW_LENGTH){
drawX = getX();
drawY = getY();
};
if (kill){
_local6 = nextBresPoint();
_local1 = _local6.getY();
_local2 = _local6.getX();
};
kill = false;
_local4 = field.particleArray.getCollision(_local2, _local1);
_local5 = field.particleArray.getParticle(_local2, _local1);
if ((((_local4 == SPECIAL)) || ((_local4 == GAS)))){
kill = true;
loc.setX(_local2);
loc.setY(_local1);
} else {
hitParticle = field.particleArray.getParticle(_local2, _local1);
hit = true;
killCount++;
while (((!(kill)) && ((power > 0)))) {
power--;
transferHeat();
hit = false;
};
};
};
field.particleArray.write(this);
}
public function getSparkTemp():int{
return (int((SPARK_MIN + ((SPARK_MAX - SPARK_MIN) * Calc.nextListRandom()))));
}
override public function transferHeat(){
var _local1:Particle;
if (((hit) && (!((hitParticle.number == NULLPARTICLE))))){
_local1 = hitParticle;
if (_local1.isExplosive()){
_local1.burn();
kill = true;
};
if ((((((_local1.number == STEEL)) || ((_local1.number == ADAMANTIUM)))) && (!(sparked)))){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
sparked = true;
};
if (Calc.nextListRandom() < 0.05){
} else {
if (_local1.strength() < power){
if (Calc.nextListRandom() < 0.5){
power = (power - _local1.strength());
};
kill = true;
_local1.setLife((_local1.getLife() - 80));
hitParticle.deleteParticle = true;
};
};
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (field.deleteArray.getBool(loc.getIntX(), loc.getIntY())){
deleteParticle = true;
} else {
if (!field.inBounds(getX(), getY())){
deleteParticle = true;
};
};
};
}
override public function simulate(){
checkDelete();
if (kill){
moveParticle();
drawParticle();
deleteParticle = false;
return;
};
if (power > 0){
kill = true;
};
if (kill == false){
deleteParticle = true;
};
}
}
}//package
Section 56
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 57
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 58
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 59
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 60
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 61
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 62
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 63
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 64
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 65
//C4 (C4)
package {
import MathPackage.*;
public class C4 extends Solid {
private var burnTime:int;
private static const BURN_TEMP = 500;
private static const BURN_MIN = 1600;
private static const BURN_MAX = 2100;
private static const C4_SPEC_HEAT = 0.6;
private static const C4_TRAN_HEAT = 0.5;
private static const C4_COLOR:uint = 14771220;
private static const C4_POWER = 5.3;
public function C4(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = C4;
pColor = C4_COLOR;
burnTime = 1;
}
override public function simulate(){
transferHeat();
if (temp > BURN_TEMP){
burn2();
};
checkDelete();
drawParticle();
}
override public function isExplosive():Boolean{
return (true);
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
if (burnTime > 0){
if (field.particleArray.explode == ParticleArray.EXPLOSION_MAX){
temp = getFireTemp();
_local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (((((field.inBounds(_local3, _local4)) && (!((_local1 == 0))))) && (!((_local2 == 0))))){
_local5 = field.particleArray.getParticle(_local3, _local4);
if (_local5.number == C4){
_local5.temp = temp;
};
};
_local2++;
};
_local1++;
};
return;
};
temp = getFireTemp();
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, C4_POWER));
burnTime--;
field.ser.C4Explosion++;
};
}
private function burn2(){
if (burnTime > 0){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, C4_POWER));
burnTime--;
field.ser.C4Explosion++;
};
}
override public function specHeat():Number{
return (C4_SPEC_HEAT);
}
override public function tranHeat():Number{
return (C4_TRAN_HEAT);
}
}
}//package
Section 66
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 67
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 68
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 69
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 70
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 71
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 72
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 73
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 74
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
}
}//package
Section 75
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
}
}//package
Section 76
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
}
}//package
Section 77
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
}
}//package
Section 78
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
}
}//package
Section 79
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
}
}//package
Section 80
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
}
}//package
Section 81
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
}
}//package
Section 82
//Clay (Clay)
package {
import MathPackage.*;
public class Clay extends Liquid {
private var hardness:int;
private static const CLAY_SPEC_HEAT = 7;
private static const CLAY_TRAN_HEAT = 0.8;
private static const CLAY_COLOR:uint = 4276545;
public function Clay(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.CLAY;
pColor = CLAY_COLOR;
MAX_VISC = 3;
hardness = 0;
}
override public function specHeat():Number{
return (CLAY_SPEC_HEAT);
}
override public function tranHeat():Number{
return (CLAY_TRAN_HEAT);
}
override public function moveParticle(){
if (magnitude > (MAX_VISC - 1)){
magnitude = (MAX_VISC - 1);
};
super.moveParticle();
}
public function handleTemp(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
hardness++;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if ((((((_local5.number == NULLPARTICLE)) && (!(_local5.deleteParticle)))) && (!(created)))){
hardness++;
};
};
_local2++;
};
_local1++;
};
if ((((hardness > 300)) && (!(created)))){
field.particleArray.addParticle(new Rock(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
override public function redirectParticle(){
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
if (VISC > MAX_VISC){
VISC = MAX_VISC;
};
moved = false;
var _local1:int;
var _local2 = 1;
while (_local2 < VISC) {
_local7 = field.particleArray.getCollision(loc.getIntX(), (loc.getIntY() + _local2));
if (_local7 <= 1){
_local1 = _local2;
moved = true;
} else {
if (_local7 >= 3){
_local2 = VISC;
};
};
_local2++;
};
if (moved){
loc.addY(_local1);
return;
};
magnitude = 0;
if (VISC > MAX_VISC){
VISC = MAX_VISC;
};
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
var _local6:int;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
} else {
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
};
};
};
if (moved){
return;
};
_local3 = true;
_local4 = true;
_local5 = 0;
_local6 = 0;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
moved = true;
} else {
loc.addX(-(_local5));
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
moved = true;
};
};
};
}
}
}//package
Section 83
//Cloner (Cloner)
package {
import MathPackage.*;
public class Cloner extends Powder {
private static const CLONER_SPEC_HEAT = 6;
private static const CLONER_TRAN_HEAT = 0.1;
private static const CLONER_COLOR:uint = 16719310;
private static const CLONE_CHANCE = 0.85;
public function Cloner(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = CLONER;
pColor = CLONER_COLOR;
size = 0.2;
temp = 300;
}
override public function specHeat():Number{
return (CLONER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (CLONER_TRAN_HEAT);
}
public function beCloner(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
var _local6:Number;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if (((((((((((!((_local5.number == NULLPARTICLE))) && (!((_local5.number == CLONER))))) && (!((_local5.number == LASER))))) && (!(_local5.deleteParticle)))) && (!(created)))) && (!((_local5.phase == SOLID))))){
_local6 = CLONE_CHANCE;
if (((((((_local1 + _local2) == 2)) || (((_local1 + _local2) == -2)))) || (((_local1 + _local2) == 0)))){
_local6 = (_local6 / 2);
};
if (Calc.nextListRandom() < _local6){
field.addParticle(loc.getX(), loc.getY(), _local5.number);
deleteParticle = true;
return;
};
};
};
_local2++;
};
_local1++;
};
}
override public function simulate(){
beCloner();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 84
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 85
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 86
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 87
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 88
//DarkMatter (DarkMatter)
package {
import MathPackage.*;
public class DarkMatter extends Special {
private var moveRange:int;
private var killRange:int;
private var kill:Boolean;
private var killedParticles:Array;
private static const DM_COLOR:uint = 3289651;
public function DarkMatter(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = DARK_MATTER;
pColor = DM_COLOR;
moveRange = 90;
killRange = 30;
kill = false;
killedParticles = new Array();
}
public function beDarkMatter(){
var _local2:Particle;
var _local3:Number;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:int;
var _local8:Number;
var _local9:int;
var _local10:int;
if (deleteParticle){
return;
};
kill = false;
killedParticles = new Array();
var _local1 = 1;
while (_local1 < field.particleArray.sizeLength()) {
_local2 = field.particleArray.getParticle_int(_local1);
_local3 = Calc.distanceCalc(loc.getX(), loc.getY(), _local2.loc.getX(), _local2.loc.getY());
if ((((((((_local2.number == Particle.DARK_MATTER)) || ((_local2.number == Particle.LASER)))) || ((_local2.number == Particle.LASER)))) || ((_local2.number == Particle.BULLET)))){
} else {
if (_local3 < killRange){
_local2.deleteParticle = true;
kill = true;
killedParticles.push(_local2);
if (Calc.nextListRandom() < (1 / killedParticles.length)){
field.drawLine((loc.getIntX() * 2), (loc.getIntY() * 2), (_local2.loc.getIntX() * 2), (_local2.loc.getIntY() * 2), _local2.pColor);
};
} else {
if ((((_local2.phase == Particle.SOLID)) && ((Calc.nextListRandom() > (1 / (_local2.strength() * 5)))))){
} else {
if (Calc.nextListRandom() < (_local3 / moveRange)){
} else {
if ((((_local3 < moveRange)) && (!(_local2.deleteParticle)))){
field.particleArray.unwrite(_local2);
_local4 = loc.getX();
_local5 = loc.getY();
_local6 = _local2.loc.getX();
_local7 = _local2.loc.getY();
_local8 = Math.atan2((_local7 - _local5), (_local6 - _local4));
_local9 = (loc.getX() - _local2.loc.getX());
_local10 = (loc.getY() - _local2.loc.getY());
if (_local9 > 1){
_local9 = 1;
};
if (_local9 < -1){
_local9 = -1;
};
if (_local10 > 1){
_local10 = 1;
};
if (_local10 < -1){
_local10 = -1;
};
if (Calc.nextListRandom() > Math.abs(Math.cos(_local8))){
_local9 = 0;
};
if (Calc.nextListRandom() > Math.abs(Math.sin(_local8))){
_local10 = 0;
};
_local2.loc.setX((_local9 + _local2.loc.getX()));
_local2.loc.setY((_local10 + _local2.loc.getY()));
_local2.magnitude = (_local2.magnitude - 2);
if (_local2.magnitude < 0){
_local2.magnitude = 0;
};
field.particleArray.write(_local2);
};
};
};
};
};
_local1++;
};
}
override public function drawParticle(){
var _local1:int;
super.drawParticle();
if (kill){
_local1 = 0;
while (_local1 < (killedParticles.length - 1)) {
_local1++;
};
};
kill = false;
killedParticles = new Array();
}
override public function simulate(){
beDarkMatter();
drawParticle();
checkDelete();
}
}
}//package
Section 89
//DeadPlant (DeadPlant)
package {
import MathPackage.*;
public class DeadPlant extends Solid {
private var burnTime:int;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1600;
private static const DEAD_PLANT_SPEC_HEAT = 1.1;
private static const DEAD_PLANT_TRAN_HEAT = 0.6;
private static const DEAD_PLANT_COLOR:uint = 15442781;
public function DeadPlant(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.DEAD_PLANT;
pColor = DEAD_PLANT_COLOR;
burnTime = 100;
temp = 220;
}
override public function specHeat():Number{
return (DEAD_PLANT_SPEC_HEAT);
}
override public function tranHeat():Number{
return (DEAD_PLANT_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
field.ser.plantBurning++;
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 90
//Description (Description)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Description extends MovieClip {
public var text:TextField;
}
}//package
Section 91
//Earth (Earth)
package {
public class Earth extends Solid {
private const EARTH_SPEC_HEAT:Number = 2.5;
private const EARTH_TRAN_HEAT:Number = 0.25;
private const EARTH_COLOR:uint = 12151592;
public function Earth(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.EARTH;
pColor = EARTH_COLOR;
}
override public function strength():Number{
return (3);
}
override public function specHeat():Number{
return (EARTH_SPEC_HEAT);
}
override public function tranHeat():Number{
return (EARTH_TRAN_HEAT);
}
}
}//package
Section 92
//Electricity (Electricity)
package {
import MathPackage.*;
public class Electricity extends Special {
private var voltage:int;
private var pointList:Array;
public var hitParticle:Particle;
public var hit:Boolean;
public var life:int;
public var vector:IntVector;
public static const STRIKE_CHANCE = 0.96;
public static const MIN_DEV_CHANCE = 0.05;
public static const MIN_CHANCE = 0.05;
private static const ELECTRICITY_COLOR:uint = 16776960;
public function Electricity(_arg1:int, _arg2:int, _arg3:Field, _arg4:int){
pointList = new Array();
super(_arg1, _arg2, _arg3);
number = ELECTRICITY;
pColor = ELECTRICITY_COLOR;
life = 2;
hit = false;
vector = new IntVector(1, 1);
if (_arg4 == 0){
this.voltage = 400;
} else {
this.voltage = _arg4;
};
temp = (this.voltage * 10);
}
override public function simulate(){
if (life == 2){
moveParticle();
transferHeat();
drawParticle();
deleteParticle = false;
life--;
return;
};
if (life == 1){
(deleteParticle == true);
};
life--;
if (life == 0){
deleteParticle = true;
};
}
override public function transferHeat(){
if (((hit) && (!((hitParticle.number == NULLPARTICLE))))){
hitParticle.temp = int((((temp - hitParticle.temp) / (hitParticle.specHeat() + 1)) + hitParticle.temp));
};
}
override public function drawParticle(){
var _local1:int;
var _local2:IntPoint;
var _local3:IntPoint;
if (!deleteParticle){
_local1 = 0;
while (_local1 < (pointList.length - 1)) {
_local2 = pointList[_local1];
_local3 = pointList[(_local1 + 1)];
field.drawLine((_local2.getIntX() * 2), (_local2.getIntY() * 2), (_local3.getIntX() * 2), (_local3.getIntY() * 2), pColor);
field.drawLine((_local2.getIntX() * 2), ((_local2.getIntY() * 2) + 1), (_local3.getIntX() * 2), ((_local3.getIntY() * 2) + 1), pColor);
_local1++;
};
};
}
public function getDestination(_arg1:int):IntPoint{
var _local7:Particle;
var _local8:Number;
var _local2:IntPoint = new IntPoint(0, 0);
var _local3:IntVector = new IntVector(1, 1);
_local3.setMagnitude((Calc.nextListRandom() * _arg1));
_local3.setRotation(((Calc.nextListRandom() * 2) * Math.PI));
_local2.setX(int((loc.getX() + _local3.getX())));
_local2.setY(int((loc.getY() + _local3.getY())));
var _local4:int;
var _local5:Number = 1000;
var _local6 = 1;
while (_local6 < field.particleArray.sizeLength()) {
_local7 = field.particleArray.getParticle_int(_local6);
_local8 = Calc.distanceCalc(loc.getX(), loc.getY(), _local7.loc.getX(), _local7.loc.getY());
if ((((_local8 < _local5)) && ((Calc.nextListRandom() > STRIKE_CHANCE)))){
if ((((_local7.phase > GAS)) && (!((_local7.number == SPARKER))))){
_local4 = _local6;
_local5 = _local8;
};
};
_local6++;
};
if (_local4 > 0){
_local7 = field.particleArray.getParticle_int(_local4);
_local2.setX(_local7.loc.getX());
_local2.setY(_local7.loc.getY());
hitParticle = _local7;
hit = true;
};
return (_local2);
}
override public function moveParticle(){
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:Number;
pointList.push(new IntPoint(loc.getX(), loc.getY()));
var _local1:IntPoint = getDestination(voltage);
var _local2:Number = Calc.distanceCalc(loc.getX(), loc.getY(), _local1.getX(), _local1.getY());
vector = new IntVector((_local1.getX() - loc.getX()), (_local1.getY() - loc.getY()));
var _local3:Number = ((1 / _local2) * 8);
if (_local3 < MIN_CHANCE){
_local3 = MIN_CHANCE;
};
var _local4 = 1;
var _local5:int;
while (_local5 < voltage) {
_local6 = loc.getIntX();
_local7 = loc.getIntY();
_local8 = Calc.distanceCalc(_local6, _local7, _local1.getX(), _local1.getY());
_local9 = Math.pow(((voltage - _local8) / voltage), 18);
if (_local9 < MIN_DEV_CHANCE){
_local9 = MIN_DEV_CHANCE;
};
if (Calc.nextListRandom() < _local9){
vector = new IntVector((_local1.getX() - _local6), (_local1.getY() - _local7));
vector.setMagnitude(Number(_local4));
pointList.push(new IntPoint(int(Math.round((vector.getX() + _local6))), int(Math.round((vector.getY() + _local7)))));
_local4 = 1;
} else {
if (Calc.nextListRandom() < _local3){
vector.setMagnitude(Number(_local4));
vector.setRotation(((vector.getRotation() + (Calc.nextListRandom() * 1.5)) - 0.75));
pointList.push(new IntPoint(int((vector.getX() + _local6)), int((vector.getY() + _local7))));
_local4 = 1;
} else {
_local4++;
};
};
loc.setX(pointList[(pointList.length - 1)].getX());
loc.setY(pointList[(pointList.length - 1)].getY());
_local5++;
};
if (hit){
hitParticle = field.particleArray.getParticle(loc.getIntX(), loc.getIntY());
};
}
}
}//package
Section 93
//ElectricitySound (ElectricitySound)
package {
import flash.media.*;
public dynamic class ElectricitySound extends Sound {
}
}//package
Section 94
//EndlessSound (EndlessSound)
package {
import flash.media.*;
import flash.events.*;
public class EndlessSound {
var sound:Sound;
var soundChannel:SoundChannel;
var stopping:Boolean;
public function EndlessSound(_arg1:Sound, _arg2:Number=0){
sound = _arg1;
soundChannel = sound.play(0, 1);
soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
setVolume(_arg2);
}
function onSoundChannelSoundComplete(_arg1:Event):void{
soundChannel = sound.play(0, 1);
soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
soundChannel.soundTransform = new SoundTransform(0);
}
function setVolume(_arg1:Number){
if (_arg1 == 0){
soundChannel.soundTransform = new SoundTransform(0);
soundChannel.stop();
stopping = true;
} else {
if (stopping){
soundChannel = sound.play(0, 1);
soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
stopping = false;
};
soundChannel.soundTransform = new SoundTransform(_arg1);
};
}
}
}//package
Section 95
//Explosion (Explosion)
package {
import MathPackage.*;
public class Explosion extends Special {
public var explosionForce:Number;
private var startPoint:IntPoint;
private var lineArray:Array;
private var life:int;
private var vector:IntVector;
private var destX;
private var destY:int;
private var deltax:int;
private var deltay:int;
private var error:int;
private var ystep:int;
private var steep;
private var reverse:Boolean;
private var x0;
private var y0;
private var x1;
private var y1:int;
private static const MAG_CAP = 180;
private static const EXPLOSION_COLOR_SHORT:uint = 16777215;
private static const EXPLOSION_COLOR_MID:uint = 16776960;
private static const EXPLOSION_COLOR_LONG:uint = 16744192;
private static const SHORT:int = 3;
private static const LONG:int = 20;
private static const SHORT_CHANCE = 0.166666666666667;
private static const LONG_CHANCE = 0.666666666666667;
private static const EXPLOSION_TEMP = 1000;
public function Explosion(_arg1:int, _arg2:int, _arg3:Field, _arg4:Number){
var _local6:int;
var _local7:int;
super(_arg1, _arg2, _arg3);
number = EXPLOSION;
explosionForce = _arg4;
temp = 2000;
startPoint = new IntPoint(loc.getX(), loc.getY());
var _local5:IntVector = new IntVector(20, 20);
_local5.setMagnitude(200);
_local5.setRotation(((Math.PI * 2) * Calc.nextListRandom()));
destX = (_local5.getX() + loc.getX());
destY = (_local5.getY() + loc.getY());
life = 1;
x0 = destX;
x1 = _arg1;
y0 = destY;
y1 = _arg2;
steep = false;
if (Math.abs((y1 - y0)) > Math.abs((x1 - x0))){
steep = true;
};
if (steep){
x0 = destY;
y0 = destX;
x1 = _arg2;
y1 = _arg1;
};
reverse = true;
if (x0 > x1){
_local6 = x0;
x0 = x1;
x1 = _local6;
_local7 = y0;
y0 = y1;
y1 = _local7;
reverse = false;
};
deltax = (x1 - x0);
deltay = Math.abs((y1 - y0));
error = (deltax / 2);
ystep = 0;
_arg2 = y0;
if (y0 < y1){
ystep = 1;
} else {
ystep = -1;
};
}
public function setColor(){
var _local1:Number = Calc.nextListRandom();
if (_local1 < SHORT_CHANCE){
pColor = EXPLOSION_COLOR_SHORT;
} else {
if ((((_local1 > SHORT_CHANCE)) && ((_local1 < LONG_CHANCE)))){
pColor = EXPLOSION_COLOR_MID;
} else {
if (_local1 > LONG_CHANCE){
pColor = EXPLOSION_COLOR_LONG;
};
};
};
}
override public function simulate(){
if (life == 1){
setColor();
checkDelete();
moveParticle();
life--;
} else {
deleteParticle = true;
};
}
override public function force():Number{
return (explosionForce);
}
private function capMag(_arg1:Number){
if (_arg1 > MAG_CAP){
return (MAG_CAP);
};
return (_arg1);
}
public function nextBresPoint():IntPoint{
if (!reverse){
error = (error - deltay);
if (error < 0){
y0 = (y0 + ystep);
error = (error + deltax);
};
x0++;
if (steep){
return (new IntPoint(y0, x0));
};
return (new IntPoint(x0, y0));
//unresolved jump
};
error = (error - deltay);
if (error < 0){
y1 = (y1 - ystep);
error = (error + deltax);
};
x1--;
if (steep){
return (new IntPoint(y1, x1));
};
return (new IntPoint(x1, y1));
}
override public function setLife(_arg1:int){
life = _arg1;
}
override public function moveParticle(){
var _local1:int;
var _local2:IntPoint;
var _local3:int;
var _local4:int;
var _local5:Particle;
field.particleArray.unwrite(this);
if (field.inBounds_Par(this)){
_local1 = 0;
while (_local1 < explosionForce) {
if (_local1 > 100){
return;
};
_local2 = nextBresPoint();
_local3 = _local2.getY();
_local4 = _local2.getX();
_local5 = field.particleArray.getParticle(_local4, _local3);
if (_local5.number == EXPLOSION){
explosionForce = (_local5.force() + explosionForce);
_local5.setLife(0);
loc.setX(_local4);
loc.setY(_local3);
} else {
if ((((_local5.phase == SPECIAL)) || ((_local5.phase == GAS)))){
loc.setX(_local4);
loc.setY(_local3);
} else {
if (_local5.isExplosive()){
_local5.burn();
loc.setX(_local4);
loc.setY(_local3);
} else {
if (_local5.phase == SOLID){
if ((explosionForce - _local1) > _local5.strength()){
_local5.deleteParticle = true;
explosionForce = (explosionForce - _local5.strength());
loc.setX(_local4);
loc.setY(_local3);
} else {
transferHeat_Par(this, _local5);
_local1 = explosionForce;
};
} else {
if ((((_local5.phase == LIQUID)) || ((_local5.phase == POWDER)))){
loc.setX(_local4);
loc.setY(_local3);
_local5.deleteParticle = true;
transferHeat_Par(this, _local5);
} else {
loc.setX(_local4);
loc.setY(_local3);
};
};
};
};
};
drawParticle();
_local1++;
};
};
if (field.inBounds(loc.getIntX(), loc.getIntY())){
field.particleArray.write(this);
};
}
}
}//package
Section 96
//Explosion1 (Explosion1)
package {
import flash.media.*;
public dynamic class Explosion1 extends Sound {
}
}//package
Section 97
//Explosion2 (Explosion2)
package {
import flash.media.*;
public dynamic class Explosion2 extends Sound {
}
}//package
Section 98
//ExplosionFire (ExplosionFire)
package {
import flash.media.*;
public dynamic class ExplosionFire extends Sound {
}
}//package
Section 99
//Field (Field)
package {
import flash.display.*;
import MathPackage.*;
import flash.geom.*;
public class Field {
public const MAG_CAP:Number = 8;
public const DEFAULT_TEMP:Number = 300;
public const TRANSFER_HEAT:Number = 0.018;
public var fieldWidth;
public var fieldHeight:int;
public var particleArray:ParticleArray;
public var deleteArray:BooleanArray;
public var writtenArray:BooleanArray;
public var count:int;
public var g:BitmapData;
public var defaultParticle:Particle;
public var ser:SoundEngineReport;
public var stopping:Boolean;
public var walls:Boolean;
public var zombies:Array;
public var zombieAmount:int;
public var backgroundRectangle:Rectangle;
public static const circleR2:Array = Calc.bresCircleFill(0, 0, 2);
public function Field(_arg1:int, _arg2:int){
walls = false;
fieldWidth = _arg1;
fieldHeight = _arg2;
count = 0;
stopping = false;
particleArray = new ParticleArray(_arg1, _arg2, this);
writtenArray = new BooleanArray(_arg1, _arg2);
deleteArray = new BooleanArray(_arg1, _arg2);
zombies = new Array();
g = new BitmapData((fieldWidth * 2), (fieldHeight * 2), false, 0);
defaultParticle = new NullParticle(0, 0, this);
particleArray.addParticle_Int(0, defaultParticle);
backgroundRectangle = new Rectangle(0, 0, (fieldWidth * 2), (fieldHeight * 2));
ser = new SoundEngineReport();
zombieAmount = 1;
}
public function addParticle_Par(_arg1:Particle){
particleArray.addParticle(_arg1);
}
public function addParticle(_arg1:int, _arg2:int, _arg3:int, _arg4:int=0, _arg5:int=0){
if (!inBounds(_arg1, _arg2)){
return;
};
if (!writtenArray.getBool(_arg1, _arg2)){
deleteArray.setBool(_arg1, _arg2, true);
if (_arg3 == Particle.NULLPARTICLE){
} else {
if (_arg3 == Particle.OIL){
particleArray.addParticle(new Oil(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.WATER){
particleArray.addParticle(new Water(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SALT_WATER){
particleArray.addParticle(new Water(_arg1, _arg2, this));
particleArray.addParticle(new Salt(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.FIRE){
particleArray.addParticle(new Fire(_arg1, _arg2, this, 0));
deleteArray.setBool(_arg1, _arg2, false);
} else {
if (_arg3 == Particle.SAND){
particleArray.addParticle(new Sand(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ROCK){
particleArray.addParticle(new Rock(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.PLANT){
particleArray.addParticle(new Plant(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.WAX){
particleArray.addParticle(new Wax(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.STEEL){
particleArray.addParticle(new Steel(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.STEAM){
particleArray.addParticle(new Steam(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.TORCH){
particleArray.addParticle(new Torch(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SPOUT){
particleArray.addParticle(new Spout(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ELECTRICITY){
particleArray.addParticle(new Electricity(_arg1, _arg2, this, 0));
} else {
if (_arg3 == Particle.SPARKER){
particleArray.addParticle(new Sparker(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SALT){
particleArray.addParticle(new Salt(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.WELL){
particleArray.addParticle(new Well(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SANDMAKER){
particleArray.addParticle(new SandMaker(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SALTMAKER){
particleArray.addParticle(new SaltMaker(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ICE){
particleArray.addParticle(new Ice(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LIQUID_NITROGEN){
particleArray.addParticle(new LiquidNitrogen(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.GUNPOWDER){
particleArray.addParticle(new Gunpowder(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.FUSE){
particleArray.addParticle(new Fuse(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.EXPLOSION){
particleArray.addParticle(new Explosion(_arg1, _arg2, this, 7));
} else {
if (_arg3 == Particle.SPARK){
particleArray.addParticle(new Spark(_arg1, _arg2, this, 2100));
} else {
if (_arg3 == Particle.C4){
particleArray.addParticle(new C4(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.FLASH_POWDER){
particleArray.addParticle(new FlashPowder(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LIQUID_STEEL){
particleArray.addParticle(new LiquidSteel(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.THERMITE){
particleArray.addParticle(new Thermite(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.DARK_MATTER){
particleArray.addParticle(new DarkMatter(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.WHITE_MATTER){
particleArray.addParticle(new WhiteMatter(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.NAPALM){
particleArray.addParticle(new Napalm(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.URANIUM){
particleArray.addParticle(new Uranium(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.CLONER){
particleArray.addParticle(new Cloner(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ANT){
particleArray.addParticle(new Ant(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LASER){
particleArray.addParticle(new Laser(_arg1, _arg2, _arg4, _arg5, this));
} else {
if (_arg3 == Particle.BULLET){
particleArray.addParticle(new Bullet(_arg1, _arg2, _arg4, _arg5, this));
} else {
if (_arg3 == Particle.NITROGLYCERIN){
particleArray.addParticle(new Nitroglycerin(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.DEAD_PLANT){
particleArray.addParticle(new DeadPlant(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ADAMANTIUM){
particleArray.addParticle(new Adamantium(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.BLOOD){
particleArray.addParticle(new Blood(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ASH){
particleArray.addParticle(new Ash(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SLASH){
particleArray.addParticle(new Slash(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LSD){
particleArray.addParticle(new LSD(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ACID){
particleArray.addParticle(new Acid(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.BEE){
particleArray.addParticle(new Bee(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.FLOWER){
particleArray.addParticle(new Flower(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.ACIDMAKER){
particleArray.addParticle(new AcidMaker(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.STEAM){
particleArray.addParticle(new Steam(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.MIRROR){
particleArray.addParticle(new Mirror(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.CLAY){
particleArray.addParticle(new Clay(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.BLUE_FIRE){
particleArray.addParticle(new BlueFire(_arg1, _arg2, this, 0));
deleteArray.setBool(_arg1, _arg2, false);
} else {
if (_arg3 == Particle.LAVA){
particleArray.addParticle(new Lava(_arg1, _arg2, this, 0));
} else {
if (_arg3 == Particle.VOLCANO){
particleArray.addParticle(new Volcano(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.SEED){
particleArray.addParticle(new Seed(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.WOOD){
particleArray.addParticle(new Wood(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LEAF){
particleArray.addParticle(new Leaf(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.EARTH){
particleArray.addParticle(new Earth(_arg1, _arg2, this));
} else {
if (_arg3 == Particle.LIQUID_HELIUM){
particleArray.addParticle(new LiquidHelium(_arg1, _arg2, this));
deleteArray.setBool(_arg1, _arg2, false);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
writtenArray.setBool(_arg1, _arg2, true);
};
}
public function toString():String{
var _local3:Particle;
var _local4:Zombie;
var _local1 = "";
if (walls){
_local1 = (_local1 + "w,");
};
var _local2 = 1;
while (_local2 < particleArray.sizeLength()) {
_local3 = particleArray.getParticle_int(_local2);
if (_local3.number != Particle.ZOMBIE_FLESH){
_local1 = (_local1 + (_local3.number.toString() + ","));
_local1 = (_local1 + (_local3.loc.getX().toString() + ","));
_local1 = (_local1 + (_local3.loc.getY().toString() + ","));
_local1 = (_local1 + (_local3.temp.toString() + ","));
};
_local2++;
};
_local2 = 0;
while (_local2 < zombies.length) {
_local4 = zombies[_local2];
_local1 = (_local1 + ("z" + ","));
_local1 = (_local1 + (_local4.loc.getX().toString() + ","));
_local1 = (_local1 + (_local4.loc.getY().toString() + ","));
_local1 = (_local1 + (" " + ","));
_local2++;
};
return (_local1);
}
public function loadString(_arg1:String){
var _local4:*;
var _local2:Array = _arg1.split(",");
if (_local2[0] == "w"){
walls = true;
_local2.splice(0, 1);
} else {
walls = false;
};
particleArray.clearAll();
clearZombies();
drawBackground();
var _local3:int;
while (_local3 < _local2.length) {
if (_local2[_local3] == "z"){
addZombie(_local2[(_local3 + 1)], _local2[(_local3 + 2)]);
} else {
if (((!((_local2[_local3] == Particle.BULLET))) && (!((_local2[_local3] == Particle.LASER))))){
_local4 = particleArray.sizeLength();
addParticle(_local2[(_local3 + 1)], _local2[(_local3 + 2)], _local2[_local3]);
if (particleArray.sizeLength() > _local4){
particleArray.getParticle_int((particleArray.sizeLength() - 1)).temp = _local2[(_local3 + 3)];
};
} else {
addParticle(_local2[(_local3 + 1)], _local2[(_local3 + 2)], _local2[_local3], (Calc.nextListRandom() * fieldWidth), (Calc.nextListRandom() * fieldHeight));
particleArray.getParticle_int((particleArray.sizeLength() - 1)).temp = _local2[(_local3 + 3)];
};
};
_local3 = (_local3 + 4);
};
zombieAmount = zombies.length;
}
public function swapParticles(_arg1:Particle, _arg2:Particle){
if ((((_arg1.number == Particle.NULLPARTICLE)) || ((_arg2.number == Particle.NULLPARTICLE)))){
return;
};
particleArray.unwrite(_arg2);
var _local3:int = _arg1.loc.getX();
var _local4:int = _arg1.loc.getY();
_arg1.loc.setX(_arg2.loc.getX());
_arg1.loc.setY(_arg2.loc.getY());
_arg2.loc.setX(_local3);
_arg2.loc.setY(_local4);
particleArray.write(_arg2);
}
public function drawLine(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:uint){
var _local17:int;
var _local18:int;
var _local6:int = _arg1;
var _local7:int = _arg3;
var _local8:int = _arg2;
var _local9:int = _arg4;
var _local10:Boolean;
if (Math.abs((_local9 - _local8)) > Math.abs((_local7 - _local6))){
_local10 = true;
};
if (_local10){
_local6 = _arg2;
_local8 = _arg1;
_local7 = _arg4;
_local9 = _arg3;
};
if (_local6 > _local7){
_local17 = _local6;
_local6 = _local7;
_local7 = _local17;
_local18 = _local8;
_local8 = _local9;
_local9 = _local18;
};
var _local11:int = (_local7 - _local6);
var _local12:int = Math.abs((_local9 - _local8));
var _local13:int = (_local11 / 2);
var _local14:int;
var _local15:int = _local8;
if (_local8 < _local9){
_local14 = 1;
} else {
_local14 = -1;
};
var _local16:int = _local6;
while (_local16 <= _local7) {
if (_local10){
g.setPixel(_local15, _local16, _arg5);
} else {
g.setPixel(_local16, _local15, _arg5);
};
_local13 = (_local13 - _local12);
if (_local13 < 0){
_local15 = (_local15 + _local14);
_local13 = (_local13 + _local11);
};
_local16++;
};
}
public function drawLine2(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:uint){
var _local17:int;
var _local18:int;
var _local6:int = _arg1;
var _local7:int = _arg3;
var _local8:int = _arg2;
var _local9:int = _arg4;
var _local10:Boolean;
if (Math.abs((_local9 - _local8)) > Math.abs((_local7 - _local6))){
_local10 = true;
};
if (_local10){
_local6 = _arg2;
_local8 = _arg1;
_local7 = _arg4;
_local9 = _arg3;
};
if (_local6 > _local7){
_local17 = _local6;
_local6 = _local7;
_local7 = _local17;
_local18 = _local8;
_local8 = _local9;
_local9 = _local18;
};
var _local11:int = (_local7 - _local6);
var _local12:int = Math.abs((_local9 - _local8));
var _local13:int = (_local11 / 2);
var _local14:int;
var _local15:int = _local8;
if (_local8 < _local9){
_local14 = 1;
} else {
_local14 = -1;
};
var _local16:int = _local6;
while (_local16 <= _local7) {
if (_local10){
g.setPixel(_local15, _local16, _arg5);
} else {
g.setPixel(_local16, _local15, _arg5);
};
_local13 = (_local13 - _local12);
if (_local13 < 0){
_local15 = (_local15 + _local14);
_local13 = (_local13 + _local11);
};
_local16++;
};
}
public function setPixelAlpha(_arg1:int, _arg2:int, _arg3:uint){
var _local4:Number = ((_arg3 >> 24) & 0xFF);
var _local5:Number = ((_arg3 >> 16) & 0xFF);
var _local6:Number = ((_arg3 >> 8) & 0xFF);
var _local7:Number = (_arg3 & 0xFF);
var _local8:Number = ((g.getPixel(_arg1, _arg2) >> 16) & 0xFF);
var _local9:Number = ((g.getPixel(_arg1, _arg2) >> 8) & 0xFF);
var _local10:Number = (g.getPixel(_arg1, _arg2) & 0xFF);
var _local11:Number = ((_local5 * (_local4 / 0xFF)) + (_local8 * ((0xFF - _local4) / 0xFF)));
var _local12:Number = ((_local7 * (_local4 / 0xFF)) + (_local10 * ((0xFF - _local4) / 0xFF)));
var _local13:Number = ((_local6 * (_local4 / 0xFF)) + (_local9 * ((0xFF - _local4) / 0xFF)));
var _local14:uint = (((uint(_local11) * 65536) + (uint(_local13) * 0x0100)) + uint(_local12));
g.setPixel(_arg1, _arg2, _local14);
}
public function fillCircle(_arg1:int, _arg2:int, _arg3:int, _arg4:uint){
setPixelAlpha((_arg1 + 1), _arg2, _arg4);
setPixelAlpha(_arg1, _arg2, _arg4);
setPixelAlpha((_arg1 - 1), _arg2, _arg4);
setPixelAlpha(_arg1, (_arg2 + 1), _arg4);
setPixelAlpha(_arg1, (_arg2 - 1), _arg4);
setPixelAlpha((_arg1 + 2), _arg2, _arg4);
setPixelAlpha((_arg1 - 2), _arg2, _arg4);
setPixelAlpha(_arg1, (_arg2 + 2), _arg4);
setPixelAlpha(_arg1, (_arg2 - 2), _arg4);
setPixelAlpha((_arg1 + 1), (_arg2 + 1), _arg4);
setPixelAlpha((_arg1 + 1), (_arg2 - 1), _arg4);
setPixelAlpha((_arg1 - 1), (_arg2 - 1), _arg4);
setPixelAlpha((_arg1 - 1), (_arg2 + 1), _arg4);
}
public function simulate(){
if (((walls) && (!(particleArray.walls)))){
particleArray.addWalls();
};
if (((!(walls)) && (particleArray.walls))){
particleArray.removeWalls();
};
drawBackground();
writeParticles();
prepareSER();
simulateParticles();
simulateZombies();
handleZombies();
deleteParticles();
count++;
}
public function addZombie(_arg1:int, _arg2:int){
zombies.push(new Zombie(_arg1, _arg2, this));
}
private function handleZombies(){
if (zombies.length < zombieAmount){
addZombie((10 + (Calc.nextListRandom() * (fieldWidth - 20))), (10 + (Calc.nextListRandom() * (fieldHeight - 200))));
} else {
if (zombies.length > zombieAmount){
zombies[0].unwriteZombie();
zombies[0].deleteFlesh();
zombies.splice(0, 1);
};
};
}
public function clearZombies(){
var _local1:int;
while (_local1 < zombies.length) {
zombies[0].unwriteZombie();
zombies[0].deleteFlesh();
zombies.splice(0, 1);
_local1--;
_local1++;
};
}
private function simulateZombies(){
var _local1:int;
while (_local1 < zombies.length) {
if (stopping){
zombies[_local1].drawZombie();
} else {
zombies[_local1].simulateZombie();
zombies[_local1].drawZombie();
zombies[_local1].magnitude++;
if (zombies[_local1].magnitude > MAG_CAP){
zombies[_local1].magnitude = MAG_CAP;
};
if (zombies[_local1].deleteZombie == true){
zombies.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
private function writeParticles(){
particleArray.writeParticles();
writtenArray.clearChanges();
}
private function simulateParticles(){
var _local1:int;
var _local2:Particle;
if (stopping == false){
_local1 = 1;
while (_local1 < particleArray.sizeLength()) {
_local2 = particleArray.getParticle_int(_local1);
fieldEffects(_local2);
_local2.simulate();
_local1++;
};
} else {
_local1 = 1;
while (_local1 < particleArray.sizeLength()) {
_local2 = particleArray.getParticle_int(_local1);
if (_local2.created){
if (((!((_local2.number == Particle.DARK_MATTER))) && (!((_local2.number == Particle.WHITE_MATTER))))){
_local2.simulate();
};
_local2.created = false;
} else {
_local2.drawParticle();
_local2.checkDeletePaused();
};
_local1++;
};
};
}
private function prepareSER(){
var _local2:Particle;
ser.reset();
var _local1 = 1;
while (_local1 < particleArray.sizeLength()) {
_local2 = particleArray.getParticle_int(_local1);
if (_local2.number == Particle.FIRE){
ser.fire++;
} else {
if ((((_local2.number == Particle.WATER)) || ((_local2.number == Particle.SALT_WATER)))){
if (_local2.moved){
ser.waterMoved++;
};
} else {
if (_local2.number == Particle.ELECTRICITY){
ser.electricity++;
} else {
if (_local2.number == Particle.ROCK){
if (_local2.created){
ser.stoneCreated++;
};
} else {
if (_local2.number == Particle.BULLET){
if (_local2.created){
ser.gunshot++;
};
} else {
if (_local2.number == Particle.ICE){
if (_local2.created){
ser.iceCreated++;
};
} else {
if ((((((((_local2.number == Particle.SAND)) || ((_local2.number == Particle.GUNPOWDER)))) || ((_local2.number == Particle.THERMITE)))) || ((_local2.number == Particle.FLASH_POWDER)))){
if (((_local2.moved) && (_local2.collided))){
ser.sandMoved++;
};
} else {
if (_local2.number == Particle.STEAM){
if (_local2.created){
ser.steamCreated++;
};
} else {
if ((((_local2.number == Particle.STEEL)) || ((_local2.number == Particle.ADAMANTIUM)))){
if (_local2.created){
ser.steelCreated++;
};
} else {
if (_local2.number == Particle.SALT){
if (((_local2.moved) && (_local2.collided))){
ser.saltMoved++;
};
} else {
if ((((_local2.number == Particle.LIQUID_NITROGEN)) || ((_local2.number == Particle.NITROGLYCERIN)))){
if (_local2.moved){
ser.lnMoved++;
};
} else {
if ((((_local2.number == Particle.OIL)) || ((_local2.number == Particle.NAPALM)))){
if (_local2.moved){
ser.oilMoved++;
};
} else {
if (_local2.number == Particle.LIQUID_STEEL){
ser.moltenSteel++;
} else {
if (_local2.number == Particle.SPARK){
ser.spark++;
} else {
if (_local2.number == Particle.DARK_MATTER){
ser.darkMatter++;
} else {
if (_local2.number == Particle.WHITE_MATTER){
ser.whiteMatter++;
} else {
if (_local2.number == Particle.LASER){
if (ser.laser < _local2.force()){
ser.laser = _local2.force();
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
_local1++;
};
}
private function deleteParticles(){
particleArray.deleteParticles();
deleteArray.clearChanges();
}
private function fieldEffects(_arg1:Particle){
_arg1.magnitude = (_arg1.magnitude + 1);
if (_arg1.magnitude > MAG_CAP){
_arg1.magnitude = MAG_CAP;
};
}
public function drawBackground(){
var _local4:Rectangle;
var _local1:int;
var _local2:int;
while (_local2 < zombies.length) {
_local1 = (_local1 + zombies[_local2].high);
_local2++;
};
var _local3:Number = (_local1 / 1500);
if (_local3 > 1){
_local3 = 1;
};
if (walls){
g.fillRect(new Rectangle(0, 0, (fieldWidth * 2), 2), 4294967295);
g.fillRect(new Rectangle(((fieldWidth * 2) - 2), 0, (fieldWidth * 2), (fieldHeight * 2)), 4294967295);
g.fillRect(new Rectangle(0, ((fieldHeight * 2) - 2), (fieldWidth * 2), (fieldHeight * 2)), 4294967295);
g.fillRect(new Rectangle(0, 0, 2, (fieldHeight * 2)), 4294967295);
_local4 = new Rectangle(2, 2, ((fieldWidth * 2) - 4), ((fieldHeight * 2) - 4));
g.colorTransform(_local4, new ColorTransform((_local3 * ((Calc.nextListRandom() * 0.1) + 0.9)), (_local3 * ((Calc.nextListRandom() * 0.1) + 0.9)), (_local3 * ((Calc.nextListRandom() * 0.1) + 0.9))));
return;
};
g.colorTransform(backgroundRectangle, new ColorTransform((_local3 * ((Calc.nextListRandom() * 0.1) + 0.9)), (_local3 * ((Calc.nextListRandom() * 0.1) + 0.9)), (_local3 * ((Calc.nextListRandom() * 0.1) + 0.9))));
}
public function canMove(_arg1:Particle):Boolean{
var _local3:int;
var _local4:int;
var _local2 = -1;
while (_local2 <= 1) {
_local3 = -1;
while (_local3 <= 1) {
if (inBounds((_arg1.loc.getIntX() + _local2), (_arg1.loc.getIntY() + _local3))){
_local4 = particleArray.getCollision((_arg1.loc.getIntX() + _local2), (_arg1.loc.getIntY() + _local3));
if ((((_local2 == 0)) && ((_local3 == 0)))){
} else {
if ((((_local4 == Particle.SPECIAL)) || ((_local4 == Particle.GAS)))){
return (true);
};
};
} else {
return (false);
};
_local3++;
};
_local2++;
};
return (false);
}
public function inBounds_Par(_arg1:Particle):Boolean{
if ((((_arg1.loc.getIntX() > (fieldWidth - 1))) || ((_arg1.loc.getIntY() >= (fieldHeight - 1))))){
return (false);
};
if ((((_arg1.loc.getIntX() < 0)) || ((_arg1.loc.getIntY() < 0)))){
return (false);
};
return (true);
}
public function inBounds(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 >= fieldWidth)) || ((_arg1 < 0)))) || ((_arg2 >= fieldHeight)))) || ((_arg2 < 0)))){
return (false);
};
return (true);
}
}
}//package
Section 100
//FieldInterface (FieldInterface)
package {
import fl.controls.*;
import flash.display.*;
import MathPackage.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.system.*;
import flash.net.*;
public class FieldInterface extends MovieClip {
public var loadingBar:LoadingBar;
public var authorText:MovieClip;
public var mainText:MovieClip;
public var loadingText:MovieClip;
public var myGlow:GlowFilter;
public var field:Field;
public var mousePressed:Boolean;
public var mouseLocX;
public var mouseLocY:int;
public var fmX;
public var fmY:int;
public var fmUsed;// = false
public var stopping;
public var saving:Boolean;
public var zombieInHand:Boolean;
public var handZombie:Zombie;
public var keyEvents:Array;
public var mouseEvents:Array;
public var actionEvents:Array;
public var buttonSelector:ComboBox;
public var comboData:Array;
public var favorites;
public var solids;
public var powders;
public var liquids;
public var explosives;
public var special;
public var makers;
public var zombieKiller;
public var everything;
public var everything2:Array;
public var particleButtons:Array;
public var clearAllButton:Button;
public var brushSizeChooser:Slider;
public var brushSizeLabel;
public var sfxMute;
public var bgmMute;
public var zombies:Label;
public var playBut:Play;
public var stopBut:Stop;
public var sfxButton;
public var bgmButton:MuteButton;
public var sfx;
public var bgm:Boolean;
public var saveButton;
public var loadButton:Button;
public var saveMenu:SaveMenu;
public var wallsBox:CheckBox;
public var zombieStepper:NumericStepper;
public var description:Description;
public var brushSize:int;
public var particle:int;
public var timer:Timer;
public var layer1;
public var layer2:Sprite;
public var showDesc:Boolean;
public var kongregate;
public var soundEngine:SoundEngine;
private var frameBuffer:BitmapData;
static const BRUSH_SIZE_MIN = 0;
static const BRUSH_SIZE_MAX = 100;
static const SPEED_MIN = 0;
static const SPEED_MAX = 10;
static const FIELD_WIDTH = 250;
static const FIELD_HEIGHT = 300;
public function FieldInterface(){
keyEvents = new Array();
mouseEvents = new Array();
actionEvents = new Array();
particleButtons = new Array();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
loaderInfo.addEventListener(Event.COMPLETE, constructorMethod);
}
public function goLoad(_arg1:ProgressEvent){
var _local2:* = (_arg1.bytesLoaded / _arg1.bytesTotal);
if ((Math.round((100 * _local2)) % 2) != 0){
} else {
loadingBar.width = Math.round((100 * _local2));
};
if (_arg1.bytesLoaded == _arg1.bytesTotal){
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, goLoad);
gotoAndStop(3);
};
}
public function constructorMethod(_arg1:Event):void{
var _local5:Object;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
gotoAndStop(4);
zombieInHand = false;
stopping = false;
saving = false;
fmX = 0;
fmY = 0;
fmUsed = false;
soundEngine = new SoundEngine();
mousePressed = false;
mouseLocX = 0;
mouseLocY = 0;
field = new Field(FIELD_WIDTH, FIELD_HEIGHT);
saveMenu = new SaveMenu(this);
saveMenu.x = 300;
saveMenu.y = 300;
particle = Particle.ERASE;
brushSize = 1;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyIsDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyIsUp);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseIsDown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseIsUp);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved);
comboData = new Array({label:"Favorites", data:"Favorites"}, {label:"Everything", data:"Everything"}, {label:"Everything 2", data:"Everything 2"}, {label:"Soilds", data:"Solids"}, {label:"Powders", data:"Powders"}, {label:"Liquids", data:"Liquids"}, {label:"Explosives", data:"Explosives"}, {label:"Special", data:"Special"}, {label:"Zombie Killer", data:"Zombie Killer"}, {label:"Makers", data:"Makers"});
favorites = new Array("Erase", "Hand", "Water", "Sand", "Plant", "Fire", "Blue Fire", "Rock", "Electricity", "Steel", "Adamantium", "C4", "Seed", "White Matter", "Dark Matter", "Laser");
solids = new Array("Plant", "Wax", "Steel", "Ice", "Fuse", "C4", "Rock", "Uranium", "Adamantium", "Mirror", "Earth");
powders = new Array("Sand", "Gunpowder", "Salt", "Thermite", "Flash Powder", "Cloner", "Ants", "Bees", "Seed");
liquids = new Array("Water", "Oil", "Liquid Nitrogen", "Napalm", "Nitroglycerin", "Acid", "LSD", "Clay", "Lava", "Liquid Helium");
explosives = new Array("Gunpowder", "C4", "Thermite", "Napalm", "Uranium", "Nitroglycerin");
special = new Array("Erase", "Hand", "Fire", "Blue Fire", "Liquid Helium", "Electricity", "Dark Matter", "White Matter", "Cloner", "Laser", "Sword", "Gun");
makers = new Array("Torch", "Sparker", "Well", "Sandmaker", "Saltmaker", "Spout", "Acidmaker", "Volcano");
zombieKiller = new Array("Hand", "Fire", "Laser", "Electricity", "Sword", "C4", "Napalm", "Gun", "Acid", "LSD");
everything = new Array("Erase", "Hand", "Water", "Sand", "Rock", "Plant", "Fire", "Oil", "Wax", "Steel", "Adamantium", "Electricity", "Fuse", "Gunpowder", "C4", "Liquid Nitrogen", "Salt", "Ice", "Flash Powder", "Thermite", "White Matter", "Dark Matter", "Laser", "Cloner", "Ants", "Napalm", "Nitroglycerin", "Acid", "Uranium", "Sword", "Gun", "LSD", "Bees", "Mirror");
everything2 = new Array("Erase", "Hand", "Clay", "Blue Fire", "Lava", "Liquid Helium", "Earth", "Torch", "Spout", "Well", "Sparker", "Sandmaker", "Saltmaker", "Acidmaker", "Volcano", "Seed");
buttonSelector = new ComboBox();
buttonSelector.dropdownWidth = 90;
buttonSelector.width = 90;
buttonSelector.move(525, 5);
buttonSelector.prompt = "Particles";
buttonSelector.dataProvider = new DataProvider(comboData);
buttonSelector.addEventListener(Event.CHANGE, changeHandler);
addChild(buttonSelector);
setButtons(favorites);
brushSizeChooser = new Slider();
brushSizeChooser.x = 525;
brushSizeChooser.y = 480;
brushSizeChooser.width = 90;
brushSizeChooser.snapInterval = 1;
brushSizeChooser.minimum = 0;
brushSizeChooser.maximum = 10;
brushSizeChooser.value = 1;
brushSizeChooser.addEventListener(SliderEvent.CHANGE, sliderChange);
addChild(brushSizeChooser);
brushSizeLabel = new Label();
sfxMute = new Label();
bgmMute = new Label();
zombies = new Label();
var _local2:TextFormat = new TextFormat();
_local2.font = "Arial";
_local2.size = 10;
brushSizeLabel.width = 100;
sfxMute.width = 100;
bgmMute.width = 100;
brushSizeLabel.text = "Brush Size";
sfxMute.text = "sfx";
bgmMute.text = "Music";
zombies.text = "Zombies";
brushSizeLabel.setStyle("textFormat", _local2);
sfxMute.setStyle("textFormat", _local2);
bgmMute.setStyle("textFormat", _local2);
zombies.setStyle("textFormat", _local2);
brushSizeLabel.move(540, 490);
zombies.move(568, 508);
sfxMute.move(575, 570);
bgmMute.move(565, 530);
addChild(brushSizeLabel);
addChild(zombies);
wallsBox = new CheckBox();
wallsBox.move(520, 525);
wallsBox.label = "Walls";
wallsBox.setStyle("textFormat", _local2);
wallsBox.addEventListener(MouseEvent.CLICK, checkWallBox);
addChild(wallsBox);
zombieStepper = new NumericStepper();
zombieStepper.move(525, 508);
zombieStepper.setStyle("textFormat", _local2);
zombieStepper.height = 18;
zombieStepper.width = 40;
zombieStepper.addEventListener(Event.CHANGE, stepperChange);
addChild(zombieStepper);
sfxButton = new MuteButton();
bgmButton = new MuteButton();
sfxButton.x = 590;
sfxButton.y = 570;
bgmButton.x = 575;
bgmButton.y = 530;
sfxButton.addEventListener(MouseEvent.CLICK, sfxClick);
bgmButton.addEventListener(MouseEvent.CLICK, bgmClick);
bgmButton.stop();
sfxButton.stop();
sfx = true;
bgm = true;
addChild(sfxButton);
clearAllButton = new Button();
var _local3:TextFormat = new TextFormat();
_local3.font = "Arial";
_local3.size = 10;
clearAllButton.label = "Clear All";
clearAllButton.setStyle("textFormat", _local3);
clearAllButton.addEventListener(MouseEvent.CLICK, buttonClick);
clearAllButton.x = 525;
clearAllButton.y = 445;
clearAllButton.setSize(90, 30);
addChild(clearAllButton);
saveButton = new Button();
loadButton = new Button();
saveButton.label = "Save";
loadButton.label = "Load";
saveButton.setStyle("textFormat", _local3);
loadButton.setStyle("textFormat", _local3);
saveButton.addEventListener(MouseEvent.CLICK, buttonClick);
loadButton.addEventListener(MouseEvent.CLICK, buttonClick);
saveButton.x = 525;
loadButton.x = 575;
saveButton.y = 548;
loadButton.y = 548;
saveButton.setSize(40, 20);
loadButton.setSize(40, 20);
addChild(saveButton);
addChild(loadButton);
stopBut = new Stop();
_local3 = new TextFormat();
_local3.font = "Arial";
_local3.size = 10;
stopBut.label = "Pause";
stopBut.addEventListener(MouseEvent.CLICK, buttonClick);
stopBut.x = 538;
stopBut.y = 580;
addChild(stopBut);
playBut = new Play();
_local3 = new TextFormat();
_local3.font = "Arial";
_local3.size = 10;
playBut.label = "Play";
playBut.addEventListener(MouseEvent.CLICK, buttonClick);
playBut.x = 538;
playBut.y = 580;
description = new Description();
description.x = 200;
description.y = 110;
description.text.text = "hi";
var _local4:GlowFilter = new GlowFilter();
_local4.alpha = 0.5;
_local4.color = 0xFFFFFF;
_local4.blurX = 15;
_local4.blurY = 15;
description.filters = [_local4];
layer1 = new Sprite();
layer2 = new Sprite();
this.addChild(layer1);
this.addChild(layer2);
layer2.addChild(description);
description.visible = false;
showDesc = false;
timer = new Timer(1000, 1);
addEventListener(Event.ENTER_FRAME, redrawFrame);
try {
_local5 = LoaderInfo(root.loaderInfo).parameters;
_local6 = ((_local5.kongregate_api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
Security.allowDomain(_local6);
_local7 = new URLRequest(_local6);
_local8 = new Loader();
_local8.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
_local8.load(_local7);
this.addChild(_local8);
} catch(e:Error) {
};
}
private function checkWallBox(_arg1:MouseEvent):void{
if (wallsBox.selected == true){
field.walls = true;
} else {
field.walls = false;
};
}
private function grabZombie(){
zombieInHand = false;
var _local1:Array = field.zombies;
var _local2:int;
while (_local2 < _local1.length) {
if (Calc.distanceCalc((fmX / 2), (fmY / 2), _local1[_local2].loc.getX(), _local1[_local2].loc.getY()) < 10){
zombieInHand = true;
handZombie = _local1[_local2];
};
_local2++;
};
}
public function loadComplete(_arg1:Event){
kongregate = _arg1.target.content;
kongregate.services.connect();
kongregate.sharedContent.addLoadListener("Field", onFieldLoad);
}
function onSaved(_arg1:Object){
if (_arg1.success){
};
}
function onFieldLoad(_arg1:Object){
var _local2:Number = _arg1.id;
var _local3:String = _arg1.name;
var _local4:String = _arg1.permalink;
var _local5:String = _arg1.content;
var _local6:String = _arg1.label;
field.loadString(_local5);
wallsBox.selected = field.walls;
zombieStepper.value = field.zombies.length;
if (stopping == false){
stopping = true;
removeChild(stopBut);
addChild(playBut);
return;
};
}
public function run(_arg1:Event):void{
}
public function redrawFrame(_arg1:Event):void{
if (!showDesc){
description.visible = false;
};
handleMouseEvents();
field.simulate();
soundEngine.changeSettings(sfx, bgm);
soundEngine.makeSFX(field.ser);
soundEngine.makeBGM();
layer1.graphics.clear();
layer1.graphics.beginBitmapFill(field.g);
layer1.graphics.drawRect(0, 0, (field.fieldWidth * 2), (field.fieldHeight * 2));
layer1.graphics.endFill();
}
public function handleMouseEvents(){
var _local4:MouseEvent;
var _local1:int = mouseLocX;
var _local2:int = mouseLocY;
field.stopping = stopping;
var _local3:int;
while (mouseEvents.length > 0) {
_local4 = mouseEvents[_local3];
mouseLocX = (_local4.stageX / 2);
mouseLocY = (_local4.stageY / 2);
mouseEvents.shift();
};
if (saving){
return;
};
if (((mousePressed) && ((particle == Particle.SLASH)))){
addParticleLine(_local1, _local2, mouseLocX, mouseLocY);
} else {
if (((mousePressed) && ((particle == Particle.HAND)))){
if (zombieInHand){
handZombie.unwriteZombie();
handZombie.moveTo((mouseLocX - handZombie.loc.getX()), (mouseLocY - handZombie.loc.getY()));
};
} else {
if (((mousePressed) && ((particle == Particle.BULLET)))){
if ((field.count % (11 - brushSize)) == 0){
field.addParticle((fmX / 2), (fmY / 2), particle, mouseLocX, mouseLocY);
};
} else {
if (((mousePressed) && (!((particle == Particle.LASER))))){
addParticleLine(_local1, _local2, mouseLocX, mouseLocY);
} else {
if (((mousePressed) && ((particle == Particle.LASER)))){
field.addParticle((fmX / 2), (fmY / 2), particle, mouseLocX, mouseLocY);
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).setLife((brushSize + 1));
};
};
};
};
};
}
public function addParticleCircle(_arg1:int, _arg2:int){
var _local3:int;
var _local4:int;
var _local5:int;
field.addParticle(_arg1, _arg2, particle);
if ((((brushSize > 0)) && (!((particle == Particle.SLASH))))){
_local3 = (_arg2 - brushSize);
while (_local3 <= (_arg2 + brushSize)) {
_local4 = int(Math.sqrt((Math.pow(Number(brushSize), 2) - Math.pow(Number((_local3 - _arg2)), 2))));
_local5 = (_arg1 + _local4);
while (_local5 >= (_arg1 - _local4)) {
if (field.inBounds(_local5, _local3)){
field.addParticle(_local5, _local3, particle);
};
_local5--;
};
_local3++;
};
};
}
public function addParticleLine(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
var _local16:int;
var _local17:int;
var _local5:int = _arg1;
var _local6:int = _arg3;
var _local7:int = _arg2;
var _local8:int = _arg4;
var _local9:Boolean;
if (Math.abs((_local8 - _local7)) > Math.abs((_local6 - _local5))){
_local9 = true;
};
if (_local9){
_local5 = _arg2;
_local7 = _arg1;
_local6 = _arg4;
_local8 = _arg3;
};
if (_local5 > _local6){
_local16 = _local5;
_local5 = _local6;
_local6 = _local16;
_local17 = _local7;
_local7 = _local8;
_local8 = _local17;
};
var _local10:int = (_local6 - _local5);
var _local11:int = Math.abs((_local8 - _local7));
var _local12:int = (_local10 / 2);
var _local13:int;
var _local14:int = _local7;
if (_local7 < _local8){
_local13 = 1;
} else {
_local13 = -1;
};
var _local15:int = _local5;
while (_local15 <= _local6) {
if (_local9){
addParticleCircle(_local14, _local15);
} else {
addParticleCircle(_local15, _local14);
};
_local12 = (_local12 - _local11);
if (_local12 < 0){
_local14 = (_local14 + _local13);
_local12 = (_local12 + _local10);
};
_local15++;
};
}
function setButtons(_arg1:Array){
var _local3:String;
var _local4:TextFormat;
var _local5:int;
var _local2:int;
while (_local2 < particleButtons.length) {
removeChild(particleButtons[_local2]);
_local2++;
};
if (_arg1.length > 20){
particleButtons = new Array();
_local2 = 0;
while (_local2 < _arg1.length) {
particleButtons[_local2] = new Button();
_local3 = _arg1[_local2];
_local4 = new TextFormat();
_local4.font = "Arial";
_local4.size = 10;
particleButtons[_local2].label = _local3;
particleButtons[_local2].setStyle("textFormat", _local4);
particleButtons[_local2].addEventListener(MouseEvent.CLICK, buttonClick);
particleButtons[_local2].addEventListener(MouseEvent.MOUSE_OVER, mouseIsOver);
particleButtons[_local2].addEventListener(MouseEvent.MOUSE_OUT, mouseIsOff);
if ((_local2 % 2) == 0){
particleButtons[_local2].x = 525;
} else {
particleButtons[_local2].x = 570;
};
_local5 = (_local2 / 2);
particleButtons[_local2].y = (35 + (24 * _local5));
particleButtons[_local2].setSize(45, 24);
addChild(particleButtons[_local2]);
_local2++;
};
return;
};
particleButtons = new Array();
_local2 = 0;
while (_local2 < _arg1.length) {
particleButtons[_local2] = new Button();
_local3 = _arg1[_local2];
_local4 = new TextFormat();
_local4.font = "Arial";
_local4.size = 10;
particleButtons[_local2].label = _local3;
particleButtons[_local2].setStyle("textFormat", _local4);
particleButtons[_local2].addEventListener(MouseEvent.CLICK, buttonClick);
particleButtons[_local2].addEventListener(MouseEvent.MOUSE_OVER, mouseIsOver);
particleButtons[_local2].addEventListener(MouseEvent.MOUSE_OUT, mouseIsOff);
particleButtons[_local2].x = 525;
particleButtons[_local2].y = (35 + (20 * _local2));
particleButtons[_local2].setSize(90, 20);
addChild(particleButtons[_local2]);
_local2++;
};
}
function changeHandler(_arg1:Event):void{
switch (buttonSelector.selectedItem.data){
case "Favorites":
setButtons(favorites);
break;
case "Solids":
setButtons(solids);
break;
case "Powders":
setButtons(powders);
break;
case "Liquids":
setButtons(liquids);
break;
case "Explosives":
setButtons(explosives);
break;
case "Special":
setButtons(special);
break;
case "Makers":
setButtons(makers);
break;
case "Zombie Killer":
setButtons(zombieKiller);
break;
case "Everything":
setButtons(everything);
break;
case "Everything 2":
setButtons(everything2);
break;
};
}
function keyIsDown(_arg1:KeyboardEvent):void{
}
function keyIsUp(_arg1:KeyboardEvent):void{
}
function mouseIsDown(_arg1:MouseEvent):void{
if (!fmUsed){
fmX = _arg1.stageX;
fmY = _arg1.stageY;
fmUsed = true;
grabZombie();
};
mousePressed = true;
mouseEvents.push(_arg1);
}
function mouseIsUp(_arg1:MouseEvent):void{
fmUsed = false;
mousePressed = false;
mouseEvents.push(_arg1);
}
function mouseMoved(_arg1:MouseEvent):void{
mouseEvents.push(_arg1);
}
function bgmClick(_arg1:MouseEvent):void{
if (bgm){
bgmButton.gotoAndStop(2);
bgm = false;
} else {
bgmButton.gotoAndStop(1);
bgm = true;
};
}
function sfxClick(_arg1:MouseEvent):void{
if (sfx){
sfxButton.gotoAndStop(2);
sfx = false;
} else {
sfxButton.gotoAndStop(1);
sfx = true;
};
}
function mouseIsOff(_arg1:MouseEvent):void{
showDesc = false;
}
function mouseIsOver(_arg1:MouseEvent):void{
description.visible = true;
showDesc = true;
var _local2:Button = (_arg1.target as Button);
if (_local2.label == "Water"){
description.text.text = "Water: evaporate it, freeze it.";
};
if (_local2.label == "Rock"){
description.text.text = "Rock: a strong solid and a poor conductor of heat";
};
if (_local2.label == "Erase"){
description.text.text = "Erase: use it to erase";
};
if (_local2.label == "Sand"){
description.text.text = "Sand: melt it to create glass";
};
if (_local2.label == "Fire"){
description.text.text = "Fire: hot enough to melt and burn some substances";
};
if (_local2.label == "Oil"){
description.text.text = "Oil: a flamable liquid";
};
if (_local2.label == "Wax"){
description.text.text = "Wax: a flamable soild";
};
if (_local2.label == "Plant"){
description.text.text = "Plant: grows when near water";
};
if (_local2.label == "Electricity"){
description.text.text = "Electricity: use it for zapping";
};
if (_local2.label == "Steel"){
description.text.text = "Steel: a very strong metal and an excellent conductor of heat";
};
if (_local2.label == "Steam"){
particle = Particle.STEAM;
};
if (_local2.label == "Torch"){
description.text.text = "Torch: creates fire";
};
if (_local2.label == "Spout"){
description.text.text = "Spout: creates water";
};
if (_local2.label == "Sparker"){
description.text.text = "Sparker: creates electricity";
};
if (_local2.label == "Salt"){
description.text.text = "Salt: mix with water to create salt water";
};
if (_local2.label == "Well"){
description.text.text = "Well: creates oil";
};
if (_local2.label == "Sandmaker"){
description.text.text = "Sandmaker: creates sand";
};
if (_local2.label == "Saltmaker"){
description.text.text = "Saltmaker: creates salt";
};
if (_local2.label == "Ice"){
description.text.text = "Ice: solid water";
};
if (_local2.label == "Liquid Nitrogen"){
description.text.text = "Liquid Nitrogen: a very cold liquid, useful for freezing water";
};
if (_local2.label == "Gunpowder"){
description.text.text = "Gunpowder: a weak explosive";
};
if (_local2.label == "Fuse"){
description.text.text = "Fuse: light the fuse, run away";
};
if (_local2.label == "C4"){
description.text.text = "C4: highly explosive";
};
if (_local2.label == "Flash Powder"){
description.text.text = "Flash Powder: a quickly burning powder";
};
if (_local2.label == "Thermite"){
description.text.text = "Thermite: burns hot enough to melt steel";
};
if (_local2.label == "Dark Matter"){
description.text.text = "Dark Matter: creates a strong gravity field";
};
if (_local2.label == "White Matter"){
description.text.text = "White Matter: creates a strong anti-gravity field";
};
if (_local2.label == "Napalm"){
description.text.text = "Napalm: burns very hot";
};
if (_local2.label == "Uranium"){
description.text.text = "Uranium: explodes when it reaches critical mass";
};
if (_local2.label == "Cloner"){
description.text.text = "Cloner: clones non-solids";
};
if (_local2.label == "Ants"){
description.text.text = "Ants: eat plant and other organic material";
};
if (_local2.label == "Laser"){
description.text.text = "Laser: useful for burning, also reflects off of mirrors";
};
if (_local2.label == "Nitroglycerin"){
description.text.text = "Nitroglycerin: shock-sensitive explosive";
};
if (_local2.label == "Adamantium"){
description.text.text = "Adamantium: an indestructible metal";
};
if (_local2.label == "Blood"){
particle = Particle.BLOOD;
};
if (_local2.label == "Sword"){
description.text.text = "Sword: useful for cutting stuff, especially zombies";
};
if (_local2.label == "Hand"){
description.text.text = "Hand: use it to pick up zombies and move them";
};
if (_local2.label == "LSD"){
description.text.text = "LSD: makes zombies trip out";
};
if (_local2.label == "Gun"){
description.text.text = "Gun: useful for shooting stuff, especially zombies";
};
if (_local2.label == "Acid"){
description.text.text = "Acid: dissolves almost anything";
};
if (_local2.label == "Bees"){
description.text.text = "Bees: pollinate plants to create flowers";
};
if (_local2.label == "Acidmaker"){
description.text.text = "Acidmaker: creates acid";
};
if (_local2.label == "Mirror"){
description.text.text = "Mirror: reflects lasers";
};
if (_local2.label == "Clay"){
description.text.text = "Clay: hardens over time";
};
if (_local2.label == "Blue Fire"){
description.text.text = "Blue Fire: Much hotter than regular fire";
};
if (_local2.label == "Lava"){
description.text.text = "Lava: Molten rock";
};
if (_local2.label == "Volcano"){
description.text.text = "Volcano: Erupts and spews out lava";
};
if (_local2.label == "Seed"){
description.text.text = "Seed: Plant this in earth, and a tree will grow";
};
if (_local2.label == "Earth"){
description.text.text = "Earth: Plant a seed in earth and a tree will grow";
};
if (_local2.label == "Liquid Helium"){
description.text.text = "Liquid Helium: Incredibly cold, evaporates very quickly";
};
if (_local2.label == "Clear All"){
description.text.text = "Clear All: removes everything";
};
}
function buttonClick(_arg1:MouseEvent):void{
if (saving){
return;
};
if ((_arg1.target is Play)){
stopping = false;
addChild(stopBut);
removeChild(playBut);
return;
};
if ((_arg1.target is Stop)){
stopping = true;
removeChild(stopBut);
addChild(playBut);
return;
};
if ((_arg1.target is MuteButton)){
if (_arg1.target == sfxButton){
sfxButton.gotoAndStop(2);
};
if (_arg1.target == bgmButton){
bgmButton.gotoAndStop(2);
};
return;
};
var _local2:Button = (_arg1.target as Button);
if (_local2.label == "Load"){
kongregate.sharedContent.browse("Field");
};
if (_local2.label == "Save"){
kongregate.sharedContent.save("Field", field.toString(), onSaved, new Bitmap(field.g));
if (stopping == false){
stopping = true;
removeChild(stopBut);
addChild(playBut);
};
};
if (_local2.label == "Water"){
particle = Particle.WATER;
};
if (_local2.label == "Rock"){
particle = Particle.ROCK;
};
if (_local2.label == "Erase"){
particle = Particle.NULLPARTICLE;
};
if (_local2.label == "Sand"){
particle = Particle.SAND;
};
if (_local2.label == "Fire"){
particle = Particle.FIRE;
};
if (_local2.label == "Oil"){
particle = Particle.OIL;
};
if (_local2.label == "Wax"){
particle = Particle.WAX;
};
if (_local2.label == "Plant"){
particle = Particle.PLANT;
};
if (_local2.label == "Electricity"){
particle = Particle.ELECTRICITY;
};
if (_local2.label == "Steel"){
particle = Particle.STEEL;
};
if (_local2.label == "Steel"){
particle = Particle.STEEL;
};
if (_local2.label == "Steam"){
particle = Particle.STEAM;
};
if (_local2.label == "Torch"){
particle = Particle.TORCH;
};
if (_local2.label == "Spout"){
particle = Particle.SPOUT;
};
if (_local2.label == "Sparker"){
particle = Particle.SPARKER;
};
if (_local2.label == "Salt"){
particle = Particle.SALT;
};
if (_local2.label == "Well"){
particle = Particle.WELL;
};
if (_local2.label == "Sandmaker"){
particle = Particle.SANDMAKER;
};
if (_local2.label == "Saltmaker"){
particle = Particle.SALTMAKER;
};
if (_local2.label == "Ice"){
particle = Particle.ICE;
};
if (_local2.label == "Liquid Nitrogen"){
particle = Particle.LIQUID_NITROGEN;
};
if (_local2.label == "Gunpowder"){
particle = Particle.GUNPOWDER;
};
if (_local2.label == "Fuse"){
particle = Particle.FUSE;
};
if (_local2.label == "C4"){
particle = Particle.C4;
};
if (_local2.label == "Flash Powder"){
particle = Particle.FLASH_POWDER;
};
if (_local2.label == "Thermite"){
particle = Particle.THERMITE;
};
if (_local2.label == "Dark Matter"){
particle = Particle.DARK_MATTER;
};
if (_local2.label == "White Matter"){
particle = Particle.WHITE_MATTER;
};
if (_local2.label == "Napalm"){
particle = Particle.NAPALM;
};
if (_local2.label == "Uranium"){
particle = Particle.URANIUM;
};
if (_local2.label == "Cloner"){
particle = Particle.CLONER;
};
if (_local2.label == "Ants"){
particle = Particle.ANT;
};
if (_local2.label == "Laser"){
particle = Particle.LASER;
};
if (_local2.label == "Nitroglycerin"){
particle = Particle.NITROGLYCERIN;
};
if (_local2.label == "Adamantium"){
particle = Particle.ADAMANTIUM;
};
if (_local2.label == "Blood"){
particle = Particle.BLOOD;
};
if (_local2.label == "Sword"){
particle = Particle.SLASH;
};
if (_local2.label == "Hand"){
particle = Particle.HAND;
};
if (_local2.label == "LSD"){
particle = Particle.LSD;
};
if (_local2.label == "Gun"){
particle = Particle.BULLET;
};
if (_local2.label == "Acid"){
particle = Particle.ACID;
};
if (_local2.label == "Bees"){
particle = Particle.BEE;
};
if (_local2.label == "Acidmaker"){
particle = Particle.ACIDMAKER;
};
if (_local2.label == "Mirror"){
particle = Particle.MIRROR;
};
if (_local2.label == "Clay"){
particle = Particle.CLAY;
};
if (_local2.label == "Blue Fire"){
particle = Particle.BLUE_FIRE;
};
if (_local2.label == "Lava"){
particle = Particle.LAVA;
};
if (_local2.label == "Volcano"){
particle = Particle.VOLCANO;
};
if (_local2.label == "Seed"){
particle = Particle.SEED;
};
if (_local2.label == "Earth"){
particle = Particle.EARTH;
};
if (_local2.label == "Liquid Helium"){
particle = Particle.LIQUID_HELIUM;
};
if (_local2.label == "Clear All"){
field.particleArray.clearAll();
field.clearZombies();
field.drawBackground();
};
}
function sliderChange(_arg1:SliderEvent):void{
brushSize = _arg1.value;
}
function stepperChange(_arg1:Event):void{
field.zombieAmount = zombieStepper.value;
}
function frame1(){
stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, goLoad);
myGlow = new GlowFilter();
myGlow.alpha = 0.5;
myGlow.color = 0xFFFFFF;
myGlow.blurX = 15;
myGlow.blurY = 15;
mainText.filters = [myGlow];
authorText.filters = [myGlow];
loadingText.filters = [myGlow];
loadingBar.filters = [myGlow];
}
function frame2(){
stop();
}
function frame3(){
stop();
}
}
}//package
Section 101
//Fire (Fire)
package {
import MathPackage.*;
public class Fire extends Special {
public const HIGHEST_TEMP = 1800;
public const HIGH_TEMP = 1500;
public const LOW_TEMP = 1100;
public const LOWEST_TEMP = 700;
private const SPREAD = 1;
private const TRANS = 0.7;
private const DELETE_CHANCE = 0.05;
private const FIRE_SPEC_HEAT = 3;
private const FIRE_TRAN_HEAT = 0.7;
private const FIRE_COLOR_LOW:uint = 8323072;
private const FIRE_COLOR_MID:uint = 16744192;
private const FIRE_COLOR_HIGH:uint = 16777087;
private var life:int;
public function Fire(_arg1:int, _arg2:int, _arg3:Field, _arg4:int){
super(_arg1, _arg2, _arg3);
number = FIRE;
if (_arg4 == 0){
this.temp = int((HIGHEST_TEMP * Calc.nextListRandom()));
} else {
this.temp = _arg4;
};
setColor();
stuff();
}
public function stuff(){
life = 2;
}
override public function specHeat():Number{
return (FIRE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (FIRE_TRAN_HEAT);
}
private function redirectParticle(_arg1:int, _arg2:int){
life--;
}
public function getMagnitude():Number{
if (temp > HIGHEST_TEMP){
return (((HIGHEST_TEMP - LOWEST_TEMP) / 150));
};
if (((temp - LOWEST_TEMP) / 150) > 0){
return (((temp - LOWEST_TEMP) / 150));
};
return (0);
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Particle;
field.particleArray.unwrite(this);
if (field.inBounds_Par(this)){
_local1 = getMagnitude();
_local2 = 1;
while (_local2 <= _local1) {
_local3 = loc.getIntX();
_local4 = (loc.getIntY() - 1);
_local5 = field.particleArray.getCollision(_local3, _local4);
_local6 = field.particleArray.getParticle(_local3, _local4);
if (_local5 == 0){
loc.addY(-1);
} else {
life--;
};
_local2++;
};
} else {
life--;
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
override public function simulate(){
if (life <= 0){
this.deleteParticle = true;
};
checkDelete();
setColor();
handleTemp();
moveParticle();
drawParticle();
}
public function handleTemp(){
temp = int((temp - (0.05 * (temp - field.DEFAULT_TEMP))));
if (temp < 850){
deleteParticle = true;
};
}
public function setColor(){
if (temp < LOW_TEMP){
pColor = FIRE_COLOR_LOW;
};
if (temp > HIGH_TEMP){
pColor = FIRE_COLOR_HIGH;
};
if ((((temp < HIGH_TEMP)) && ((temp > LOW_TEMP)))){
pColor = FIRE_COLOR_MID;
};
}
}
}//package
Section 102
//FireSound (FireSound)
package {
import flash.media.*;
public dynamic class FireSound extends Sound {
}
}//package
Section 103
//FlashPowder (FlashPowder)
package {
import MathPackage.*;
public class FlashPowder extends Powder {
private var burnTime:int;
private static const BURN_TEMP = 450;
private static const BURN_MIN = 700;
private static const BURN_MAX = 1100;
private static const SPARK_MIN = 1900;
private static const SPARK_MAX = 2500;
private static const FP_SPEC_HEAT = 0.4;
private static const FP_TRAN_HEAT = 0.6;
private static const FP_COLOR:uint = 16752029;
private static const FP_POWER = 0.6;
public function FlashPowder(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = FLASH_POWDER;
pColor = FP_COLOR;
size = 0.7;
burnTime = 12;
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
moveParticle();
drawParticle();
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
public function getSparkTemp():int{
return (int((SPARK_MIN + ((SPARK_MAX - SPARK_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((burnTime > 0)) && ((temp > BURN_TEMP)))){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
burnTime--;
};
}
override public function specHeat():Number{
return (FP_SPEC_HEAT);
}
override public function tranHeat():Number{
return (FP_TRAN_HEAT);
}
}
}//package
Section 104
//Flower (Flower)
package {
import MathPackage.*;
public class Flower extends Solid {
private var burnTime:int;
private var petalColor:uint;
private static const FREEZE_TEMP = 220;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1600;
private static const FLOWER_SPEC_HEAT = 1.4;
private static const FLOWER_TRAN_HEAT = 0.6;
private static const FLOWER_COLOR:uint = 16777065;
private static const DEAD_FLOWER_COLOR:uint = 8224125;
public function Flower(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = FLOWER;
pColor = FLOWER_COLOR;
burnTime = 100;
var _local4:* = Calc.nextListRandom();
if (_local4 < (1 / 6)){
petalColor = (((228 * 65536) + (47 * 0x0100)) + 12);
} else {
if (_local4 < (2 / 6)){
petalColor = (((225 * 65536) + (183 * 0x0100)) + 197);
} else {
if (_local4 < (3 / 6)){
petalColor = (((0xFF * 65536) + (159 * 0x0100)) + 0);
} else {
if (_local4 < (4 / 6)){
petalColor = (((0xFF * 65536) + (243 * 0x0100)) + 0);
} else {
if (_local4 < (5 / 6)){
petalColor = (((181 * 65536) + (126 * 0x0100)) + 220);
} else {
petalColor = (((249 * 65536) + (0xFF * 0x0100)) + 249);
};
};
};
};
};
}
override public function specHeat():Number{
return (FLOWER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (FLOWER_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function drawParticle(){
if (!deleteParticle){
field.g.setPixel((loc.getIntX() * 2), (loc.getIntY() * 2), pColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), (loc.getIntY() * 2), pColor);
field.g.setPixel((loc.getIntX() * 2), ((loc.getIntY() * 2) + 1), pColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), ((loc.getIntY() * 2) + 1), pColor);
field.g.setPixel(((loc.getIntX() * 2) + 2), (loc.getIntY() * 2), petalColor);
field.g.setPixel((((loc.getIntX() * 2) + 1) + 2), (loc.getIntY() * 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) + 2), ((loc.getIntY() * 2) + 1), petalColor);
field.g.setPixel((((loc.getIntX() * 2) + 1) + 2), ((loc.getIntY() * 2) + 1), petalColor);
field.g.setPixel(((loc.getIntX() * 2) - 2), (loc.getIntY() * 2), petalColor);
field.g.setPixel((((loc.getIntX() * 2) + 1) - 2), (loc.getIntY() * 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) - 2), ((loc.getIntY() * 2) + 1), petalColor);
field.g.setPixel((((loc.getIntX() * 2) + 1) - 2), ((loc.getIntY() * 2) + 1), petalColor);
field.g.setPixel((loc.getIntX() * 2), ((loc.getIntY() * 2) + 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), ((loc.getIntY() * 2) + 2), petalColor);
field.g.setPixel((loc.getIntX() * 2), (((loc.getIntY() * 2) + 1) + 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), (((loc.getIntY() * 2) + 1) + 2), petalColor);
field.g.setPixel((loc.getIntX() * 2), ((loc.getIntY() * 2) - 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), ((loc.getIntY() * 2) - 2), petalColor);
field.g.setPixel((loc.getIntX() * 2), (((loc.getIntY() * 2) + 1) - 2), petalColor);
field.g.setPixel(((loc.getIntX() * 2) + 1), (((loc.getIntY() * 2) + 1) - 2), petalColor);
};
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
field.ser.plantBurning++;
} else {
if (temp < FREEZE_TEMP){
};
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 105
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 106
//Fuse (Fuse)
package {
import MathPackage.*;
public class Fuse extends Solid {
private const BURN_TEMP = 450;
private const BURN_MIN = 1600;
private const BURN_MAX = 1800;
private const FUSE_SPEC_HEAT = 2;
private const FUSE_TRAN_HEAT = 0.9;
private const FUSE_COLOR:uint = 13148872;
private var burnTime:int;
public function Fuse(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = FUSE;
pColor = FUSE_COLOR;
burnTime = 10;
}
override public function specHeat():Number{
return (FUSE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (FUSE_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
public function spark(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
if (temp > BURN_TEMP){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
temp = getFireTemp();
_local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if ((((((_local5.number == FUSE)) && ((burnTime <= 9)))) && (!(created)))){
_local5.temp = temp;
};
};
_local2++;
};
_local1++;
};
burnTime--;
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
spark();
checkDelete();
drawParticle();
}
}
}//package
Section 107
//Gas (Gas)
package {
import MathPackage.*;
public class Gas extends Particle {
public var density:Number;
public function Gas(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
phase = GAS;
}
override public function simulate(){
checkDelete();
moveParticle();
drawParticle();
}
public function redirectParticle(){
}
override public function drawParticle(){
if (field.canMove(this)){
field.fillCircle((loc.getIntX() * 2), (loc.getIntY() * 2), 2, pColor);
};
}
public function getMagnitude():Number{
return (((density * Calc.nextListRandom()) * 2));
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
field.particleArray.unwrite(this);
if (((field.inBounds_Par(this)) && (field.canMove(this)))){
_local1 = getMagnitude();
_local2 = 1;
while (_local2 <= _local1) {
_local3 = loc.getIntX();
_local4 = (loc.getIntY() - 1);
_local5 = field.particleArray.getCollision(_local3, _local4);
if (_local5 <= 2){
loc.addY(-1);
} else {
redirectParticle();
};
_local2++;
};
} else {
redirectParticle();
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
}
}//package
Section 108
//Gunpowder (Gunpowder)
package {
import MathPackage.*;
public class Gunpowder extends Powder {
private var burnTime:int;
private static const BURN_TEMP = 400;
private static const BURN_MIN = 1500;
private static const BURN_MAX = 1900;
private static const GP_SPEC_HEAT = 0.4;
private static const GP_TRAN_HEAT = 0.2;
private static const GP_COLOR:uint = 6378322;
private static const GP_POWER = 2.3;
public function Gunpowder(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = GUNPOWDER;
pColor = GP_COLOR;
size = 0.76;
burnTime = 2;
temp = 300;
}
override public function simulate(){
transferHeat();
if (temp > BURN_TEMP){
burn2();
};
checkDelete();
moveParticle();
drawParticle();
}
override public function isExplosive():Boolean{
return (true);
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if (burnTime > 0){
temp = getFireTemp();
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, int(getFireTemp())));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, GP_POWER));
field.addParticle_Par(new Smoke(loc.getIntX(), loc.getIntY(), field));
burnTime--;
field.ser.gunpowderExplosion++;
};
}
private function burn2(){
if (burnTime > 0){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, int(getFireTemp())));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, GP_POWER));
field.addParticle_Par(new Smoke(loc.getIntX(), loc.getIntY(), field));
burnTime--;
field.ser.gunpowderExplosion++;
};
}
override public function specHeat():Number{
return (GP_SPEC_HEAT);
}
override public function tranHeat():Number{
return (GP_TRAN_HEAT);
}
}
}//package
Section 109
//Gunshot (Gunshot)
package {
import flash.media.*;
public dynamic class Gunshot extends Sound {
}
}//package
Section 110
//HighNoise (HighNoise)
package {
import flash.media.*;
public dynamic class HighNoise extends Sound {
}
}//package
Section 111
//Ice (Ice)
package {
public class Ice extends Solid {
private static const MELT_TEMP = 280;
private static const ICE_SPEC_HEAT = 4.9;
private static const ICE_TRAN_HEAT = 0.3;
private static const ICE_COLOR:uint = 14476543;
public function Ice(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = ICE;
pColor = ICE_COLOR;
temp = 200;
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
drawParticle();
}
override public function specHeat():Number{
return (ICE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ICE_TRAN_HEAT);
}
public function handleTemp(){
if ((((temp > MELT_TEMP)) && (!(created)))){
field.particleArray.addParticle(new Water(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function strength():Number{
return (1.2);
}
}
}//package
Section 112
//IceSound (IceSound)
package {
import flash.media.*;
public dynamic class IceSound extends Sound {
}
}//package
Section 113
//Laser (Laser)
package {
import MathPackage.*;
public class Laser extends Special {
private var distance:int;
private var rotation:Number;
private var points:Array;
private var destX;
private var destY:int;
private var deltax:int;
private var deltay:int;
private var error:int;
private var ystep:int;
private var steep;
private var reverse:Boolean;
private var x0;
private var y0;
private var x1;
private var y1:int;
private var startX;
private var startY:int;
private var hit;
private var kill:Boolean;
private var hitParticle:Particle;
private var life:int;
private var power:int;
private var killCount:int;
private var reflected:int;
private static const LASER_COLOR:uint = 15400960;
private static const MAX_DIST = 2500;
public function Laser(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Field){
var _local8:int;
var _local9:int;
points = new Array();
reflected = 0;
points.push(new IntPoint(_arg1, _arg2));
distance = 0;
power = 1;
killCount = 0;
kill = false;
super(_arg1, _arg2, _arg5);
number = LASER;
temp = 2400;
pColor = LASER_COLOR;
hit = false;
life = 2;
startX = _arg1;
startY = _arg2;
var _local6:Number = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
var _local7:IntVector = new IntVector(250, 300);
_local7.setRotation(_local6);
rotation = _local6;
destX = (_local7.getIntX() + loc.getX());
destY = (_local7.getIntY() + loc.getY());
x0 = destX;
x1 = _arg1;
y0 = destY;
y1 = _arg2;
steep = false;
if (Math.abs((y1 - y0)) > Math.abs((x1 - x0))){
steep = true;
};
if (steep){
x0 = destY;
y0 = destX;
x1 = _arg2;
y1 = _arg1;
};
reverse = true;
if (x0 > x1){
_local8 = x0;
x0 = x1;
x1 = _local8;
_local9 = y0;
y0 = y1;
y1 = _local9;
reverse = false;
};
deltax = (x1 - x0);
deltay = Math.abs((y1 - y0));
error = (deltax / 2);
ystep = 0;
_arg2 = y0;
if (y0 < y1){
ystep = 1;
} else {
ystep = -1;
};
}
override public function setLife(_arg1:int){
power = _arg1;
}
override public function force():Number{
return (power);
}
public function nextBresPoint():IntPoint{
if (!reverse){
error = (error - deltay);
if (error < 0){
y0 = (y0 + ystep);
error = (error + deltax);
};
x0++;
if (steep){
return (new IntPoint(y0, x0));
};
return (new IntPoint(x0, y0));
//unresolved jump
};
error = (error - deltay);
if (error < 0){
y1 = (y1 - ystep);
error = (error + deltax);
};
x1--;
if (steep){
return (new IntPoint(y1, x1));
};
return (new IntPoint(x1, y1));
}
override public function drawParticle(){
var _local1:int;
if (power > 10){
power = 10;
};
pColor = (((235 * 65536) + ((power * 25) * 0x0100)) + (power * 25));
if (!deleteParticle){
_local1 = 0;
while (_local1 < (points.length - 1)) {
field.drawLine((points[_local1].getX() * 2), (points[_local1].getY() * 2), (points[(_local1 + 1)].getX() * 2), (points[(_local1 + 1)].getY() * 2), pColor);
field.drawLine(((points[_local1].getX() * 2) + 1), ((points[_local1].getY() * 2) + 1), ((points[(_local1 + 1)].getX() * 2) + 1), ((points[(_local1 + 1)].getY() * 2) + 1), pColor);
field.drawLine((points[_local1].getX() * 2), ((points[_local1].getY() * 2) + 1), (points[(_local1 + 1)].getX() * 2), ((points[(_local1 + 1)].getY() * 2) + 1), pColor);
field.drawLine(((points[_local1].getX() * 2) + 1), (points[_local1].getY() * 2), ((points[(_local1 + 1)].getX() * 2) + 1), (points[(_local1 + 1)].getY() * 2), pColor);
_local1++;
};
};
}
private function mirrorRot(_arg1:int, _arg2:int, _arg3:Boolean):Number{
var _local4:int;
if (_arg3){
rotation = (rotation % (Math.PI * 2));
rotation = (rotation + (Math.PI * 2));
rotation = (rotation % (Math.PI * 2));
_local4 = -16;
while (_local4 <= 16) {
if (((((rotation * (180 / Math.PI)) <= ((_local4 * 45) + 22.5))) && (((rotation * (180 / Math.PI)) >= ((_local4 * 45) - 22.5))))){
return (((_local4 * 45) / (180 / Math.PI)));
};
_local4++;
};
};
return (0);
}
private function reflect(_arg1:int, _arg2:int, _arg3:Boolean){
var _local8:int;
var _local9:int;
var _local4:Number = (mirrorRot((_arg1 - points[(points.length - 1)].getX()), (_arg2 - points[(points.length - 1)].getY()), true) + (180 / (180 / Math.PI)));
var _local5:Particle = field.particleArray.getParticle(_arg1, _arg2);
if (!_arg3){
if (((((((_local5.top()) && (_local5.right()))) && (_local5.left()))) && (!(_local5.bottom())))){
_local4 = (90 / (180 / Math.PI));
points.push(new IntPoint(_arg1, (_arg2 + 1)));
} else {
if (((((((_local5.top()) && (_local5.right()))) && (!(_local5.left())))) && (_local5.bottom()))){
_local4 = (180 / (180 / Math.PI));
points.push(new IntPoint((_arg1 - 1), _arg2));
} else {
if (((((((_local5.top()) && (!(_local5.right())))) && (_local5.left()))) && (_local5.bottom()))){
_local4 = (0 / (180 / Math.PI));
points.push(new IntPoint((_arg1 + 1), _arg2));
} else {
if (((((((!(_local5.top())) && (_local5.right()))) && (_local5.left()))) && (_local5.bottom()))){
_local4 = (270 / (180 / Math.PI));
points.push(new IntPoint(_arg1, (_arg2 - 1)));
} else {
if (((((((_local5.top()) && (!(_local5.right())))) && (_local5.left()))) && (!(_local5.bottom())))){
_local4 = (45 / (180 / Math.PI));
points.push(new IntPoint((_arg1 + 1), (_arg2 + 1)));
} else {
if (((((((!(_local5.top())) && (!(_local5.right())))) && (_local5.left()))) && (_local5.bottom()))){
_local4 = (315 / (180 / Math.PI));
points.push(new IntPoint((_arg1 + 1), (_arg2 - 1)));
} else {
if (((((((!(_local5.top())) && (_local5.right()))) && (!(_local5.left())))) && (_local5.bottom()))){
_local4 = (225 / (180 / Math.PI));
points.push(new IntPoint((_arg1 - 1), (_arg2 - 1)));
} else {
if (((((((_local5.top()) && (_local5.right()))) && (!(_local5.left())))) && (!(_local5.bottom())))){
_local4 = (135 / (180 / Math.PI));
points.push(new IntPoint((_arg1 - 1), (_arg2 + 1)));
} else {
points.push(new IntPoint(_arg1, _arg2));
};
};
};
};
};
};
};
};
loc.setX(points[(points.length - 1)].getX());
loc.setY(points[(points.length - 1)].getY());
} else {
points.push(new IntPoint(_arg1, _arg2));
};
var _local6:Number = (_local4 + ((_local4 - Math.PI) - rotation));
var _local7:IntVector = new IntVector(350, 300);
_local7.setRotation(_local6);
rotation = _local6;
_arg1 = loc.getX();
_arg2 = loc.getY();
destX = (_local7.getIntX() + loc.getX());
destY = (_local7.getIntY() + loc.getY());
x0 = destX;
x1 = loc.getX();
y0 = destY;
y1 = loc.getY();
steep = false;
if (Math.abs((y1 - y0)) > Math.abs((x1 - x0))){
steep = true;
};
if (steep){
x0 = destY;
y0 = destX;
x1 = _arg2;
y1 = _arg1;
};
reverse = true;
if (x0 > x1){
_local8 = x0;
x0 = x1;
x1 = _local8;
_local9 = y0;
y0 = y1;
y1 = _local9;
reverse = false;
};
deltax = (x1 - x0);
deltay = Math.abs((y1 - y0));
error = (deltax / 2);
ystep = 0;
_arg2 = y0;
if (y0 < y1){
ystep = 1;
} else {
ystep = -1;
};
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Particle;
var _local5:IntPoint;
field.particleArray.unwrite(this);
kill = true;
if (field.inBounds_Par(this)){
_local1 = startY;
_local2 = startX;
while (((((field.inBounds(_local2, _local1)) && (!(hit)))) && ((distance < MAX_DIST)))) {
distance++;
if (kill){
_local5 = nextBresPoint();
_local1 = _local5.getY();
_local2 = _local5.getX();
};
kill = false;
_local3 = field.particleArray.getCollision(_local2, _local1);
_local4 = field.particleArray.getParticle(_local2, _local1);
reflected--;
if ((((((_local3 == SPECIAL)) || ((_local3 == GAS)))) || ((reflected >= 0)))){
kill = true;
loc.setX(_local2);
loc.setY(_local1);
} else {
if (_local4.number == MIRROR){
kill = true;
if (field.canMove(_local4)){
distance = (distance + 0);
reflected = 0;
reflect(_local2, _local1, false);
loc.setX(points[(points.length - 1)].getX());
loc.setY(points[(points.length - 1)].getY());
} else {
distance = (distance + 200);
reflected = 5;
reflect(_local2, _local1, true);
loc.setX(points[(points.length - 1)].getX());
loc.setY(points[(points.length - 1)].getY());
points.push(new IntPoint(_local2, _local1));
};
} else {
hitParticle = field.particleArray.getParticle(_local2, _local1);
hit = true;
killCount++;
if (killCount < power){
transferHeat();
hit = false;
};
};
};
};
};
points.push(new IntPoint(getX(), getY()));
field.particleArray.write(this);
}
override public function transferHeat(){
var _local1:Particle;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
if (((hit) && (!((hitParticle.number == NULLPARTICLE))))){
_local1 = hitParticle;
if ((((_local1.phase == Particle.SOLID)) && ((Calc.nextListRandom() > (1 / _local1.strength()))))){
} else {
if (Calc.nextListRandom() < 0.05){
} else {
kill = true;
hitParticle.deleteParticle = true;
};
};
_local2 = -1;
while (_local2 <= 1) {
_local3 = -1;
while (_local3 <= 1) {
_local4 = (hitParticle.loc.getIntX() + _local2);
_local5 = (hitParticle.loc.getIntY() + _local3);
if (field.inBounds(_local4, _local5)){
_local1 = field.particleArray.getParticle(_local4, _local5);
if (_local1.phase != SPECIAL){
_local1.temp = (_local1.temp + 100);
if (_local1.temp > temp){
_local1.temp = temp;
};
};
};
_local3++;
};
_local2++;
};
};
}
override public function simulate(){
if (life == 2){
moveParticle();
transferHeat();
drawParticle();
deleteParticle = false;
life--;
return;
};
life--;
if (life == 0){
deleteParticle = true;
};
}
}
}//package
Section 114
//LaserSound (LaserSound)
package {
import flash.media.*;
public dynamic class LaserSound extends Sound {
}
}//package
Section 115
//Lava (Lava)
package {
import MathPackage.*;
public class Lava extends Liquid {
private static const FREZ_TEMP = 2500;
private static const MID_TEMP = 3500;
private static const LAVA_SPEC_HEAT = 4.1;
private static const LAVA_TRAN_HEAT = 0.44;
private static const HIGH_COLOR:uint = 15081504;
private static const LOW_COLOR:uint = 9830400;
public function Lava(_arg1:int, _arg2:int, _arg3:Field, _arg4=1){
super(_arg1, _arg2, _arg3);
number = Particle.LAVA;
pColor = LOW_COLOR;
if (_arg4 == 1){
temp = 3500;
} else {
temp = (((4500 - 2500) * Calc.nextListRandom()) + FREZ_TEMP);
};
MAX_VISC = 3;
}
override public function specHeat():Number{
return (LAVA_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LAVA_TRAN_HEAT);
}
public function handleTemp(){
if ((((temp < FREZ_TEMP)) && (!(created)))){
field.particleArray.addParticle(new LAVA(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
public function setColor(){
var _local1:uint = pColor;
if (temp >= FREZ_TEMP){
pColor = LOW_COLOR;
};
if (temp >= MID_TEMP){
pColor = HIGH_COLOR;
};
if (temp <= FREZ_TEMP){
field.addParticle_Par(new Rock(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
setColor();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 116
//Leaf (Leaf)
package {
import MathPackage.*;
public class Leaf extends Solid {
private var burnTime:int;
private static const BURN_TEMP = 900;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1500;
private static const LEAF_SPEC_HEAT = 1.5;
private static const LEAF_TRAN_HEAT = 0.6;
private static const LEAF_COLOR:uint = 2263842;
public function Leaf(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = LEAF;
pColor = LEAF_COLOR;
burnTime = 190;
}
override public function specHeat():Number{
return (LEAF_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LEAF_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
field.ser.plantBurning++;
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 117
//Liquid (Liquid)
package {
import MathPackage.*;
public class Liquid extends Particle {
public var VISC:int;// = 20
public var MAX_VISC;
public function Liquid(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
phase = LIQUID;
MAX_VISC = 10;
}
override public function simulate(){
transferHeat();
checkDelete();
moveParticle();
drawParticle();
}
public function nextToLiquid(_arg1:int, _arg2:int):Boolean{
var _local4:int;
var _local5:int;
var _local3 = -1;
while (_local3 <= 1) {
_local4 = -1;
while (_local4 <= 1) {
if (field.inBounds(_arg1, _arg2)){
_local5 = field.particleArray.getCollision((_arg1 + _local3), (_arg2 + _local4));
if ((((_local3 == 0)) && ((_local4 == 0)))){
} else {
if (_local5 == LIQUID){
return (true);
};
};
} else {
return (false);
};
_local4++;
};
_local3++;
};
return (false);
}
public function redirectParticle(){
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
VISC = magnitude;
moved = false;
var _local1:int;
var _local2 = 1;
while (_local2 < VISC) {
_local7 = field.particleArray.getCollision(loc.getIntX(), (loc.getIntY() + _local2));
if (_local7 <= 1){
_local1 = _local2;
moved = true;
} else {
if (_local7 >= 3){
_local2 = VISC;
};
};
_local2++;
};
if (moved){
loc.addY(_local1);
return;
};
if (VISC > MAX_VISC){
VISC = MAX_VISC;
};
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
var _local6:int;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
} else {
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
};
};
};
if (moved){
return;
};
_local3 = true;
_local4 = true;
_local5 = 0;
_local6 = 0;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
moved = true;
} else {
loc.addX(-(_local5));
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
moved = true;
};
};
};
}
override public function moveParticle(){
var _local2:int;
var _local3:int;
var _local4:int;
field.particleArray.unwrite(this);
var _local1:int;
while (_local1 < magnitude) {
_local2 = loc.getIntX();
_local3 = (loc.getIntY() + 1);
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= 1){
loc.setY(_local3);
} else {
_local1 = magnitude;
redirectParticle();
};
_local1++;
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
}
}//package
Section 118
//LiquidHelium (LiquidHelium)
package {
import MathPackage.*;
public class LiquidHelium extends Liquid {
private var life:int;
private static const EVAP_TEMP = 10;
private static const LN_SPEC_HEAT = 15;
private static const LN_TRAN_HEAT = 0.95;
private static const LN_COLOR:uint = 11182535;
public function LiquidHelium(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LIQUID_NITROGEN;
pColor = LN_COLOR;
life = (5 + (Calc.nextListRandom() * 5));
temp = -2000;
}
public function handleTemp(){
life--;
if (temp > EVAP_TEMP){
temp = EVAP_TEMP;
life = (life - 5);
field.particleArray.addParticle(new LNSteam(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = EVAP_TEMP;
};
if (life <= 0){
this.deleteParticle = true;
};
}
override public function specHeat():Number{
return (LN_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LN_TRAN_HEAT);
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 119
//LiquidNitrogen (LiquidNitrogen)
package {
public class LiquidNitrogen extends Liquid {
private var life:int;
private static const EVAP_TEMP = 160;
private static const LN_SPEC_HEAT = 2.95;
private static const LN_TRAN_HEAT = 0.83;
private static const LN_COLOR:uint = 9609679;
public function LiquidNitrogen(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LIQUID_NITROGEN;
pColor = LN_COLOR;
life = 2;
temp = 19;
}
public function handleTemp(){
if (temp > EVAP_TEMP){
temp = EVAP_TEMP;
life--;
field.particleArray.addParticle(new LNSteam(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = EVAP_TEMP;
};
if (life <= 0){
this.deleteParticle = true;
};
}
override public function specHeat():Number{
return (LN_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LN_TRAN_HEAT);
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 120
//LiquidSand (LiquidSand)
package {
public class LiquidSand extends Liquid {
private static const FREZ_TEMP = 1800;
private static const LS_SPEC_HEAT = 7;
private static const LS_TRAN_HEAT = 0.8;
private static const LS_COLOR:uint = 16244163;
public function LiquidSand(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LIQUID_SAND;
pColor = LS_COLOR;
temp = 3000;
MAX_VISC = 5;
}
override public function specHeat():Number{
return (LS_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LS_TRAN_HEAT);
}
public function handleTemp(){
if ((((temp < FREZ_TEMP)) && (!(created)))){
field.particleArray.addParticle(new Mirror(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 121
//LiquidSteel (LiquidSteel)
package {
public class LiquidSteel extends Liquid {
private static const FREZ_TEMP = 1700;
private static const LS_SPEC_HEAT = 7;
private static const LS_TRAN_HEAT = 0.8;
private static const LS_COLOR:uint = 16777100;
public function LiquidSteel(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LIQUID_STEEL;
pColor = LS_COLOR;
temp = 3000;
MAX_VISC = 4;
}
override public function specHeat():Number{
return (LS_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LS_TRAN_HEAT);
}
public function handleTemp(){
if ((((temp < FREZ_TEMP)) && (!(created)))){
field.particleArray.addParticle(new Steel(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 122
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 123
//LNSteam (LNSteam)
package {
public class LNSteam extends Gas {
private var life:int;
private static const LNSTEAM_SPEC_HEAT = 1;
private static const LNSTEAM_TRAN_HEAT = 0;
private static const LNSTEAM_COLOR:uint = 1520736916;
public function LNSteam(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LNSTEAM;
pColor = LNSTEAM_COLOR;
density = 5;
temp = 373;
life = 80;
}
override public function specHeat():Number{
return (LNSTEAM_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LNSTEAM_TRAN_HEAT);
}
override public function redirectParticle(){
life = (life - 40);
}
override public function simulate(){
checkDelete();
moveParticle();
life--;
if (life <= 0){
deleteParticle = true;
};
drawParticle();
}
}
}//package
Section 124
//LoadingBar (LoadingBar)
package {
import flash.display.*;
public dynamic class LoadingBar extends MovieClip {
}
}//package
Section 125
//LowNoise (LowNoise)
package {
import flash.media.*;
public dynamic class LowNoise extends Sound {
}
}//package
Section 126
//LSD (LSD)
package {
public class LSD extends Liquid {
private static const LSD_SPEC_HEAT = 3;
private static const LSD_TRAN_HEAT = 0.4;
private static const LSD_COLOR:uint = 14315734;
public function LSD(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.LSD;
pColor = LSD_COLOR;
temp = 300;
MAX_VISC = 8;
}
override public function specHeat():Number{
return (LSD_SPEC_HEAT);
}
override public function tranHeat():Number{
return (LSD_TRAN_HEAT);
}
override public function simulate(){
transferHeat();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 127
//Mirror (Mirror)
package {
public class Mirror extends Solid {
private const MIRROR_SPEC_HEAT:Number = 4;
private const MIRROR_TRAN_HEAT:Number = 0.3;
private const MIRROR_COLOR:uint = 11513775;
private var tc;
private var bc;
private var rc;
private var lc:Boolean;
public function Mirror(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.MIRROR;
pColor = MIRROR_COLOR;
tc = false;
bc = false;
rc = false;
lc = false;
}
private function surroundedByMirror():Boolean{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Particle;
var _local1:int;
tc = true;
bc = true;
rc = true;
lc = true;
var _local2 = -1;
while (_local2 <= 1) {
_local3 = -1;
while (_local3 <= 1) {
_local4 = (loc.getIntX() + _local2);
_local5 = (loc.getIntY() + _local3);
if (field.inBounds(_local4, _local5)){
_local6 = field.particleArray.getParticle(_local4, _local5);
if (_local6.number == MIRROR){
_local1++;
} else {
if ((((_local2 == 0)) && ((_local3 == -1)))){
tc = false;
};
if ((((_local2 == 0)) && ((_local3 == 1)))){
bc = false;
};
if ((((_local2 == 1)) && ((_local3 == 0)))){
rc = false;
};
if ((((_local2 == -1)) && ((_local3 == 0)))){
lc = false;
};
};
};
_local3++;
};
_local2++;
};
if (_local1 >= 9){
return (true);
};
return (false);
}
override public function top():Boolean{
return (tc);
}
override public function bottom():Boolean{
return (bc);
}
override public function right():Boolean{
return (rc);
}
override public function left():Boolean{
return (lc);
}
override public function drawParticle(){
if (deleteParticle){
return;
};
if (surroundedByMirror()){
} else {
super.drawParticle();
};
}
override public function strength():Number{
return (2);
}
override public function specHeat():Number{
return (MIRROR_SPEC_HEAT);
}
override public function tranHeat():Number{
return (MIRROR_TRAN_HEAT);
}
override public function simulate(){
transferHeat();
checkDelete();
drawParticle();
}
}
}//package
Section 128
//MoltenSteelSound (MoltenSteelSound)
package {
import flash.media.*;
public dynamic class MoltenSteelSound extends Sound {
}
}//package
Section 129
//MuteButton (MuteButton)
package {
import flash.display.*;
public dynamic class MuteButton extends MovieClip {
public var on_mc:MuteButtonOn;
public var off_mc:MuteButtonOff;
}
}//package
Section 130
//MuteButtonOff (MuteButtonOff)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class MuteButtonOff extends MovieClip {
public var placeholder_mc:MuteButtonOffNormal;
public function MuteButtonOff(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.upLinkageID = "MuteButtonOffNormal";
this.overLinkageID = "MuteButtonOffOver";
this.downLinkageID = "MuteButtonOffDown";
this.disabledLinkageID = "MuteButtonOffDisabled";
}
}
}//package
Section 131
//MuteButtonOffDisabled (MuteButtonOffDisabled)
package {
import flash.display.*;
public dynamic class MuteButtonOffDisabled extends MovieClip {
public var button_mc:MovieClip;
}
}//package
Section 132
//MuteButtonOffDown (MuteButtonOffDown)
package {
import flash.display.*;
public dynamic class MuteButtonOffDown extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 133
//MuteButtonOffNormal (MuteButtonOffNormal)
package {
import flash.display.*;
public dynamic class MuteButtonOffNormal extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 134
//MuteButtonOffOver (MuteButtonOffOver)
package {
import flash.display.*;
public dynamic class MuteButtonOffOver extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 135
//MuteButtonOn (MuteButtonOn)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class MuteButtonOn extends MovieClip {
public var placeholder_mc:MuteButtonOnNormal;
public function MuteButtonOn(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.upLinkageID = "MuteButtonOnNormal";
this.overLinkageID = "MuteButtonOnOver";
this.downLinkageID = "MuteButtonOnDown";
this.disabledLinkageID = "MuteButtonOnDisabled";
}
}
}//package
Section 136
//MuteButtonOnDisabled (MuteButtonOnDisabled)
package {
import flash.display.*;
public dynamic class MuteButtonOnDisabled extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 137
//MuteButtonOnDown (MuteButtonOnDown)
package {
import flash.display.*;
public dynamic class MuteButtonOnDown extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 138
//MuteButtonOnNormal (MuteButtonOnNormal)
package {
import flash.display.*;
public dynamic class MuteButtonOnNormal extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 139
//MuteButtonOnOver (MuteButtonOnOver)
package {
import flash.display.*;
public dynamic class MuteButtonOnOver extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 140
//Napalm (Napalm)
package {
import MathPackage.*;
public class Napalm extends Liquid {
private var burnTime:int;
private static const BURN_TEMP = 550;
private static const BURN_MIN = 1400;
private static const BURN_MAX = 2000;
private static const NAPALM_SPEC_HEAT = 1;
private static const NAPALM_TRAN_HEAT = 0.8;
private static const NAPALM_COLOR:uint = 16773054;
public function Napalm(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.NAPALM;
pColor = NAPALM_COLOR;
burnTime = 110;
MAX_VISC = 3;
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
moveParticle();
drawParticle();
}
override public function specHeat():Number{
return (NAPALM_SPEC_HEAT);
}
override public function tranHeat():Number{
return (NAPALM_TRAN_HEAT);
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
temp = getFireTemp();
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, temp));
burnTime--;
};
}
override public function redirectParticle(){
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
VISC = magnitude;
if ((((VISC > 7)) && ((Calc.nextListRandom() > 0.1)))){
VISC = 7;
};
moved = false;
var _local1:int;
var _local2 = 1;
while (_local2 < VISC) {
_local7 = field.particleArray.getCollision(loc.getIntX(), (loc.getIntY() + _local2));
if (_local7 <= 1){
_local1 = _local2;
moved = true;
} else {
if (_local7 >= 3){
_local2 = VISC;
};
};
_local2++;
};
if (moved){
loc.addY(_local1);
return;
};
if (Calc.nextListRandom() > 0.4){
return;
};
if (VISC > MAX_VISC){
VISC = MAX_VISC;
};
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
var _local6:int;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
} else {
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
};
};
};
if (moved){
return;
};
_local3 = true;
_local4 = true;
_local5 = 0;
_local6 = 0;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
moved = true;
} else {
loc.addX(-(_local5));
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
moved = true;
};
};
};
}
}
}//package
Section 141
//Nitroglycerin (Nitroglycerin)
package {
import MathPackage.*;
public class Nitroglycerin extends Liquid {
private var burnTime:int;
private static const BURN_TEMP = 390;
private static const BURN_MIN = 1500;
private static const BURN_MAX = 1900;
private static const GP_SPEC_HEAT = 0.4;
private static const GP_TRAN_HEAT = 0.2;
private static const NG_COLOR:uint = 9031664;
private static const NG_POWER = 6;
public function Nitroglycerin(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = NITROGLYCERIN;
pColor = NG_COLOR;
burnTime = 1;
temp = 300;
MAX_VISC = 7;
}
override public function simulate(){
transferHeat();
if (temp > BURN_TEMP){
burn2();
};
checkDelete();
moveParticle();
drawParticle();
}
override public function isExplosive():Boolean{
return (true);
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if (burnTime > 0){
temp = getFireTemp();
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, int(getFireTemp())));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, NG_POWER));
burnTime--;
field.ser.C4Explosion++;
};
}
private function burn2(){
if (burnTime > 0){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, int(getFireTemp())));
field.addParticle_Par(new Explosion(loc.getIntX(), loc.getIntY(), field, NG_POWER));
burnTime--;
field.ser.C4Explosion++;
};
}
override public function specHeat():Number{
return (GP_SPEC_HEAT);
}
override public function tranHeat():Number{
return (GP_TRAN_HEAT);
}
override public function moveParticle(){
var _local3:int;
var _local4:int;
var _local5:int;
field.particleArray.unwrite(this);
var _local1:Boolean;
var _local2:int;
while ((((_local2 < magnitude)) && ((_local1 == false)))) {
_local3 = loc.getIntX();
_local4 = (loc.getIntY() + 1);
_local5 = field.particleArray.getCollision(_local3, _local4);
if (_local5 <= 1){
loc.setY(_local4);
} else {
if ((((_local5 == SOLID)) && ((magnitude == 8)))){
temp = 600;
};
_local2 = magnitude;
magnitude = 8;
redirectParticle();
_local1 = true;
};
_local2++;
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
override public function redirectParticle(){
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
VISC = magnitude;
moved = false;
var _local1:int;
var _local2 = 1;
while (_local2 < VISC) {
_local7 = field.particleArray.getCollision(loc.getIntX(), (loc.getIntY() + _local2));
if (_local7 <= 1){
_local1 = _local2;
moved = true;
} else {
if (_local7 >= 3){
_local2 = VISC;
};
};
_local2++;
};
if (moved){
loc.addY(_local1);
return;
};
magnitude = 0;
if (VISC > MAX_VISC){
VISC = MAX_VISC;
};
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
var _local6:int;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = (loc.getIntY() + _local2);
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
} else {
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
loc.addY(_local5);
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
loc.addY(_local6);
moved = true;
};
};
};
if (moved){
return;
};
_local3 = true;
_local4 = true;
_local5 = 0;
_local6 = 0;
_local2 = 1;
while (_local2 < VISC) {
if (((!(_local3)) && (!(_local4)))){
_local2 = VISC;
};
if (_local4){
_local8 = (loc.getIntX() - _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local5 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local4 = false;
};
};
};
if (_local3){
_local8 = (loc.getIntX() + _local2);
_local9 = loc.getIntY();
_local10 = field.particleArray.getCollision(_local8, _local9);
if ((((_local10 <= 1)) && (nextToLiquid(_local8, _local9)))){
_local6 = _local2;
} else {
if ((((_local10 >= 3)) || ((_local10 <= 1)))){
_local3 = false;
};
};
};
_local2++;
};
if ((((_local5 > 0)) && ((_local6 > 0)))){
if (Calc.nextListBool()){
loc.addX(_local6);
moved = true;
} else {
loc.addX(-(_local5));
moved = true;
};
} else {
if (_local5 > 0){
loc.addX(-(_local5));
moved = true;
} else {
if (_local6 > 0){
loc.addX(_local6);
moved = true;
};
};
};
}
}
}//package
Section 142
//NuclearExplosion (NuclearExplosion)
package {
import MathPackage.*;
import flash.geom.*;
public class NuclearExplosion extends Special {
public var life:int;
private static const NUCLEAR_EXPLOSION_COLOR:uint = 16777215;
private static const EXPLOSION_TEMP = 2300;
public function NuclearExplosion(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = NUCLEAR_EXPLOSION;
temp = 2000;
life = 100;
}
override public function simulate(){
if (life == 100){
explode();
life--;
drawParticle();
} else {
if (life > 0){
life--;
drawParticle();
} else {
deleteParticle = true;
};
};
}
override public function setLife(_arg1:int){
life = _arg1;
}
override public function getLife():int{
return (life);
}
override public function drawParticle(){
var _local1:int = ((life / 100) * 0xFF);
field.g.colorTransform(field.backgroundRectangle, new ColorTransform(1, 1, 1, 1, _local1, _local1, _local1));
}
public function explode(){
var _local2:Particle;
var _local3:Number;
var _local1 = 1;
while (_local1 < field.particleArray.sizeLength()) {
_local2 = field.particleArray.getParticle_int(_local1);
_local3 = Calc.distanceCalc(loc.getX(), loc.getY(), _local2.loc.getX(), _local2.loc.getY());
_local2.temp = (EXPLOSION_TEMP * (1 - (_local3 / 500)));
if (_local2.number == NUCLEAR_EXPLOSION){
if (_local2.getLife() < 100){
_local2.setLife(0);
};
} else {
if (_local2.number == URANIUM){
_local2.deleteParticle = true;
} else {
if (Calc.nextListRandom() < 0.05){
} else {
if (Calc.nextListRandom() < (_local3 / 800)){
} else {
if ((((_local2.phase == Particle.SOLID)) && ((Calc.nextListRandom() > (1 / (_local2.strength() / 2)))))){
} else {
_local2.deleteParticle = true;
};
};
};
};
};
_local1++;
};
}
}
}//package
Section 143
//NukeNoise (NukeNoise)
package {
import flash.media.*;
public dynamic class NukeNoise extends Sound {
}
}//package
Section 144
//NullParticle (NullParticle)
package {
public class NullParticle extends Special {
public function NullParticle(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
pColor = 0;
number = NULLPARTICLE;
}
}
}//package
Section 145
//NumericStepperDownArrow_disabledSkin (NumericStepperDownArrow_disabledSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_disabledSkin extends MovieClip {
}
}//package
Section 146
//NumericStepperDownArrow_downSkin (NumericStepperDownArrow_downSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_downSkin extends MovieClip {
}
}//package
Section 147
//NumericStepperDownArrow_overSkin (NumericStepperDownArrow_overSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_overSkin extends MovieClip {
}
}//package
Section 148
//NumericStepperDownArrow_upSkin (NumericStepperDownArrow_upSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_upSkin extends MovieClip {
}
}//package
Section 149
//NumericStepperUpArrow_disabledSkin (NumericStepperUpArrow_disabledSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_disabledSkin extends MovieClip {
}
}//package
Section 150
//NumericStepperUpArrow_downSkin (NumericStepperUpArrow_downSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_downSkin extends MovieClip {
}
}//package
Section 151
//NumericStepperUpArrow_overSkin (NumericStepperUpArrow_overSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_overSkin extends MovieClip {
}
}//package
Section 152
//NumericStepperUpArrow_upSkin (NumericStepperUpArrow_upSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_upSkin extends MovieClip {
}
}//package
Section 153
//Oil (Oil)
package {
import MathPackage.*;
public class Oil extends Liquid {
private var burnTime:int;
private static const BURN_TEMP = 550;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1800;
private static const OIL_SPEC_HEAT = 0.9;
private static const OIL_TRAN_HEAT = 0.8;
private static const OIL_COLOR:uint = 9991764;
public function Oil(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.OIL;
pColor = OIL_COLOR;
burnTime = 60;
MAX_VISC = 3;
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
moveParticle();
drawParticle();
}
override public function specHeat():Number{
return (OIL_SPEC_HEAT);
}
override public function tranHeat():Number{
return (OIL_TRAN_HEAT);
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
temp = getFireTemp();
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, temp));
burnTime--;
};
}
}
}//package
Section 154
//OilSound (OilSound)
package {
import flash.media.*;
public dynamic class OilSound extends Sound {
}
}//package
Section 155
//Particle (Particle)
package {
import MathPackage.*;
public class Particle {
public var arrayListNumber:int;
public var loc:IntPoint;
public var phase:int;
public var deleteParticle:Boolean;
public var number:int;
public var pColor:uint;
public var magnitude:int;
public var moved:Boolean;
public var collided:Boolean;
public var created:Boolean;
public var field:Field;
public var temp:int;
static const SPECIAL = 0;
static const GAS = 1;
static const LIQUID = 2;
static const POWDER = 3;
static const SOLID = 4;
static const NULLPARTICLE = 0;
static const ERASE = 0;
static const FIRE = 1;
static const ELECTRICITY = 2;
static const SPARK = 3;
static const EXPLOSION = 4;
static const NUCLEAR_EXPLOSION = 5;
static const DARK_MATTER = 6;
static const WHITE_MATTER = 7;
static const LASER = 8;
static const SLASH = 9;
static const HAND = 10;
static const BULLET = 11;
static const BLUE_FIRE = 12;
static const SAND = 101;
static const SALT = 102;
static const GUNPOWDER = 103;
static const FLASH_POWDER = 104;
static const THERMITE = 105;
static const CLONER = 106;
static const ANT = 107;
static const DEAD_ANT = 108;
static const ASH = 109;
static const BEE = 110;
static const DEAD_BEE = 111;
static const SEED = 112;
static const WATER = 201;
static const OIL = 202;
static const LIQUID_NITROGEN = 203;
static const SALT_WATER = 204;
static const LIQUID_STEEL = 205;
static const NAPALM = 206;
static const NITROGLYCERIN = 207;
static const BLOOD = 208;
static const LSD = 209;
static const ACID = 210;
static const LAVA = 211;
static const CLAY = 212;
static const LIQUID_SAND = 213;
static const LIQUID_HELIUM = 214;
static const ROCK = 301;
static const PLANT = 302;
static const WAX = 303;
static const STEEL = 304;
static const TORCH = 305;
static const SPOUT = 306;
static const SPARKER = 307;
static const WELL = 308;
static const SANDMAKER = 309;
static const SALTMAKER = 310;
static const ICE = 311;
static const FUSE = 312;
static const C4 = 313;
static const DEAD_PLANT = 314;
static const URANIUM = 315;
static const ADAMANTIUM = 316;
static const ZOMBIE_FLESH = 317;
static const FLOWER = 318;
static const ACIDMAKER = 319;
static const MIRROR = 320;
static const VOLCANO = 321;
static const WOOD = 322;
static const LEAF = 323;
static const EARTH = 324;
static const STEAM = 401;
static const SMOKE = 402;
static const LNSTEAM = 403;
private static const SPEC_HEAT = 0;
private static const TRAN_HEAT = 0;
public function Particle(_arg1:int, _arg2:int, _arg3:Field){
arrayListNumber = _arg3.particleArray.sizeLength();
created = true;
loc = new IntPoint(_arg1, _arg2);
this.field = _arg3;
temp = _arg3.DEFAULT_TEMP;
magnitude = 0;
moved = false;
collided = false;
}
public function specHeat():Number{
return (SPEC_HEAT);
}
public function tranHeat():Number{
return (TRAN_HEAT);
}
public function strength():Number{
return (0);
}
public function applyProperties(){
}
public function burn(){
}
public function force():Number{
return (0);
}
public function isExplosive():Boolean{
return (false);
}
public function top():Boolean{
return (false);
}
public function bottom():Boolean{
return (false);
}
public function right():Boolean{
return (false);
}
public function left():Boolean{
return (false);
}
public function transferHeat_Par(_arg1:Particle, _arg2:Particle){
var _local4:Number;
var _local3:Number = _arg2.temp;
if (_arg2.number == NULLPARTICLE){
return;
};
if (_arg1.number == NULLPARTICLE){
_local4 = (((field.DEFAULT_TEMP - _arg2.temp) * (field.TRANSFER_HEAT * _arg2.tranHeat())) + _arg2.temp);
_arg2.temp = _local4;
} else {
_local4 = (((_arg1.temp - _arg2.temp) * (_arg1.tranHeat() * _arg2.tranHeat())) + _arg2.temp);
_arg2.temp = _local4;
};
_local4 = (((_arg2.temp - _local3) / (_arg2.specHeat() + 1)) + _local3);
_arg2.temp = _local4;
}
public function transferHeat(){
var _local1:int;
var _local2:int;
if ((field.count % 4) == 0){
_local1 = 1;
_local2 = 1;
heatStuff(_local1, _local2);
_local1 = 0;
_local2 = 1;
heatStuff(_local1, _local2);
} else {
if ((field.count % 4) == 1){
_local1 = -1;
_local2 = 1;
heatStuff(_local1, _local2);
_local1 = -1;
_local2 = 0;
heatStuff(_local1, _local2);
} else {
if ((field.count % 4) == 2){
_local1 = -1;
_local2 = -1;
heatStuff(_local1, _local2);
_local1 = 0;
_local2 = -1;
heatStuff(_local1, _local2);
} else {
_local1 = 1;
_local2 = -1;
heatStuff(_local1, _local2);
_local1 = 1;
_local2 = 0;
heatStuff(_local1, _local2);
};
};
};
}
public function heatStuff(_arg1:int, _arg2:int){
var _local5:int;
var _local6:Particle;
var _local7:Number;
var _local8:int;
var _local3:int = (loc.getIntX() + _arg1);
var _local4:int = (loc.getIntY() + _arg2);
if (field.inBounds(_local3, _local4)){
if (tranHeat() < Calc.nextListRandom()){
return;
};
_local5 = temp;
_local6 = field.particleArray.getParticle(_local3, _local4);
if (_local6.number == NULLPARTICLE){
if (temp == field.DEFAULT_TEMP){
return;
};
if (field.TRANSFER_HEAT < Calc.nextListRandom()){
return;
};
_local8 = (field.DEFAULT_TEMP - temp);
} else {
if ((((_local6.number == FIRE)) && ((_local5 > _local6.temp)))){
return;
};
if (temp == _local6.temp){
return;
};
if (_local6.tranHeat() < Calc.nextListRandom()){
return;
};
_local8 = (_local6.temp - temp);
};
_local7 = (_local8 / (specHeat() + 1));
if (_local8 < 0){
temp = (Math.floor(_local7) + _local5);
} else {
temp = (Math.ceil(_local7) + _local5);
};
};
}
public function getLife():int{
return (0);
}
public function setLife(_arg1:int){
}
public function drawParticle(){
var _local1:* = (loc.getIntX() * 2);
var _local2:* = (loc.getIntY() * 2);
if (!deleteParticle){
field.g.setPixel(_local1, _local2, pColor);
field.g.setPixel((_local1 + 1), _local2, pColor);
field.g.setPixel(_local1, (_local2 + 1), pColor);
field.g.setPixel((_local1 + 1), (_local2 + 1), pColor);
};
}
public function simulate(){
}
public function checkDelete(){
if (created){
created = false;
} else {
if (field.deleteArray.getBool(loc.getIntX(), loc.getIntY())){
deleteParticle = true;
} else {
if (!field.inBounds_Par(this)){
deleteParticle = true;
};
};
};
}
public function checkDeletePaused(){
if (created){
created = false;
} else {
if (field.deleteArray.getBool(loc.getIntX(), loc.getIntY())){
deleteParticle = true;
};
};
}
public function moveParticle(){
}
public function getX():int{
return (loc.getX());
}
public function getY():int{
return (loc.getY());
}
}
}//package
Section 156
//ParticleArray (ParticleArray)
package {
import MathPackage.*;
public class ParticleArray {
private var particleNumbers:IntegerArray;
private var collisionArray:IntegerArray;
public var particles:Array;
private var wid;
private var hei:int;
private var field:Field;
public var walls:Boolean;
public var elec;
public var dark;
public var white;
public var explode:int;
private static const ELECTRICITY_MAX = 15;
private static const DARK_MATTER_MAX = 20;
private static const WHITE_MATTER_MAX = 20;
public static const EXPLOSION_MAX = 1000;
public function ParticleArray(_arg1:int, _arg2:int, _arg3:Field){
walls = false;
particleNumbers = new IntegerArray(_arg1, _arg2);
collisionArray = new IntegerArray(_arg1, _arg2);
particles = new Array();
wid = _arg1;
hei = _arg2;
field = _arg3;
elec = 0;
dark = 0;
white = 0;
explode = 0;
}
private function isWall(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 == 0)) || ((_arg1 == (wid - 1))))) || ((_arg2 == 0)))) || ((_arg2 == (hei - 1))))){
return (true);
};
return (false);
}
public function addWalls(){
walls = true;
var _local1:int;
while (_local1 < wid) {
collisionArray.setNumber(_local1, 0, Particle.SOLID);
collisionArray.setNumber(_local1, (hei - 1), Particle.SOLID);
_local1++;
};
_local1 = 0;
while (_local1 < hei) {
collisionArray.setNumber(0, _local1, Particle.SOLID);
collisionArray.setNumber((wid - 1), _local1, Particle.SOLID);
_local1++;
};
}
public function removeWalls(){
walls = false;
var _local1:int;
while (_local1 < wid) {
collisionArray.setNumber(_local1, 0, 0);
collisionArray.setNumber(_local1, (hei - 1), 0);
_local1++;
};
_local1 = 0;
while (_local1 < hei) {
collisionArray.setNumber(0, _local1, 0);
collisionArray.setNumber((wid - 1), _local1, 0);
_local1++;
};
}
public function setForDeletion(_arg1:int):Boolean{
var _local3:Particle;
var _local2 = 1;
while (_local2 < particles.length) {
_local3 = particles[_local2];
if (_local3.number == _arg1){
if (!_local3.deleteParticle){
_local3.deleteParticle = true;
return (true);
};
};
_local2++;
};
return (false);
}
public function addParticle(_arg1:Particle):void{
particles.push(_arg1);
if (_arg1.number == Particle.ELECTRICITY){
elec++;
if (elec > ELECTRICITY_MAX){
elec--;
particles.pop();
};
} else {
if (_arg1.number == Particle.EXPLOSION){
explode++;
if (explode > EXPLOSION_MAX){
explode--;
particles.pop();
};
} else {
if (_arg1.number == Particle.DARK_MATTER){
dark++;
if (dark > DARK_MATTER_MAX){
setForDeletion(Particle.DARK_MATTER);
};
} else {
if (_arg1.number == Particle.WHITE_MATTER){
white++;
if (white > WHITE_MATTER_MAX){
setForDeletion(Particle.WHITE_MATTER);
};
};
};
};
};
}
public function addParticle_Int(_arg1:int, _arg2:Particle):void{
if (_arg2.number == Particle.ELECTRICITY){
elec++;
};
if (elec > ELECTRICITY_MAX){
elec--;
return;
};
if (_arg2.number == Particle.EXPLOSION){
explode++;
};
if (explode > EXPLOSION_MAX){
explode--;
return;
};
particles[_arg1] = _arg2;
}
public function getCollision(_arg1:int, _arg2:int):int{
return (collisionArray.getNumber(_arg1, _arg2));
}
public function getParticle(_arg1:int, _arg2:int):Particle{
var _local3:int = particleNumbers.getNumber(_arg1, _arg2);
if (_local3 >= particles.length){
_local3 = 0;
};
return (particles[_local3]);
}
public function sizeLength():int{
return (particles.length);
}
public function getParticle_int(_arg1:int):Particle{
if ((((_arg1 < sizeLength())) && (!((_arg1 == 0))))){
return (particles[_arg1]);
};
return (particles[0]);
}
public function writeParticles(){
var _local2:Particle;
var _local1 = 1;
while (_local1 < particles.length) {
_local2 = particles[_local1];
_local2.arrayListNumber = _local1;
write(_local2);
_local1++;
};
}
public function write(_arg1:Particle){
particleNumbers.setNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY(), _arg1.arrayListNumber);
if (_arg1.phase > collisionArray.getNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY())){
collisionArray.setNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY(), _arg1.phase);
};
}
public function unwrite(_arg1:Particle){
particleNumbers.setNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY(), 0);
if (collisionArray.getNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY()) <= _arg1.phase){
if (((!(walls)) || (!(isWall(_arg1.loc.getX(), _arg1.loc.getY()))))){
collisionArray.setNumber(_arg1.loc.getIntX(), _arg1.loc.getIntY(), 0);
};
};
}
public function clearAll(){
var _local2:Particle;
var _local1 = 1;
while (_local1 < particles.length) {
_local2 = particles[_local1];
if (_local2.number == Particle.ZOMBIE_FLESH){
unwrite(_local2);
particles.splice(_local1, 1);
_local1--;
} else {
unwrite(_local2);
particles.splice(_local1, 1);
_local1--;
};
_local1++;
};
elec = 0;
dark = 0;
white = 0;
explode = 0;
}
public function deleteParticles(){
var _local2:Particle;
var _local1 = 1;
while (_local1 < particles.length) {
_local2 = particles[_local1];
elec = 0;
explode = 0;
if (_local2.deleteParticle){
if (_local2.number == Particle.DARK_MATTER){
dark--;
};
if (_local2.number == Particle.WHITE_MATTER){
white--;
};
unwrite(_local2);
particles.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
}
}//package
Section 157
//Plant (Plant)
package {
import MathPackage.*;
public class Plant extends Solid {
private var burnTime:int;
private static const GROW_CHANCE = 0.65;
private static const FREEZE_TEMP = 220;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1600;
private static const PLANT_SPEC_HEAT = 1.4;
private static const PLANT_TRAN_HEAT = 0.6;
private static const PLANT_COLOR:uint = 2263842;
public function Plant(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = PLANT;
pColor = PLANT_COLOR;
burnTime = 100;
}
override public function specHeat():Number{
return (PLANT_SPEC_HEAT);
}
override public function tranHeat():Number{
return (PLANT_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
field.ser.plantBurning++;
} else {
if (temp < FREEZE_TEMP){
field.addParticle_Par(new DeadPlant(loc.getIntX(), loc.getIntY(), field));
deleteParticle = true;
};
};
}
public function grow(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if ((((((_local5.number == WATER)) && (!(_local5.deleteParticle)))) && (!(created)))){
if (Calc.nextListRandom() < GROW_CHANCE){
field.addParticle_Par(new Plant(_local3, _local4, field));
_local5.deleteParticle = true;
};
};
};
_local2++;
};
_local1++;
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
grow();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 158
//PlantFireSound (PlantFireSound)
package {
import flash.media.*;
public dynamic class PlantFireSound extends Sound {
}
}//package
Section 159
//Play (Play)
package {
import flash.display.*;
public dynamic class Play extends SimpleButton {
}
}//package
Section 160
//Powder (Powder)
package {
import MathPackage.*;
public class Powder extends Particle {
public var particleSize:Number;
public var size:Number;
public function Powder(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
phase = POWDER;
}
override public function simulate(){
transferHeat();
checkDelete();
moveParticle();
drawParticle();
}
private function moveToOpenSpot(){
var _local1:Boolean;
var _local2:Boolean;
var _local3:int = field.particleArray.getCollision((loc.getIntX() + 1), (loc.getIntY() + 1));
var _local4:int = field.particleArray.getCollision((loc.getIntX() - 1), (loc.getIntY() + 1));
if (_local3 <= 2){
_local1 = true;
};
if (_local4 <= 2){
_local2 = true;
};
if (((_local2) && (_local1))){
if (Calc.nextListBool()){
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() + 1), (loc.getY() + 1)));
return;
};
loc.addX(1);
loc.addY(1);
} else {
if (_local4 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() - 1), (loc.getY() + 1)));
return;
};
loc.addX(-1);
loc.addY(1);
};
return;
} else {
if (_local2){
if (_local4 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() - 1), (loc.getY() + 1)));
return;
};
loc.addX(-1);
loc.addY(1);
return;
} else {
if (_local1){
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() + 1), (loc.getY() + 1)));
return;
};
loc.addX(1);
loc.addY(1);
return;
};
};
};
_local3 = field.particleArray.getCollision((loc.getIntX() + 1), loc.getIntY());
_local4 = field.particleArray.getCollision((loc.getIntX() - 1), loc.getIntY());
if (_local3 <= 2){
_local1 = true;
};
if (_local4 <= 2){
_local2 = true;
};
if (((_local2) && (_local1))){
if (Calc.nextListBool()){
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() + 1), loc.getY()));
return;
};
loc.addX(1);
} else {
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() - 1), loc.getY()));
return;
};
loc.addX(-1);
};
return;
} else {
if (_local2){
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() - 1), loc.getY()));
return;
};
loc.addX(-1);
return;
} else {
if (_local1){
if (_local3 == 2){
field.swapParticles(this, field.particleArray.getParticle((loc.getX() + 1), loc.getY()));
return;
};
loc.addX(1);
return;
};
};
};
}
private function redirectParticle(){
if (Calc.nextListRandom() > size){
moveToOpenSpot();
};
}
override public function moveParticle(){
var _local2:int;
var _local3:int;
var _local4:int;
moved = false;
collided = false;
field.particleArray.unwrite(this);
var _local1:int;
while (_local1 < magnitude) {
_local2 = loc.getIntX();
_local3 = (loc.getIntY() + 1);
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= 1){
loc.setY(_local3);
moved = true;
} else {
if (_local4 == 2){
field.swapParticles(this, field.particleArray.getParticle(_local2, _local3));
_local1 = (_local1 + 3);
} else {
_local1 = magnitude;
redirectParticle();
collided = true;
};
};
_local1++;
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
}
}//package
Section 161
//Rock (Rock)
package {
public class Rock extends Solid {
private const ROCK_SPEC_HEAT:Number = 4.5;
private const ROCK_TRAN_HEAT:Number = 0.15;
private const ROCK_COLOR:uint = 6908265;
private static const MELT_TEMP = 2800;
public function Rock(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.ROCK;
pColor = ROCK_COLOR;
}
override public function strength():Number{
return (5);
}
override public function specHeat():Number{
return (ROCK_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ROCK_TRAN_HEAT);
}
public function handleTemp(){
if ((((temp >= MELT_TEMP)) && (!(created)))){
field.particleArray.addParticle(new Lava(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 162
//Salt (Salt)
package {
public class Salt extends Powder {
private static const SALT_SPEC_HEAT = 4;
private static const SALT_TRAN_HEAT = 0.1;
private static const SALT_COLOR:uint = 16447474;
public function Salt(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.SALT;
pColor = SALT_COLOR;
size = 0.75;
}
override public function specHeat():Number{
return (SALT_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SALT_TRAN_HEAT);
}
}
}//package
Section 163
//SaltMaker (SaltMaker)
package {
import MathPackage.*;
public class SaltMaker extends Solid {
private static const SALT_CHANCE = 0.35;
private static const SALTMAKER_SPEC_HEAT = 30;
private static const SALTMAKER_TRAN_HEAT = 0.1;
public function SaltMaker(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = SALTMAKER;
pColor = (((248 * 65536) + (248 * 0x0100)) + 0xFF);
temp = 300;
}
override public function specHeat():Number{
return (SALTMAKER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SALTMAKER_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function salt(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (((field.canMove(this)) && ((Calc.nextListRandom() < SALT_CHANCE)))){
field.addParticle_Par(new Salt(_local2, _local3, field));
};
};
};
_local1++;
};
}
override public function simulate(){
salt();
checkDelete();
drawParticle();
}
}
}//package
Section 164
//SaltSound (SaltSound)
package {
import flash.media.*;
public dynamic class SaltSound extends Sound {
}
}//package
Section 165
//Sand (Sand)
package {
public class Sand extends Powder {
private static const SAND_SPEC_HEAT = 5;
private static const SAND_TRAN_HEAT = 0.4;
private static const SAND_COLOR:uint = 15583663;
private static const MELT_TEMP = 2400;
public function Sand(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = SAND;
pColor = SAND_COLOR;
size = 0.1;
}
override public function specHeat():Number{
return (SAND_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SAND_TRAN_HEAT);
}
override public function simulate(){
if (temp > MELT_TEMP){
deleteParticle = true;
field.addParticle_Par(new LiquidSand(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
};
transferHeat();
moveParticle();
checkDelete();
drawParticle();
}
}
}//package
Section 166
//SandMaker (SandMaker)
package {
import MathPackage.*;
public class SandMaker extends Solid {
private static const SAND_CHANCE = 0.35;
private static const SANDMAKER_SPEC_HEAT = 30;
private static const SANDMAKER_TRAN_HEAT = 0.1;
public function SandMaker(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = SANDMAKER;
pColor = (((194 * 65536) + (178 * 0x0100)) + 128);
temp = 300;
}
override public function specHeat():Number{
return (SANDMAKER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SANDMAKER_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function sand(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (Calc.nextListRandom() < SAND_CHANCE){
field.addParticle_Par(new Sand(loc.getIntX(), loc.getIntY(), field));
};
};
};
_local1++;
};
}
override public function simulate(){
sand();
checkDelete();
drawParticle();
}
}
}//package
Section 167
//SandSound (SandSound)
package {
import flash.media.*;
public dynamic class SandSound extends Sound {
}
}//package
Section 168
//SaveMenu (SaveMenu)
package {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.text.*;
import flash.geom.*;
public class SaveMenu extends MovieClip {
public var inputText:TextInput;
public var Save:Button;
public var Cancel:Button;
public var fI:FieldInterface;
public function SaveMenu(_arg1:FieldInterface){
inputText.text = "Falling sands";
Save.label = "Save";
Cancel.label = "Cancel";
fI = _arg1;
Save.addEventListener(MouseEvent.CLICK, saveContent);
Cancel.addEventListener(MouseEvent.CLICK, cancel);
}
public function showImage(){
trace("hi");
var _local1:Number = 0.32;
var _local2:Matrix = new Matrix();
_local2.scale(_local1, _local1);
var _local3:BitmapData = new BitmapData((fI.field.g.width * _local1), (fI.field.g.height * _local1), true, 0);
_local3.draw(fI.field.g, _local2, null, null, null, true);
var _local4:Bitmap = new Bitmap(_local3, PixelSnapping.NEVER, true);
var _local5:Sprite = new Sprite();
_local5.graphics.beginBitmapFill(_local3);
_local5.graphics.drawRect(0, 0, 160, 192);
_local5.graphics.endFill();
_local5.x = -80;
_local5.y = -96;
addChild(_local5);
}
function saveContent(_arg1:MouseEvent):void{
fI.kongregate.sharedContent.save("Field", fI.field.toString(), fI.onSaved, new Bitmap(fI.field.g), inputText.text);
fI.removeChild(this);
fI.saving = false;
}
function cancel(_arg1:MouseEvent):void{
fI.removeChild(this);
fI.saving = false;
}
}
}//package
Section 169
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 170
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 171
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 172
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 173
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 174
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 175
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 176
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 177
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 178
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 179
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 180
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 181
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 182
//Seed (Seed)
package {
import MathPackage.*;
public class Seed extends Powder {
public var growing;
public var newBranch;
public var leafs:Boolean;
private var directionArray:Array;
private var lineArray:Array;
private var branchArray:Array;
private var branchLength:Number;
private var branchCount:int;
private var dead:Boolean;
private var branches;
private var degree;
private var offset;
private var shortConstant;
private var shortFactor:Number;
private static const SEED_SPEC_HEAT = 4;
private static const SEED_TRAN_HEAT = 0.1;
private static const SEED_COLOR:uint = 16309886;
private static const MIN_BRANCH_LEN = 5;
private static const OFFSET_CHANCE = 0.1;
public function Seed(_arg1:int, _arg2:int, _arg3:Field){
directionArray = new Array();
lineArray = new Array();
branchArray = new Array();
super(_arg1, _arg2, _arg3);
number = SEED;
pColor = SEED_COLOR;
size = 0.4;
growing = false;
newBranch = false;
leafs = false;
dead = false;
}
public function canGrow(){
var _local3:Particle;
var _local4:Number;
var _local5:Seed;
var _local1:Number = 1000;
var _local2 = 1;
while (_local2 < field.particleArray.sizeLength()) {
_local3 = field.particleArray.getParticle_int(_local2);
_local4 = Calc.distanceCalc(loc.getX(), loc.getY(), _local3.loc.getX(), _local3.loc.getY());
if (_local4 < _local1){
if (_local3.number == SEED){
_local5 = (_local3 as Seed);
if (((_local5.growing) || (_local5.leafs))){
_local1 = _local4;
};
};
};
_local2++;
};
if (_local1 < 40){
return (false);
};
return (true);
}
public function startGrowing(){
directionArray[0] = 270;
branchArray[0] = loc;
branchLength = (15 + (25 * Calc.nextListRandom()));
var _local1:* = loc.getX();
var _local2:* = loc.getY();
var _local3:* = Calc.toRadian(directionArray[0]);
lineArray[0] = Calc.bresLine((_local1 + (Math.cos(_local3) * branchLength)), (_local2 + (Math.sin(_local3) * branchLength)), _local1, _local2);
branchArray[0] = new IntPoint((_local1 + (Math.cos(_local3) * branchLength)), (_local2 + (Math.sin(_local3) * branchLength)));
branchCount = 0;
branches = int((Math.round((Calc.nextListRandom() * 2.49)) + 2));
degree = (((Calc.nextListRandom() * 0.3) + 0.15) * (360 / branches));
offset = 0;
if (Calc.nextListRandom() < 0.4){
offset = ((Calc.nextListRandom() - 0.5) * 70);
if (offset < 0){
offset = (offset - 10);
} else {
offset = (offset + 10);
};
};
shortConstant = (1 + (2 * Calc.nextListRandom()));
shortFactor = (1 + (1 * Calc.nextListRandom()));
}
override public function specHeat():Number{
return (SEED_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SEED_TRAN_HEAT);
}
private function resetArrays(){
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:*;
var _local10:*;
var _local11:*;
branchCount++;
var _local1:* = new Array();
var _local2:* = new Array();
var _local3:* = new Array();
branchLength = (branchLength - (shortConstant + (branchCount * shortFactor)));
var _local4:int;
while (_local4 < lineArray.length) {
_local5 = 0;
_local6 = 0;
_local7 = 0;
if (branches == 2){
_local5 = ((-(degree) / 2) + offset);
_local6 = (((degree / 2) + 2) + offset);
_local7 = degree;
};
if (branches == 3){
_local5 = (-(degree) + offset);
_local6 = ((degree + 1) + offset);
_local7 = degree;
};
if (branches == 4){
_local5 = (((-(degree) / 2) - degree) + offset);
_local6 = ((((degree / 2) + degree) + 2) + offset);
_local7 = degree;
};
_local8 = _local5;
while (_local8 <= _local6) {
_local9 = branchArray[_local4].getX();
_local10 = branchArray[_local4].getY();
_local11 = Calc.toRadian((directionArray[_local4] + _local8));
_local3.push(Calc.bresLine((_local9 + (Math.cos(_local11) * branchLength)), (_local10 + (Math.sin(_local11) * branchLength)), _local9, _local10));
_local1.push((directionArray[_local4] + _local8));
_local2.push(new IntPoint(_local9, _local10));
_local8 = (_local8 + _local7);
};
_local4++;
};
lineArray = _local3;
branchArray = _local2;
directionArray = _local1;
if (branchLength <= MIN_BRANCH_LEN){
leafs = true;
};
}
public function grow(){
var _local1:*;
var _local2:int;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:Particle;
var _local9:*;
var _local10:int;
var _local11:int;
var _local12:int;
if (growing){
if (newBranch){
resetArrays();
newBranch = false;
};
if (leafs){
_local2 = 0;
while (_local2 < lineArray.length) {
if (lineArray[_local2].length > 0){
_local3 = lineArray[_local2][0];
_local4 = _local3.getX();
_local5 = _local3.getY();
field.particleArray.getParticle(_local4, _local5).deleteParticle = true;
field.addParticle_Par(new Leaf(_local4, _local5, field));
field.particleArray.getParticle((_local4 + 1), _local5).deleteParticle = true;
field.addParticle_Par(new Leaf((_local4 + 1), _local5, field));
field.particleArray.getParticle((_local4 - 2), _local5).deleteParticle = true;
field.addParticle_Par(new Leaf((_local4 - 1), _local5, field));
field.particleArray.getParticle(_local4, (_local5 + 1)).deleteParticle = true;
field.addParticle_Par(new Leaf(_local4, (_local5 + 1), field));
field.particleArray.getParticle(_local4, (_local5 - 1)).deleteParticle = true;
field.addParticle_Par(new Leaf(_local4, (_local5 - 1), field));
lineArray[_local2].shift();
growing = false;
};
_local2++;
};
deleteParticle = true;
};
_local1 = true;
if (growing){
_local2 = 0;
while (_local2 < lineArray.length) {
if (lineArray[_local2].length > 0){
_local3 = lineArray[_local2][0];
_local6 = _local3.getX();
_local7 = _local3.getY();
_local8 = field.particleArray.getParticle(_local6, _local7);
if ((((((((_local8.phase < SOLID)) || ((_local8.number == WOOD)))) || ((_local8.number == EARTH)))) || ((_local8.number == ZOMBIE_FLESH)))){
field.addParticle_Par(new Wood(_local6, _local7, field));
lineArray[_local2].shift();
_local1 = false;
branchArray[_local2] = new IntPoint(_local6, _local7);
if (_local8.number != SEED){
_local8.deleteParticle = true;
};
} else {
lineArray[_local2] = new Array();
};
};
_local2++;
};
};
if (_local1){
newBranch = true;
};
} else {
if (!leafs){
_local9 = false;
_local2 = -1;
while (_local2 <= 1) {
_local10 = -1;
while (_local10 <= 1) {
_local11 = (loc.getIntX() + _local2);
_local12 = (loc.getIntY() + _local10);
if (field.inBounds(_local11, _local12)){
_local8 = field.particleArray.getParticle(_local11, _local12);
if ((((((_local8.number == EARTH)) && (!(_local8.deleteParticle)))) && (!(created)))){
_local9 = true;
};
};
_local10++;
};
_local2++;
};
if (_local9){
if (canGrow()){
startGrowing();
growing = true;
} else {
dead = true;
};
};
};
};
}
override public function simulate(){
transferHeat();
checkDelete();
if (!dead){
grow();
} else {
if (Calc.nextListRandom() > 0.95){
deleteParticle = true;
};
};
if (((!(growing)) && (!(leafs)))){
moveParticle();
};
drawParticle();
}
}
}//package
Section 183
//Slash (Slash)
package {
public class Slash extends Special {
private var life:int;
private static const SLASH_COLOR = 16777215;
public function Slash(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
pColor = SLASH_COLOR;
number = SLASH;
life = 2;
}
override public function simulate(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Particle;
life--;
if (life <= 0){
this.deleteParticle = true;
};
var _local1 = -1;
while (_local1 <= 1) {
_local2 = -1;
while (_local2 <= 1) {
_local3 = (loc.getIntX() + _local1);
_local4 = (loc.getIntY() + _local2);
if (field.inBounds(_local3, _local4)){
_local5 = field.particleArray.getParticle(_local3, _local4);
if ((((_local5.phase >= 1)) && ((((_local1 == 0)) || ((_local2 == 0)))))){
_local5.setLife((_local5.getLife() - 1));
if (_local5.number == ZOMBIE_FLESH){
field.ser.sword++;
_local5.deleteParticle = true;
};
};
};
_local2++;
};
_local1++;
};
checkDelete();
drawParticle();
}
}
}//package
Section 184
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 185
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 186
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 187
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 188
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 189
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 190
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 191
//SmallWaterSound (SmallWaterSound)
package {
import flash.media.*;
public dynamic class SmallWaterSound extends Sound {
}
}//package
Section 192
//Smoke (Smoke)
package {
import MathPackage.*;
public class Smoke extends Gas {
private var life:int;
private var rotation:int;
private static const SMOKE_SPEC_HEAT = 1;
private static const SMOKE_TRAN_HEAT = 0;
private static const SMOKE_COLOR:uint = 2522503770;
private static const DELETE_CHANCE = 0.01;
public function Smoke(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.SMOKE;
pColor = SMOKE_COLOR;
temp = 373;
density = 12;
life = 10;
}
override public function specHeat():Number{
return (SMOKE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SMOKE_TRAN_HEAT);
}
override public function getMagnitude():Number{
return ((density * Calc.nextListRandom()));
}
override public function redirectParticle(){
life = (life - 40);
}
override public function simulate(){
checkDelete();
moveParticle();
life--;
if ((((life <= 0)) || ((Calc.nextListRandom() < DELETE_CHANCE)))){
deleteParticle = true;
};
drawParticle();
}
}
}//package
Section 193
//Solid (Solid)
package {
public class Solid extends Particle {
public function Solid(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
phase = SOLID;
}
override public function simulate(){
checkDelete();
drawParticle();
}
}
}//package
Section 194
//SoundEngine (SoundEngine)
package {
import flash.display.*;
import flash.media.*;
public class SoundEngine extends MovieClip {
public const SFX_CAP:Number = 0.65;
public const BGM_CAP:Number = 1.3;
public var bgm;
public var sfx:Boolean;
public var gunpowderChannel:SoundChannel;
public var nukeChannel:SoundChannel;
public var c4Channel:SoundChannel;
public var gunshotChannel:SoundChannel;
public var swordChannel:SoundChannel;
public var bgmSoundChannel:EndlessSound;
public var sfxSoundChannel:EndlessSound;
public var waterChannel:EndlessSound;
public var bigWaterChannel:EndlessSound;
public var fireChannel:EndlessSound;
public var electricityChannel:EndlessSound;
public var stoneChannel:EndlessSound;
public var iceChannel:EndlessSound;
public var sandChannel:EndlessSound;
public var steamChannel:EndlessSound;
public var steelChannel:EndlessSound;
public var plantBurnChannel:EndlessSound;
public var saltChannel:EndlessSound;
public var littleWaterChannel:EndlessSound;
public var oilChannel:EndlessSound;
public var moltenSteelChannel:EndlessSound;
public var sparkChannel:EndlessSound;
public var darkMatterChannel:EndlessSound;
public var whiteMatterChannel:EndlessSound;
public var laserChannel:EndlessSound;
public var waterDrip:Waterdrip;
public var fireSound:FireSound;
public var electricitySound:ElectricitySound;
public var bigWater:BigWaterSound;
public var stoneSound:StoneDraggingSound;
public var iceSound:IceSound;
public var sandSound:SandSound;
public var steamSound:SteamSound;
public var steelSound:SteelSound;
public var plantFireSound:PlantFireSound;
public var saltSound:SaltSound;
public var littleWaterSound:SmallWaterSound;
public var oilSound:OilSound;
public var moltenSteelSound:MoltenSteelSound;
public var explosion1Sound:Explosion1;
public var explosion2Sound:Explosion2;
public var sparkSound:SparkSound;
public var explosionFire:ExplosionFire;
public var darkMatterSound:LowNoise;
public var whiteMatterSound:HighNoise;
public var nuclearExplosion:NukeNoise;
public var sword:Sword;
public var gunshot:Gunshot;
public var laserSound:LaserSound;
public var steamLevel:int;
public var nukeDelay:int;
public var swordDelay:int;
public var explosionDelay:int;
public function SoundEngine(){
bgm = true;
sfx = true;
waterDrip = new Waterdrip();
fireSound = new FireSound();
electricitySound = new ElectricitySound();
bigWater = new BigWaterSound();
stoneSound = new StoneDraggingSound();
iceSound = new IceSound();
sandSound = new SandSound();
steamSound = new SteamSound();
steelSound = new SteelSound();
plantFireSound = new PlantFireSound();
saltSound = new SaltSound();
littleWaterSound = new SmallWaterSound();
oilSound = new OilSound();
moltenSteelSound = new MoltenSteelSound();
explosion1Sound = new Explosion1();
explosion2Sound = new Explosion2();
sparkSound = new SparkSound();
explosionFire = new ExplosionFire();
darkMatterSound = new LowNoise();
whiteMatterSound = new HighNoise();
nuclearExplosion = new NukeNoise();
sword = new Sword();
gunshot = new Gunshot();
laserSound = new LaserSound();
fireChannel = new EndlessSound(fireSound);
electricityChannel = new EndlessSound(electricitySound);
bigWaterChannel = new EndlessSound(bigWater);
stoneChannel = new EndlessSound(stoneSound);
iceChannel = new EndlessSound(iceSound);
sandChannel = new EndlessSound(sandSound);
steamChannel = new EndlessSound(steamSound);
steelChannel = new EndlessSound(steelSound);
plantBurnChannel = new EndlessSound(plantFireSound);
saltChannel = new EndlessSound(saltSound);
littleWaterChannel = new EndlessSound(littleWaterSound);
oilChannel = new EndlessSound(oilSound);
moltenSteelChannel = new EndlessSound(moltenSteelSound);
sparkChannel = new EndlessSound(sparkSound);
darkMatterChannel = new EndlessSound(darkMatterSound);
whiteMatterChannel = new EndlessSound(whiteMatterSound);
laserChannel = new EndlessSound(laserSound);
}
public function changeSettings(_arg1:Boolean, _arg2:Boolean){
sfx = _arg1;
bgm = _arg2;
}
public function makeBGM(){
}
public function makeSFX(_arg1:SoundEngineReport){
if (!sfx){
fireChannel.setVolume(0);
electricityChannel.setVolume(0);
bigWaterChannel.setVolume(0);
stoneChannel.setVolume(0);
iceChannel.setVolume(0);
sandChannel.setVolume(0);
steamChannel.setVolume(0);
steelChannel.setVolume(0);
plantBurnChannel.setVolume(0);
saltChannel.setVolume(0);
littleWaterChannel.setVolume(0);
oilChannel.setVolume(0);
moltenSteelChannel.setVolume(0);
sparkChannel.setVolume(0);
darkMatterChannel.setVolume(0);
whiteMatterChannel.setVolume(0);
laserChannel.setVolume(0);
return;
};
bigWaterChannel.setVolume(maxNum((_arg1.waterMoved / 1000), 0.9));
fireChannel.setVolume(maxNum((_arg1.fire / 1000), 0.8));
electricityChannel.setVolume(maxNum((_arg1.electricity / 12), 0.8));
stoneChannel.setVolume(maxNum((_arg1.stoneCreated / 10), 0.6));
iceChannel.setVolume(maxNum((_arg1.iceCreated / 29), 1));
sandChannel.setVolume(maxNum((_arg1.sandMoved / 100), 0.9));
if (_arg1.steamCreated > steamLevel){
steamLevel = _arg1.steamCreated;
} else {
steamLevel = (steamLevel - 2);
};
if (steamLevel < 0){
steamLevel = 0;
};
if (steamLevel > 50){
steamLevel = 50;
};
steamChannel.setVolume(maxNum((steamLevel / 50), 1));
steelChannel.setVolume(maxNum((_arg1.steelCreated / 10), 1));
plantBurnChannel.setVolume(maxNum((_arg1.plantBurning / 20), 0.8));
saltChannel.setVolume(maxNum((_arg1.saltMoved / 50), 1));
littleWaterChannel.setVolume(maxNum((_arg1.lnMoved / 100), 1));
oilChannel.setVolume(maxNum((_arg1.oilMoved / 100), 0.8));
moltenSteelChannel.setVolume(maxNum((_arg1.moltenSteel / 140), 0.9));
sparkChannel.setVolume(maxNum((_arg1.spark / 60), 0.7));
darkMatterChannel.setVolume(maxNum((_arg1.darkMatter / 2), 2.1));
whiteMatterChannel.setVolume(maxNum((_arg1.whiteMatter / 40), 0.05));
laserChannel.setVolume(maxNum((_arg1.laser / 20), 0.85));
if (explosionDelay > 0){
explosionDelay--;
} else {
if (_arg1.C4Explosion > 20){
c4Channel = explosion2Sound.play(0, 1, new SoundTransform(maxNum((_arg1.C4Explosion / 50), 1)));
explosionDelay = 3;
};
if (_arg1.gunpowderExplosion > 20){
gunpowderChannel = explosionFire.play(0, 1, new SoundTransform(maxNum((_arg1.gunpowderExplosion / 60), 1)));
explosionDelay = 3;
};
};
if (_arg1.gunshot > 0){
gunshotChannel = gunshot.play(0, 1, new SoundTransform(maxNum(0.5, 1)));
};
if (swordDelay > 0){
swordDelay--;
} else {
swordDelay = 0;
};
if ((((_arg1.sword >= 1)) && ((swordDelay == 0)))){
swordChannel = sword.play(0, 1, new SoundTransform(maxNum(((_arg1.sword / 10) + 0.5), 1)));
swordDelay = 6;
};
if (nukeDelay > 0){
nukeDelay--;
} else {
nukeDelay = 0;
};
if ((((_arg1.nuclearExplosion >= 1)) && ((nukeDelay == 0)))){
nukeChannel = nuclearExplosion.play(0, 1, new SoundTransform(0.9));
nukeDelay = 4;
};
}
public function maxNum(_arg1:Number, _arg2:Number):Number{
if (_arg1 > _arg2){
_arg1 = _arg2;
};
_arg1 = (_arg1 * SFX_CAP);
if (_arg1 > SFX_CAP){
_arg1 = SFX_CAP;
};
return (_arg1);
}
}
}//package
Section 195
//SoundEngineReport (SoundEngineReport)
package {
public class SoundEngineReport {
public var fire:int;
public var plantBurning;
public var electricity:int;
public var waterMoved:int;
public var stoneCreated:int;
public var iceCreated:int;
public var sandMoved:int;
public var steamCreated:int;
public var steelCreated:int;
public var saltMoved:int;
public var lnMoved:int;
public var oilMoved:int;
public var moltenSteel:int;
public var C4Explosion:int;
public var nuclearExplosion:int;
public var gunpowderExplosion:int;
public var spark:int;
public var darkMatter:int;
public var whiteMatter:int;
public var gunshot:int;
public var sword:int;
public var laser:int;
public function SoundEngineReport(){
reset();
}
public function reset(){
fire = 0;
plantBurning = 0;
electricity = 0;
waterMoved = 0;
stoneCreated = 0;
iceCreated = 0;
sandMoved = 0;
steamCreated = 0;
steelCreated = 0;
saltMoved = 0;
lnMoved = 0;
oilMoved = 0;
moltenSteel = 0;
C4Explosion = 0;
gunpowderExplosion = 0;
spark = 0;
darkMatter = 0;
whiteMatter = 0;
nuclearExplosion = 0;
sword = 0;
gunshot = 0;
laser = 0;
}
public function printReport(){
trace(("waterMoved:" + waterMoved));
trace(("stoneCreated:" + stoneCreated));
trace(("C4Explosion:" + C4Explosion));
}
}
}//package
Section 196
//Spark (Spark)
package {
import MathPackage.*;
public class Spark extends Special {
private var sparkRotation:Number;
private var life:int;
private var destX;
private var destY:int;
private var deltax:int;
private var deltay:int;
private var error:int;
private var ystep:int;
private var steep;
private var reverse:Boolean;
private var x0;
private var y0;
private var x1;
private var y1:int;
public static const HIGHEST_TEMP = 2200;
public static const HIGH_TEMP = 1900;
public static const MID_TEMP = 1700;
public static const LOW_TEMP = 1200;
public static const LOWEST_TEMP = 800;
private static const SPARK_SPEC_HEAT = 3;
private static const SPARK_TRAN_HEAT = 0.7;
private static const SPARK_COLOR_LOW:uint = 8323072;
private static const SPARK_COLOR_MID:uint = 16744192;
private static const SPARK_COLOR_HIGH:uint = 16777087;
private static const SPARK_COLOR_HIGHEST:uint = 16777215;
private static const TEMP_LOSS_RATE = 0.26;
public function Spark(_arg1:int, _arg2:int, _arg3:Field, _arg4:int){
var _local6:int;
var _local7:int;
super(_arg1, _arg2, _arg3);
this.temp = _arg4;
number = SPARK;
sparkRotation = ((Math.PI * 2) * Calc.nextListRandom());
life = 5;
var _local5:IntVector = new IntVector(50, 50);
_local5.setRotation(sparkRotation);
destX = (_local5.getIntX() + loc.getX());
destY = (_local5.getIntY() + loc.getY());
x0 = destX;
x1 = _arg1;
y0 = destY;
y1 = _arg2;
steep = false;
if (Math.abs((y1 - y0)) > Math.abs((x1 - x0))){
steep = true;
};
if (steep){
x0 = destY;
y0 = destX;
x1 = _arg2;
y1 = _arg1;
};
reverse = true;
if (x0 > x1){
_local6 = x0;
x0 = x1;
x1 = _local6;
_local7 = y0;
y0 = y1;
y1 = _local7;
reverse = false;
};
deltax = (x1 - x0);
deltay = Math.abs((y1 - y0));
error = (deltax / 2);
ystep = 0;
_arg2 = y0;
if (y0 < y1){
ystep = 1;
} else {
ystep = -1;
};
}
public function nextBresPoint():IntPoint{
if (!reverse){
error = (error - deltay);
if (error < 0){
y0 = (y0 + ystep);
error = (error + deltax);
};
x0++;
if (steep){
return (new IntPoint(y0, x0));
};
return (new IntPoint(x0, y0));
//unresolved jump
};
error = (error - deltay);
if (error < 0){
y1 = (y1 - ystep);
error = (error + deltax);
};
x1--;
if (steep){
return (new IntPoint(y1, x1));
};
return (new IntPoint(x1, y1));
}
override public function specHeat():Number{
return (SPARK_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SPARK_TRAN_HEAT);
}
public function setColor(){
if (temp < LOW_TEMP){
pColor = SPARK_COLOR_MID;
};
if (temp > HIGH_TEMP){
pColor = SPARK_COLOR_HIGHEST;
};
if ((((temp < HIGH_TEMP)) && ((temp > MID_TEMP)))){
pColor = SPARK_COLOR_HIGH;
};
if ((((temp < MID_TEMP)) && ((temp > LOW_TEMP)))){
pColor = SPARK_COLOR_MID;
};
}
public function handleTemp(){
temp = int((temp - (TEMP_LOSS_RATE * (temp - field.DEFAULT_TEMP))));
if (temp < LOWEST_TEMP){
deleteParticle = true;
};
}
public function getMagnitude():Number{
if (temp > HIGHEST_TEMP){
return (((HIGHEST_TEMP - LOWEST_TEMP) / 100));
};
if (((temp - LOWEST_TEMP) / 100) > 0){
return (((temp - LOWEST_TEMP) / 100));
};
return (0);
}
private function redirectParticle(){
if (life <= 0){
this.deleteParticle = true;
};
life--;
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:IntPoint;
var _local4:int;
var _local5:int;
var _local6:int;
field.particleArray.unwrite(this);
if (((field.inBounds_Par(this)) && (field.canMove(this)))){
_local1 = getMagnitude();
_local2 = 0;
while (_local2 < _local1) {
_local3 = nextBresPoint();
_local4 = _local3.getY();
_local5 = _local3.getX();
_local6 = field.particleArray.getCollision(_local5, _local4);
if (_local6 == SPECIAL){
loc.setX(_local5);
loc.setY(_local4);
} else {
redirectParticle();
_local2 = _local1;
};
_local2++;
};
};
field.particleArray.write(this);
}
override public function simulate(){
checkDelete();
if (life <= 0){
deleteParticle = true;
};
setColor();
handleTemp();
moveParticle();
drawParticle();
}
}
}//package
Section 197
//Sparker (Sparker)
package {
import MathPackage.*;
public class Sparker extends Solid {
private static const SPARK_CHANCE = 0.03;
private static const SPARKER_SPEC_HEAT = 30;
private static const SPARKER_TRAN_HEAT = 0.1;
public function Sparker(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = SPARKER;
pColor = (((0xFF * 65536) + (215 * 0x0100)) + 0);
temp = 1000;
}
override public function specHeat():Number{
return (SPARKER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SPARKER_TRAN_HEAT);
}
public function spark(){
if (((field.canMove(this)) && ((Calc.nextListRandom() < SPARK_CHANCE)))){
field.addParticle_Par(new Electricity(loc.getIntX(), loc.getIntY(), field, 0));
};
}
override public function simulate(){
spark();
checkDelete();
drawParticle();
}
}
}//package
Section 198
//SparkSound (SparkSound)
package {
import flash.media.*;
public dynamic class SparkSound extends Sound {
}
}//package
Section 199
//Special (Special)
package {
public class Special extends Particle {
public function Special(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
phase = SPECIAL;
}
}
}//package
Section 200
//Spout (Spout)
package {
import MathPackage.*;
public class Spout extends Solid {
private static const WATER_CHANCE = 0.4;
private static const SPOUT_SPEC_HEAT = 30;
private static const SPOUT_TRAN_HEAT = 0.1;
private static const SPOUT_COLOR = 205;
public function Spout(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = SPOUT;
pColor = SPOUT_COLOR;
temp = 300;
}
override public function specHeat():Number{
return (SPOUT_SPEC_HEAT);
}
override public function tranHeat():Number{
return (SPOUT_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function pour(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (Calc.nextListRandom() < WATER_CHANCE){
field.addParticle_Par(new Water(_local2, _local3, field));
};
};
};
_local1++;
};
}
override public function simulate(){
pour();
checkDelete();
drawParticle();
}
}
}//package
Section 201
//Steam (Steam)
package {
import MathPackage.*;
public class Steam extends Gas {
private var life:int;
private static const STEAM_SPEC_HEAT = 1;
private static const STEAM_TRAN_HEAT = 0;
private static const STEAM_COLOR:uint = 1520736916;
public function Steam(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.STEAM;
pColor = STEAM_COLOR;
density = 5;
temp = 373;
life = 80;
}
override public function specHeat():Number{
return (STEAM_SPEC_HEAT);
}
override public function tranHeat():Number{
return (STEAM_TRAN_HEAT);
}
override public function redirectParticle(){
life = (life - 40);
}
override public function simulate(){
checkDelete();
moveParticle();
life--;
if (life <= 0){
deleteParticle = true;
};
drawParticle();
}
override public function moveParticle(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
field.particleArray.unwrite(this);
if (field.inBounds_Par(this)){
_local1 = getMagnitude();
_local2 = 1;
while (_local2 <= _local1) {
_local3 = loc.getIntX();
_local4 = (loc.getIntY() - 1);
_local5 = field.particleArray.getCollision(_local3, _local4);
if (_local5 <= 2){
loc.addY(-1);
} else {
if (field.particleArray.getParticle(_local3, _local4).temp < temp){
if (Calc.nextListRandom() < (1 / 40)){
deleteParticle = true;
field.particleArray.addParticle(new Water(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = 360;
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).setLife(1);
} else {
redirectParticle();
};
} else {
redirectParticle();
};
};
_local2++;
};
} else {
redirectParticle();
};
if (field.inBounds_Par(this)){
field.particleArray.write(this);
} else {
deleteParticle = true;
};
}
}
}//package
Section 202
//SteamSound (SteamSound)
package {
import flash.media.*;
public dynamic class SteamSound extends Sound {
}
}//package
Section 203
//Steel (Steel)
package {
public class Steel extends Solid {
private static const STEEL_SPEC_HEAT = 2.1;
private static const STEEL_TRAN_HEAT = 0.5;
public static const HIGH_TEMP = 1800;
public static const MID_TEMP = 1200;
public static const LOW_TEMP = 800;
private static const STEEL_COLOR:uint = 9212588;
private static const LOW_COLOR:uint = 11153970;
private static const MID_COLOR:uint = 16415232;
private static const HIGH_COLOR:uint = 15132210;
public function Steel(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.STEEL;
pColor = STEEL_COLOR;
}
override public function strength():Number{
return (17);
}
override public function specHeat():Number{
return (STEEL_SPEC_HEAT);
}
override public function tranHeat():Number{
return (STEEL_TRAN_HEAT);
}
public function setColor(){
var _local1:uint = pColor;
if (temp < LOW_TEMP){
pColor = STEEL_COLOR;
};
if ((((temp < HIGH_TEMP)) && ((temp > MID_TEMP)))){
pColor = MID_COLOR;
};
if ((((temp < MID_TEMP)) && ((temp > LOW_TEMP)))){
pColor = LOW_COLOR;
};
if (temp > HIGH_TEMP){
pColor = HIGH_COLOR;
field.addParticle_Par(new LiquidSteel(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
this.deleteParticle = true;
};
}
override public function simulate(){
transferHeat();
setColor();
checkDelete();
drawParticle();
}
}
}//package
Section 204
//SteelSound (SteelSound)
package {
import flash.media.*;
public dynamic class SteelSound extends Sound {
}
}//package
Section 205
//StoneDraggingSound (StoneDraggingSound)
package {
import flash.media.*;
public dynamic class StoneDraggingSound extends Sound {
}
}//package
Section 206
//Stop (Stop)
package {
import flash.display.*;
public dynamic class Stop extends SimpleButton {
}
}//package
Section 207
//Sword (Sword)
package {
import flash.media.*;
public dynamic class Sword extends Sound {
}
}//package
Section 208
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 209
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 210
//Thermite (Thermite)
package {
import MathPackage.*;
public class Thermite extends Powder {
private var burnTime:int;
private var liquidMetal:int;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1500;
private static const BURN_MAX = 1800;
private static const SPARK_MIN = 2000;
private static const SPARK_MAX = 2500;
private static const THERMITE_SPEC_HEAT = 1.1;
private static const THERMITE_TRAN_HEAT = 0.5;
private static const THERMITE_COLOR:uint = 8855584;
public function Thermite(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = THERMITE;
pColor = THERMITE_COLOR;
size = 0.8;
burnTime = 20;
liquidMetal = 3;
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
moveParticle();
drawParticle();
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
public function getSparkTemp():int{
return (int((SPARK_MIN + ((SPARK_MAX - SPARK_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((burnTime > 0)) && ((temp > BURN_TEMP)))){
if (field.canMove(this)){
field.addParticle_Par(new Spark(loc.getIntX(), loc.getIntY(), field, getSparkTemp()));
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
if (liquidMetal > 0){
field.addParticle_Par(new LiquidSteel(loc.getIntX(), loc.getIntY(), field));
liquidMetal--;
};
};
burnTime--;
};
}
override public function specHeat():Number{
return (THERMITE_SPEC_HEAT);
}
override public function tranHeat():Number{
return (THERMITE_TRAN_HEAT);
}
}
}//package
Section 211
//Torch (Torch)
package {
import MathPackage.*;
public class Torch extends Solid {
private static const FIRE_CHANCE = 0.7;
private static const BURN_MIN = 700;
private static const BURN_MAX = 1800;
private static const TORCH_SPEC_HEAT = 30;
private static const TORCH_TRAN_HEAT = 0.1;
private static const TORCH_COLOR:uint = 16719872;
public function Torch(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = TORCH;
pColor = TORCH_COLOR;
temp = 1700;
}
override public function specHeat():Number{
return (TORCH_SPEC_HEAT);
}
override public function tranHeat():Number{
return (TORCH_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if (((field.canMove(this)) && ((Calc.nextListRandom() < FIRE_CHANCE)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
};
}
override public function simulate(){
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 212
//Uranium (Uranium)
package {
public class Uranium extends Solid {
public var power:int;
public var radiation:Number;
public var life:int;
private static const URANIUM_SPEC_HEAT = 0.4;
private static const URANIUM_TRAN_HEAT = 0.2;
private static const URANIUM_COLOR:uint = 5684011;
private static const URANIUM_FISSION:Number = 10000;
public function Uranium(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.URANIUM;
pColor = URANIUM_COLOR;
power = 0;
radiation = 0;
life = 2;
}
override public function force():Number{
return (radiation);
}
override public function simulate(){
if (deleteParticle){
return;
};
transferHeat();
radiate();
checkDelete();
drawParticle();
}
public function radiate(){
var _local1:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Particle;
if (((((field.count % 2) == 0)) && ((radiation < URANIUM_FISSION)))){
radiation = 0.01;
return;
};
radiation = 0.01;
_local1 = 0;
var _local2 = -1;
while (_local2 <= 1) {
_local3 = -1;
while (_local3 <= 1) {
_local4 = (loc.getIntX() + _local2);
_local5 = (loc.getIntY() + _local3);
if (field.inBounds(_local4, _local5)){
_local6 = field.particleArray.getParticle(_local4, _local5);
if ((((((_local6.number == URANIUM)) && (!(_local6.deleteParticle)))) && (!(created)))){
_local1++;
if (((((!(((_local2 + _local3) == 0))) && (!(((_local2 + _local3) == 2))))) && (!(((_local2 + _local3) == -2))))){
radiation = (radiation + _local6.force());
};
};
};
_local3++;
};
_local2++;
};
temp = (temp + _local1);
if (_local1 < 9){
radiation = 0;
};
if (radiation > URANIUM_FISSION){
field.particleArray.addParticle(new NuclearExplosion(loc.getIntX(), loc.getIntY(), field));
field.ser.nuclearExplosion++;
deleteParticle = true;
};
}
override public function strength():Number{
return (4);
}
override public function specHeat():Number{
return (URANIUM_SPEC_HEAT);
}
override public function tranHeat():Number{
return (URANIUM_TRAN_HEAT);
}
}
}//package
Section 213
//Water (Water)
package {
import MathPackage.*;
public class Water extends Liquid {
private var life:int;
private static const EVAP_TEMP = 373;
private static const FREZ_TEMP = 270;
private static const WATER_SPEC_HEAT = 7;
private static const WATER_TRAN_HEAT = 0.9;
private static const WATER_COLOR:uint = 255;
private static const SALT_WATER_COLOR:uint = 33023;
private static const CHANCE = 0.82;
public function Water(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.WATER;
pColor = WATER_COLOR;
life = 4;
temp = 300;
MAX_VISC = 8;
}
override public function specHeat():Number{
return (WATER_SPEC_HEAT);
}
override public function tranHeat():Number{
return (WATER_TRAN_HEAT);
}
public function dissolveSalt(){
number = Particle.SALT_WATER;
pColor = SALT_WATER_COLOR;
}
public function unDissolveSalt(){
number = Particle.WATER;
pColor = WATER_COLOR;
}
public function handleTemp(){
var _local1:int;
if (temp > EVAP_TEMP){
life--;
_local1 = 0;
while (_local1 < 2) {
field.particleArray.addParticle(new Steam(loc.getIntX(), loc.getIntY(), field));
field.ser.steamCreated++;
_local1++;
};
} else {
if ((((temp < FREZ_TEMP)) && (!(created)))){
if (number != SALT_WATER){
field.particleArray.addParticle(new Ice(loc.getIntX(), loc.getIntY(), field));
field.particleArray.getParticle_int((field.particleArray.sizeLength() - 1)).temp = temp;
field.ser.iceCreated++;
this.deleteParticle = true;
};
};
};
if (life <= 0){
if (number == SALT_WATER){
field.particleArray.addParticle(new Salt(loc.getIntX(), loc.getIntY(), field));
};
this.deleteParticle = true;
};
}
override public function getLife():int{
return (life);
}
override public function setLife(_arg1:int){
life = _arg1;
}
public function checkDissolve(){
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Particle;
var _local1 = 1;
var _local2 = 1;
if (Calc.nextListBool()){
_local1 = -1;
_local2 = -1;
};
var _local3:int = -(_local1);
while (_local3 <= _local1) {
_local4 = -(_local2);
while (_local4 <= _local2) {
_local5 = (loc.getIntX() + _local3);
_local6 = (loc.getIntY() + _local4);
if (field.inBounds(_local5, _local6)){
_local7 = field.particleArray.getParticle(_local5, _local6);
if ((((((((number == WATER)) && ((_local7.number == SALT)))) && (!(_local7.deleteParticle)))) && (!(created)))){
dissolveSalt();
_local7.deleteParticle = true;
};
};
_local4 = (_local4 + _local2);
};
_local3 = (_local3 + _local1);
};
}
override public function simulate(){
checkDissolve();
transferHeat();
handleTemp();
checkDelete();
moveParticle();
drawParticle();
}
}
}//package
Section 214
//Waterdrip (Waterdrip)
package {
import flash.media.*;
public dynamic class Waterdrip extends Sound {
}
}//package
Section 215
//Wax (Wax)
package {
import MathPackage.*;
public class Wax extends Solid {
private var burnTime:int;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1000;
private static const BURN_MAX = 1700;
private static const WAX_SPEC_HEAT = 1.1;
private static const WAX_TRAN_HEAT = 0.6;
private static const WAX_COLOR:uint = 16777160;
public function Wax(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = WAX;
pColor = WAX_COLOR;
burnTime = 90;
}
override public function specHeat():Number{
return (WAX_SPEC_HEAT);
}
override public function tranHeat():Number{
return (WAX_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
temp = (temp + 1000);
};
}
public function melt(){
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 216
//Well (Well)
package {
import MathPackage.*;
public class Well extends Solid {
private static const OIL_CHANCE = 0.4;
private static const WELL_SPEC_HEAT = 30;
private static const WELL_TRAN_HEAT = 0.1;
private static const WELL_COLOR = 7356948;
public function Well(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = WELL;
pColor = WELL_COLOR;
temp = 300;
}
override public function specHeat():Number{
return (WELL_SPEC_HEAT);
}
override public function tranHeat():Number{
return (WELL_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function pour(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (Calc.nextListRandom() < OIL_CHANCE){
field.addParticle_Par(new Oil(_local2, _local3, field));
};
};
};
_local1++;
};
}
override public function simulate(){
pour();
checkDelete();
drawParticle();
}
}
}//package
Section 217
//WhiteMatter (WhiteMatter)
package {
import MathPackage.*;
public class WhiteMatter extends Special {
private var moveRange:int;
private var purgeRange:int;
private var purge:Boolean;
private var purgedParticles:Array;
private static const WM_COLOR:uint = 16711422;
public function WhiteMatter(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = WHITE_MATTER;
pColor = WM_COLOR;
moveRange = 90;
purgeRange = 30;
purge = false;
purgedParticles = new Array();
}
public function beWhiteMatter(){
var _local2:Particle;
var _local3:Number;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:int;
var _local8:Number;
var _local9:int;
var _local10:int;
if (deleteParticle){
return;
};
purge = false;
purgedParticles = new Array();
var _local1 = 1;
while (_local1 < field.particleArray.sizeLength()) {
_local2 = field.particleArray.getParticle_int(_local1);
_local3 = Calc.distanceCalc(loc.getX(), loc.getY(), _local2.loc.getX(), _local2.loc.getY());
if ((((((((_local2.number == Particle.WHITE_MATTER)) || ((_local2.number == Particle.LASER)))) || ((_local2.number == Particle.LASER)))) || ((_local2.number == Particle.BULLET)))){
} else {
if (_local3 <= purgeRange){
purge = true;
purgedParticles.push(_local2);
field.particleArray.unwrite(_local2);
_local2.magnitude = 0;
if (_local2.magnitude < 0){
_local2.magnitude = 0;
};
_local4 = loc.getX();
_local5 = loc.getY();
_local6 = _local2.loc.getX();
_local7 = _local2.loc.getY();
_local8 = Math.atan2((_local7 - _local5), (_local6 - _local4));
_local9 = (Math.cos(_local8) * ((purgeRange + 1) - _local3));
_local10 = (Math.sin(_local8) * ((purgeRange + 1) - _local3));
_local2.loc.setX((_local9 + _local2.loc.getX()));
_local2.loc.setY((_local10 + _local2.loc.getY()));
field.drawLine((_local6 * 2), (_local7 * 2), (_local2.loc.getX() * 2), (_local2.loc.getY() * 2), _local2.pColor);
field.particleArray.write(_local2);
} else {
if ((((_local2.phase == Particle.SOLID)) && ((Calc.nextListRandom() > (1 / (_local2.strength() * 5)))))){
} else {
if (Calc.nextListRandom() < (_local3 / moveRange)){
} else {
if ((((_local3 < moveRange)) && (!(_local2.deleteParticle)))){
field.particleArray.unwrite(_local2);
_local4 = loc.getX();
_local5 = loc.getY();
_local6 = _local2.loc.getX();
_local7 = _local2.loc.getY();
_local8 = Math.atan2((_local7 - _local5), (_local6 - _local4));
_local9 = -((loc.getX() - _local2.loc.getX()));
_local10 = -((loc.getY() - _local2.loc.getY()));
if (_local9 > 1){
_local9 = 1;
};
if (_local9 < -1){
_local9 = -1;
};
if (_local10 > 1){
_local10 = 1;
};
if (_local10 < -1){
_local10 = -1;
};
if (Calc.nextListRandom() > Math.abs(Math.cos(_local8))){
_local9 = 0;
};
if (Calc.nextListRandom() > Math.abs(Math.sin(_local8))){
_local10 = 0;
};
_local2.loc.setX((_local9 + _local2.loc.getX()));
_local2.loc.setY((_local10 + _local2.loc.getY()));
field.particleArray.write(_local2);
};
};
};
};
};
_local1++;
};
}
override public function drawParticle(){
super.drawParticle();
}
override public function simulate(){
beWhiteMatter();
drawParticle();
checkDelete();
}
}
}//package
Section 218
//Volcano (Volcano)
package {
import MathPackage.*;
public class Volcano extends Solid {
private static const LAVA_CHANCE = 0.4;
private static const VOL_SPEC_HEAT = 30;
private static const VOL_TRAN_HEAT = 0.4;
private static const VOL_COLOR = 9207936;
public function Volcano(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = VOLCANO;
pColor = VOL_COLOR;
temp = 2500;
}
override public function specHeat():Number{
return (VOL_SPEC_HEAT);
}
override public function tranHeat():Number{
return (VOL_TRAN_HEAT);
}
private function xor(_arg1:Boolean, _arg2:Boolean):Boolean{
return (((!(((_arg1) && (_arg2)))) && (((_arg1) || (_arg2)))));
}
public function erupt(){
var _local2:int;
var _local3:int;
var _local4:int;
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = (loc.getIntY() + 1);
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getCollision(_local2, _local3);
if (_local4 <= GAS){
if (Calc.nextListRandom() < LAVA_CHANCE){
field.addParticle_Par(new Lava(_local2, _local3, field, 0));
};
};
};
_local1++;
};
}
override public function simulate(){
erupt();
checkDelete();
drawParticle();
}
}
}//package
Section 219
//VolumeBar (VolumeBar)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class VolumeBar extends MovieClip {
public var fullness_mc:MovieClip;
public function VolumeBar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.handleLinkageID = "VolumeBarHandle";
this.handleLeftMargin = 0;
this.handleRightMargin = 0;
this.handleY = 11;
this.fullness_mc.fill_mc.slideReveal = true;
}
}
}//package
Section 220
//VolumeBarHandle (VolumeBarHandle)
package {
import flash.display.*;
public dynamic class VolumeBarHandle extends MovieClip {
}
}//package
Section 221
//VolumeBarProgress (VolumeBarProgress)
package {
import flash.display.*;
public dynamic class VolumeBarProgress extends MovieClip {
}
}//package
Section 222
//Wood (Wood)
package {
import MathPackage.*;
public class Wood extends Solid {
private var burnTime:int;
private static const BURN_TEMP = 800;
private static const BURN_MIN = 1100;
private static const BURN_MAX = 1700;
private static const WOOD_SPEC_HEAT = 1.5;
private static const WOOD_TRAN_HEAT = 0.6;
private static const WOOD_COLOR:uint = 9849600;
public function Wood(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = WOOD;
pColor = WOOD_COLOR;
burnTime = 200;
}
override public function specHeat():Number{
return (WOOD_SPEC_HEAT);
}
override public function tranHeat():Number{
return (WOOD_TRAN_HEAT);
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if ((((temp > BURN_TEMP)) && (field.canMove(this)))){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
burnTime--;
field.ser.plantBurning++;
};
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (((field.deleteArray.getBool(loc.getIntX(), loc.getIntY())) || ((burnTime <= 0)))){
deleteParticle = true;
};
};
}
override public function simulate(){
transferHeat();
burn();
checkDelete();
drawParticle();
}
}
}//package
Section 223
//Zombie (Zombie)
package {
import MathPackage.*;
public class Zombie {
private var speed:Number;
public var loc:IntPoint;
private var field:Field;
private var head:Array;
private var leftArm;
private var rightArm:Array;
private var body:Array;
private var leftLeg;
private var rightLeg:Array;
private var headX;
private var headY:int;
private var walkCount:int;
private var falling;
private var walkRight;
private var walkLeft;
private var standStill:Boolean;
private var rightCount;
private var leftCount;
private var idleCount;
private var deadCount:int;
private var rightLegCrip;
private var leftLegCrip;
private var rightArmCrip;
private var leftArmCrip;
private var dead;
private var burn;
private var bleed;
private var vaporize;
private var gib:Boolean;
private var headHealth:int;
private var rightDest;
private var leftDest;
private var headDest:int;
public var freeze;
public var high:int;
public var deleteZombie:Boolean;
public var magnitude:int;
private var leftArmDegree;
private var rightArmDegree;
private var leftLegDegree;
private var rightLegDegree;
private var headDegree:Number;
private var zColor:uint;
private static const ZOMBIE_COLOR:uint = 12763843;
private static const HEAD_RADIUS:int = 2;
private static const BODY_LENGTH:int = 6;
private static const ARM_LENGTH:int = 4;
private static const LEG_LENGTH:int = 10;
private static const ARM_LOCATION:int = 3;
private static const LEG_LOCATION:int = 12;
private static const FREEZE_TEMP:Number = 250;
private static const MAX_WALK_SPEED:Number = 0.5;
public function Zombie(_arg1:int, _arg2:int, _arg3:Field){
zColor = ZOMBIE_COLOR;
freeze = 0;
high = 0;
deleteZombie = false;
rightLegCrip = false;
leftLegCrip = false;
leftArmCrip = false;
rightArmCrip = false;
gib = false;
dead = false;
burn = false;
vaporize = false;
bleed = false;
headHealth = 6;
rightCount = 0;
leftCount = 0;
idleCount = 0;
deadCount = 0;
speed = MAX_WALK_SPEED;
walkCount = 0;
falling = false;
walkRight = false;
walkLeft = false;
standStill = true;
loc = new IntPoint(_arg1, _arg2);
this.field = _arg3;
magnitude = 0;
var _local4:Array = Calc.bresLine(loc.getX(), loc.getY(), loc.getX(), (loc.getY() + BODY_LENGTH));
var _local5:int;
while (_local5 < _local4.length) {
_local5++;
};
_local4.reverse();
body = new Array();
leftArm = new Array();
rightArm = new Array();
leftLeg = new Array();
rightLeg = new Array();
head = new Array();
fillArrayWithZombie(body, _local4);
rightArmDegree = (330 / (180 / Math.PI));
rightDest = 330;
_local4 = Calc.bresLine(body[ARM_LOCATION].getX(), body[ARM_LOCATION].getY(), (body[ARM_LOCATION].getX() + (ARM_LENGTH * Math.cos(rightArmDegree))), (body[ARM_LOCATION].getY() + (ARM_LENGTH * Math.sin(rightArmDegree))));
fillArrayWithZombie(rightArm, _local4);
leftArmDegree = (210 / (180 / Math.PI));
leftDest = 210;
_local4 = Calc.bresLine(body[ARM_LOCATION].getX(), body[ARM_LOCATION].getY(), (body[ARM_LOCATION].getX() + (ARM_LENGTH * Math.cos(leftArmDegree))), (body[ARM_LOCATION].getY() + (ARM_LENGTH * Math.sin(leftArmDegree))));
fillArrayWithZombie(leftArm, _local4);
rightLegDegree = (80 / (180 / Math.PI));
_local4 = Calc.bresLine(body[(body.length - 1)].getX(), body[(body.length - 1)].getY(), (body[(body.length - 1)].getX() + (LEG_LENGTH * Math.cos(rightLegDegree))), (body[(body.length - 1)].getY() + (LEG_LENGTH * Math.sin(rightLegDegree))));
fillArrayWithZombie(rightLeg, _local4);
leftLegDegree = (100 / (180 / Math.PI));
_local4 = Calc.bresLine(body[(body.length - 1)].getX(), body[(body.length - 1)].getY(), (body[(body.length - 1)].getX() + (LEG_LENGTH * Math.cos(leftLegDegree))), (body[(body.length - 1)].getY() + (LEG_LENGTH * Math.sin(leftLegDegree))));
fillArrayWithZombie(leftLeg, _local4);
headDegree = (270 / (180 / Math.PI));
headDest = 270;
headX = (body[0].getX() + (HEAD_RADIUS * Math.cos(headDegree)));
headY = (body[0].getY() + (HEAD_RADIUS * Math.sin(headDegree)));
_local4 = Calc.bresCircle(headX, headY, HEAD_RADIUS);
fillArrayWithZombie(head, _local4);
}
private function fillArrayWithZombie(_arg1:Array, _arg2:Array){
var _local3:int;
while (_local3 < _arg2.length) {
_arg1.push(new ZombieFlesh(_arg2[_local3].getX(), _arg2[_local3].getY(), field));
field.particleArray.addParticle(_arg1[(_arg1.length - 1)]);
_local3++;
};
}
public function compareZombieArray(_arg1:Array, _arg2:Array){
var _local3:int;
while ((((_local3 < _arg1.length)) && ((_local3 < _arg2.length)))) {
if (((!((_arg1[_local3].getX() == _arg2[_local3].getX()))) || (!((_arg1[_local3].getY() == _arg2[_local3].getY()))))){
_arg1[_local3].loc.setX(_arg2[_local3].getX());
_arg1[_local3].loc.setY(_arg2[_local3].getY());
};
_local3++;
};
}
public function moveZombieArray(_arg1:Array, _arg2:int, _arg3:int){
var _local4:int;
while (_local4 < _arg1.length) {
_arg1[_local4].loc.setX((_arg1[_local4].getX() + _arg2));
_arg1[_local4].loc.setY((_arg1[_local4].getY() + _arg3));
_local4++;
};
}
private function writeZombie(){
foobar(head, true);
foobar(rightArm, true);
foobar(leftArm, true);
foobar(body, true);
foobar(leftLeg, true);
foobar(rightLeg, true);
}
public function unwriteZombie(){
foobar(head, false);
foobar(rightArm, false);
foobar(leftArm, false);
foobar(body, false);
foobar(leftLeg, false);
foobar(rightLeg, false);
}
private function foobar(_arg1:Array, _arg2:Boolean){
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg2){
field.particleArray.write(_arg1[_local3]);
} else {
field.particleArray.unwrite(_arg1[_local3]);
};
_local3++;
};
}
private function getCollision(_arg1:int, _arg2:int):int{
var _local4:Array;
var _local5:int;
var _local3:int;
while (_local3 < 6) {
if (_local3 == 0){
_local4 = rightLeg;
};
if (_local3 == 1){
_local4 = leftLeg;
};
if (_local3 == 2){
_local4 = body;
};
if (_local3 == 3){
_local4 = rightArm;
};
if (_local3 == 4){
_local4 = leftArm;
};
if (_local3 == 5){
_local4 = head;
};
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((field.particleArray.getCollision((_local4[_local5].getX() + _arg1), (_local4[_local5].getY() + _arg2)) > 2)) && (!((field.particleArray.getParticle((_local4[_local5].getX() + _arg1), (_local4[_local5].getY() + _arg2)).number == Particle.ZOMBIE_FLESH))))){
return (4);
};
_local5++;
};
_local3++;
};
return (0);
}
public function moveTo(_arg1:int, _arg2:int){
moveZombieArray(head, _arg1, _arg2);
moveZombieArray(rightArm, _arg1, _arg2);
moveZombieArray(leftArm, _arg1, _arg2);
moveZombieArray(body, _arg1, _arg2);
moveZombieArray(rightLeg, _arg1, _arg2);
moveZombieArray(leftLeg, _arg1, _arg2);
headX = (body[0].getX() + (HEAD_RADIUS * Math.cos(headDegree)));
headY = (body[0].getY() + (HEAD_RADIUS * Math.sin(headDegree)));
loc.setX(body[0].getX());
loc.setY(body[0].getY());
}
public function moveZombie(){
var _local2:int;
var _local3:int;
var _local4:int;
falling = false;
var _local1:int;
while (_local1 < magnitude) {
_local2 = 0;
_local3 = 1;
_local4 = getCollision(_local2, _local3);
if (_local4 <= 2){
moveTo(0, 1);
falling = true;
_local1 = (_local1 + 6);
idleCount++;
} else {
_local1 = magnitude;
magnitude = 0;
};
_local1++;
};
if (dead){
return;
};
if (Calc.nextListRandom() < (freeze / 20)){
return;
};
if (((falling) && ((idleCount > 15)))){
idle();
} else {
if (walkRight){
faceRight();
if ((((Calc.nextListRandom() < speed)) && (!(falling)))){
if (getCollision(1, 0) <= 2){
moveTo(1, 0);
} else {
if (getCollision(1, -2) <= 2){
moveTo(1, -2);
};
};
};
walk();
} else {
if (walkLeft){
faceLeft();
if ((((Calc.nextListRandom() < speed)) && (!(falling)))){
if (getCollision(-1, 0) <= 2){
moveTo(-1, 0);
} else {
if (getCollision(-1, -2) <= 2){
moveTo(-1, -2);
};
};
};
walk();
} else {
if (standStill){
idle();
};
};
};
};
}
private function faceRight(){
if (rightCount == 0){
rotateHead(285);
rotateRightArm(0);
rotateLeftArm(20);
};
headDest = 285;
leftDest = 20;
rightDest = 0;
leftCount = 0;
idleCount = 0;
rightCount++;
}
private function handleDest(){
if (leftDest < Calc.toDegree(leftArmDegree)){
rotateLeftArm((Calc.toDegree(leftArmDegree) - 2));
};
if (leftDest > Calc.toDegree(leftArmDegree)){
rotateLeftArm((Calc.toDegree(leftArmDegree) + 2));
};
if (rightDest < Calc.toDegree(rightArmDegree)){
rotateRightArm((Calc.toDegree(rightArmDegree) - 2));
};
if (rightDest > Calc.toDegree(rightArmDegree)){
rotateRightArm((Calc.toDegree(rightArmDegree) + 2));
};
if (headDest < Calc.toDegree(headDegree)){
rotateHead((Calc.toDegree(headDegree) - 1));
};
if (headDest > Calc.toDegree(headDegree)){
rotateHead((Calc.toDegree(headDegree) + 1));
};
}
private function faceLeft(){
if (leftCount == 0){
rotateHead(265);
rotateRightArm(180);
rotateLeftArm(160);
};
headDest = 265;
leftDest = 160;
rightDest = 180;
rightCount = 0;
idleCount = 0;
leftCount++;
}
private function idle(){
if (idleCount == 0){
rotateHead(270);
rotateRightArm(30);
rotateLeftArm(150);
headDest = 270;
leftDest = 150;
rightDest = 30;
};
if (Calc.nextListRandom() > (0.95 - (high / 100))){
headDest = (270 + (20 * (Calc.nextListRandom() - 0.5)));
};
if (Calc.nextListRandom() > (0.95 - (high / 100))){
leftDest = (150 + (40 * (Calc.nextListRandom() - 0.5)));
};
if (Calc.nextListRandom() > (0.95 - (high / 100))){
rightDest = (30 + (40 * (Calc.nextListRandom() - 0.5)));
};
rightCount = 0;
leftCount = 0;
idleCount++;
}
private function removeLegs(){
var _local1:Array = rightLeg;
var _local2:int;
while (_local2 < _local1.length) {
_local1.pop().deleteParticle = true;
};
_local1 = leftLeg;
_local2 = 0;
while (_local2 < _local1.length) {
_local1.pop().deleteParticle = true;
};
}
private function removeArms(){
var _local1:Array = rightArm;
var _local2:int;
while (_local2 < _local1.length) {
_local1.pop().deleteParticle = true;
};
_local1 = leftArm;
_local2 = 0;
while (_local2 < _local1.length) {
_local1.pop().deleteParticle = true;
};
}
private function turnToBlood(){
var _local2:Array;
var _local3:int;
var _local1:int;
while (_local1 < 6) {
if (_local1 == 0){
_local2 = rightLeg;
};
if (_local1 == 1){
_local2 = leftLeg;
};
if (_local1 == 2){
_local2 = body;
};
if (_local1 == 3){
_local2 = rightArm;
};
if (_local1 == 4){
_local2 = leftArm;
};
if (_local1 == 5){
_local2 = head;
};
_local3 = 0;
while (_local3 < (_local2.length - 1)) {
field.particleArray.addParticle(new Blood(_local2[_local3].getX(), _local2[_local3].getY(), field));
_local3++;
};
_local1++;
};
}
private function turnToAsh(){
var _local2:Array;
var _local3:int;
var _local1:int;
while (_local1 < 6) {
if (_local1 == 0){
_local2 = rightLeg;
};
if (_local1 == 1){
_local2 = leftLeg;
};
if (_local1 == 2){
_local2 = body;
};
if (_local1 == 3){
_local2 = rightArm;
};
if (_local1 == 4){
_local2 = leftArm;
};
if (_local1 == 5){
_local2 = head;
};
_local3 = 0;
while (_local3 < (_local2.length - 1)) {
field.particleArray.addParticle(new Ash(_local2[_local3].getX(), _local2[_local3].getY(), field));
_local3++;
};
_local1++;
};
}
public function deleteFlesh(){
var _local2:Array;
var _local3:int;
var _local1:int;
while (_local1 < 6) {
if (_local1 == 0){
_local2 = rightLeg;
};
if (_local1 == 1){
_local2 = leftLeg;
};
if (_local1 == 2){
_local2 = body;
};
if (_local1 == 3){
_local2 = rightArm;
};
if (_local1 == 4){
_local2 = leftArm;
};
if (_local1 == 5){
_local2 = head;
};
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].deleteParticle = true;
_local3++;
};
_local1++;
};
}
private function handleDamage(){
var _local2:Array;
var _local5:int;
freeze = 0;
high = 0;
if (dead){
deadCount++;
if (deadCount > 46){
deleteZombie = true;
} else {
if (deadCount > 44){
if (burn){
turnToAsh();
} else {
if (bleed){
};
};
} else {
if (vaporize){
deleteZombie = true;
} else {
if (gib){
turnToBlood();
deleteZombie = true;
};
};
};
};
if (deleteZombie){
deleteFlesh();
return;
};
};
var _local1:int;
var _local3:int;
var _local4:int;
while (_local1 < 6) {
if (_local1 == 0){
_local2 = rightLeg;
};
if (_local1 == 1){
_local2 = leftLeg;
};
if (_local1 == 2){
_local2 = body;
};
if (_local1 == 3){
_local2 = rightArm;
};
if (_local1 == 4){
_local2 = leftArm;
};
if (_local1 == 5){
_local2 = head;
};
_local5 = 0;
while (_local5 < _local2.length) {
if (_local2[_local5].temp < FREEZE_TEMP){
freeze++;
};
high = (high + _local2[_local5].high);
if (((_local2[_local5].deleteParticle) || ((_local2[_local5].getLife() <= 0)))){
if ((((_local1 == 2)) && ((_local2[_local5].getLife() < 0)))){
};
if (_local1 == 5){
headHealth--;
if ((((headHealth <= 0)) || ((_local2[_local5].getLife < -25)))){
dead = true;
};
};
if (((!((_local1 == 2))) && ((_local2[_local5].getLife() < 0)))){
if (_local1 == 0){
rightLegCrip = true;
};
if (_local1 == 1){
leftLegCrip = true;
};
if (_local1 == 3){
rightArmCrip = true;
};
if (_local1 == 4){
leftArmCrip = true;
};
};
_local2[_local5].setLife((_local2[_local5].getLife() - 20));
_local2[_local5].deleteParticle = false;
if (_local2[_local5].temp > 1700){
_local3++;
};
if ((((_local2[_local5].temp < 800)) && ((_local2[_local5].getLife() >= -100)))){
_local4++;
field.particleArray.addParticle(new Blood((_local2[_local5].getX() + 1), _local2[_local5].getY(), field));
field.particleArray.addParticle(new Blood((_local2[_local5].getX() - 1), _local2[_local5].getY(), field));
};
if (dead){
if (_local2[_local5].temp > 800){
burn = true;
} else {
bleed = true;
};
};
};
_local5++;
};
_local1++;
};
if (_local3 > 15){
vaporize = true;
dead = true;
};
if (_local4 > 10){
gib = true;
dead = true;
};
}
private function rotateHead(_arg1:int){
headDegree = (_arg1 / (180 / Math.PI));
headX = (body[0].getX() + (HEAD_RADIUS * Math.cos(headDegree)));
headY = (body[0].getY() + (HEAD_RADIUS * Math.sin(headDegree)));
var _local2:Array = Calc.bresCircle(headX, headY, HEAD_RADIUS);
compareZombieArray(head, _local2);
}
private function rotateRightArm(_arg1:int){
if (body.length < ARM_LOCATION){
return;
};
rightArmDegree = (_arg1 / (180 / Math.PI));
var _local2:* = Calc.bresLine(body[ARM_LOCATION].getX(), body[ARM_LOCATION].getY(), (body[ARM_LOCATION].getX() + (ARM_LENGTH * Math.cos(rightArmDegree))), (body[ARM_LOCATION].getY() + (ARM_LENGTH * Math.sin(rightArmDegree))));
compareZombieArray(rightArm, _local2);
}
private function rotateLeftArm(_arg1:int){
if (body.length < ARM_LOCATION){
return;
};
leftArmDegree = (_arg1 / (180 / Math.PI));
var _local2:* = Calc.bresLine(body[ARM_LOCATION].getX(), body[ARM_LOCATION].getY(), (body[ARM_LOCATION].getX() + (ARM_LENGTH * Math.cos(leftArmDegree))), (body[ARM_LOCATION].getY() + (ARM_LENGTH * Math.sin(leftArmDegree))));
compareZombieArray(leftArm, _local2);
}
private function rotateRightLeg(_arg1:int){
if (body.length <= 0){
return;
};
rightLegDegree = (_arg1 / (180 / Math.PI));
var _local2:* = Calc.bresLine(body[(body.length - 1)].getX(), body[(body.length - 1)].getY(), (body[(body.length - 1)].getX() + (LEG_LENGTH * Math.cos(rightLegDegree))), (body[(body.length - 1)].getY() + (LEG_LENGTH * Math.sin(rightLegDegree))));
compareZombieArray(rightLeg, _local2);
}
private function rotateLeftLeg(_arg1:int){
if (body.length <= 0){
return;
};
leftLegDegree = (_arg1 / (180 / Math.PI));
var _local2:* = Calc.bresLine(body[(body.length - 1)].getX(), body[(body.length - 1)].getY(), (body[(body.length - 1)].getX() + (LEG_LENGTH * Math.cos(leftLegDegree))), (body[(body.length - 1)].getY() + (LEG_LENGTH * Math.sin(leftLegDegree))));
compareZombieArray(leftLeg, _local2);
}
public function pickBehavior(){
if (((walkLeft) && ((leftCount < 15)))){
return;
};
if (((walkRight) && ((rightCount < 15)))){
return;
};
if (((standStill) && ((idleCount < 15)))){
return;
};
if (Calc.nextListRandom() < (0.005 + (high / 1000))){
standStill = true;
walkRight = false;
walkLeft = false;
return;
};
if (Calc.nextListRandom() < (0.03 + (high / 100))){
if (idleCount < (15 - (high / 10))){
standStill = true;
walkRight = false;
walkLeft = false;
return;
};
if (Calc.nextListBool()){
walkRight = true;
standStill = false;
walkLeft = false;
} else {
walkLeft = true;
standStill = false;
walkRight = false;
};
};
}
private function beDead(){
if (deadCount == 1){
if (walkRight){
headDest = 310;
} else {
if (walkLeft){
headDest = 230;
} else {
if (Calc.nextListBool()){
headDest = 310;
} else {
headDest = 230;
};
};
};
rightDest = 80;
leftDest = 100;
};
rightDest = 80;
leftDest = 100;
}
private function changeColor(){
if (high > 0){
if (Calc.nextListRandom() < (high / 100)){
zColor = ((((55 + (Calc.nextListRandom() * 200)) * 65536) + ((55 + (Calc.nextListRandom() * 200)) * 0x0100)) + (55 + (Calc.nextListRandom() * 200)));
};
} else {
zColor = ZOMBIE_COLOR;
};
}
public function simulateZombie(){
unwriteZombie();
changeColor();
handleDest();
if (dead){
beDead();
} else {
pickBehavior();
};
moveZombie();
handleDamage();
if (!deleteZombie){
writeZombie();
};
}
public function walk(){
walkCount++;
var _local1:int = walkCount;
if (walkCount > 18){
_local1 = Math.abs((walkCount - 36));
};
rotateLeftLeg((110 - _local1));
rotateRightLeg((70 + _local1));
if (walkCount > 36){
walkCount = 0;
};
}
public function drawZombie(){
if (body.length > 0){
field.drawLine((body[0].getX() * 2), (body[0].getY() * 2), (body[(body.length - 1)].getX() * 2), ((body[(body.length - 1)].getY() * 2) + 1), zColor);
};
if (rightArm.length > 0){
field.drawLine((rightArm[0].getX() * 2), (rightArm[0].getY() * 2), (rightArm[(rightArm.length - 1)].getX() * 2), (rightArm[(rightArm.length - 1)].getY() * 2), zColor);
};
if (leftArm.length > 0){
field.drawLine((leftArm[0].getX() * 2), (leftArm[0].getY() * 2), (leftArm[(leftArm.length - 1)].getX() * 2), (leftArm[(leftArm.length - 1)].getY() * 2), zColor);
};
if (rightLeg.length > 0){
field.drawLine((rightLeg[0].getX() * 2), (rightLeg[0].getY() * 2), (rightLeg[(rightLeg.length - 1)].getX() * 2), (rightLeg[(rightLeg.length - 1)].getY() * 2), zColor);
};
if (leftLeg.length > 0){
field.drawLine((leftLeg[0].getX() * 2), (leftLeg[0].getY() * 2), (leftLeg[(leftLeg.length - 1)].getX() * 2), (leftLeg[(leftLeg.length - 1)].getY() * 2), zColor);
};
var _local1:Array = Calc.bresCircle((headX * 2), (headY * 2), (HEAD_RADIUS * 2));
var _local2:int;
while (_local2 < (_local1.length - 1)) {
field.g.setPixel(_local1[_local2].getX(), _local1[_local2].getY(), zColor);
_local2++;
};
}
}
}//package
Section 224
//ZombieFlesh (ZombieFlesh)
package {
import MathPackage.*;
public class ZombieFlesh extends Solid {
private const ZF_SPEC_HEAT:Number = 2.4;
private const ZF_TRAN_HEAT:Number = 0.6;
private const ZF_COLOR:uint = 12763843;
private var life:int;
public var high:int;
private static const BURN_TEMP = 810;
private static const BURN_MIN = 900;
private static const BURN_MAX = 1300;
private static const FREEZE_TEMP = 250;
public function ZombieFlesh(_arg1:int, _arg2:int, _arg3:Field){
super(_arg1, _arg2, _arg3);
number = Particle.ZOMBIE_FLESH;
pColor = ZF_COLOR;
life = 100;
high = 0;
}
override public function drawParticle(){
if (temp < FREEZE_TEMP){
pColor = (((220 * 65536) + (228 * 0x0100)) + 0xFF);
super.drawParticle();
} else {
pColor = (((194 * 65536) + (194 * 0x0100)) + 195);
};
}
public function getFireTemp():int{
return (int((BURN_MIN + ((BURN_MAX - BURN_MIN) * Calc.nextListRandom()))));
}
override public function burn(){
if (temp > BURN_TEMP){
if (field.canMove(this)){
field.addParticle_Par(new Fire(loc.getIntX(), loc.getIntY(), field, getFireTemp()));
};
life--;
if (temp > (BURN_TEMP * 2)){
life = (life - 10);
};
};
}
override public function getLife():int{
return (life);
}
override public function setLife(_arg1:int){
life = _arg1;
}
override public function strength():Number{
return (9);
}
override public function specHeat():Number{
return (ZF_SPEC_HEAT);
}
override public function tranHeat():Number{
return (ZF_TRAN_HEAT);
}
override public function simulate(){
var _local2:int;
var _local3:int;
var _local4:Particle;
high--;
if (high < 0){
high = 0;
};
var _local1 = -1;
while (_local1 <= 1) {
_local2 = (loc.getIntX() + _local1);
_local3 = loc.getIntY();
if (field.inBounds(_local2, _local3)){
_local4 = field.particleArray.getParticle(_local2, _local3);
if ((((((_local4.number == LSD)) && (!(_local4.deleteParticle)))) && (!(created)))){
high = (high + 10);
_local4.deleteParticle = true;
};
};
_local1++;
};
transferHeat();
burn();
checkDelete();
drawParticle();
}
override public function checkDelete(){
if (created){
created = false;
} else {
if (!field.inBounds_Par(this)){
deleteParticle = true;
};
};
}
}
}//package