Section 1
//Collection (de.polygonal.ds.Collection)
package de.polygonal.ds {
public interface Collection {
function isEmpty():Boolean;
function getIterator():Iterator;
function get size():int;
function clear():void;
function toArray():Array;
function contains(_arg1):Boolean;
}
}//package de.polygonal.ds
Section 2
//Iterator (de.polygonal.ds.Iterator)
package de.polygonal.ds {
public interface Iterator {
function start():void;
function next();
function set data(_arg1):void;
function get data();
function hasNext():Boolean;
}
}//package de.polygonal.ds
Section 3
//SLinkedList (de.polygonal.ds.SLinkedList)
package de.polygonal.ds {
public class SLinkedList implements Collection {
private var _count:int;
public var tail:SListNode;
public var head:SListNode;
public function SLinkedList(){
head = (tail = null);
_count = 0;
}
public function isEmpty():Boolean{
return ((_count == 0));
}
public function remove(_arg1:SListIterator):Boolean{
var _local2:SListNode;
if (((!((_arg1.list == this))) || (!(_arg1.node)))){
return (false);
};
_local2 = head;
if (_arg1.node == head){
_arg1.forth();
removeHead();
return (true);
};
while (_local2.next != _arg1.node) {
_local2 = _local2.next;
};
_arg1.forth();
if (_local2.next == tail){
tail = _local2;
};
_local2.next = _arg1.node;
_count--;
return (true);
}
public function get size():int{
return (_count);
}
public function removeHead():void{
var _local1:SListNode;
if (!head){
return;
};
if (head == tail){
head = (tail = null);
} else {
_local1 = head;
head = head.next;
_local1.next = null;
if (head == null){
tail = null;
};
};
_count--;
}
public function clear():void{
var _local1:SListNode;
var _local2:SListNode;
_local1 = head;
head = null;
while (_local1) {
_local2 = _local1.next;
_local1.next = null;
_local1 = _local2;
};
_count = 0;
}
public function prepend(_arg1):SListNode{
var _local2:SListNode;
_local2 = new SListNode(_arg1);
if (head){
_local2.next = head;
head = _local2;
} else {
head = (tail = _local2);
};
_count++;
return (_local2);
}
public function popDown():void{
var _local1:SListNode;
var _local2:SListNode;
_local1 = tail;
if (head.next == tail){
tail = head;
head = _local1;
tail.next = null;
head.next = tail;
} else {
_local2 = head;
while (_local2.next != tail) {
_local2 = _local2.next;
};
tail = _local2;
tail.next = null;
_local1.next = head;
head = _local1;
};
}
public function append(_arg1):SListNode{
var _local2:SListNode;
_local2 = new SListNode(_arg1);
if (head){
tail.next = _local2;
tail = _local2;
} else {
head = (tail = _local2);
};
_count++;
return (_local2);
}
public function toArray():Array{
var _local1:Array;
var _local2:SListNode;
_local1 = [];
_local2 = head;
while (_local2) {
_local1.push(_local2.data);
_local2 = _local2.next;
};
return (_local1);
}
public function getListIterator():SListIterator{
return (new SListIterator(this, head));
}
public function insertAfter(_arg1:SListIterator, _arg2):SListNode{
var _local3:SListNode;
if (_arg1.list != this){
return (null);
};
if (_arg1.node){
_local3 = new SListNode(_arg2);
_arg1.node.insertAfter(_local3);
if (_arg1.node == tail){
tail = _arg1.node.next;
};
_count++;
return (_local3);
//unresolved jump
};
return (append(_arg2));
}
public function contains(_arg1):Boolean{
var _local2:SListNode;
_local2 = head;
while (_local2) {
if (_local2.data == _arg1){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
public function getIterator():Iterator{
return (new SListIterator(this, head));
}
public function toString():String{
return ((("[SlinkedList, size=" + size) + "]"));
}
public function removeTail():void{
var _local1:SListNode;
if (!tail){
return;
};
if (head == tail){
head = (tail = null);
} else {
_local1 = head;
while (_local1.next != tail) {
_local1 = _local1.next;
};
tail = _local1;
_local1.next = null;
};
_count--;
}
public function dump():String{
var _local1:String;
var _local2:SListIterator;
if (!head){
return ("SLinkedList: (empty)");
};
_local1 = (((("SLinkedList: (has " + _count) + " node") + ((_count == 1)) ? ")" : "s") + "\n|< Head\n");
_local2 = getListIterator();
while (_local2.valid()) {
_local1 = (_local1 + (("\t" + _local2.data) + "\n"));
_local2.forth();
};
_local1 = (_local1 + "Tail >|");
return (_local1);
}
public function shiftUp():void{
var _local1:SListNode;
_local1 = head;
if (head.next == tail){
head = tail;
tail = _local1;
tail.next = null;
head.next = tail;
} else {
head = head.next;
tail.next = _local1;
_local1.next = null;
tail = _local1;
};
}
}
}//package de.polygonal.ds
Section 4
//SListIterator (de.polygonal.ds.SListIterator)
package de.polygonal.ds {
public class SListIterator implements Iterator {
public var node:SListNode;
public var list:SLinkedList;
public function SListIterator(_arg1:SLinkedList=null, _arg2:SListNode=null){
this.list = _arg1;
this.node = _arg2;
}
public function remove():void{
list.remove(this);
}
public function start():void{
if (list){
node = list.head;
};
}
public function get data(){
if (node){
return (node.data);
};
return (null);
}
public function forth():void{
if (node){
node = node.next;
};
}
public function toString():String{
return ((("{SListIterator: data=" + node.data) + "}"));
}
public function hasNext():Boolean{
return (Boolean(node));
}
public function valid():Boolean{
return (Boolean(node));
}
public function next(){
var _local1:*;
if (hasNext()){
_local1 = node.data;
node = node.next;
return (_local1);
};
return (null);
}
public function set data(_arg1):void{
node.data = _arg1;
}
public function end():void{
if (list){
node = list.tail;
};
}
}
}//package de.polygonal.ds
Section 5
//SListNode (de.polygonal.ds.SListNode)
package de.polygonal.ds {
public class SListNode {
public var next:SListNode;
public var data;
public function SListNode(_arg1){
data = _arg1;
next = null;
}
public function insertAfter(_arg1:SListNode):void{
_arg1.next = next;
next = _arg1;
}
public function toString():String{
return ((("[SListNode, data=" + data) + "]"));
}
}
}//package de.polygonal.ds
Section 6
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 7
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 8
//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 9
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 10
//TextInput (fl.controls.TextInput)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 11
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 12
//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 13
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.text.*;
import flash.utils.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 14
//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 15
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 16
//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 17
//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 18
//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 19
//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 20
//Contenedor (interfaz.Contenedor)
package interfaz {
import org.cove.ape.*;
public class Contenedor extends Composite {
private var dispObject;
private var umbralAdentro:Number;// = 375
private var adentro:Boolean;// = false
private var umbralAfuera:Number;// = 650
private var rp1:RectangleParticle;
private var afuera:Boolean;// = true
public function Contenedor(_arg1:Number=1){
afuera = true;
adentro = false;
umbralAdentro = 375;
umbralAfuera = 650;
super();
if (_arg1 == 1){
rp1 = new RectangleParticle(60, umbralAfuera, 100, 20, 0, true);
addParticle(rp1);
} else {
if (_arg1 == 2){
rp1 = new RectangleParticle(473, umbralAfuera, 100, 20, 0, true);
addParticle(rp1);
};
};
}
public function getPos(){
return (rp1.center);
}
public function setUmbrales(_arg1:Number, _arg2:Number){
umbralAdentro = _arg1;
umbralAfuera = _arg2;
afuera = true;
adentro = false;
rp1.py = umbralAfuera;
}
public function setLado(_arg1:Number){
if (_arg1 == 1){
rp1.px = 60;
} else {
if (_arg1 == 2){
rp1.px = 473;
};
};
}
public function repaint(){
rp1.paint();
}
public function getDisplay(){
return (dispObject);
}
public function addEventListener(_arg1, _arg2:Function){
this.addEventListener(_arg1, _arg2);
}
public function moverArriba(){
if (rp1.py <= (umbralAdentro + 45)){
afuera = false;
adentro = true;
return;
};
if (rp1.py <= umbralAdentro){
};
rp1.py = (rp1.py - 1);
repaint();
}
public function moverAbajo(){
if (rp1.py >= (umbralAdentro + 45)){
afuera = true;
adentro = false;
rp1.py = umbralAfuera;
return;
};
rp1.py = (rp1.py + 1);
repaint();
}
public function isAfuera():Boolean{
return (afuera);
}
}
}//package interfaz
Section 21
//Caja (items.caja.Caja)
package items.caja {
import flash.display.*;
import org.cove.ape.*;
import flash.events.*;
public class Caja extends Composite {
private var dispObject;
private var c12;
private var mainParticle;
private var c23;
private var drag:Boolean;// = false
public function Caja(_arg1:Number, _arg2:Number, _arg3:Number=20, _arg4:Number=0){
var _local5:Number;
var _local6:CircleParticle;
var _local7:CircleParticle;
var _local8:CircleParticle;
var _local9:CircleParticle;
var _local10:CircleParticle;
var _local11:SpringConstraint;
var _local12:SpringConstraint;
var _local13:SpringConstraint;
var _local14:SpringConstraint;
var _local15:SpringConstraint;
var _local16:SpringConstraint;
var _local17:SpringConstraint;
var _local18:SpringConstraint;
var _local19:*;
drag = false;
super();
_local5 = 7;
_local6 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 - (_arg3 / 2)), _local5, false, 1, 0, 0.8);
_local7 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 + (_arg3 / 2)), _local5, false, 1, 0, 0.8);
_local8 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 + (_arg3 / 2)), _local5, false, 1, 0, 0.8);
_local9 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 - (_arg3 / 2)), _local5, false, 1, 0, 0.8);
_local10 = new CircleParticle(_arg1, _arg2, Math.min((_arg3 / 2), (_arg3 / 2)), false, 1, 0, 0.8);
c12 = new SpringConstraint(_local6, _local7, 1, true, (_local5 * 2), 1, true);
c23 = new SpringConstraint(_local7, _local8, 1, true, (_local5 * 2), 1, true);
_local11 = new SpringConstraint(_local8, _local9, 1, true, (_local5 * 2), 1, true);
_local12 = new SpringConstraint(_local9, _local6, 1, true, (_local5 * 2), 1, true);
_local13 = new SpringConstraint(_local9, _local7, 1, false);
_local14 = new SpringConstraint(_local8, _local6, 1, false);
_local15 = new SpringConstraint(_local10, _local6, 1, false);
_local16 = new SpringConstraint(_local10, _local7, 1, false);
_local17 = new SpringConstraint(_local10, _local8, 1, false);
_local18 = new SpringConstraint(_local10, _local9, 1, false);
addParticle(_local6);
addParticle(_local7);
addParticle(_local8);
addParticle(_local9);
addParticle(_local10);
addConstraint(c12);
addConstraint(c23);
addConstraint(_local11);
addConstraint(_local12);
addConstraint(_local13);
addConstraint(_local14);
addConstraint(_local15);
addConstraint(_local16);
addConstraint(_local17);
addConstraint(_local18);
_local10.visible = false;
_local14.visible = false;
_local15.visible = false;
_local16.visible = false;
_local17.visible = false;
_local18.visible = false;
dispObject = new mcCajaCuerpo();
dispObject.height = c12.currLength;
dispObject.width = c23.currLength;
_local13.setDisplay(dispObject, 0, 0, 45);
dispObject.simOwner = this;
_local19 = new mcBordeCaja();
_local19.width = c12.currLength;
_local19.height = c12.rectHeight;
c12.setDisplay(_local19);
_local19 = new mcBordeCaja();
_local19.width = c23.currLength;
_local19.height = c23.rectHeight;
c23.setDisplay(_local19);
_local19 = new mcBordeCaja();
_local19.width = _local11.currLength;
_local19.height = _local11.rectHeight;
_local11.setDisplay(_local19);
_local19 = new mcBordeCaja();
_local19.width = _local12.currLength;
_local19.height = _local12.rectHeight;
_local12.setDisplay(_local19);
_local19 = new mcPuntaCaja();
_local19.width = (_local6.radius * 2);
_local19.height = (_local6.radius * 2);
_local6.setDisplay(_local19);
_local19 = new mcPuntaCaja();
_local19.width = (_local7.radius * 2);
_local19.height = (_local7.radius * 2);
_local7.setDisplay(_local19);
_local19 = new mcPuntaCaja();
_local19.width = (_local8.radius * 2);
_local19.height = (_local8.radius * 2);
_local8.setDisplay(_local19);
_local19 = new mcPuntaCaja();
_local19.width = (_local9.radius * 2);
_local19.height = (_local9.radius * 2);
_local9.setDisplay(_local19);
mainParticle = _local10;
}
public function getDisplay(){
return (dispObject);
}
public function addEventListener(_arg1, _arg2:Function){
this.addEventListener(_arg1, _arg2);
}
public function getMainParticle(){
return (mainParticle);
}
public function getRadius():Number{
return ((c12.currLength / 2));
}
public function getVel():Number{
return (mainParticle.velocity.magnitude());
}
public function setFixed(_arg1:Boolean):void{
this.fixed = _arg1;
}
public function getDrag():Boolean{
return (drag);
}
public function setDrag(_arg1:Boolean):void{
this.drag = _arg1;
}
}
}//package items.caja
Section 22
//Pentagono (items.pentagono.Pentagono)
package items.pentagono {
import flash.display.*;
import org.cove.ape.*;
import flash.events.*;
public class Pentagono extends Composite {
private var dispObject;
private var c12;
private var mainParticle;
private var c23;
private var drag:Boolean;// = false
public function Pentagono(_arg1:Number, _arg2:Number, _arg3:Number=20, _arg4:Number=20, _arg5:Number=0){
var _local6:Number;
var _local7:CircleParticle;
var _local8:CircleParticle;
var _local9:CircleParticle;
var _local10:CircleParticle;
var _local11:CircleParticle;
var _local12:CircleParticle;
var _local13:SpringConstraint;
var _local14:SpringConstraint;
var _local15:SpringConstraint;
var _local16:SpringConstraint;
var _local17:SpringConstraint;
var _local18:SpringConstraint;
var _local19:SpringConstraint;
var _local20:SpringConstraint;
var _local21:SpringConstraint;
var _local22:SpringConstraint;
var _local23:SpringConstraint;
var _local24:*;
drag = false;
super();
_local6 = 7;
_local7 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 - (_arg4 / 6)), _local6, false, 1, 0, 0.8);
_local8 = new CircleParticle((_arg1 - (_arg3 / 3)), (_arg2 + (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local9 = new CircleParticle((_arg1 + (_arg3 / 3)), (_arg2 + (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local10 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 - (_arg4 / 6)), _local6, false, 1, 0, 0.8);
_local11 = new CircleParticle(_arg1, ((_arg2 - (_arg4 / 3)) - (_arg4 / 6)), _local6, false, 1, 0, 0.8);
_local12 = new CircleParticle(_arg1, _arg2, Math.min((_arg3 / 2.2), (_arg4 / 2.2)), false, 1, 0, 0.8);
c12 = new SpringConstraint(_local7, _local8, 1, true, (_local6 * 2), 1, true);
c23 = new SpringConstraint(_local8, _local9, 1, true, (_local6 * 2), 1, true);
_local13 = new SpringConstraint(_local9, _local10, 1, true, (_local6 * 2), 1, true);
_local14 = new SpringConstraint(_local10, _local11, 1, true, (_local6 * 2), 1, true);
_local15 = new SpringConstraint(_local11, _local7, 1, true, (_local6 * 2), 1, true);
_local16 = new SpringConstraint(_local10, _local7, 1, true, (_local6 * 2), 1, true);
_local17 = new SpringConstraint(_local10, _local8, 1, false);
_local18 = new SpringConstraint(_local9, _local7, 1, false);
_local19 = new SpringConstraint(_local12, _local7, 1, false);
_local20 = new SpringConstraint(_local12, _local8, 1, false);
_local21 = new SpringConstraint(_local12, _local9, 1, false);
_local22 = new SpringConstraint(_local12, _local10, 1, false);
_local23 = new SpringConstraint(_local12, _local11, 1, false);
addParticle(_local7);
addParticle(_local8);
addParticle(_local9);
addParticle(_local10);
addParticle(_local11);
addParticle(_local12);
addConstraint(c12);
addConstraint(c23);
addConstraint(_local13);
addConstraint(_local14);
addConstraint(_local16);
addConstraint(_local15);
addConstraint(_local17);
addConstraint(_local18);
addConstraint(_local19);
addConstraint(_local20);
addConstraint(_local21);
addConstraint(_local22);
addConstraint(_local23);
_local18.visible = false;
_local16.visible = false;
_local19.visible = false;
_local20.visible = false;
_local21.visible = false;
_local22.visible = false;
_local23.visible = false;
dispObject = new mcPentagonoCuerpo();
dispObject.height = (_local12.radius * 2.3);
dispObject.width = (_local12.radius * 2.3);
_local17.setDisplay(dispObject, 5, -13, 40);
dispObject.simOwner = this;
_local24 = new mcBordePent();
_local24.width = c12.currLength;
_local24.height = c12.rectHeight;
c12.setDisplay(_local24);
_local24 = new mcBordePent();
_local24.width = c23.currLength;
_local24.height = c23.rectHeight;
c23.setDisplay(_local24);
_local24 = new mcBordePent();
_local24.width = _local13.currLength;
_local24.height = _local13.rectHeight;
_local13.setDisplay(_local24);
_local24 = new mcBordePent();
_local24.width = _local14.currLength;
_local24.height = _local14.rectHeight;
_local14.setDisplay(_local24);
_local24 = new mcBordePent();
_local24.width = _local15.currLength;
_local24.height = _local15.rectHeight;
_local15.setDisplay(_local24);
_local24 = new mcPuntaPent();
_local24.width = (_local7.radius * 2);
_local24.height = (_local7.radius * 2);
_local7.setDisplay(_local24);
_local24 = new mcPuntaPent();
_local24.width = (_local8.radius * 2);
_local24.height = (_local8.radius * 2);
_local8.setDisplay(_local24);
_local24 = new mcPuntaPent();
_local24.width = (_local9.radius * 2);
_local24.height = (_local9.radius * 2);
_local9.setDisplay(_local24);
_local24 = new mcPuntaPent();
_local24.width = (_local10.radius * 2);
_local24.height = (_local10.radius * 2);
_local10.setDisplay(_local24);
_local24 = new mcPuntaPent();
_local24.width = (_local11.radius * 2);
_local24.height = (_local11.radius * 2);
_local11.setDisplay(_local24);
mainParticle = _local12;
}
public function getDisplay(){
return (dispObject);
}
public function addEventListener(_arg1, _arg2:Function){
this.addEventListener(_arg1, _arg2);
}
public function getMainParticle(){
return (mainParticle);
}
public function getRadius():Number{
return ((((mainParticle.radius * 2) + ((mainParticle.radius * 2) / 3)) / 2));
}
public function getVel():Number{
return (mainParticle.velocity.magnitude());
}
public function setFixed(_arg1:Boolean):void{
this.fixed = _arg1;
}
public function getDrag():Boolean{
return (drag);
}
public function setDrag(_arg1:Boolean):void{
this.drag = _arg1;
}
}
}//package items.pentagono
Section 23
//Rectangulo (items.rectangulo.Rectangulo)
package items.rectangulo {
import flash.display.*;
import org.cove.ape.*;
import flash.events.*;
public class Rectangulo extends Composite {
private var dispObject;
private var c12;
private var mainParticle;
private var c23;
private var drag:Boolean;// = false
public function Rectangulo(_arg1:Number, _arg2:Number, _arg3:Number=20, _arg4:Number=20, _arg5:Number=0){
var _local6:Number;
var _local7:CircleParticle;
var _local8:CircleParticle;
var _local9:CircleParticle;
var _local10:CircleParticle;
var _local11:CircleParticle;
var _local12:SpringConstraint;
var _local13:SpringConstraint;
var _local14:SpringConstraint;
var _local15:SpringConstraint;
var _local16:SpringConstraint;
var _local17:SpringConstraint;
var _local18:SpringConstraint;
var _local19:SpringConstraint;
var _local20:*;
drag = false;
super();
_local6 = 7;
_local7 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 - (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local8 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 + (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local9 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 + (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local10 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 - (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local11 = new CircleParticle(_arg1, _arg2, Math.min((_arg3 / 2), (_arg4 / 2)), false, 1, 0, 0.8);
c12 = new SpringConstraint(_local7, _local8, 1, true, (_local6 * 2), 1, true);
c23 = new SpringConstraint(_local8, _local9, 1, true, (_local6 * 2), 1, true);
_local12 = new SpringConstraint(_local9, _local10, 1, true, (_local6 * 2), 1, true);
_local13 = new SpringConstraint(_local10, _local7, 1, true, (_local6 * 2), 1, true);
_local14 = new SpringConstraint(_local10, _local8, 1, false);
_local15 = new SpringConstraint(_local9, _local7, 1, false);
_local16 = new SpringConstraint(_local11, _local7, 1, false);
_local17 = new SpringConstraint(_local11, _local8, 1, false);
_local18 = new SpringConstraint(_local11, _local9, 1, false);
_local19 = new SpringConstraint(_local11, _local10, 1, false);
addParticle(_local7);
addParticle(_local8);
addParticle(_local9);
addParticle(_local10);
addParticle(_local11);
addConstraint(c12);
addConstraint(c23);
addConstraint(_local12);
addConstraint(_local13);
addConstraint(_local14);
addConstraint(_local15);
addConstraint(_local16);
addConstraint(_local17);
addConstraint(_local18);
addConstraint(_local19);
_local11.visible = false;
_local15.visible = false;
_local16.visible = false;
_local17.visible = false;
_local18.visible = false;
_local19.visible = false;
dispObject = new mcRectanguloCuerpo();
dispObject.height = c12.currLength;
dispObject.width = c23.currLength;
if (_arg3 >= _arg4){
_local14.setDisplay(dispObject, 0, 0, 30);
} else {
_local14.setDisplay(dispObject, 0, 0, 60);
};
dispObject.simOwner = this;
_local20 = new mcBordeRect();
_local20.width = c12.currLength;
_local20.height = c12.rectHeight;
c12.setDisplay(_local20);
_local20 = new mcBordeRect();
_local20.width = c23.currLength;
_local20.height = c23.rectHeight;
c23.setDisplay(_local20);
_local20 = new mcBordeRect();
_local20.width = _local12.currLength;
_local20.height = _local12.rectHeight;
_local12.setDisplay(_local20);
_local20 = new mcBordeRect();
_local20.width = _local13.currLength;
_local20.height = _local13.rectHeight;
_local13.setDisplay(_local20);
_local20 = new mcPuntaRect();
_local20.width = (_local7.radius * 2);
_local20.height = (_local7.radius * 2);
_local7.setDisplay(_local20);
_local20 = new mcPuntaRect();
_local20.width = (_local8.radius * 2);
_local20.height = (_local8.radius * 2);
_local8.setDisplay(_local20);
_local20 = new mcPuntaRect();
_local20.width = (_local9.radius * 2);
_local20.height = (_local9.radius * 2);
_local9.setDisplay(_local20);
_local20 = new mcPuntaRect();
_local20.width = (_local10.radius * 2);
_local20.height = (_local10.radius * 2);
_local10.setDisplay(_local20);
mainParticle = _local11;
}
public function getDisplay(){
return (dispObject);
}
public function addEventListener(_arg1, _arg2:Function){
this.addEventListener(_arg1, _arg2);
}
public function getMainParticle(){
return (mainParticle);
}
public function getRadius():Number{
return ((c12.currLength / 2));
}
public function getVel():Number{
return (mainParticle.velocity.magnitude());
}
public function setFixed(_arg1:Boolean):void{
this.fixed = _arg1;
}
public function getDrag():Boolean{
return (drag);
}
public function setDrag(_arg1:Boolean):void{
this.drag = _arg1;
}
}
}//package items.rectangulo
Section 24
//Triangulo (items.triangulo.Triangulo)
package items.triangulo {
import flash.display.*;
import org.cove.ape.*;
import flash.events.*;
public class Triangulo extends Composite {
private var dispObject;
private var c12;
private var mainParticle;
private var cr1;
private var c23;
private var drag:Boolean;// = false
public function Triangulo(_arg1:Number, _arg2:Number, _arg3:Number=30, _arg4:Number=30, _arg5:Number=0){
var _local6:Number;
var _local7:CircleParticle;
var _local8:CircleParticle;
var _local9:CircleParticle;
var _local10:CircleParticle;
var _local11:SpringConstraint;
var _local12:SpringConstraint;
var _local13:SpringConstraint;
var _local14:*;
drag = false;
super();
_local6 = 7;
_local7 = new CircleParticle(_arg1, (_arg2 - (_arg4 / 2)), _local6, false, 1, 0, 0.8);
_local8 = new CircleParticle((_arg1 - (_arg3 / 2)), (_arg2 + (_arg4 / 3)), _local6, false, 1, 0, 0.8);
_local9 = new CircleParticle((_arg1 + (_arg3 / 2)), (_arg2 + (_arg4 / 3)), _local6, false, 1, 0, 0.8);
_local10 = new CircleParticle(_arg1, _arg2, Math.min((_arg3 / 3), (_arg4 / 3)), false, 1, 0, 0.8);
mainParticle = _local10;
c12 = new SpringConstraint(_local7, _local8, 1, true, (_local6 * 2), 1, true);
c23 = new SpringConstraint(_local8, _local9, 1, true, (_local6 * 2), 1, true);
_local11 = new SpringConstraint(_local9, _local7, 1, true, (_local6 * 2), 1, true);
cr1 = new SpringConstraint(_local10, _local7, 1, false);
_local12 = new SpringConstraint(_local10, _local8, 1, false);
_local13 = new SpringConstraint(_local10, _local9, 1, false);
addParticle(_local7);
addParticle(_local8);
addParticle(_local9);
addParticle(_local10);
addConstraint(c12);
addConstraint(c23);
addConstraint(_local11);
addConstraint(cr1);
addConstraint(_local12);
addConstraint(_local13);
_local12.visible = false;
_local13.visible = false;
_local10.visible = false;
dispObject = new mcTrianguloCuerpo();
dispObject.height = (_local10.radius * 2.5);
dispObject.width = (_local10.radius * 3.4);
cr1.setDisplay(dispObject, (_arg4 / 3), 0, 30);
dispObject.simOwner = this;
_local14 = new mcBordeTriangulo();
_local14.width = c12.currLength;
_local14.height = c12.rectHeight;
c12.setDisplay(_local14);
_local14 = new mcBordeTriangulo();
_local14.width = c23.currLength;
_local14.height = c23.rectHeight;
c23.setDisplay(_local14);
_local14 = new mcBordeTriangulo();
_local14.width = _local11.currLength;
_local14.height = _local11.rectHeight;
_local11.setDisplay(_local14);
_local14 = new mcPuntaTriangulo();
_local14.width = (_local7.radius * 2);
_local14.height = (_local7.radius * 2);
_local7.setDisplay(_local14);
_local14 = new mcPuntaTriangulo();
_local14.width = (_local8.radius * 2);
_local14.height = (_local8.radius * 2);
_local8.setDisplay(_local14);
_local14 = new mcPuntaTriangulo();
_local14.width = (_local9.radius * 2);
_local14.height = (_local9.radius * 2);
_local9.setDisplay(_local14);
mainParticle = _local10;
}
public function getDisplay(){
return (dispObject);
}
public function addEventListener(_arg1, _arg2:Function){
this.addEventListener(_arg1, _arg2);
}
public function getMainParticle(){
return (mainParticle);
}
public function getVel():Number{
return (mainParticle.velocity.magnitude());
}
public function getRadius():Number{
return (cr1.currLength);
}
public function setFixed(_arg1:Boolean):void{
this.fixed = _arg1;
}
public function getDrag():Boolean{
return (drag);
}
public function setDrag(_arg1:Boolean):void{
this.drag = _arg1;
}
}
}//package items.triangulo
Section 25
//Global (lt.uza.utils.Global)
package lt.uza.utils {
import flash.events.*;
import flash.utils.*;
public dynamic class Global extends Proxy implements IEventDispatcher {
private var globalRepository:HashMap;
private var dispatcher:EventDispatcher;
private static var allowInstantiation:Boolean = false;
private static var instance:Global = null;
public function Global(){
if (getQualifiedClassName(this) == "lt.uza.utils::Global"){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use Global.getInstance() instead of new Global()."));
};
globalRepository = new HashMap();
dispatcher = new EventDispatcher(this);
};
}
public function containsKey(_arg1:String):Boolean{
var _local2:Boolean;
_local2 = globalRepository.containsKey(_arg1);
return (_local2);
}
public function remove(_arg1:String):void{
globalRepository.remove(_arg1);
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (globalRepository.getValue(_arg1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
var _local3:*;
switch (_arg1.toString()){
default:
_local3 = globalRepository.getValue(_arg1).apply(globalRepository, _args);
break;
};
return (_local3);
}
public function put(_arg1:String, _arg2):void{
globalRepository.put(_arg1, _arg2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:*;
_local3 = globalRepository.getValue(_arg1);
globalRepository.put(_arg1, _arg2);
if (_local3 !== _arg2){
dispatchEvent(new GlobalEvent(GlobalEvent.PROPERTY_CHANGED, _arg1));
};
}
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
public function containsValue(_arg1):Boolean{
var _local2:Boolean;
_local2 = globalRepository.containsValue(_arg1);
return (_local2);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
public function take(_arg1){
return (globalRepository.getValue(_arg1));
}
public function get length():int{
var _local1:int;
_local1 = globalRepository.size();
return (_local1);
}
public function toString():String{
var _local1:Array;
var _local2:*;
_local1 = new Array();
for (_local2 in globalRepository) {
_local1.push((((("{" + _local2) + ":") + globalRepository[_local2]) + "}"));
};
return (_local1.join(","));
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
public static function getInstance():Global{
if (Global.instance == null){
Global.allowInstantiation = true;
Global.instance = new (Global);
Global.allowInstantiation = false;
};
return (Global.instance);
}
}
}//package lt.uza.utils
Section 26
//GlobalEvent (lt.uza.utils.GlobalEvent)
package lt.uza.utils {
import flash.events.*;
public class GlobalEvent extends Event {
public var property;
public static const PROPERTY_CHANGED:String = "globalPropertyChanged";
public function GlobalEvent(_arg1:String, _arg2, _arg3:Boolean=false, _arg4:Boolean=false){
this.property = _arg2;
super(_arg1, _arg3, _arg4);
}
override public function clone():Event{
return (new GlobalEvent(type, property, bubbles, cancelable));
}
}
}//package lt.uza.utils
Section 27
//HashMap (lt.uza.utils.HashMap)
package lt.uza.utils {
import flash.utils.*;
public dynamic class HashMap extends Dictionary implements IMap {
public function HashMap(_arg1:Boolean=true){
super(_arg1);
}
public function containsKey(_arg1:String):Boolean{
return (!((this[_arg1] == null)));
}
public function remove(_arg1:String):void{
this[_arg1] = null;
}
public function size():int{
var _local1:int;
var _local2:String;
_local1 = 0;
for (_local2 in this) {
if (this[_local2] != null){
_local1++;
};
};
return (_local1);
}
public function getKey(_arg1):String{
var _local2:String;
for (_local2 in this) {
if (this[_local2] == _arg1){
return (_local2);
};
};
return (null);
}
public function isEmpty():Boolean{
var _local1:int;
var _local2:String;
_local1 = 0;
for (_local2 in this) {
if (this[_local2] != null){
_local1++;
};
};
return ((_local1 <= 0));
}
public function clear():void{
var _local1:String;
for (_local1 in this) {
this[_local1] = null;
};
}
public function put(_arg1:String, _arg2):void{
this[_arg1] = _arg2;
}
public function containsValue(_arg1):Boolean{
var _local2:String;
for (_local2 in this) {
if (this[_local2] == _arg1){
return (true);
};
};
return (false);
}
public function getValue(_arg1:String){
if (this[_arg1] != null){
return (this[_arg1]);
};
}
}
}//package lt.uza.utils
Section 28
//IMap (lt.uza.utils.IMap)
package lt.uza.utils {
public interface IMap {
function containsKey(_arg1:String):Boolean;
function isEmpty():Boolean;
function remove(_arg1:String):void;
function size():int;
function getKey(_arg1):String;
function clear():void;
function containsValue(_arg1):Boolean;
function put(_arg1:String, _arg2):void;
function getValue(_arg1:String);
}
}//package lt.uza.utils
Section 29
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 30
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 31
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
private var _constraints:Array;
public function AbstractCollection(){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
_constraints = new Array();
}
public function getAll():Array{
return (particles.concat(constraints));
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:AbstractParticle;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:AbstractParticle;
var _local10:SpringConstraint;
var _local11:SpringConstraint;
var _local12:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _particles[_local3];
if (!_local5.collidable){
} else {
_local6 = _arg1.particles.length;
_local7 = 0;
while (_local7 < _local6) {
_local9 = _arg1.particles[_local7];
if (_local9.collidable){
CollisionDetector.test(_local5, _local9);
};
_local7++;
};
_local8 = _arg1.constraints.length;
_local7 = 0;
while (_local7 < _local8) {
_local10 = _arg1.constraints[_local7];
if (((_local10.collidable) && (!(_local10.isConnectedTo(_local5))))){
_local10.scp.updatePosition();
CollisionDetector.test(_local5, _local10.scp);
};
_local7++;
};
};
_local3++;
};
_local4 = _constraints.length;
_local3 = 0;
while (_local3 < _local4) {
_local11 = _constraints[_local3];
if (!_local11.collidable){
} else {
_local6 = _arg1.particles.length;
_local12 = 0;
while (_local12 < _local6) {
_local9 = _arg1.particles[_local12];
if (((_local9.collidable) && (!(_local11.isConnectedTo(_local9))))){
_local11.scp.updatePosition();
CollisionDetector.test(_local9, _local11.scp);
};
_local12++;
};
};
_local3++;
};
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
function checkInternalCollisions():void{
var _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:AbstractParticle;
var _local8:SpringConstraint;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if (!_local3.collidable){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local7 = _particles[_local4];
if (_local7.collidable){
CollisionDetector.test(_local3, _local7);
};
_local4++;
};
_local5 = _constraints.length;
_local6 = 0;
while (_local6 < _local5) {
_local8 = _constraints[_local6];
if (((_local8.collidable) && (!(_local8.isConnectedTo(_local3))))){
_local8.scp.updatePosition();
CollisionDetector.test(_local3, _local8.scp);
};
_local6++;
};
};
_local2++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeConstraint(_arg1:AbstractConstraint):void{
var _local2:int;
_local2 = constraints.indexOf(_arg1);
if (_local2 == -1){
return;
};
constraints.splice(_local2, 1);
_arg1.cleanup();
}
function get isParented():Boolean{
return (_isParented);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].init();
_local1++;
};
}
function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:AbstractConstraint;
_local1 = _constraints.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _constraints[_local2];
_local3.resolve();
_local2++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:int;
var _local3:int;
var _local4:SpringConstraint;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _particles[_local3];
if (((!(_local1.fixed)) || (_local1.alwaysRepaint))){
_local1.paint();
};
_local3++;
};
_local2 = _constraints.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _constraints[_local3];
if (((!(_local4.fixed)) || (_local4.alwaysRepaint))){
_local4.paint();
};
_local3++;
};
}
public function addConstraint(_arg1:AbstractConstraint):void{
constraints.push(_arg1);
if (isParented){
_arg1.init();
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
return;
};
particles.splice(_local2, 1);
_arg1.cleanup();
}
public function cleanup():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].cleanup();
_local1++;
};
}
public function get particles():Array{
return (_particles);
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function get constraints():Array{
return (_constraints);
}
}
}//package org.cove.ape
Section 32
//AbstractConstraint (org.cove.ape.AbstractConstraint)
package org.cove.ape {
import flash.utils.*;
public class AbstractConstraint extends AbstractItem {
private var _stiffness:Number;
public function AbstractConstraint(_arg1:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractConstraint"){
throw (new ArgumentError("AbstractConstraint can't be instantiated directly"));
};
this.stiffness = _arg1;
setStyle();
}
public function get stiffness():Number{
return (_stiffness);
}
public function set stiffness(_arg1:Number):void{
_stiffness = _arg1;
}
function resolve():void{
}
}
}//package org.cove.ape
Section 33
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.display.*;
public class AbstractItem {
var lineAlpha:Number;
var lineColor:uint;
var displayObjectOffset:Vector;
var lineThickness:Number;
var displayObject:DisplayObject;
var fillAlpha:Number;
private var _sprite:Sprite;
var fillColor:uint;
private var _visible:Boolean;
private var _alwaysRepaint:Boolean;
var displayObjectRotation:Number;
public function AbstractItem(){
_visible = true;
_alwaysRepaint = false;
}
public function setLine(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1):void{
lineThickness = _arg1;
lineColor = _arg2;
lineAlpha = _arg3;
}
public function set visible(_arg1:Boolean):void{
_visible = _arg1;
sprite.visible = _arg1;
}
public function setFill(_arg1:uint=0xFFFFFF, _arg2:Number=1):void{
fillColor = _arg1;
fillAlpha = _arg2;
}
public function init():void{
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function paint():void{
}
public function cleanup():void{
var _local1:int;
sprite.graphics.clear();
_local1 = 0;
while (_local1 < sprite.numChildren) {
sprite.removeChildAt(_local1);
_local1++;
};
}
public function setStyle(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1, _arg4:uint=0xFFFFFF, _arg5:Number=1):void{
setLine(_arg1, _arg2, _arg3);
setFill(_arg4, _arg5);
}
public function get visible():Boolean{
return (_visible);
}
final public function set alwaysRepaint(_arg1:Boolean):void{
_alwaysRepaint = _arg1;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 34
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractParticle extends AbstractItem {
private var _collidable:Boolean;
private var _multisample:int;
private var collision:Collision;
var prev:Vector;
private var _kfr:Number;
var curr:Vector;
private var _invMass:Number;
var interval:Interval;
private var _mass:Number;
private var temp:Vector;
private var _friction:Number;
private var forces:Vector;
var samp:Vector;
private var _center:Vector;
private var _fixed:Boolean;
public function AbstractParticle(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(_arg1, _arg2);
prev = new Vector(_arg1, _arg2);
samp = new Vector();
temp = new Vector();
fixed = _arg3;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = _arg4;
this.elasticity = _arg5;
this.friction = _arg6;
setStyle();
_center = new Vector();
_multisample = 0;
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
function getComponents(_arg1:Vector):Collision{
var _local2:Vector;
var _local3:Number;
_local2 = velocity;
_local3 = _arg1.dot(_local2);
collision.vn = _arg1.mult(_local3);
collision.vt = _local2.minus(collision.vn);
return (collision);
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function get fixed():Boolean{
return (_fixed);
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
public function get multisample():int{
return (_multisample);
}
function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
curr.plusEquals(_arg1);
velocity = _arg2;
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
public function addMasslessForce(_arg1:Vector):void{
forces.plusEquals(_arg1);
}
public function set velocity(_arg1:Vector):void{
prev = curr.minus(_arg1);
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function get elasticity():Number{
return (_kfr);
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1));
curr.plusEquals(_local2.multEquals(APEngine.damping));
prev.copy(temp);
forces.setTo(0, 0);
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function get collidable():Boolean{
return (_collidable);
}
public function addForce(_arg1:Vector):void{
forces.plusEquals(_arg1.mult(invMass));
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get friction():Number{
return (_friction);
}
public function get mass():Number{
return (_mass);
}
}
}//package org.cove.ape
Section 35
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var _container:DisplayObjectContainer;
private static var _damping:Number;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
private static var _constraintCycles:int;
static var force:Vector;
private static var timeStep:Number;
private static var numGroups:int;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
var _local2:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCycles) {
satisfyConstraints();
_local1++;
};
_local2 = 0;
while (_local2 < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
_local2++;
};
}
public static function init(_arg1:Number=0.25):void{
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCycles = 0;
_constraintCollisionCycles = 1;
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function set constraintCycles(_arg1:int):void{
_constraintCycles = _arg1;
}
public static function addForce(_arg1:Vector):void{
force.plusEquals(_arg1);
}
public static function get damping():Number{
return (_damping);
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function addGroup(_arg1:Group):void{
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
_arg1.cleanup();
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
private static function satisfyConstraints():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.satisfyConstraints();
_local1++;
};
}
public static function addMasslessForce(_arg1:Vector):void{
masslessForce.plusEquals(_arg1);
}
}
}//package org.cove.ape
Section 36
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_radius = _arg3;
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
};
paint();
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
public function get radius():Number{
return (_radius);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
}
}//package org.cove.ape
Section 37
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package org.cove.ape
Section 38
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:Array;
var _local6:int;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Vector;
var _local11:Number;
_local4 = Number.POSITIVE_INFINITY;
_local5 = new Array(2);
_local6 = 0;
while (_local6 < 2) {
_local8 = _arg1.axes[_local6];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
if (Math.abs(_local9) < Math.abs(_local4)){
_local3 = _local8;
_local4 = _local9;
};
_local5[_local6] = _local9;
_local6++;
};
_local7 = _arg2.radius;
if ((((Math.abs(_local5[0]) < _local7)) && ((Math.abs(_local5[1]) < _local7)))){
_local10 = closestVertexOnOBB(_arg2.samp, _arg1);
_local3 = _local10.minus(_arg2.samp);
_local11 = _local3.magnitude();
_local4 = (_local7 - _local11);
if (_local4 > 0){
_local3.divEquals(_local11);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
testTypes(_arg1, _arg2);
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Vector;
var _local6:Number;
var _local7:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
_local5 = _arg1.samp.minus(_arg2.samp);
_local6 = _local5.magnitude();
_local7 = ((_arg1.radius + _arg2.radius) - _local6);
if (_local7 > 0){
_local5.divEquals(_local6);
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local5, _local7);
return (true);
};
return (false);
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
return (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
return (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_arg2.samp.copy(_arg2.curr);
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local4.plusEquals(_arg2.axes[_local5].mult(_local6));
_local5++;
};
return (_local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:int;
var _local6:Vector;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Boolean;
_local4 = Number.POSITIVE_INFINITY;
_local5 = 0;
while (_local5 < 2) {
_local6 = _arg1.axes[_local5];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
_local8 = _arg2.axes[_local5];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
_local10 = Math.abs(_local7);
_local11 = Math.abs(_local9);
if ((((_local10 < Math.abs(_local4))) || ((_local11 < Math.abs(_local4))))){
_local12 = (_local10 < _local11);
_local3 = (_local12) ? _local6 : _local8;
_local4 = (_local12) ? _local7 : _local9;
};
_local5++;
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
}
}//package org.cove.ape
Section 39
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionResolver {
static function resolveParticleParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Vector;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Collision;
var _local11:Vector;
var _local12:Vector;
var _local13:Vector;
var _local14:Vector;
_arg1.curr.copy(_arg1.samp);
_arg2.curr.copy(_arg2.samp);
_local5 = _arg3.mult(_arg4);
_local6 = (_arg1.elasticity + _arg2.elasticity);
_local7 = (_arg1.invMass + _arg2.invMass);
_local8 = clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local9 = _arg1.getComponents(_arg3);
_local10 = _arg2.getComponents(_arg3);
_local11 = _local10.vn.mult(((_local6 + 1) * _arg1.invMass)).plus(_local9.vn.mult((_arg2.invMass - (_local6 * _arg1.invMass)))).divEquals(_local7);
_local12 = _local9.vn.mult(((_local6 + 1) * _arg2.invMass)).plus(_local10.vn.mult((_arg1.invMass - (_local6 * _arg2.invMass)))).divEquals(_local7);
_local9.vt.multEquals(_local8);
_local10.vt.multEquals(_local8);
_local13 = _local5.mult((_arg1.invMass / _local7));
_local14 = _local5.mult((-(_arg2.invMass) / _local7));
_local11.plusEquals(_local9.vt);
_local12.plusEquals(_local10.vt);
if (!_arg1.fixed){
_arg1.resolveCollision(_local13, _local11, _arg3, _arg4, -1, _arg2);
};
if (!_arg2.fixed){
_arg2.resolveCollision(_local14, _local12, _arg3, _arg4, 1, _arg1);
};
}
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > _arg3){
return (_arg3);
};
if (_arg1 < _arg2){
return (_arg2);
};
return (_arg1);
}
}
}//package org.cove.ape
Section 40
//Composite (org.cove.ape.Composite)
package org.cove.ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
delta = new Vector();
}
private function getRelativeAngle(_arg1:Vector, _arg2:Vector):Number{
delta.setTo((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
return (Math.atan2(delta.y, delta.x));
}
public function rotateByRadian(_arg1:Number, _arg2:Vector):void{
var _local3:AbstractParticle;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
_local4 = particles;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _local4[_local6];
_local7 = _local3.center.distance(_arg2);
_local8 = (getRelativeAngle(_arg2, _local3.center) + _arg1);
_local3.px = ((Math.cos(_local8) * _local7) + _arg2.x);
_local3.py = ((Math.sin(_local8) * _local7) + _arg2.y);
_local6++;
};
}
public function rotateByAngle(_arg1:Number, _arg2:Vector):void{
var _local3:Number;
_local3 = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(_local3, _arg2);
}
public function set fixed(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].fixed = _arg1;
_local2++;
};
}
public function get fixed():Boolean{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
if (!particles[_local1].fixed){
return (false);
};
_local1++;
};
return (true);
}
}
}//package org.cove.ape
Section 41
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _collideInternal:Boolean;
private var _composites:Array;
private var _collisionList:Array;
public function Group(_arg1:Boolean=false){
_composites = new Array();
_collisionList = new Array();
this.collideInternal = _arg1;
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
checkCollisionVsGroup(_local3);
_local2++;
};
}
public function get composites():Array{
return (_composites);
}
override public function init():void{
var _local1:int;
super.init();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].init();
_local1++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
private function checkCollisionVsGroup(_arg1:Group):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Composite;
var _local6:int;
var _local7:Composite;
checkCollisionsVsCollection(_arg1);
_local2 = _composites.length;
_local3 = _arg1.composites.length;
_local4 = 0;
while (_local4 < _local2) {
_local5 = _composites[_local4];
_local5.checkCollisionsVsCollection(_arg1);
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
_local5.checkCollisionsVsCollection(_local7);
_local6++;
};
_local4++;
};
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
checkCollisionsVsCollection(_local7);
_local6++;
};
}
override function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.satisfyConstraints();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.satisfyConstraints();
_local2++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function addCollidableList(_arg1:Array):void{
var _local2:int;
var _local3:Group;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
collisionList.push(_local3);
_local2++;
};
}
public function removeComposite(_arg1:Composite):void{
var _local2:int;
_local2 = composites.indexOf(_arg1);
if (_local2 == -1){
return;
};
composites.splice(_local2, 1);
_arg1.isParented = false;
_arg1.cleanup();
}
override public function cleanup():void{
var _local1:int;
super.cleanup();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].cleanup();
_local1++;
};
}
override public function paint():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.paint();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.paint();
_local2++;
};
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
public function get collisionList():Array{
return (_collisionList);
}
override function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Composite;
super.integrate(_arg1);
_local2 = _composites.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _composites[_local3];
_local4.integrate(_arg1);
_local3++;
};
}
public function addComposite(_arg1:Composite):void{
composites.push(_arg1);
_arg1.isParented = true;
if (isParented){
_arg1.init();
};
}
private function checkCollisionGroupInternal():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
var _local4:int;
var _local5:Composite;
checkInternalCollisions();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.checkCollisionsVsCollection(this);
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _composites[_local4];
_local3.checkCollisionsVsCollection(_local5);
_local4++;
};
_local2++;
};
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
}
}//package org.cove.ape
Section 42
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 43
//MathUtil (org.cove.ape.MathUtil)
package org.cove.ape {
final class MathUtil {
static var ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static var PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 44
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
_extents = new Array((_arg3 / 2), (_arg4 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg5;
}
override public function init():void{
var _local1:Number;
var _local2:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
_local1 = (extents[0] * 2);
_local2 = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(_local1) / 2), (-(_local2) / 2), _local1, _local2);
sprite.graphics.endFill();
};
paint();
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
function get extents():Array{
return (_extents);
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get radian():Number{
return (_radian);
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
}
}//package org.cove.ape
Section 45
//SpringConstraint (org.cove.ape.SpringConstraint)
package org.cove.ape {
import flash.display.*;
public class SpringConstraint extends AbstractConstraint {
private var _collidable:Boolean;
private var _restLength:Number;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var _scp:SpringConstraintParticle;
public function SpringConstraint(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Number=0.5, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=1, _arg7:Boolean=false){
super(_arg3);
this.p1 = _arg1;
this.p2 = _arg2;
checkParticlesLocation();
_restLength = currLength;
setCollidable(_arg4, _arg5, _arg6, _arg7);
}
public function set rectScale(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectScale = _arg1;
}
override public function init():void{
cleanup();
if (collidable){
scp.init();
} else {
if (displayObject != null){
initDisplay();
};
};
paint();
}
function initDisplay():void{
if (collidable){
scp.initDisplay();
} else {
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
};
}
private function checkParticlesLocation():void{
if ((((p1.curr.x == p2.curr.x)) && ((p1.curr.y == p2.curr.y)))){
p2.curr.x = (p2.curr.x + 0.0001);
};
}
public function get radian():Number{
var _local1:Vector;
_local1 = delta;
return (Math.atan2(_local1.y, _local1.x));
}
function get scp():SpringConstraintParticle{
return (_scp);
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
if (collidable){
scp.setDisplay(_arg1, _arg2, _arg3, _arg4);
} else {
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
};
}
public function set restLength(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("restLength must be greater than 0"));
};
_restLength = _arg1;
}
public function get currLength():Number{
return (p1.curr.distance(p2.curr));
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
public function get rectScale():Number{
return (scp.rectScale);
}
function get delta():Vector{
return (p1.curr.minus(p2.curr));
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function get center():Vector{
return (p1.curr.plus(p2.curr).divEquals(2));
}
public function set rectHeight(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectHeight = _arg1;
}
public function get restLength():Number{
return (_restLength);
}
override public function paint():void{
var _local1:Vector;
if (collidable){
scp.paint();
} else {
if (displayObject != null){
_local1 = center;
sprite.x = _local1.x;
sprite.y = _local1.y;
sprite.rotation = angle;
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.moveTo(p1.px, p1.py);
sprite.graphics.lineTo(p2.px, p2.py);
};
};
}
public function setCollidable(_arg1:Boolean, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_collidable = _arg1;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(p1, p2, this, _arg2, _arg3, _arg4);
};
}
public function get collidable():Boolean{
return (_collidable);
}
public function isConnectedTo(_arg1:AbstractParticle):Boolean{
return ((((_arg1 == p1)) || ((_arg1 == p2))));
}
override function resolve():void{
var _local1:Number;
var _local2:Number;
var _local3:Vector;
if (((p1.fixed) && (p2.fixed))){
return;
};
_local1 = currLength;
_local2 = ((_local1 - restLength) / (_local1 * (p1.invMass + p2.invMass)));
_local3 = delta.mult((_local2 * stiffness));
p1.curr.minusEquals(_local3.mult(p1.invMass));
p2.curr.plusEquals(_local3.mult(p2.invMass));
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function set fixedEndLimit(_arg1:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = _arg1;
}
}
}//package org.cove.ape
Section 46
//SpringConstraintParticle (org.cove.ape.SpringConstraintParticle)
package org.cove.ape {
import flash.display.*;
import org.cove.ape.*;
class SpringConstraintParticle extends RectangleParticle {
private var _fixedEndLimit:Number;
private var _rectScale:Number;
private var rca:Vector;
private var rcb:Vector;
private var s:Number;
private var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var lambda:Vector;
private var avgVelocity:Vector;
private var _rectHeight:Number;
function SpringConstraintParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:SpringConstraint, _arg4:Number, _arg5:Number, _arg6:Boolean){
super(0, 0, 0, 0, 0, false);
this.p1 = _arg1;
this.p2 = _arg2;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = _arg3;
this.rectScale = _arg5;
this.rectHeight = _arg4;
this.scaleToLength = _arg6;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
private function setCorners(_arg1:RectangleParticle, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local3 = _arg1.curr.x;
_local4 = _arg1.curr.y;
_local5 = _arg1.axes;
_local6 = _arg1.extents;
_local7 = (_local5[0].x * _local6[0]);
_local8 = (_local5[0].y * _local6[0]);
_local9 = (_local5[1].x * _local6[1]);
_local10 = (_local5[1].y * _local6[1]);
_local11 = (_local7 - _local9);
_local12 = (_local8 - _local10);
_local13 = (_local7 + _local9);
_local14 = (_local8 + _local10);
if (_arg2 == 0){
rca.x = (_local3 - _local13);
rca.y = (_local4 - _local14);
rcb.x = (_local3 + _local11);
rcb.y = (_local4 + _local12);
} else {
if (_arg2 == 1){
rca.x = (_local3 + _local11);
rca.y = (_local4 + _local12);
rcb.x = (_local3 + _local13);
rcb.y = (_local4 + _local14);
} else {
if (_arg2 == 2){
rca.x = (_local3 + _local13);
rca.y = (_local4 + _local14);
rcb.x = (_local3 - _local11);
rcb.y = (_local4 - _local12);
} else {
if (_arg2 == 3){
rca.x = (_local3 - _local11);
rca.y = (_local4 - _local12);
rcb.x = (_local3 - _local13);
rcb.y = (_local4 - _local14);
};
};
};
};
}
override public function init():void{
var _local1:Sprite;
var _local2:Number;
var _local3:Number;
if (displayObject != null){
initDisplay();
} else {
_local1 = new Sprite();
parent.sprite.addChild(_local1);
_local1.name = "inner";
_local2 = (parent.currLength * rectScale);
_local3 = rectHeight;
_local1.graphics.clear();
_local1.graphics.lineStyle(parent.lineThickness, parent.lineColor, parent.lineAlpha);
_local1.graphics.beginFill(parent.fillColor, parent.fillAlpha);
_local1.graphics.drawRect((-(_local2) / 2), (-(_local3) / 2), _local2, _local3);
_local1.graphics.endFill();
};
paint();
}
function updatePosition():void{
var _local1:Vector;
_local1 = parent.center;
curr.setTo(_local1.x, _local1.y);
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
private function closestPtSegmentSegment():Number{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vector;
var _local16:Vector;
var _local17:Vector;
_local1 = p1.curr;
_local2 = p2.curr;
_local3 = rca;
_local4 = rcb;
_local5 = _local2.minus(_local1);
_local6 = _local4.minus(_local3);
_local7 = _local1.minus(_local3);
_local9 = _local5.dot(_local5);
_local10 = _local6.dot(_local6);
_local11 = _local6.dot(_local7);
_local12 = _local5.dot(_local7);
_local13 = _local5.dot(_local6);
_local14 = ((_local9 * _local10) - (_local13 * _local13));
if (_local14 != 0){
s = MathUtil.clamp((((_local13 * _local11) - (_local12 * _local10)) / _local14), 0, 1);
} else {
s = 0.5;
};
_local8 = (((_local13 * s) + _local11) / _local10);
if (_local8 < 0){
_local8 = 0;
s = MathUtil.clamp((-(_local12) / _local9), 0, 1);
} else {
if (_local8 > 0){
_local8 = 1;
s = MathUtil.clamp(((_local13 - _local12) / _local9), 0, 1);
};
};
_local15 = _local1.plus(_local5.mult(s));
_local16 = _local3.plus(_local6.mult(_local8));
_local17 = _local15.minus(_local16);
return (_local15.minus(_local16).dot(_local17));
}
function get rectHeight():Number{
return (_rectHeight);
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
private function closestParamPoint(_arg1:Vector):Number{
var _local2:Vector;
var _local3:Number;
_local2 = p2.curr.minus(p1.curr);
_local3 = (_local2.dot(_arg1.minus(p1.curr)) / _local2.dot(_local2));
return (MathUtil.clamp(_local3, 0, 1));
}
function set rectHeight(_arg1:Number):void{
_rectHeight = _arg1;
}
override public function paint():void{
var _local1:Vector;
var _local2:Sprite;
_local1 = parent.center;
_local2 = parent.sprite;
if (scaleToLength){
_local2.getChildByName("inner").width = (parent.currLength * rectScale);
} else {
if (displayObject != null){
_local2.getChildByName("inner").width = (parent.restLength * rectScale);
};
};
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.rotation = parent.angle;
}
private function getContactPointParam(_arg1:AbstractParticle):Number{
var _local2:Number;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:int;
var _local7:Number;
if ((_arg1 is CircleParticle)){
_local2 = closestParamPoint(_arg1.curr);
} else {
if ((_arg1 is RectangleParticle)){
_local4 = new Array(4);
_local5 = Number.POSITIVE_INFINITY;
_local6 = 0;
while (_local6 < 4) {
setCorners((_arg1 as RectangleParticle), _local6);
_local7 = closestPtSegmentSegment();
if (_local7 < _local5){
_local5 = _local7;
_local3 = _local6;
_local4[_local6] = s;
};
_local6++;
};
_local2 = _local4[_local3];
};
};
return (_local2);
}
function set fixedEndLimit(_arg1:Number):void{
_fixedEndLimit = _arg1;
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
override function initDisplay():void{
var _local1:Sprite;
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
_local1 = new Sprite();
_local1.name = "inner";
_local1.addChild(displayObject);
parent.sprite.addChild(_local1);
}
function set rectScale(_arg1:Number):void{
_rectScale = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:AbstractParticle;
_local7 = getContactPointParam(_arg6);
_local8 = (1 - _local7);
_local9 = _local7;
if (p1.fixed){
if (_local9 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local9), (_arg1.y / _local9));
p2.curr.plusEquals(lambda);
p2.velocity = _arg2;
} else {
if (p2.fixed){
if (_local8 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local8), (_arg1.y / _local8));
p1.curr.plusEquals(lambda);
p1.velocity = _arg2;
} else {
_local10 = ((_local8 * _local8) + (_local9 * _local9));
if (_local10 == 0){
return;
};
lambda.setTo((_arg1.x / _local10), (_arg1.y / _local10));
p1.curr.plusEquals(lambda.mult(_local8));
p2.curr.plusEquals(lambda.mult(_local9));
if (_local7 == 0.5){
p1.velocity = _arg2;
p2.velocity = _arg2;
} else {
_local11 = ((_local7)<0.5) ? p1 : p2;
_local11.velocity = _arg2;
};
};
};
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
function get rectScale():Number{
return (_rectScale);
}
override public function get velocity():Vector{
var _local1:Vector;
var _local2:Vector;
_local1 = p1.velocity;
_local2 = p2.velocity;
avgVelocity.setTo(((_local1.x + _local2.x) / 2), ((_local1.y + _local2.y) / 2));
return (avgVelocity);
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
}
}//package org.cove.ape
Section 47
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function normalize():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (mult((1 / _local1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function distance(_arg1:Vector):Number{
var _local2:Vector;
_local2 = this.minus(_arg1);
return (_local2.magnitude());
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
}
}//package org.cove.ape
Section 48
//Blah_1 (TorreHaciaLaLuna3_fla.Blah_1)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
public dynamic class Blah_1 extends MovieClip {
public function Blah_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TorreHaciaLaLuna3_fla
Section 49
//Disp_18 (TorreHaciaLaLuna3_fla.Disp_18)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
public dynamic class Disp_18 extends MovieClip {
public function Disp_18(){
addFrameScript(0, frame1, 15, frame16);
}
function frame16(){
stop();
}
function frame1(){
stop();
}
}
}//package TorreHaciaLaLuna3_fla
Section 50
//FaderOnce_22 (TorreHaciaLaLuna3_fla.FaderOnce_22)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
public dynamic class FaderOnce_22 extends MovieClip {
public function FaderOnce_22(){
addFrameScript(58, frame59);
}
function frame59(){
stop();
}
}
}//package TorreHaciaLaLuna3_fla
Section 51
//Intro_2 (TorreHaciaLaLuna3_fla.Intro_2)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
import flash.events.*;
import lt.uza.utils.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Intro_2 extends MovieClip {
public var channel:SoundChannel;
public var btnPuntajes:SimpleButton;
public var intro:IntroSong;
public var btnComenzar:SimpleButton;
public var global:Global;
public var global2:Global;
public function Intro_2(){
addFrameScript(0, frame1, 59, frame60, 61, frame62, 120, frame121);
}
function frame1(){
intro = new IntroSong();
channel = new SoundChannel();
channel = intro.play(0, 9999999);
}
function frame121(){
stop();
channel.stop();
global2 = Global.getInstance();
global2.mainApp.gotoAndPlay("Intro");
}
function frame62(){
global = Global.getInstance();
global.mainApp.gotoAndPlay(11);
gotoAndPlay(59);
}
function frame60(){
stop();
}
}
}//package TorreHaciaLaLuna3_fla
Section 52
//IntroMovie_12 (TorreHaciaLaLuna3_fla.IntroMovie_12)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
import flash.events.*;
import lt.uza.utils.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class IntroMovie_12 extends MovieClip {
public var global:Global;
public function IntroMovie_12(){
addFrameScript(1454, frame1455);
}
function frame1455(){
global = Global.getInstance();
global.mainApp.mcIntro.stop();
global.mainApp.mcIntro.x = 1000;
global.mainApp.gotoAndPlay("Juego");
}
}
}//package TorreHaciaLaLuna3_fla
Section 53
//MainTimeline (TorreHaciaLaLuna3_fla.MainTimeline)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
import org.cove.ape.*;
import flash.events.*;
import de.polygonal.ds.*;
import lt.uza.utils.*;
import flash.text.*;
import flash.utils.*;
import mochi.*;
import interfaz.*;
import items.pentagono.*;
import items.rectangulo.*;
import items.triangulo.*;
import items.caja.*;
import flash.media.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var hayPedido:Boolean;
public var tiempoTimer:Timer;
public var mcNivel:TextField;
public var btnSkip:SimpleButton;
public var songChannel:SoundChannel;
public var scoreTicker:Timer;
public var rp:RectangleParticle;
public var marco:Shape;
public var mcDisp:MovieClip;
public var mcPiezas:TextField;
public var btnReset:SimpleButton;
public var numPedido:Number;
public var intro:MovieClip;
public var mcIntro:MovieClip;
public var objectList:SLinkedList;
public var sndRobot:Robot;
public var cielo:Number;
public var mcFin:MovieClip;
public var oldGroup:Group;
public var mcConteo:Conteo;
public var contenedor:Contenedor;
public var mcScore:TextField;
public var MUNDO:Number;
public var lastRequestedObject;
public var texto:TextField;
public var linea:Linea;
public var puntaje:Number;
public var mcJuego:MovieClip;
public var umbral:Number;
public var song:MainSong;
public var activeGroup:Group;
public var btnMusic:SimpleButton;
public var nrp:RectangleParticle;
public var mouseRay:MovieClip;
public var lastGrabbedObject;
public var estado:String;
public var barra:Shape;
public var juegoTimer:Timer;
public var global:Global;
public var rp2:RectangleParticle;
public var rp3:RectangleParticle;
public var cam:MovieClip;
public var btnMenu:SimpleButton;
public var seAcabo:Boolean;
public var numObjetos:Number;
public function MainTimeline(){
addFrameScript(0, frame1, 11, frame12, 20, frame21, 30, frame31, 40, frame41, 50, frame51, 60, frame61);
}
public function comenzar(_arg1:MouseEvent){
intro.gotoAndPlay(64);
}
public function onTick(_arg1:TimerEvent):void{
mcConteo.gotoAndPlay((5 * _arg1.target.currentCount));
}
public function scores(_arg1:MouseEvent){
intro.gotoAndPlay(61);
removeChild(global.roboto);
Mouse.show();
MochiScores.showLeaderboard({clip:intro, boardID:"5123684050d270c8", res:"533x400"});
}
public function music(_arg1:MouseEvent){
if (!global.musicEnabled){
songChannel = song.play(0, 9999999);
} else {
songChannel.stop();
};
global.musicEnabled = !(global.musicEnabled);
}
public function onScoreTick(_arg1:TimerEvent):void{
puntaje = (puntaje + 1);
mcScore.text = (("Time: " + puntaje) + " seg.");
}
public function pruebaSuperada():Boolean{
var vel:Number;
var superado:Boolean;
var it:SListIterator;
var obj:*;
var alt:Number;
vel = 0;
superado = false;
it = objectList.getListIterator();
while (it.hasNext()) {
try {
obj = it.next();
alt = (obj.getMainParticle().py - obj.getRadius());
if (alt <= cielo){
superado = true;
};
vel = (vel + obj.getVel());
} catch(e) {
};
};
if ((((vel <= umbral)) && (superado))){
return (true);
};
return (false);
}
public function dibujaPreload(){
texto = new TextField();
marco = new Shape();
barra = new Shape();
marco.graphics.lineStyle(1, 0xFFFFFF);
marco.graphics.drawRoundRect(0, 20, 70, 5, 0);
barra.graphics.beginFill(0xFFFFFF);
barra.graphics.drawRect(0, 20, 70, 5);
barra.graphics.endFill();
addChild(texto);
addChild(marco);
addChild(barra);
}
public function hacerMundo(_arg1:Number){
if (nrp.px >= 266){
contenedor.setLado(1);
mcDisp.x = 60;
} else {
contenedor.setLado(2);
mcDisp.x = 473;
};
mcDisp.y = (nrp.py - 50);
mcDisp.scaleX = 0.5;
mcDisp.scaleY = 0.5;
seAcabo = false;
mcDisp.gotoAndPlay("No");
mcDisp.gotoAndPlay("Si");
numPedido = 1;
contenedor.setUmbrales((nrp.py - 25), (nrp.py + 250));
if (_arg1 == 1){
umbral = 0.2;
cielo = 150;
numObjetos = 4;
numPedido = 1;
linea.y = cielo;
pedirObjeto();
} else {
if (_arg1 == 2){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 170);
linea.y = cielo;
numObjetos = 2;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 3){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 180);
linea.y = cielo;
numObjetos = 3;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 4){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 100);
linea.y = cielo;
numObjetos = 4;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 5){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 60);
linea.y = cielo;
numObjetos = 5;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 6){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 180);
linea.y = cielo;
numObjetos = 3;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 7){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 180);
linea.y = cielo;
numObjetos = 4;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 8){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 160);
linea.y = cielo;
numObjetos = 3;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 9){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 150);
linea.y = cielo;
numObjetos = 5;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 10){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 180);
linea.y = cielo;
numObjetos = 3;
numPedido = 1;
pedirObjeto();
} else {
if (_arg1 == 11){
umbral = 0.2;
cielo = ((nrp.py - stage.stageHeight) + 180);
linea.y = cielo;
numObjetos = 5;
numPedido = 1;
pedirObjeto();
} else {
if (scoreTicker.running){
scoreTicker.reset();
};
global.puntaje = puntaje;
estado = "FIN";
songChannel.stop();
return;
};
};
};
};
};
};
};
};
};
};
};
mostrarGUI();
}
public function robotMouseUp(_arg1:MouseEvent){
global.roboto.gotoAndPlay("Up");
}
function frame12(){
stop();
global = Global.getInstance();
global.mainApp = this;
global.roboto = new Roboto();
global.musicEnabled = true;
sndRobot = new Robot();
addChild(global.roboto);
addEventListener(Event.ENTER_FRAME, actMouse);
stage.addEventListener(MouseEvent.MOUSE_DOWN, robotMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, robotMouseUp);
Mouse.hide();
intro.x = 0;
intro.y = 0;
intro.btnPuntajes.addEventListener(MouseEvent.CLICK, scores);
intro.btnComenzar.addEventListener(MouseEvent.CLICK, comenzar);
}
function frame21(){
stop();
btnSkip.addEventListener(MouseEvent.CLICK, juego);
MUNDO = 1;
mcIntro.x = 266.5;
mcIntro.y = 200;
}
public function esconderGUI(){
btnReset.visible = false;
btnMusic.visible = false;
btnMenu.visible = false;
mcPiezas.visible = false;
mcNivel.visible = false;
mcScore.visible = false;
}
function frame1(){
stage.showDefaultContextMenu = false;
MochiServices.connect("4069be0a4ced63ca", root);
MochiAd.showPreGameAd({clip:root, id:"4069be0a4ced63ca", res:"533x400", background:0, color:0xFFFFFF, outline:0xFFFFFF, no_bg:true});
}
public function moverMundo():void{
if (scoreTicker.running){
scoreTicker.reset();
};
cam.y = (cam.y - 1);
if ((cam.y + (stage.stageHeight / 2)) < nrp.py){
nrp.fixed = true;
quitarObjetos();
activeGroup.removeParticle(nrp);
oldGroup.addParticle(nrp);
hayPedido = false;
rp2.py = (nrp.py + (stage.stageHeight * 3));
estado = "JUEGO";
mcConteo.gotoAndPlay(0);
MUNDO = (MUNDO + 1);
hacerMundo(MUNDO);
};
}
public function run(_arg1:Event):void{
APEngine.step();
APEngine.paint();
if (estado == "CAMBIO"){
moverMundo();
} else {
if (estado == "JUEGO"){
jugar();
} else {
if (estado == "FIN"){
removeEventListener(Event.ENTER_FRAME, run);
gotoAndPlay("Fin");
} else {
if (estado == "RESET"){
removeEventListener(Event.ENTER_FRAME, run);
gotoAndPlay(9);
};
};
};
};
}
function frame31(){
stop();
estado = "JUEGO";
numPedido = 1;
hayPedido = false;
seAcabo = false;
tiempoTimer = new Timer(1000, 5);
tiempoTimer.addEventListener(TimerEvent.TIMER, onTick);
tiempoTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
puntaje = 0;
scoreTicker = new Timer(1000);
scoreTicker.addEventListener(TimerEvent.TIMER, onScoreTick);
lastGrabbedObject = null;
lastRequestedObject = null;
juegoTimer = new Timer(2.5);
activeGroup = new Group();
oldGroup = new Group();
oldGroup.collideInternal = false;
activeGroup.addCollidable(oldGroup);
Main(MUNDO);
}
function frame41(){
stop();
mcFin.x = (cam.x - 266.5);
mcFin.y = (cam.y - 200);
mcFin.gotoAndPlay(2);
}
public function prepararNuevoNivel(_arg1:Vector):void{
nrp = new RectangleParticle(_arg1.x, ((nrp.py - stage.stageHeight) - 50), 250, 50, 0, false);
nrp.setDisplay(new mcViga(), 0, 0, 0);
activeGroup.addParticle(nrp);
estado = "CAMBIO";
esconderGUI();
}
public function setDrag(_arg1:MouseEvent){
var simObj:*;
var evt = _arg1;
if (evt.type == MouseEvent.MOUSE_UP){
if (lastGrabbedObject != null){
lastGrabbedObject.setDrag(false);
lastGrabbedObject = null;
};
} else {
try {
simObj = evt.target.simOwner;
lastGrabbedObject = simObj;
if (simObj.fixed == false){
simObj.setDrag(true);
};
} catch(e) {
};
};
}
function frame51(){
stop();
}
function frame61(){
stop();
}
public function juego(_arg1:MouseEvent){
mcIntro.stop();
mcIntro.x = 1000;
gotoAndPlay("Juego");
}
public function actMouse(_arg1:Event){
global.roboto.x = mouseX;
global.roboto.y = (mouseY - 22);
}
public function posicionaPreload(){
texto.x = (marco.x = (barra.x = ((stage.stageWidth / 2) - (marco.width / 2))));
texto.y = ((stage.stageHeight / 2) - (texto.height / 2));
marco.y = (barra.y = (texto.y + 5));
}
public function reset(_arg1:MouseEvent){
congelarObjetos();
quitarObjetos();
hayPedido = false;
hacerMundo(MUNDO);
}
public function mostrarGUI(){
btnReset.visible = true;
btnMusic.visible = true;
btnMenu.visible = true;
mcPiezas.visible = true;
mcNivel.visible = true;
mcScore.visible = true;
mcNivel.text = ("LEVEL: " + MUNDO);
mcPiezas.text = ("Nº Pieces: " + numObjetos);
mcScore.text = (("Time: " + puntaje) + " seg.");
mcNivel.y = ((nrp.py - stage.stageHeight) + 5);
btnReset.y = ((nrp.py - stage.stageHeight) + 40);
btnMusic.y = ((nrp.py - stage.stageHeight) + 90);
btnMenu.y = ((nrp.py - stage.stageHeight) + 40);
mcPiezas.y = ((nrp.py - stage.stageHeight) + 55);
mcConteo.y = ((nrp.py - stage.stageHeight) + 80);
mcScore.y = ((nrp.py - stage.stageHeight) + 5);
linea.gotoAndPlay(0);
}
public function menu(_arg1:MouseEvent){
scoreTicker.stop();
scoreTicker.reset();
scoreTicker.removeEventListener(TimerEvent.TIMER, onScoreTick);
tiempoTimer.reset();
puntaje = 0;
global.mainApp.removeChild(global.roboto);
Mouse.show();
songChannel.stop();
global.mainApp.cam.x = 266.5;
global.mainApp.cam.y = 200;
congelarObjetos();
quitarObjetos();
hayPedido = false;
hacerMundo(MUNDO);
estado = "RESET";
}
public function quitarObjetos(){
var it:Iterator;
var obj:*;
var lastPos:Vector;
it = objectList.getIterator();
lastPos = new Vector(1000, 1000);
while (it.hasNext()) {
try {
obj = it.next();
oldGroup.removeComposite(obj);
} catch(e) {
};
};
objectList.clear();
lastGrabbedObject = null;
}
public function PreloadBasico(){
var onLoadProgress:Function;
var onLoadComplete:Function;
onLoadProgress = function (_arg1:ProgressEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = _arg1.bytesLoaded;
_local3 = _arg1.bytesTotal;
_local4 = ((_local2 / _local3) * 100);
texto.text = (("Loaded: " + String(_local4)) + "%");
barra.width = ((_local4 * marco.width) / 100);
};
onLoadComplete = function (_arg1:Event):void{
removeChild(texto);
removeChild(marco);
removeChild(barra);
gotoAndPlay(10);
};
dibujaPreload();
posicionaPreload();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
}
public function robotMouseDown(_arg1:MouseEvent){
global.roboto.gotoAndPlay("Down");
sndRobot.play();
}
public function jugar():void{
if (!scoreTicker.running){
scoreTicker.start();
};
mouseRay.graphics.clear();
if (lastGrabbedObject != null){
if (lastGrabbedObject == lastRequestedObject){
contenedor.moverArriba();
hayPedido = false;
};
tiempoTimer.reset();
mcConteo.gotoAndPlay(0);
if (lastGrabbedObject.getDrag()){
lastGrabbedObject.getMainParticle().px = (lastGrabbedObject.getMainParticle().px + ((mouseX - lastGrabbedObject.getMainParticle().px) / 5));
lastGrabbedObject.getMainParticle().py = (lastGrabbedObject.getMainParticle().py + ((mouseY - lastGrabbedObject.getMainParticle().py) / 5));
mouseRay.graphics.lineStyle(5, 0xFF9900, 0.5);
mouseRay.graphics.moveTo(lastGrabbedObject.getMainParticle().px, lastGrabbedObject.getMainParticle().py);
mouseRay.graphics.lineTo(mouseX, (mouseY - 5));
};
} else {
if (pruebaSuperada()){
if (!tiempoTimer.running){
tiempoTimer.start();
};
} else {
tiempoTimer.reset();
mcConteo.gotoAndPlay(0);
};
};
if (hayPedido){
contenedor.moverArriba();
} else {
contenedor.moverAbajo();
if (contenedor.isAfuera()){
pedirObjeto();
};
};
}
public function congelarObjetos():Vector{
var it:Iterator;
var obj:*;
var lastPos:Vector;
it = objectList.getIterator();
lastPos = new Vector(1000, 1000);
while (it.hasNext()) {
try {
obj = it.next();
obj.fixed = true;
activeGroup.removeComposite(obj);
oldGroup.addComposite(obj);
if (obj.getMainParticle().py < lastPos.y){
lastPos = obj.getMainParticle().center;
};
} catch(e) {
};
};
lastGrabbedObject = null;
return (lastPos);
}
public function Main(_arg1:Number){
var _local2:Boolean;
APEngine.init((1 / 4));
APEngine.container = mcJuego;
APEngine.addMasslessForce(new Vector(0, 2));
song = new MainSong();
songChannel = song.play(0, 9999999);
mouseRay = new MovieClip();
addChild(mouseRay);
activeGroup.collideInternal = true;
contenedor = new Contenedor(1);
oldGroup.addComposite(contenedor);
nrp = new RectangleParticle(266, 400, 250, 50, 0, true);
nrp.setDisplay(new mcViga(), 0, 0, 0);
rp2 = new RectangleParticle(266, (stage.stageHeight * 2.5), 199999999, 100, 0, true);
oldGroup.addParticle(nrp);
oldGroup.addParticle(rp2);
APEngine.addGroup(activeGroup);
APEngine.addGroup(oldGroup);
stage.frameRate = 60;
objectList = new SLinkedList();
_local2 = true;
if (_local2){
addEventListener(Event.ENTER_FRAME, run);
} else {
juegoTimer.addEventListener(TimerEvent.TIMER, run);
juegoTimer.start();
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, setDrag);
stage.addEventListener(MouseEvent.MOUSE_UP, setDrag);
btnReset.addEventListener(MouseEvent.CLICK, reset);
btnMusic.addEventListener(MouseEvent.CLICK, music);
btnMenu.addEventListener(MouseEvent.CLICK, menu);
hacerMundo(_arg1);
}
public function pedirObjeto(){
var _local1:Caja;
var _local2:Rectangulo;
var _local3:Triangulo;
var _local4:Pentagono;
if (hayPedido){
return;
};
if (numPedido > numObjetos){
if (!seAcabo){
mcDisp.gotoAndPlay("No");
seAcabo = true;
};
return;
};
if (MUNDO == 1){
if (numPedido == 1){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 2){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 3){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 4){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
};
};
};
};
} else {
if (MUNDO == 2){
if (numPedido == 1){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 2){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
};
};
} else {
if (MUNDO == 3){
if (numPedido == 1){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 2){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 3){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
};
};
};
} else {
if (MUNDO == 4){
if (numPedido == 1){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 50), 60);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 2){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 60), 25, 50);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 3){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 50), 60);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 4){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 50), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
};
};
};
};
} else {
if (MUNDO == 5){
if (numPedido == 1){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 2){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 3){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 60), 50);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 4){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 5){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 70), 60, 60);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
};
};
};
};
};
} else {
if (MUNDO == 6){
if (numPedido == 1){
_local4 = new Pentagono(contenedor.getPos().x, (contenedor.getPos().y - 70), 60, 60);
activeGroup.addComposite(_local4);
objectList.append(_local4);
lastRequestedObject = _local4;
} else {
if (numPedido == 2){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 50), 40, 40);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 3){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
};
};
};
} else {
if (MUNDO == 7){
if (numPedido == 1){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 70, 70);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 2){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 70, 70);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 3){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
} else {
if (numPedido == 4){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
};
};
};
};
} else {
if (MUNDO == 8){
if (numPedido == 1){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 2){
_local4 = new Pentagono(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local4);
objectList.append(_local4);
lastRequestedObject = _local4;
} else {
if (numPedido == 3){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 60), 25, 50);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
};
};
};
} else {
if (MUNDO == 9){
if (numPedido == 1){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 2){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 50), 40, 40);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 3){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 50), 60);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
} else {
if (numPedido == 4){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 50), 40, 40);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 5){
_local1 = new Caja(contenedor.getPos().x, (contenedor.getPos().y - 50), 60);
activeGroup.addComposite(_local1);
objectList.append(_local1);
lastRequestedObject = _local1;
};
};
};
};
};
} else {
if (MUNDO == 10){
if (numPedido == 1){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 70, 70);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 2){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 70, 70);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 3){
_local2 = new Rectangulo(contenedor.getPos().x, (contenedor.getPos().y - 110), 50, 100);
activeGroup.addComposite(_local2);
objectList.append(_local2);
lastRequestedObject = _local2;
};
};
};
} else {
if (MUNDO == 11){
if (numPedido == 1){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 2){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 3){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 4){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
} else {
if (numPedido == 5){
_local3 = new Triangulo(contenedor.getPos().x, (contenedor.getPos().y - 90), 80, 80);
activeGroup.addComposite(_local3);
objectList.append(_local3);
lastRequestedObject = _local3;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
hayPedido = true;
numPedido = (numPedido + 1);
}
public function onTimerComplete(_arg1:TimerEvent):void{
var _local2:Vector;
mcConteo.gotoAndPlay(30);
tiempoTimer.stop();
tiempoTimer.reset();
_local2 = congelarObjetos();
prepararNuevoNivel(_local2);
}
}
}//package TorreHaciaLaLuna3_fla
Section 54
//OutroMovie_28 (TorreHaciaLaLuna3_fla.OutroMovie_28)
package TorreHaciaLaLuna3_fla {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import lt.uza.utils.*;
import flash.text.*;
import flash.utils.*;
import mochi.*;
import flash.media.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class OutroMovie_28 extends MovieClip {
public var btnSend:SimpleButton;
public var btnYes:SimpleButton;
public var btnSkipFin:SimpleButton;
public var txtName:TextInput;
public var btnNo:SimpleButton;
public var punt:Number;
public var global:Global;
public var mcFinalScore:TextField;
public function OutroMovie_28(){
addFrameScript(0, frame1, 2, frame3, 949, frame950, 951, frame952, 953, frame954, 954, frame955);
}
function frame952(){
stop();
btnSend.addEventListener(MouseEvent.CLICK, enviar);
}
function frame954(){
stop();
global.mainApp.removeChild(global.roboto);
Mouse.show();
MochiScores.showLeaderboard({clip:this, boardID:"5123684050d270c8", res:"533x400", score:(global.puntaje * 1000), name:txtName.text});
}
function frame950(){
stop();
global = Global.getInstance();
punt = global.puntaje;
mcFinalScore.text = ("Score: " + global.puntaje);
btnYes.addEventListener(MouseEvent.CLICK, yes);
btnNo.addEventListener(MouseEvent.CLICK, no);
}
function frame955(){
this.x = 0;
this.y = 0;
global.mainApp.cam.x = 266.5;
global.mainApp.cam.y = 200;
this.x = 100000;
global.mainApp.gotoAndPlay(10);
}
function frame3(){
btnSkipFin.addEventListener(MouseEvent.CLICK, juegoFin);
}
function frame1(){
stop();
}
public function enviar(_arg1:MouseEvent){
gotoAndPlay(953);
}
public function no(_arg1:MouseEvent){
this.x = 0;
this.y = 0;
global.mainApp.cam.x = 266.5;
global.mainApp.cam.y = 200;
this.x = 100000;
global.mainApp.removeChild(global.roboto);
Mouse.show();
global.mainApp.gotoAndPlay(10);
}
public function juegoFin(_arg1:MouseEvent){
gotoAndPlay(949);
}
public function yes(_arg1:MouseEvent){
play();
}
}
}//package TorreHaciaLaLuna3_fla
Section 55
//V_11 (TorreHaciaLaLuna3_fla.V_11)
package TorreHaciaLaLuna3_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class V_11 extends MovieClip {
public var camera:Transform;
public var curCam:Transform;
public var h:int;
public var w:int;
public function V_11(){
addFrameScript(0, frame1);
}
public function doCam(_arg1:Event):void{
var _local2:*;
this.parent.filters = this.filters;
_local2 = curCam.matrix;
camera.colorTransform = curCam.colorTransform;
_local2.invert();
_local2.translate((w * 0.5), (h * 0.5));
camera.matrix = _local2;
}
function frame1(){
curCam = new Transform(this);
camera = new Transform(this.parent);
w = stage.stageWidth;
h = stage.stageHeight;
this.visible = false;
addEventListener(Event.ENTER_FRAME, doCam);
}
}
}//package TorreHaciaLaLuna3_fla
Section 56
//Conteo (Conteo)
package {
import flash.display.*;
public dynamic class Conteo extends MovieClip {
public function Conteo(){
addFrameScript(0, frame1, 4, frame5, 9, frame10, 14, frame15, 19, frame20, 24, frame25, 29, frame30);
}
function frame10(){
stop();
}
function frame15(){
stop();
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame5(){
stop();
}
function frame20(){
stop();
}
function frame30(){
stop();
}
}
}//package
Section 57
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 58
//IntroSong (IntroSong)
package {
import flash.media.*;
public dynamic class IntroSong extends Sound {
}
}//package
Section 59
//Linea (Linea)
package {
import flash.display.*;
public dynamic class Linea extends MovieClip {
public function Linea(){
addFrameScript(134, frame135);
}
function frame135(){
stop();
}
}
}//package
Section 60
//MainSong (MainSong)
package {
import flash.media.*;
public dynamic class MainSong extends Sound {
}
}//package
Section 61
//mcBordeCaja (mcBordeCaja)
package {
import flash.display.*;
public dynamic class mcBordeCaja extends MovieClip {
}
}//package
Section 62
//mcBordePent (mcBordePent)
package {
import flash.display.*;
public dynamic class mcBordePent extends MovieClip {
}
}//package
Section 63
//mcBordeRect (mcBordeRect)
package {
import flash.display.*;
public dynamic class mcBordeRect extends MovieClip {
}
}//package
Section 64
//mcBordeTriangulo (mcBordeTriangulo)
package {
import flash.display.*;
public dynamic class mcBordeTriangulo extends MovieClip {
}
}//package
Section 65
//mcCajaCuerpo (mcCajaCuerpo)
package {
import flash.display.*;
public dynamic class mcCajaCuerpo extends MovieClip {
}
}//package
Section 66
//mcPentagonoCuerpo (mcPentagonoCuerpo)
package {
import flash.display.*;
public dynamic class mcPentagonoCuerpo extends MovieClip {
}
}//package
Section 67
//mcPuntaCaja (mcPuntaCaja)
package {
import flash.display.*;
public dynamic class mcPuntaCaja extends MovieClip {
}
}//package
Section 68
//mcPuntaPent (mcPuntaPent)
package {
import flash.display.*;
public dynamic class mcPuntaPent extends MovieClip {
}
}//package
Section 69
//mcPuntaRect (mcPuntaRect)
package {
import flash.display.*;
public dynamic class mcPuntaRect extends MovieClip {
}
}//package
Section 70
//mcPuntaTriangulo (mcPuntaTriangulo)
package {
import flash.display.*;
public dynamic class mcPuntaTriangulo extends MovieClip {
}
}//package
Section 71
//mcRectanguloCuerpo (mcRectanguloCuerpo)
package {
import flash.display.*;
public dynamic class mcRectanguloCuerpo extends MovieClip {
}
}//package
Section 72
//mcTrianguloCuerpo (mcTrianguloCuerpo)
package {
import flash.display.*;
public dynamic class mcTrianguloCuerpo extends MovieClip {
}
}//package
Section 73
//mcViga (mcViga)
package {
import flash.display.*;
public dynamic class mcViga extends MovieClip {
}
}//package
Section 74
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.2");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 75
//Robot (Robot)
package {
import flash.media.*;
public dynamic class Robot extends Sound {
}
}//package
Section 76
//Roboto (Roboto)
package {
import flash.display.*;
public dynamic class Roboto extends MovieClip {
public function Roboto(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 77
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 78
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package