Section 1
//archerBody_60 (castle_keeper_fla.archerBody_60)
package castle_keeper_fla {
import flash.display.*;
public dynamic class archerBody_60 extends MovieClip {
public function archerBody_60(){
addFrameScript(0, frame1, 16, frame17);
}
function frame1(){
stop();
}
function frame17(){
gotoAndStop("hold");
}
}
}//package castle_keeper_fla
Section 2
//Skill01_73 (castle_keeper_fla.Skill01_73)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill01_73 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 3
//Skill02_74 (castle_keeper_fla.Skill02_74)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill02_74 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 4
//Skill03_75 (castle_keeper_fla.Skill03_75)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill03_75 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 5
//Skill04_76 (castle_keeper_fla.Skill04_76)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill04_76 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 6
//Skill05_77 (castle_keeper_fla.Skill05_77)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill05_77 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 7
//Skill06_78 (castle_keeper_fla.Skill06_78)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill06_78 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 8
//Skill07_79 (castle_keeper_fla.Skill07_79)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill07_79 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 9
//Skill08_80 (castle_keeper_fla.Skill08_80)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill08_80 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 10
//Skill09_81 (castle_keeper_fla.Skill09_81)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill09_81 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 11
//Skill10_82 (castle_keeper_fla.Skill10_82)
package castle_keeper_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Skill10_82 extends MovieClip {
public var info:TextField;
}
}//package castle_keeper_fla
Section 12
//Timeline_13 (castle_keeper_fla.Timeline_13)
package castle_keeper_fla {
import flash.display.*;
public dynamic class Timeline_13 extends MovieClip {
public function Timeline_13(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package castle_keeper_fla
Section 13
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 14
//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 15
//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 16
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 17
//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 18
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 19
//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 20
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.display.*;
import flash.events.*;
import fl.controls.*;
import fl.core.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 21
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
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 22
//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 23
//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 24
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 25
//ResourceFactory (handjoys.ca.factory.ResourceFactory)
package handjoys.ca.factory {
import flash.display.*;
import flash.media.*;
import handjoys.ca.util.*;
import flash.system.*;
public class ResourceFactory {
public static function getResource(_arg1:String):Sprite{
var _local2:ApplicationDomain;
var _local3:Sprite;
var _local4:Class;
_local2 = ApplicationDomain.currentDomain;
_local3 = null;
_local4 = (_local2.getDefinition(_arg1) as Class);
if (_local4 != null){
_local3 = new (_local4);
};
return (_local3);
}
public static function getSenceResource():Sprite{
var _local1:Sprite;
var _local2:int;
var _local3:Class;
_local1 = null;
_local2 = ((Cache.CurrentGate + 6) % 6);
if (_local2 == 0){
_local2 = 1;
};
_local3 = (Cache.Sences[_local2] as Class);
if (_local3 != null){
_local1 = new (_local3);
};
return (_local1);
}
public static function getSoundResource(_arg1:String):Sound{
var _local2:ApplicationDomain;
var _local3:Sound;
var _local4:Class;
_local2 = ApplicationDomain.currentDomain;
_local3 = null;
_local4 = (_local2.getDefinition(_arg1) as Class);
if (_local4 != null){
_local3 = new (_local4);
};
return (_local3);
}
}
}//package handjoys.ca.factory
Section 26
//RomanceFacotry (handjoys.ca.factory.RomanceFacotry)
package handjoys.ca.factory {
import flash.display.*;
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
import handjoys.ca.model.*;
import handjoys.ca.main.*;
public class RomanceFacotry {
public static function refreshToolBarMoney():void{
var _local1:*;
_local1 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local1.txtMoney.htmlText = (("<b>" + Cache.TotalMoney) + "</b>");
}
public static function BuySoldier(_arg1:int):void{
var tempX:*;
var arrE:Array;
var so:soldierObject;
var j:int;
var indx0:int;
var enemy1:*;
var tmpCount:int;
var indx:int;
var enemy:*;
var count = _arg1;
tempX = (SystemConst.MAX_RIGHT + 40);
arrE = new Array("enemySoldier01", "enemyKnight", "enemySoldier02", "enemyRockThrower", "enemySoldier03", "enemyMonk", "enemyFlyingDragon", "enemyBoss");
if (Cache.EnemyActiveWarriors != null){
if (Cache.EnemyActiveWarriors.length > 0){
try {
so = soldierObject(Cache.EnemyActiveWarriors[(Cache.EnemyActiveWarriors.length - 1)]);
if (so.x < SystemConst.MAX_RIGHT){
} else {
tempX = (so.x + 60);
};
} catch(e:Error) {
};
};
};
if (count == 0){
} else {
if (Cache.EnemyTmpCountOfToll <= 0){
return;
};
if (Cache.EnemyTmpCountOfToll == 1){
indx0 = getIndex();
enemy1 = ResourceFactory.getResource(arrE[indx0]);
enemy1.x = (tempX + 60);
Cache.EnemyActiveWarriors.push(enemy1);
Cache.Layers["people"].addChild(enemy1);
Cache.EnemyTmpCountOfToll--;
enemy1.startGame();
return;
};
tmpCount = ((count > Cache.EnemyTmpCountOfToll)) ? Cache.EnemyTmpCountOfToll : count;
j = 0;
while (j < (tmpCount - 1)) {
indx = getIndex();
enemy = ResourceFactory.getResource(arrE[indx]);
enemy.x = tempX;
tempX = (tempX + 60);
enemy.onLine_Flag = true;
Cache.EnemyActiveWarriors.push(enemy);
Cache.Layers["people"].addChild(enemy);
Cache.EnemyTmpCountOfToll--;
enemy.startGame();
if (Cache.EnemyTmpCountOfToll == 1){
enemy1 = ResourceFactory.getResource(arrE[indx]);
enemy1.x = (tempX + 60);
Cache.EnemyActiveWarriors.push(enemy1);
Cache.Layers["people"].addChild(enemy1);
Cache.EnemyTmpCountOfToll--;
enemy1.startGame();
};
j = (j + 1);
};
};
}
public static function initLevelSoldiers():void{
var _local1:int;
var _local2:Sprite;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:*;
var _local8:Sprite;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:Sprite;
var _local13:*;
var _local14:Sprite;
var _local15:int;
var _local16:*;
var _local17:Array;
Cache.Boors.splice(0);
Cache.tmpBoors.splice(0);
Cache.BowWarriors.splice(0);
Cache.EnemyActiveWarriors.splice(0);
Cache.EnemyWarriors.splice(0);
Cache.MyActiveWarriors.splice(0);
Cache.MyWarriors.splice(0);
_local1 = 0;
_local2 = null;
if (Cache.Boors.length < 3){
_local1 = 0;
while (_local1 < SystemConst.BoorCount) {
_local7 = ResourceFactory.getResource("BoorMovieClip");
_local7.x = 182;
_local7.y = 380;
_local7.alpha = 0.01;
_local7.stop();
Cache.tmpBoors.push(_local7);
Cache.Layers["barrier"].addChild(_local7);
_local8 = ResourceFactory.getResource("farmer");
_local9 = MovieClip(Cache.Layers["toolbar"].getChildAt(0).getChildByName("fmContainer"));
_local8.x = (((_local9.numChildren - 1) * _local8.width) + 15);
_local9.addChild(_local8);
_local1++;
};
};
if (Cache.BowWarriors.length < 3){
_local10 = Cache.Layers["barrier"].getChildAt(0).getChildByName("castle");
_local1 = 0;
while (_local1 < SystemConst.BoorCount) {
_local11 = ResourceFactory.getResource("mcArcher");
_local11.x = 20;
_local11.y = -25;
_local11.stop();
Cache.BowWarriors.push(_local11);
Cache.MyWarriors.push(_local11);
Cache.MyActiveWarriors.push(_local11);
_local10.getChildByName(("pole0" + _local1)).addChildAt(_local11, 0);
_local12 = ResourceFactory.getResource("bow_soldiers");
_local13 = MovieClip(Cache.Layers["toolbar"].getChildAt(0).getChildByName("bsContainer"));
_local12.x = (((_local13.numChildren - 1) * _local12.width) + 15);
_local13.addChild(_local12);
_local1++;
};
};
_local3 = 0;
_local1 = 0;
while (_local1 < 0) {
trace("==============>>>");
_local2 = ResourceFactory.getResource("swordGuard");
Cache.MyActiveWarriors.push(_local2);
_local2.x = _local3;
_local2.y = SystemConst.SEA_LEVEL;
Cache.Layers["people"].addChild(_local2);
MovieClip(_local2).startGame();
_local14 = ResourceFactory.getResource("knightGuard");
Cache.MyWarriors.push(_local2);
Cache.MyActiveWarriors.push(_local14);
_local14.x = (_local3 - 10);
_local14.y = SystemConst.SEA_LEVEL;
Cache.Layers["people"].addChild(_local14);
MovieClip(_local14).startGame();
_local1++;
};
Cache.MyActiveWarriors.push(Cache.castle);
_local4 = new Array("enemySoldier01", "enemyKnight", "enemySoldier02", "enemySoldier03", "enemyMonk", "enemyRockThrower", "enemyFlyingDragon", "enemyBoss");
_local3 = (SystemConst.MAX_RIGHT + 100);
Cache.EnemyTmpCountOfToll = Cache.EnemyCountOfTollGame;
_local5 = 0;
_local6 = 0;
while (_local6 < (Cache.EnemyCountOfTollGame - 1)) {
_local15 = getIndex(true);
_local16 = ResourceFactory.getResource(_local4[_local15]);
_local16.x = _local3;
_local3 = (_local3 + 60);
if (Cache.EnemyActiveWarriors.length > 7){
break;
} else {
_local16.onLine_Flag = true;
Cache.EnemyActiveWarriors.push(_local16);
Cache.Layers["people"].addChild(_local16);
Cache.EnemyTmpCountOfToll--;
_local16.startGame();
};
_local6++;
};
}
public static function gameOver():void{
var _local1:*;
_local1 = ResourceFactory.getResource("restartGameClip");
Cache.Layers["alert"].addChild(_local1);
Cache.gameOver = true;
}
public static function updateSkill(_arg1:int):void{
}
public static function gameToRead():void{
var _local1:*;
var _local2:Sprite;
Cache.gameOver = false;
while (Cache.Layers["sence"].numChildren > 0) {
Cache.Layers["sence"].removeChildAt(0);
};
while (Cache.Layers["barrier"].numChildren > 0) {
Cache.Layers["barrier"].removeChildAt(0);
};
while (Cache.Layers["people"].numChildren > 0) {
Cache.Layers["people"].removeChildAt(0);
};
while (Cache.Layers["tool01"].numChildren > 0) {
Cache.Layers["tool01"].removeChildAt(0);
};
while (Cache.Layers["info"].numChildren > 0) {
Cache.Layers["info"].removeChildAt(0);
};
while (Cache.Layers["alert"].numChildren > 0) {
Cache.Layers["alert"].removeChildAt(0);
};
_local1 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
if (_local1.soundChannel != null){
_local1.soundChannel.stop();
_local1.soundChannel = null;
_local1.sound = null;
};
while (Cache.Layers["toolbar"].numChildren > 0) {
Cache.Layers["toolbar"].removeChildAt(0);
};
Cache.gamePaused = false;
Cache.mainPro.angle = 0;
Cache.totalIntegral = 0;
Cache.TotalMoney = 0;
Cache.EnemyCountOfTollGame = 20000;
Cache.EnemyTmpCountOfToll = 20000;
Cache.CurrentGate = 1;
SystemUtil.initSkillsProperty();
Cache.mainPro.setStageFocus();
_local2 = ResourceFactory.getResource("StartGameMovieClip");
Cache.Layers["sence"].addChild(_local2);
}
public static function sendSkills(_arg1:String, _arg2:Number=0):Boolean{
var _local3:Boolean;
var _local4:*;
_local3 = true;
trace("can not used sendSkills", _arg2, Cache.TotalMoney, _arg1);
_local4 = null;
if (_arg2 > Cache.TotalMoney){
trace("can not used sendSkills", _arg2, Cache.TotalMoney, _arg1);
_local3 = false;
} else {
_local4 = ResourceFactory.getResource(_arg1);
trace("can not used sendSkills", _arg2, Cache.TotalMoney, _arg1, _local4);
if (_local4 != null){
_local4.stop();
Cache.Layers["tool01"].addChild(_local4);
_local4.play();
Cache.TotalMoney = (Cache.TotalMoney - _arg2);
RomanceFacotry.refreshToolBarMoney();
};
};
return (_local3);
}
public static function refreshToolBarSkillPro(_arg1:int, _arg2:Number):void{
var _local3:*;
_local3 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local3.txtSkillCount.htmlText = (("<b>" + _arg1) + "</b>");
_local3.txtUseGold.htmlText = (("<b>" + _arg2) + "</b>");
}
public static function refreshToolBarIntegral():void{
var _local1:*;
_local1 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local1.txtScore.htmlText = (("<b>" + Cache.totalIntegral) + "</b>");
}
public static function refreshToolBarInfo(_arg1:Boolean=true):void{
var _local2:*;
_local2 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
if (_arg1){
_local2.infoCount = 0;
_local2.txtInfo.htmlText = "<b>There is not enough gold</b>";
} else {
_local2.txtInfo.htmlText = "";
};
}
public static function startNewGame():void{
var _local1:*;
var _local2:*;
var _local3:Sprite;
var _local4:Sprite;
while (Cache.Layers["sence"].numChildren > 0) {
Cache.Layers["sence"].removeChildAt(0);
};
while (Cache.Layers["barrier"].numChildren > 0) {
Cache.Layers["barrier"].removeChildAt(0);
};
while (Cache.Layers["people"].numChildren > 0) {
Cache.Layers["people"].removeChildAt(0);
};
while (Cache.Layers["tool01"].numChildren > 0) {
Cache.Layers["tool01"].removeChildAt(0);
};
while (Cache.Layers["info"].numChildren > 0) {
Cache.Layers["info"].removeChildAt(0);
};
while (Cache.Layers["alert"].numChildren > 0) {
Cache.Layers["alert"].removeChildAt(0);
};
Cache.gamePaused = false;
Cache.mainPro.angle = 0;
Cache.totalIntegral = 0;
Cache.TotalMoney = 0;
Cache.CurrentGate = 1;
Cache.gamePaused = false;
_local1 = ResourceFactory.getSenceResource();
Cache.Layers["sence"].addChild(_local1);
_local2 = Cache.Layers["toolbar"].getChildAt(0);
if (_local2.soundChannel != null){
_local2.soundChannel.stop();
_local2.soundChannel = null;
_local2.sound = null;
};
Cache.Layers["toolbar"].removeChildAt(0);
SystemUtil.initSkillsProperty();
_local3 = ResourceFactory.getResource("ToolBarClip");
Cache.Layers["toolbar"].addChild(_local3);
_local4 = ResourceFactory.getResource("BarrierLayer");
_local4.name = "barrier";
Cache.Layers["barrier"].addChild(_local4);
Cache.castle = MovieClip(_local4.getChildByName("castle"));
Cache.EnemyCountOfTollGame = 20000;
Cache.EnemyTmpCountOfToll = 20000;
RomanceFacotry.initLevelSoldiers();
Cache.gameOver = false;
Cache.mainPro.setStageFocus();
}
public static function SoldierChangeRace(_arg1:int):void{
var _local2:*;
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:int;
var _local11:*;
if (_arg1 == 0){
if (Cache.Boors.length > 0){
_local2 = boor(Cache.Boors.shift());
_local2.stopWork();
_local6 = Cache.Layers["toolbar"].getChildAt(0);
_local3 = _local6.getChildByName("fmContainer");
_local3.removeChildAt((_local3.numChildren - 1));
if (_local2.parent){
_local2.parent.removeChild(_local2);
};
_local4 = _local6.getChildByName("bsContainer");
_local5 = ResourceFactory.getResource("bow_soldiers");
_local5.x = (((_local4.numChildren - 1) * _local5.width) + 15);
_local4.addChild(_local5);
_local8 = ResourceFactory.getResource("mcArcher");
trace(_local8);
_local8.x = 20;
_local8.y = -25;
_local8.stop();
Cache.BowWarriors.push(_local8);
_local8.Angle = Cache.shootAngle;
_local8.adjustAngle(Cache.shootAngle);
Cache.MyWarriors.push(_local8);
Cache.MyActiveWarriors.push(_local8);
_local9 = Cache.Layers["barrier"].getChildAt(0).getChildByName("castle");
_local10 = 2;
while (_local10 >= 0) {
trace(MovieClip(_local9.getChildByName(("pole0" + _local10))).numChildren, _local9.getChildByName(("pole0" + _local10)).name);
if (_local9.getChildByName(("pole0" + _local10)).numChildren == 1){
_local9.getChildByName(("pole0" + _local10)).addChildAt(_local8, 0);
};
_local10--;
};
};
} else {
if (_arg1 == 1){
if (Cache.BowWarriors.length > 0){
_local7 = Archer(Cache.BowWarriors.shift());
if (_local7.stopWork){
_local7.stopWork();
};
_local6 = Cache.Layers["toolbar"].getChildAt(0);
_local4 = _local6.getChildByName("bsContainer");
_local6.getChildByName("bsContainer").removeChildAt((_local4.numChildren - 1));
if (_local7.parent){
_local7.parent.removeChild(_local7);
};
_local3 = _local6.getChildByName("fmContainer");
_local5 = ResourceFactory.getResource("farmer");
_local5.x = (((_local3.numChildren - 1) * _local5.width) + 15);
_local3.addChild(_local5);
_local11 = ResourceFactory.getResource("BoorMovieClip");
_local11.x = 182;
_local11.y = 380;
_local11.alpha = 0.01;
_local11.stop();
Cache.Boors.push(_local11);
Cache.Layers["barrier"].addChild(_local11);
_local11.startWork();
};
};
};
}
public static function refreshToolBarSkillLevel(_arg1:int):void{
var _local2:*;
_local2 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local2.txtSkillCount.htmlText = (("<b>" + _arg1) + "</b>");
}
public static function startPause():void{
var _local1:Sprite;
var _local2:int;
var _local3:toolbar;
var _local4:*;
var _local5:Sprite;
var _local6:int;
var _local7:*;
var _local8:*;
_local1 = Cache.Layers["tool01"];
_local2 = 0;
while (_local2 < _local1.numChildren) {
_local7 = _local1.getChildAt(_local2);
if (_local7.startPause){
_local7.startPause();
};
_local2++;
};
_local3 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local3.startPause();
for (_local4 in Cache.Boors) {
Cache.Boors[_local4].startPause();
};
_local2 = 0;
while (_local2 < Cache.MyWarriors.length) {
Cache.MyWarriors[_local2].startPause();
_local2++;
};
_local5 = Cache.Layers["people"];
_local6 = 0;
while (_local6 < _local5.numChildren) {
_local8 = _local5.getChildAt(_local6);
if (_local8.startPause){
_local8.startPause();
};
_local6++;
};
}
public static function initDestroyFlag():void{
var _local1:int;
_local1 = 0;
while (_local1 < Cache.MyActiveWarriors.length) {
if (Cache.MyActiveWarriors[_local1].initDestroyFlag){
Cache.MyActiveWarriors[_local1].initDestroyFlag();
};
_local1++;
};
}
public static function activeSkill(_arg1:int):void{
}
public static function startGame():void{
var _local1:Sprite;
var _local2:int;
var _local3:toolbar;
var _local4:*;
var _local5:Sprite;
var _local6:int;
var _local7:*;
var _local8:*;
_local1 = Cache.Layers["tool01"];
_local2 = 0;
while (_local2 < _local1.numChildren) {
_local7 = _local1.getChildAt(_local2);
if (_local7.startGame){
_local7.startGame();
};
_local2++;
};
_local3 = toolbar(Cache.Layers["toolbar"].getChildAt(0));
_local3.startGame();
for (_local4 in Cache.Boors) {
Cache.Boors[_local4].startGame();
};
_local2 = 0;
while (_local2 < Cache.MyWarriors.length) {
Cache.MyWarriors[_local2].startGame();
_local2++;
};
_local5 = Cache.Layers["people"];
_local6 = 0;
while (_local6 < _local5.numChildren) {
_local8 = _local5.getChildAt(_local6);
if (_local8.startGame){
_local8.startGame();
};
_local6++;
};
}
public static function getIndex(_arg1:Boolean=false):int{
var _local2:int;
_local2 = 0;
switch (Cache.CurrentGate){
case 1:
_local2 = int((Math.random() * 1));
trace(_local2, "index");
break;
case 2:
_local2 = int((Math.random() * 2));
if (_arg1){
_local2 = 0;
};
trace(_local2, "index");
break;
case 3:
_local2 = int((Math.random() * 3));
if (_arg1){
_local2 = int((Math.random() * 2));
};
trace(_local2, "index");
break;
case 4:
_local2 = int((Math.random() * 4));
if (_arg1){
_local2 = int((Math.random() * 3));
};
trace(_local2, "index");
break;
case 5:
_local2 = int((Math.random() * 5));
if (_arg1){
_local2 = int((Math.random() * 4));
};
trace(_local2, "index");
break;
case 6:
_local2 = int((Math.random() * 6));
if (_arg1){
_local2 = int((Math.random() * 5));
};
trace(_local2, "index");
break;
case 7:
_local2 = int((Math.random() * 7));
if (_arg1){
_local2 = int((Math.random() * 6));
};
trace(_local2, "index");
break;
case 8:
_local2 = int((Math.random() * 8));
if (_arg1){
_local2 = int((Math.random() * 7));
};
trace(_local2, "index");
break;
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
_local2 = int((Math.random() * 8));
if (_arg1){
_local2 = int((Math.random() * 7));
};
break;
default:
_local2 = int((Math.random() * 8));
if (_arg1){
_local2 = int((Math.random() * 7));
};
break;
};
return (_local2);
}
public static function changeTollGate():void{
var _local1:*;
var _local2:*;
var _local3:Sprite;
var _local4:Sprite;
var _local5:int;
var _local6:SkillsProperty;
Cache.gameOver = false;
while (Cache.Layers["sence"].numChildren > 0) {
Cache.Layers["sence"].removeChildAt(0);
};
while (Cache.Layers["barrier"].numChildren > 0) {
Cache.Layers["barrier"].removeChildAt(0);
};
while (Cache.Layers["people"].numChildren > 0) {
Cache.Layers["people"].removeChildAt(0);
};
while (Cache.Layers["tool01"].numChildren > 0) {
Cache.Layers["tool01"].removeChildAt(0);
};
Cache.CurrentGate++;
_local1 = ResourceFactory.getSenceResource();
Cache.Layers["sence"].addChild(_local1);
_local2 = Cache.Layers["toolbar"].getChildAt(0);
trace("========================================================>>>>>>", _local2.soundChannel, _local2);
if (_local2.soundChannel != null){
trace("========================================================>>>>>>");
_local2.soundChannel.stop();
_local2.soundChannel = null;
_local2.sound = null;
};
Cache.Layers["toolbar"].removeChildAt(0);
_local3 = ResourceFactory.getResource("ToolBarClip");
Cache.Layers["toolbar"].addChild(_local3);
_local4 = ResourceFactory.getResource("BarrierLayer");
_local4.name = "barrier";
Cache.Layers["barrier"].addChild(_local4);
Cache.castle = MovieClip(_local4.getChildByName("castle"));
RomanceFacotry.initLevelSoldiers();
Cache.gamePaused = false;
Cache.mainPro.angle = 0;
_local5 = 1;
while (_local5 < Cache.SkillArray.length) {
_local6 = SkillsProperty(Cache.SkillArray[_local5]);
_local6.update_flag = false;
_local5++;
};
Cache.mainPro.setStageFocus();
}
}
}//package handjoys.ca.factory
Section 27
//main (handjoys.ca.main.main)
package handjoys.ca.main {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import fl.managers.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
import handjoys.ca.model.*;
import flash.net.*;
import flash.system.*;
public class main extends MovieClip {
public var progress_bar;// = null
private var timer:Timer;// = null
public var urlLoader:URLLoader;
private var timer2:Timer;// = null
var fm:FocusManager;
public var angle:Number;// = 0
public function main(){
var _local1:*;
timer = null;
timer2 = null;
angle = 0;
progress_bar = null;
urlLoader = new URLLoader();
super();
Cache.sound = ResourceFactory.getSoundResource("gaming_sound");
Cache.sound_flag = true;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
progress_bar = ResourceFactory.getResource("game_loader");
addChild(progress_bar);
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, gressHandler);
this.loaderInfo.addEventListener(Event.COMPLETE, complete);
Cache.mainPro = this;
timer2 = new Timer(400, 1);
timer2.addEventListener(TimerEvent.TIMER_COMPLETE, timer2CompleteHandler);
_local1 = Security["allowDomain"];
if (_local1){
Security.allowDomain("*.*", "mochiads.com");
Security.allowDomain("*.dragongamez.com");
trace("1======");
};
_local1 = Security["allowInsecureDomain"];
if (_local1){
trace("2======");
Security.allowInsecureDomain("*.*", "mochiads.com");
Security.allowInsecureDomain("*.dragongamez.com");
};
}
public function btnHowToPlayClickHandler(_arg1:MouseEvent):void{
var _local2:*;
_local2 = ResourceFactory.getResource("helpClip");
Cache.Layers["alert"].addChild(_local2);
}
public function comioerror_handler(_arg1:Event):void{
}
public function enterFrameHandler(_arg1:Event):void{
if (Cache.isLinkPressed == true){
if ((getTimer() - Cache.linkPressedTimer) > 4000){
navigateToURL(new URLRequest("http://www.dragongamez.com"), "_blank");
Cache.isLinkPressed = false;
};
};
}
private function loadStartGame():void{
var _local1:Sprite;
_local1 = ResourceFactory.getResource("StartGameMovieClip");
Cache.Layers["sence"].addChild(_local1);
}
public function gressHandler(_arg1:ProgressEvent):void{
trace("Hello");
progress_bar.progress_bar.scaleX = (_arg1.bytesLoaded / _arg1.bytesTotal);
}
public function startGameClickHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:Sprite;
var _local4:Sprite;
var _local5:Sprite;
_local2 = Cache.Layers["sence"].getChildAt(0);
if (_local2.soundChannel != null){
_local2.soundChannel.stop();
_local2.soundChannel = null;
_local2.sound = null;
};
Cache.Layers["sence"].removeChildAt(0);
_local3 = ResourceFactory.getSenceResource();
Cache.Layers["sence"].addChild(_local3);
_local4 = ResourceFactory.getResource("BarrierLayer");
_local4.name = "barrier";
Cache.Layers["barrier"].addChild(_local4);
Cache.castle = MovieClip(_local4.getChildByName("castle"));
SystemUtil.initSkillsProperty();
_local5 = ResourceFactory.getResource("ToolBarClip");
Cache.Layers["toolbar"].addChild(_local5);
RomanceFacotry.initLevelSoldiers();
stage.focus = this.stage;
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, keydownHandler);
Cache.gameStarted = true;
}
public function complete(_arg1:Event):void{
timer2.start();
}
public function progressHandler(_arg1:ProgressEvent):void{
progress_bar.textprogress.text = (progress_bar.textprogress.text + (((((progress_bar.textprogress.text + "\t") + _arg1.bytesLoaded.toString()) + "\t") + _arg1.bytesTotal.toString()) + "\n"));
progress_bar.progress_bar.scaleX = (_arg1.bytesLoaded / _arg1.bytesTotal);
}
public function ioErrorHandler(_arg1:IOErrorEvent):void{
}
public function setStageFocus():void{
if (fm == null){
fm = new FocusManager(Cache.Layers["sence"].stage);
fm.setFocus(Cache.Layers["sence"].stage);
} else {
fm.setFocus(Cache.Layers["sence"].stage);
};
}
public function timer2CompleteHandler(_arg1:TimerEvent):void{
if (progress_bar != null){
if (progress_bar.parent != null){
progress_bar.parent.removeChild(progress_bar);
};
};
timer2.stop();
startNewGame();
}
public function keydownHandler(_arg1:KeyboardEvent):void{
var _local2:*;
var _local3:*;
var _local4:SkillsProperty;
var _local5:int;
var _local6:*;
var _local7:Sprite;
var _local8:Sprite;
var _local9:*;
var _local10:Number;
var _local11:Archer;
var _local12:Boolean;
var _local13:*;
var _local14:*;
var _local15:*;
if (Cache.gameOver){
return;
};
if (_arg1.keyCode == 80){
if (Cache.gamePaused){
Cache.gamePaused = false;
RomanceFacotry.startGame();
} else {
RomanceFacotry.startPause();
Cache.gamePaused = true;
};
return;
} else {
if (Cache.gamePaused){
return;
};
};
_local2 = Cache.BowWarriors;
if (_arg1.shiftKey){
if (_arg1.keyCode == 187){
};
} else {
if (Cache.KeyboardCode.indexOf(_arg1.keyCode) != -1){
_local3 = (_arg1.keyCode - 48);
if ((((_local3 >= 0)) && ((_local3 <= 9)))){
_local4 = null;
if (_local3 == 0){
_local4 = Cache.SkillArray[10];
} else {
_local4 = Cache.SkillArray[_local3];
};
if (_local4.active_flag){
if ((((_local3 >= 1)) && ((_local3 <= 2)))){
RomanceFacotry.refreshToolBarSkillPro(_local4.level, _local4.price);
_local6 = Cache.ToolBarEquip[_local3];
Cache.ToolBarEquip[_local3].getChildByName(_local6.name).gotoAndStop("used");
if (_local4.price > Cache.TotalMoney){
RomanceFacotry.refreshToolBarInfo();
return;
};
if (_local6.count <= 0){
} else {
if (_local3 == 1){
_local7 = ResourceFactory.getResource("swordGuard");
Cache.MyActiveWarriors.push(_local7);
_local7.x = 0;
_local7.y = SystemConst.SEA_LEVEL;
MovieClip(_local7).startGame();
_local6.count--;
Cache.Layers["people"].addChild(_local7);
_local6.startTimer();
RomanceFacotry.refreshToolBarInfo(false);
Cache.TotalMoney = (Cache.TotalMoney - _local4.price);
RomanceFacotry.refreshToolBarMoney();
} else {
if (_local3 == 2){
_local8 = ResourceFactory.getResource("knightGuard");
Cache.MyActiveWarriors.push(_local8);
_local8.x = 0;
_local8.y = SystemConst.SEA_LEVEL;
Cache.Layers["people"].addChild(_local8);
MovieClip(_local8).startGame();
_local6.count--;
_local6.startTimer();
RomanceFacotry.refreshToolBarInfo(false);
Cache.TotalMoney = (Cache.TotalMoney - _local4.price);
RomanceFacotry.refreshToolBarMoney();
};
};
};
} else {
_local9 = Cache.ToolBarEquip[_local3];
if (_local9.count <= 0){
RomanceFacotry.refreshToolBarSkillPro(_local4.level, _local4.price);
_local9.getChildByName(_local9.name).gotoAndStop("used");
} else {
_local10 = _local4.price;
if (_local10 > Cache.TotalMoney){
RomanceFacotry.refreshToolBarSkillPro(_local4.level, _local4.price);
RomanceFacotry.refreshToolBarInfo();
} else {
if (RomanceFacotry.sendSkills(_local4.skill_name, _local4.price)){
RomanceFacotry.refreshToolBarSkillPro(_local4.level, _local4.price);
_local9.count--;
_local9.startTimer();
_local9.getChildByName(_local9.name).gotoAndStop("used");
RomanceFacotry.refreshToolBarInfo(false);
};
};
};
};
_local5 = 0;
while (_local5 < Cache.ToolBarEquip.length) {
if (_local3 == _local5){
} else {
_local9 = toolButton(Cache.ToolBarEquip[_local5]);
if (_local9.activeFlag){
_local9.getChildByName(_local9.name).gotoAndStop("actived");
};
};
_local5++;
};
};
} else {
if (_local3 == -10){
if (Cache.BowWarriors.length == SystemConst.BoorCount){
} else {
RomanceFacotry.SoldierChangeRace(0);
};
} else {
if (_local3 == -8){
RomanceFacotry.SoldierChangeRace(1);
} else {
if (_local3 == -16){
if (Cache.gameStarted){
_local11 = null;
_local12 = false;
_local13 = 0;
while (_local13 < _local2.length) {
_local11 = _local2[_local13];
if (_local11.bReadyShoot){
_local12 = true;
};
_local13++;
};
_local14 = 0;
while (_local14 < _local2.length) {
_local11 = _local2[_local14];
_local11.Angle = this.angle;
_local11.bReadyShoot = _local12;
_local11.shoot();
_local14++;
};
} else {
RomanceFacotry.startGame();
Cache.gameStarted = true;
};
} else {
if (_local3 == -11){
if (this.angle < 1){
this.angle = (this.angle + (0.25 / Math.PI));
_local15 = 0;
while (_local15 < _local2.length) {
_local11 = _local2[_local15];
_local11.Angle = this.angle;
_local11.adjustAngle(this.angle);
_local15++;
};
Cache.shootAngle = this.angle;
};
} else {
if (_local3 == -9){
if (this.angle > -1.2){
this.angle = (this.angle - (0.25 / Math.PI));
_local14 = 0;
while (_local14 < _local2.length) {
_local11 = _local2[_local14];
_local11.Angle = this.angle;
_local11.adjustAngle(this.angle);
_local14++;
};
Cache.shootAngle = this.angle;
};
};
};
};
};
};
};
};
};
}
private function initLayers():void{
var _local1:Array;
var _local2:*;
var _local3:Sprite;
_local1 = ["background", "sence", "barrier", "people", "tool01", "tool02", "tool03", "tool04", "tool05", "tool06", "tool07", "tool08", "toolbar", "info", "alert"];
for (_local2 in _local1) {
_local3 = new Sprite();
_local3.name = _local1[_local2];
this.addChild(_local3);
Cache.Layers[_local1[_local2]] = _local3;
};
__com_mochibot__("507714e5", this, 10301, true);
}
public function ioerror_handler(_arg1:IOErrorEvent):void{
}
function __com_mochibot__(_arg1, _arg2, _arg3, _arg4){
var x:*;
var g:*;
var s:*;
var fv:*;
var sb:*;
var u:*;
var mb:*;
var mbc:*;
var res:Loader;
var arr:Array;
var arr2:Array;
var swfid = _arg1;
var mc = _arg2;
var lv = _arg3;
var trk = _arg4;
mb = "__mochibot__";
mbc = "mochibot.com";
trace(("x=" + x), (x) ? 9 : (this) ? 6 : 5);
try {
arr = Capabilities.version.split(" ");
arr2 = arr[1].split(",");
x = int(arr2[0]);
trace(("x=" + x));
} catch(error2:Error) {
};
s = Security;
trace(("x=" + x), (x) ? 9 : (this) ? 6 : 5);
fv = (x) ? 9 : (this) ? 6 : 5;
if (!s){
s = {};
};
sb = s["sandboxType"];
trace(s["sandboxType"]);
if (sb == "localWithFile"){
trace("===================================localWithFile");
return (null);
};
x = s["allowDomain"];
if (x){
s.allowDomain(mbc);
};
x = s["allowInsecureDomain"];
if (x){
s.allowInsecureDomain(mbc);
};
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(Capabilities.version)) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=_level0") + (sb) ? ("&sb=" + sb) : "") + (trk) ? "&t=1" : "");
lv = ((fv)>6) ? (mc.numChildren + 1) : (g[(mb + "level")]) ? (g[(mb + "level")] + 1) : lv;
res = new Loader();
res.name = (mb + swfid);
this.addChildAt(res, 0);
try {
res.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioerror_handler);
res.contentLoaderInfo.addEventListener(Event.COMPLETE, comioerror_handler);
res.load(new URLRequest(u));
} catch(error:Error) {
};
return (res);
}
private function initComponent():void{
var _local1:ApplicationDomain;
var _local2:int;
_local1 = ApplicationDomain.currentDomain;
Cache.Component["StartGameMovieClip"] = _local1.getDefinition("StartGameMovieClip");
Cache.Component["ToolBarClip"] = _local1.getDefinition("ToolBarClip");
Cache.Component["BoorMovieClip"] = _local1.getDefinition("BoorMovieClip");
_local2 = 1;
while (_local2 < 6) {
Cache.Sences[_local2] = _local1.getDefinition(("Sence0" + _local2));
_local2++;
};
Cache.Component["gameAlert"] = _local1.getDefinition("gameAlert");
Cache.Component["upgrades"] = _local1.getDefinition("upgrades");
Cache.Component["BarrierLayer"] = _local1.getDefinition("BarrierLayer");
Cache.Component["help"] = _local1.getDefinition("helpClip");
Cache.Component["bow_soldiers"] = _local1.getDefinition("bow_soldiers");
Cache.Component["farmer"] = _local1.getDefinition("farmer");
Cache.Component["mcArcher"] = _local1.getDefinition("mcArcher");
Cache.Component["mcArrow"] = _local1.getDefinition("mcArrow");
Cache.Component["swordGuard"] = _local1.getDefinition("swordGuard");
Cache.Component["InfoDlg01"] = _local1.getDefinition("InfoDlg01");
Cache.Component["InfoDlg02"] = _local1.getDefinition("InfoDlg02");
Cache.Component["InfoDlg03"] = _local1.getDefinition("InfoDlg03");
Cache.Component["lightning"] = _local1.getDefinition("lightning");
Cache.SkillArray[6] = {skill_name:"lightning", price:SystemConst.PriceOfLightning};
Cache.SkillArray[1] = {skill_name:"swordGuard", price:0};
Cache.SkillArray[2] = {skill_name:"knightGuard", price:0};
Cache.Component["cannonBall"] = _local1.getDefinition("cannonBall");
Cache.Component["skillCannon"] = _local1.getDefinition("skillCannon");
Cache.SkillArray[5] = {skill_name:"skillCannon", price:SystemConst.PriceOfCannon};
Cache.Component["fireArrow"] = _local1.getDefinition("fireArrow");
Cache.Component["skillFireArrow"] = _local1.getDefinition("skillFireArrow");
Cache.SkillArray[4] = {skill_name:"skillFireArrow", price:SystemConst.PriceOfFireArrow};
Cache.Component["iceArrow"] = _local1.getDefinition("iceArrow");
Cache.Component["skillIceArrow"] = _local1.getDefinition("skillIceArrow");
Cache.SkillArray[3] = {skill_name:"skillIceArrow", price:SystemConst.PriceOfIceArrow};
Cache.Component["cyclone"] = _local1.getDefinition("cyclone");
Cache.SkillArray[9] = {skill_name:"cyclone", price:SystemConst.PriceOfCyclone};
Cache.Component["arrowsFall"] = _local1.getDefinition("arrowsFall");
Cache.SkillArray[8] = {skill_name:"arrowsFall", price:SystemConst.PriceOfArrowFall};
Cache.Component["rollStone"] = _local1.getDefinition("rollStone");
Cache.SkillArray[7] = {skill_name:"rollStone", price:SystemConst.PriceOfRollStone};
Cache.SkillArray[10] = {skill_name:"dingban", price:2000};
}
public function completeHandler(_arg1:Event):void{
var _local2:XML;
_local2 = new XML(urlLoader.data);
Cache.url = _local2.toString();
}
private function loadServerURL():void{
urlLoader.addEventListener(Event.COMPLETE, completeHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
urlLoader.load(new URLRequest("server_url.xml"));
}
public function startNewGame():void{
stage.showDefaultContextMenu = false;
StageMask.cover(stage);
initLayers();
initComponent();
loadStartGame();
}
}
}//package handjoys.ca.main
Section 28
//startgame (handjoys.ca.main.startgame)
package handjoys.ca.main {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class startgame extends MovieClip {
public var mcHelp:MovieClip;
public var sound:Sound;// = null
public var soundChannel:SoundChannel;// = null
public var btnMainMenu:SimpleButton;
public var btnMoreGame:SimpleButton;
public var btnStartGame:SimpleButton;
public var btnPlay:SimpleButton;
public function startgame(){
var _local1:SoundTransform;
sound = null;
soundChannel = null;
super();
Cache.gameOver = true;
this.stop();
initEventListener();
sound = ResourceFactory.getSoundResource("startgame_sound");
if (sound != null){
_local1 = new SoundTransform(0.5);
soundChannel = sound.play(0, 1000000, _local1);
};
}
private function rmEventListener():void{
}
private function initEventListener():void{
this.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(_arg1:MouseEvent):void{
var _local2:String;
var _local3:*;
var _local4:Sprite;
var _local5:Sprite;
var _local6:Sprite;
_arg1.stopPropagation();
if (_arg1.target != null){
if (_arg1.target.name != null){
_local2 = _arg1.target.name;
switch (_local2){
case "btnPlay":
Cache.gameOver = false;
trace("===============");
_local3 = Cache.Layers["sence"].getChildAt(0);
trace(_local3);
if (_local3.soundChannel != null){
_local3.soundChannel.stop();
_local3.soundChannel = null;
_local3.sound = null;
};
Cache.Layers["sence"].removeChildAt(0);
_local4 = ResourceFactory.getSenceResource();
Cache.Layers["sence"].addChild(_local4);
_local5 = ResourceFactory.getResource("BarrierLayer");
_local5.name = "barrier";
Cache.Layers["barrier"].addChild(_local5);
Cache.castle = MovieClip(_local5.getChildByName("castle"));
SystemUtil.initSkillsProperty();
trace("===================================aaa==============");
_local6 = ResourceFactory.getResource("ToolBarClip");
Cache.Layers["toolbar"].addChild(_local6);
RomanceFacotry.initLevelSoldiers();
trace("=================================bbb================", Cache.mainPro, Cache.mainPro.stage);
Cache.Layers["sence"].stage.focus = Cache.Layers["sence"].stage;
Cache.Layers["sence"].stage.addEventListener(KeyboardEvent.KEY_DOWN, Cache.mainPro.keydownHandler);
Cache.gameStarted = true;
trace("=================================bbb================");
break;
case "btnMainMenu":
prevFrame();
break;
case "btnMoreGame":
Cache.linkPressedTimer = getTimer();
Cache.isLinkPressed = true;
navigateToURL(new URLRequest("http://www.dragongamez.com"), "_self");
break;
case "btnStartGame":
nextFrame();
break;
case "btnGameScore":
_local3 = ResourceFactory.getResource("IntegralList");
Cache.Layers["alert"].addChild(_local3);
};
};
};
}
}
}//package handjoys.ca.main
Section 29
//arrowsFall (handjoys.ca.model.skills.arrowsFall)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import handjoys.ca.model.*;
public class arrowsFall extends SkillObject implements RomanceInterface {
public function arrowsFall(){
var _local1:Arrow;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:*;
var _local6:*;
var _local7:SkillsProperty;
super();
this.UserPrice = SystemConst.PriceOfArrowFall;
this.y = SystemConst.SEA_LEVEL;
this.DestroyDegree = 10;
_local2 = 10;
_local3 = -200;
_local4 = 100;
_local5 = (Cache.shootAngle + 0.02);
_local6 = 0;
while (_local6 < _local2) {
_local1 = (ResourceFactory.getResource("mcArrow") as Arrow);
_local1.x = _local3;
_local1.y = _local4;
_local1.Angle = _local5;
_local7 = Cache.SkillArray[8];
_local1.intDamagePoint = _local7.destroy_degree;
_local1.fly();
Cache.Layers["tool01"].addChild(_local1);
_local3 = (_local3 + 30);
_local6++;
};
this.x = 250;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function enterFrameHandler(_arg1:Event):void{
if (this.x > SystemConst.MAX_RIGHT){
if (this.parent != null){
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.parent.removeChild(this);
};
};
this.x = (this.x + 5);
}
public function startGame():void{
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model.skills
Section 30
//cyclone (handjoys.ca.model.skills.cyclone)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
public class cyclone extends SkillObject implements RomanceInterface {
public function cyclone(){
var _local1:SkillsProperty;
super();
this.y = SystemConst.SEA_LEVEL;
this.stop();
this.x = 60;
this.UserPrice = SystemConst.PriceOfCyclone;
_local1 = Cache.SkillArray[9];
this.DestroyDegree = _local1.destroy_degree;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:int;
var _local3:soldierObject;
var _local4:Number;
if (this.x > SystemConst.MAX_RIGHT){
if (this.parent != null){
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.parent.removeChild(this);
};
};
this.Frequency++;
if ((this.Frequency % 20) == 0){
_local2 = 0;
while (_local2 < Cache.EnemyActiveWarriors.length) {
if (this.hitTestObject(Cache.EnemyActiveWarriors[_local2])){
if (Cache.EnemyActiveWarriors[_local2].Life > 0){
_local3 = Cache.EnemyActiveWarriors[_local2];
_local4 = ((Cache.EnemyActiveWarriors[_local2].Life > this.DestroyDegree)) ? this.DestroyDegree : Cache.EnemyActiveWarriors[_local2].Life;
_local3.soldierInjured(_local4);
};
};
_local2++;
};
};
this.x = (this.x + 5);
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model.skills
Section 31
//lightning (handjoys.ca.model.skills.lightning)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
public class lightning extends SkillObject implements RomanceInterface {
public function lightning(){
var _local1:SkillsProperty;
super();
this.UserPrice = SystemConst.PriceOfLightning;
_local1 = Cache.SkillArray[6];
this.DestroyDegree = _local1.destroy_degree;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.x = 300;
this.y = 220;
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:int;
var _local3:soldierObject;
var _local4:Number;
this.Frequency++;
if ((((this.currentFrame == this.totalFrames)) && (!((this.parent == null))))){
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.parent.removeChild(this);
};
if ((this.Frequency % 15) == 0){
_local2 = 0;
while (_local2 < Cache.EnemyActiveWarriors.length) {
if (this.hitTestObject(Cache.EnemyActiveWarriors[_local2])){
if (Cache.EnemyActiveWarriors[_local2].Life > 0){
_local3 = Cache.EnemyActiveWarriors[_local2];
_local4 = ((Cache.EnemyActiveWarriors[_local2].Life > this.DestroyDegree)) ? this.DestroyDegree : Cache.EnemyActiveWarriors[_local2].Life;
_local3.soldierInjured(_local4);
};
};
_local2++;
};
};
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.stop();
}
}
}//package handjoys.ca.model.skills
Section 32
//nailWall (handjoys.ca.model.skills.nailWall)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
public class nailWall extends SkillObject implements RomanceInterface {
public function nailWall(){
var _local1:SkillsProperty;
super();
this.scaleX = -1;
this.height = 50;
this.width = 40;
this.y = SystemConst.SEA_LEVEL;
this.stop();
this.x = 60;
this.UserPrice = SystemConst.PriceOfNailWall;
_local1 = Cache.SkillArray[10];
this.DestroyDegree = _local1.destroy_degree;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:int;
var _local3:soldierObject;
var _local4:Number;
if (this.x > SystemConst.MAX_RIGHT){
if (this.parent != null){
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.parent.removeChild(this);
};
};
this.Frequency++;
if ((this.Frequency % 20) == 0){
_local2 = 0;
while (_local2 < Cache.EnemyActiveWarriors.length) {
if (this.hitTestObject(Cache.EnemyActiveWarriors[_local2])){
if (Cache.EnemyActiveWarriors[_local2].Life > 0){
_local3 = Cache.EnemyActiveWarriors[_local2];
_local4 = ((Cache.EnemyActiveWarriors[_local2].Life > this.DestroyDegree)) ? this.DestroyDegree : Cache.EnemyActiveWarriors[_local2].Life;
_local3.soldierInjured(_local4);
};
};
_local2++;
};
};
this.x = (this.x + 3);
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model.skills
Section 33
//rollStone (handjoys.ca.model.skills.rollStone)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
public class rollStone extends SkillObject implements RomanceInterface {
public function rollStone(){
var _local1:SkillsProperty;
super();
this.y = SystemConst.SEA_LEVEL;
this.stop();
this.x = 60;
this.UserPrice = SystemConst.PriceOfRollStone;
_local1 = Cache.SkillArray[7];
this.DestroyDegree = _local1.destroy_degree;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
RomanceFacotry.initDestroyFlag();
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:int;
var _local3:soldierObject;
var _local4:Number;
this.Frequency++;
if (this.x > SystemConst.MAX_RIGHT){
if (this.parent != null){
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.parent.removeChild(this);
};
};
if ((this.Frequency % 20) == 0){
_local2 = 0;
while (_local2 < Cache.EnemyActiveWarriors.length) {
if (this.hitTestObject(Cache.EnemyActiveWarriors[_local2])){
if (Cache.EnemyActiveWarriors[_local2].Life > 0){
_local3 = Cache.EnemyActiveWarriors[_local2];
_local4 = ((Cache.EnemyActiveWarriors[_local2].Life > this.DestroyDegree)) ? this.DestroyDegree : Cache.EnemyActiveWarriors[_local2].Life;
_local3.soldierInjured(_local4);
};
};
_local2++;
};
};
this.x = (this.x + 5);
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model.skills
Section 34
//skillCannon (handjoys.ca.model.skills.skillCannon)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import handjoys.ca.model.*;
public class skillCannon extends SkillObject implements RomanceInterface {
private var startX:int;// = -250
private var startY:int;// = -100
private var speed:Number;// = 20
private var shotFlag:Boolean;// = false
private var arrowNumber:int;// = 1
private var angle:Number;// = 0.7
public function skillCannon(){
var _local1:int;
var _local2:SkillsProperty;
arrowNumber = 1;
startX = -250;
startY = -100;
angle = 0.7;
speed = 20;
shotFlag = false;
super();
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.x = 200;
this.y = SystemConst.SEA_LEVEL;
_local1 = 30;
this.UserPrice = SystemConst.PriceOfIceArrow;
_local2 = Cache.SkillArray[5];
this.DestroyDegree = _local2.destroy_degree;
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:Arrow;
if (this.currentFrame == this.totalFrames){
this.stop();
if (shotFlag == false){
_local2 = (ResourceFactory.getResource("cannonBall") as Arrow);
_local2.bMultiAttack = true;
_local2.type = "cannonBall";
Cache.Layers["tool01"].addChild(_local2);
_local2.x = (this.x + 20);
_local2.y = (this.y - 15);
_local2.Speed = this.speed;
_local2.Angle = this.angle;
_local2.intDamagePoint = this.DestroyDegree;
_local2.fly();
shotFlag = true;
} else {
if (this.parent){
this.parent.removeChild(this);
};
};
};
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function cannonBallEnterFrameHandler(_arg1:Event):void{
}
}
}//package handjoys.ca.model.skills
Section 35
//skillFireArrow (handjoys.ca.model.skills.skillFireArrow)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import handjoys.ca.model.*;
public class skillFireArrow extends SkillObject {
private var startX:int;// = -250
private var startY:int;// = -100
private var arrowNumber:int;// = 10
private var angle:Number;// = -0.4
public function skillFireArrow(){
var _local1:int;
var _local2:*;
var _local3:Arrow;
var _local4:SkillsProperty;
arrowNumber = 10;
startX = -250;
startY = -100;
angle = -0.4;
super();
_local1 = 30;
_local2 = 0;
while (_local2 < arrowNumber) {
_local3 = (ResourceFactory.getResource("fireArrow") as Arrow);
_local3.bMultiAttack = true;
_local3.x = startX;
_local3.y = startY;
_local3.Angle = angle;
_local4 = Cache.SkillArray[4];
_local3.intDamagePoint = _local4.destroy_degree;
_local3.fly();
_local3.parentTarget = this;
Cache.Layers["tool01"].addChild(_local3);
startX = (startX + _local1);
_local2++;
};
this.y = SystemConst.SEA_LEVEL;
this.UserPrice = SystemConst.PriceOfIceArrow;
this.DestroyDegree = 20;
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:Arrow;
_local2 = (_arg1.target as Arrow);
if (_local2.y >= (SystemConst.SEA_LEVEL - 25)){
_local2.stopFlying();
if (_local2.currentLabel != "fall"){
_local2.gotoAndPlay("fall");
};
if ((((_local2.currentFrame == _local2.totalFrames)) && (!((_local2.parent == null))))){
_local2.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
_local2.parent.removeChild(_local2);
};
};
this.x = (this.x + 5);
}
}
}//package handjoys.ca.model.skills
Section 36
//skillIceArrow (handjoys.ca.model.skills.skillIceArrow)
package handjoys.ca.model.skills {
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import handjoys.ca.model.*;
public class skillIceArrow extends SkillObject {
private var startX:int;// = -250
private var startY:int;// = -100
private var arrowNumber:int;// = 10
private var angle:Number;// = -0.4
public function skillIceArrow(){
var _local1:int;
var _local2:*;
var _local3:Arrow;
var _local4:SkillsProperty;
arrowNumber = 10;
startX = -250;
startY = -100;
angle = -0.4;
super();
_local1 = 30;
_local2 = 0;
while (_local2 < arrowNumber) {
_local3 = (ResourceFactory.getResource("iceArrow") as Arrow);
_local3.bMultiAttack = true;
_local3.x = startX;
_local3.y = startY;
_local3.Angle = angle;
_local4 = Cache.SkillArray[3];
_local3.intDamagePoint = _local4.destroy_degree;
_local3.fly();
_local3.parentTarget = this;
Cache.Layers["tool01"].addChild(_local3);
startX = (startX + _local1);
_local2++;
};
this.UserPrice = SystemConst.PriceOfIceArrow;
this.DestroyDegree = 20;
this.y = SystemConst.SEA_LEVEL;
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:Arrow;
_local2 = (_arg1.target as Arrow);
if (_local2.y >= (SystemConst.SEA_LEVEL - 25)){
_local2.stopFlying();
if (_local2.currentLabel != "fall"){
_local2.gotoAndPlay("fall");
};
if ((((_local2.currentFrame == _local2.totalFrames)) && (!((_local2.parent == null))))){
_local2.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
_local2.parent.removeChild(_local2);
};
};
this.x = (this.x + 5);
}
}
}//package handjoys.ca.model.skills
Section 37
//SkillObject (handjoys.ca.model.skills.SkillObject)
package handjoys.ca.model.skills {
import flash.display.*;
public class SkillObject extends MovieClip {
public var UserPrice:Number;// = 0
public var Frequency:int;// = 0
public var Level:int;// = 1
public var DestroyDegree:Number;// = 0
public function SkillObject(){
UserPrice = 0;
DestroyDegree = 0;
Level = 1;
Frequency = 0;
super();
}
}
}//package handjoys.ca.model.skills
Section 38
//SkillsProperty (handjoys.ca.model.skills.SkillsProperty)
package handjoys.ca.model.skills {
public class SkillsProperty {
public var level:int;// = 0
public var active_flag:Boolean;// = false
public var upgrades_price;// = 0
public var price:Number;// = 0
public var destroy_degree:Number;// = 0
public var skill_name:String;// = ""
public var update_flag:Boolean;// = false
public var life:Number;// = 0
public var wait_time:Number;// = 1000
public function SkillsProperty(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:int, _arg6:Number, _arg7:Number, _arg8:Number=0){
skill_name = "";
price = 0;
upgrades_price = 0;
active_flag = false;
level = 0;
destroy_degree = 0;
life = 0;
update_flag = false;
wait_time = 1000;
super();
this.skill_name = _arg1;
this.price = _arg2;
this.upgrades_price = _arg3;
this.active_flag = _arg4;
this.level = _arg5;
this.destroy_degree = _arg6;
this.wait_time = _arg7;
this.life = _arg8;
}
}
}//package handjoys.ca.model.skills
Section 39
//enemyBoss (handjoys.ca.model.soldiers.enemyBoss)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemyBoss extends soldierObject {
public var container:MovieClip;
public function enemyBoss(){
Life = uint((((Cache.CurrentGate + 10) / 10) * 240));
this.Integral = 240;
Direction = -1;
intMoveSpeed = 1.6;
intMoveSpeed = (2.5 * SystemConst.MoveTimes);
intAttackInterval = 12;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 85));
bFaceRight = false;
AttackDistance = 40;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 40
//enemyFlyingDragon (handjoys.ca.model.soldiers.enemyFlyingDragon)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemyFlyingDragon extends soldierObject {
public var container:MovieClip;
public function enemyFlyingDragon(){
Life = uint((((Cache.CurrentGate + 10) / 10) * 180));
this.Integral = 120;
Direction = -1;
intMoveSpeed = (3.8 * SystemConst.MoveTimes);
intAttackInterval = 200;
intDamagePoint = 0;
bFaceRight = false;
AttackDistance = 170;
side = "enemy";
this.soldier_cat = "fly_army";
this.y = (SystemConst.SEA_LEVEL - 30);
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 41
//enemyKnight (handjoys.ca.model.soldiers.enemyKnight)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemyKnight extends soldierObject {
public var container:MovieClip;
public function enemyKnight(){
this.Integral = 70;
if (Cache.CurrentGate > 5){
Life = uint((((Cache.CurrentGate + 10) / 10) * 120));
} else {
if (Cache.CurrentGate > 10){
Life = uint((((Cache.CurrentGate + 10) / 10) * 180));
} else {
Life = 90;
};
};
this.Integral = 140;
Direction = -1;
intMoveSpeed = 2.5;
intMoveSpeed = (3.3 * SystemConst.MoveTimes);
intAttackInterval = 10;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 30));
bFaceRight = false;
AttackDistance = 50;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 42
//enemyMonk (handjoys.ca.model.soldiers.enemyMonk)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemyMonk extends soldierObject {
public var container:MovieClip;
public function enemyMonk(){
Life = uint((((Cache.CurrentGate + 10) / 10) * 48));
this.Integral = 160;
Direction = -1;
intMoveSpeed = 1.4;
intMoveSpeed = (2.6 * SystemConst.MoveTimes);
intAttackInterval = 23;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 60));
bFaceRight = false;
AttackDistance = 200;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 43
//enemyRockThrower (handjoys.ca.model.soldiers.enemyRockThrower)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemyRockThrower extends soldierObject {
public var container:MovieClip;
public function enemyRockThrower(){
this.Integral = 80;
Life = int((((Cache.CurrentGate + 10) / 10) * 120));
Direction = -1;
intMoveSpeed = 1.4;
intMoveSpeed = (2.4 * SystemConst.MoveTimes);
intAttackInterval = 23;
intDamagePoint = 0;
bFaceRight = false;
AttackDistance = 350;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 44
//enemySoldier01 (handjoys.ca.model.soldiers.enemySoldier01)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemySoldier01 extends soldierObject {
public var container:MovieClip;
public function enemySoldier01(){
this.Integral = 45;
if (Cache.CurrentGate > 5){
Life = uint((((Cache.CurrentGate + 10) / 10) * 30));
} else {
if (Cache.CurrentGate > 10){
Life = uint((((Cache.CurrentGate + 10) / 10) * 65));
} else {
Life = 30;
};
};
Direction = -1;
intMoveSpeed = 1.9;
intMoveSpeed = (2.8 * SystemConst.MoveTimes);
intAttackInterval = 16;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 20));
bFaceRight = false;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 45
//enemySoldier02 (handjoys.ca.model.soldiers.enemySoldier02)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemySoldier02 extends soldierObject {
public var container:MovieClip;
public function enemySoldier02(){
this.Integral = 85;
Life = uint((((Cache.CurrentGate + 10) / 10) * 120));
Direction = -1;
intMoveSpeed = 1.8;
intMoveSpeed = (2.7 * SystemConst.MoveTimes);
intAttackInterval = 28;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 20));
bFaceRight = false;
AttackDistance = 30;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 46
//enemySoldier03 (handjoys.ca.model.soldiers.enemySoldier03)
package handjoys.ca.model.soldiers {
import flash.display.*;
import handjoys.ca.util.*;
public class enemySoldier03 extends soldierObject {
public var container:MovieClip;
public function enemySoldier03(){
this.Integral = 100;
Life = uint((((Cache.CurrentGate + 10) / 10) * 160));
Direction = -1;
intMoveSpeed = 2;
intMoveSpeed = (2.5 * SystemConst.MoveTimes);
intAttackInterval = 23;
intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 25));
bFaceRight = false;
AttackDistance = 30;
side = "enemy";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 47
//knightGuard (handjoys.ca.model.soldiers.knightGuard)
package handjoys.ca.model.soldiers {
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
public class knightGuard extends soldierObject {
public function knightGuard(){
var _local1:SkillsProperty;
super();
_local1 = Cache.SkillArray[2];
Life = _local1.life;
Direction = 1;
intMoveSpeed = 2.4;
intMoveSpeed = (3.3 * SystemConst.MoveTimes);
intAttackInterval = 15;
intDamagePoint = _local1.destroy_degree;
bFaceRight = true;
AttackDistance = 30;
side = "friend";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 48
//soldierObject (handjoys.ca.model.soldiers.soldierObject)
package handjoys.ca.model.soldiers {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import handjoys.ca.model.*;
public class soldierObject extends MovieClip implements RomanceInterface {
public var onLine_Flag:Boolean;// = false
public var Life:Number;// = 240
public var intAttackInterval:int;// = 20
public var side:String;// = "friend"
public var Direction:int;// = 1
public var AttackDistance:int;// = 10
private var soldierStregth:int;// = 0
public var bFaceRight;// = true
public var soldier_cat:String;// = "land_army"
public var type:Boolean;// = false
private var targetSoldier:soldierObject;// = null
public var rollStoneDestroyFlag:Boolean;// = false
public var Integral:int;// = 100
public var intMoveSpeed:Number;// = 2.3
public var intDamagePoint;// = 15
public var deadFlag:Boolean;// = false
public function soldierObject(){
Life = 240;
AttackDistance = 10;
Direction = 1;
rollStoneDestroyFlag = false;
Integral = 100;
deadFlag = false;
bFaceRight = true;
side = "friend";
onLine_Flag = false;
intDamagePoint = 15;
targetSoldier = null;
intMoveSpeed = 2.3;
intAttackInterval = 20;
soldierStregth = 0;
type = false;
soldier_cat = "land_army";
super();
this.gotoAndStop("stand");
this.y = SystemConst.SEA_LEVEL;
}
public function enterFrameHandler(_arg1:Event):void{
if (this.side == "enemy"){
if (this.x <= (SystemConst.MAX_RIGHT + 20)){
} else {
this.x = (this.x - 1.5);
return;
};
};
if (this.Life <= 0){
deadHandler();
} else {
if (this.type){
} else {
if ((((((this.x > (SystemConst.MAX_RIGHT - 240))) && ((this.Direction == 1)))) || ((((this.x <= 200)) && ((this.Direction == -1)))))){
if (this.side == "friend"){
this.turnFace();
};
};
if (((((((((!((this.currentLabel == "attack"))) && (!((this.currentLabel == "dead_type_01"))))) && (!((this.currentLabel == "dead_type_02"))))) && (!((this.currentLabel == "dead_type_03"))))) && (!((this.currentLabel == "injured"))))){
if (this.side == "enemy"){
if (this.x < 185){
} else {
soldierActivate();
if (this.soldierStregth < this.intAttackInterval){
this.soldierStregth++;
};
};
return;
};
soldierActivate();
};
if (this.soldierStregth < this.intAttackInterval){
this.soldierStregth++;
};
};
};
}
public function initDestroyFlag():void{
this.rollStoneDestroyFlag = false;
}
public function initSoldier():void{
if (((((this.bFaceRight) && ((this.Direction == -1)))) || (((!(this.bFaceRight)) && ((this.Direction == 1)))))){
this.scaleX = -1;
};
if (this.side == "friend"){
};
}
public function soldierWalk():void{
if (this.currentLabel != "walk"){
this.gotoAndPlay("walk");
this.x = (this.x + ((this.Direction * this.intMoveSpeed) * 0.7));
} else {
this.x = (this.x + ((this.Direction * this.intMoveSpeed) * 0.7));
};
if ((this is knightGuard)){
};
}
public function soldierAttack():void{
if (this.Life > 0){
if ((((this.soldierStregth > this.intAttackInterval)) && ((Math.abs((targetSoldier.x - this.x)) < this.AttackDistance)))){
this.soldierStregth = 0;
if (((!((targetSoldier == null))) && ((targetSoldier.Life >= 0)))){
targetSoldier.soldierInjured(this.intDamagePoint);
if (targetSoldier.Life <= 0){
this.targetSoldier = null;
soldierActivate();
};
};
} else {
this.soldierStregth++;
};
if (((((!((this.currentLabel == "attack"))) && (!((this.targetSoldier == null))))) && ((this.targetSoldier.Life > 0)))){
this.gotoAndPlay("attack");
};
} else {
deadHandler();
};
if ((this is knightGuard)){
};
}
public function deadHandler():void{
var _local1:String;
var _local2:int;
var _local3:int;
_local1 = "dead_type_01";
if (this.currentLabel != _local1){
this.gotoAndPlay(_local1);
};
if (this.deadFlag){
_local2 = 0;
_local3 = Cache.MyWarriors.indexOf(this);
if (_local3 >= 0){
Cache.MyWarriors.splice(_local3, 1);
};
_local3 = Cache.MyActiveWarriors.indexOf(this);
if (_local3 >= 0){
Cache.MyActiveWarriors.splice(_local3, 1);
};
_local3 = Cache.BowWarriors.indexOf(this);
if (_local3 >= 0){
Cache.BowWarriors.splice(_local3, 1);
};
_local3 = Cache.EnemyActiveWarriors.indexOf(this);
if (_local3 >= 0){
Cache.EnemyActiveWarriors.splice(_local3, 1);
};
_local3 = Cache.EnemyWarriors.indexOf(this);
if (_local3 >= 0){
Cache.EnemyWarriors.splice(_local3, 1);
};
if (this.side == "enemy"){
Cache.totalIntegral = (Cache.totalIntegral + this.Integral);
RomanceFacotry.refreshToolBarIntegral();
};
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (this.parent){
this.parent.removeChild(this);
};
};
}
public function startGame():void{
if (this.type){
} else {
this.gotoAndPlay(this.currentFrame);
};
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function soldierInjured(_arg1:int):Boolean{
var _local2:Boolean;
var _local3:int;
var _local4:int;
_local2 = false;
if (((((((!((this.currentLabel == "injured"))) && (!((this.currentLabel == "dead_type_01"))))) && (!((this.currentLabel == "dead_type_02"))))) && (!((this.currentLabel == "dead_type_03"))))){
if (this.name == "castle"){
} else {
this.gotoAndPlay("injured");
};
} else {
if (((((!((this.currentLabel == "dead_type_01"))) && (!((this.currentLabel == "dead_type_02"))))) && (!((this.currentLabel == "dead_type_03"))))){
soldierActivate();
};
};
if ((this.Life - _arg1) <= 0){
_local3 = 0;
_local4 = Cache.MyWarriors.indexOf(this);
if (_local4 >= 0){
Cache.MyWarriors.splice(_local4, 1);
};
_local4 = Cache.MyActiveWarriors.indexOf(this);
if (_local4 >= 0){
Cache.MyActiveWarriors.splice(_local4, 1);
};
_local4 = Cache.BowWarriors.indexOf(this);
if (_local4 >= 0){
Cache.BowWarriors.splice(_local4, 1);
};
_local4 = Cache.EnemyActiveWarriors.indexOf(this);
if (_local4 >= 0){
Cache.EnemyActiveWarriors.splice(_local4, 1);
};
_local4 = Cache.EnemyWarriors.indexOf(this);
if (_local4 >= 0){
Cache.EnemyWarriors.splice(_local4, 1);
};
this.Life = (this.Life - _arg1);
deadHandler();
_local2 = true;
} else {
if (_arg1 != 0){
this.Life = (this.Life - _arg1);
};
};
return (_local2);
}
public function turnFace():void{
this.Direction = -(this.Direction);
this.scaleX = -(this.scaleX);
this.soldierActivate();
}
public function soldierStop():void{
this.gotoAndStop("stand");
}
public function findTarget():soldierObject{
var _local1:Array;
var _local2:Number;
var _local3:soldierObject;
var _local4:soldierObject;
var _local5:*;
var _local6:Number;
var _local7:Boolean;
_local1 = null;
if (this.side == "friend"){
_local1 = Cache.EnemyActiveWarriors;
} else {
_local1 = Cache.MyActiveWarriors;
};
if (this.soldier_cat == "fly_army"){
if (Cache.BowWarriors.length <= 0){
_local1 = Cache.MyActiveWarriors;
} else {
_local1 = Cache.BowWarriors;
};
};
_local2 = 9999999999;
_local3 = null;
_local4 = null;
_local5 = 0;
while (_local5 < _local1.length) {
_local3 = (_local1[_local5] as soldierObject);
if (_local3 != null){
_local6 = _local3.x;
if ((_local3 is Archer)){
_local6 = (_local6 + (20 + 70));
};
};
if (Math.abs((this.x - _local6)) < this.AttackDistance){
if (_local3.Life < _local2){
_local2 = _local3.Life;
_local4 = _local3;
};
};
_local5++;
};
this.targetSoldier = _local4;
if ((((_local4 == null)) && ((_local1.length > 0)))){
_local7 = false;
_local5 = 0;
while (_local5 < _local1.length) {
if ((((((_local1[_local5].x < this.x)) && ((this.Direction == 1)))) || ((((_local1[_local5].x > this.x)) && ((this.Direction == -1)))))){
_local7 = true;
};
_local5++;
};
if (_local7){
};
};
return (_local4);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function soldierActivate():void{
if (this.Life <= 0){
this.deadHandler();
return;
};
this.targetSoldier = findTarget();
if ((this is knightGuard)){
if (this.targetSoldier != null){
trace(this.targetSoldier.name);
};
};
if (this.targetSoldier == null){
soldierWalk();
} else {
if (this.targetSoldier.soldier_cat != "fly_army"){
this.soldierAttack();
} else {
soldierWalk();
};
};
}
public function deadHandlerOfMine():void{
Cache.totalIntegral = (Cache.totalIntegral + this.Integral);
RomanceFacotry.refreshToolBarIntegral();
if (this.parent){
this.parent.removeChild(this);
};
}
}
}//package handjoys.ca.model.soldiers
Section 49
//swordGuard (handjoys.ca.model.soldiers.swordGuard)
package handjoys.ca.model.soldiers {
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
public class swordGuard extends soldierObject {
public function swordGuard(){
var _local1:SkillsProperty;
super();
_local1 = Cache.SkillArray[1];
Life = _local1.life;
Direction = 1;
intMoveSpeed = 1.9;
intMoveSpeed = (2.8 * SystemConst.MoveTimes);
intAttackInterval = 72;
intDamagePoint = _local1.destroy_degree;
bFaceRight = true;
AttackDistance = 40;
side = "friend";
initSoldier();
}
}
}//package handjoys.ca.model.soldiers
Section 50
//Archer (handjoys.ca.model.Archer)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
public class Archer extends soldierObject {
public var bReadyShoot:Boolean;// = false
private var timer:Timer;
public var mcArcherBody:MovieClip;
private var angle:Number;// = 0
public function Archer(){
bReadyShoot = false;
timer = new Timer(1300, 0);
angle = 0;
super();
this.stop();
this.mcArcherBody.stop();
this.type = true;
timer.addEventListener(TimerEvent.TIMER, gatherStrength);
timer.start();
}
public function shot():void{
}
public function shoot():void{
var arrowInst:*;
var archerPoint:Point;
try {
if (bReadyShoot == true){
this.mcArcherBody.gotoAndPlay("attack");
arrowInst = ResourceFactory.getResource("mcArrow");
archerPoint = localToGlobal(new Point(this.mcArcherBody.x, this.mcArcherBody.y));
arrowInst.speed = 19;
arrowInst.drop_speed = 0.6;
arrowInst.x = (archerPoint.x + (Math.sin((this.angle + (Math.PI / 2))) * 8));
arrowInst.y = ((archerPoint.y - 8) + (Math.cos((this.angle + (Math.PI / 2))) * 8));
arrowInst.Angle = this.angle;
arrowInst.fly();
Cache.Layers["tool01"].addChild(arrowInst);
bReadyShoot = false;
timer.reset();
timer.start();
};
} catch(err:Error) {
};
}
private function gatherStrength(_arg1:TimerEvent):void{
bReadyShoot = true;
}
public function set Angle(_arg1:Number):void{
this.angle = _arg1;
}
override public function startGame():void{
}
override public function startPause():void{
this.stop();
if (this.mcArcherBody != null){
this.mcArcherBody.stop();
};
}
public function adjustAngle(_arg1:Number):void{
if (this.mcArcherBody != null){
this.mcArcherBody.rotation = ((-(this.angle) / Math.PI) * 180);
};
}
public function iniPlace():void{
this.x = 30;
this.y = 340;
}
}
}//package handjoys.ca.model
Section 51
//Arrow (handjoys.ca.model.Arrow)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.ui.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
public class Arrow extends SkillObject implements RomanceInterface {
public var drop_speed:Number;// = 0.8
public var bMultiAttack:Boolean;// = false
private var bUsed:Boolean;// = false
public var side:String;// = "friend"
public var speed:Number;// = 18
public var type:String;// = "arrow"
private var vx:Number;// = 0
private var vy:Number;// = 0
public var bHitGround:Boolean;// = false
private var angle:Number;// = 0
public var parentTarget:Object;// = null
public var intDamagePoint:int;// = 50
public function Arrow(){
angle = 0;
speed = 18;
drop_speed = 0.8;
vy = 0;
vx = 0;
intDamagePoint = 50;
type = "arrow";
bMultiAttack = false;
bUsed = false;
bHitGround = false;
parentTarget = null;
side = "friend";
super();
}
public function frameHandle(_arg1:Event){
var _local2:soldierObject;
var _local3:soldierObject;
var _local4:soldierObject;
var _local5:Boolean;
if (this.side == "friend"){
_local2 = null;
_local3 = null;
_local4 = null;
for each (_local2 in Cache.EnemyActiveWarriors) {
if (((HitTest.complexHitTestObject(this, _local2)) && ((_local2.Life >= 0)))){
if (!bUsed){
_local5 = _local2.soldierInjured(this.intDamagePoint);
trace("================<><><><><><><><==================");
if (_local5){
if ((((this.intDamagePoint >= _local2.Life)) && (((this.intDamagePoint - _local2.Life) >= 0)))){
stopFlying();
MovieClip(_local2).container.addChild(this);
if ((_local2 is enemySoldier01)){
this.x = -20;
this.y = -30;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemySoldier02)){
this.x = -17;
this.y = -30;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemySoldier03)){
this.x = -20;
this.y = -35;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemyKnight)){
this.x = -8;
this.y = -30;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemyMonk)){
this.x = -25;
this.y = -30;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemyBoss)){
this.x = -25;
this.y = -50;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemyFlyingDragon)){
this.x = -15;
this.y = -15;
if (_local2.x <= 230){
this.alpha = 0.01;
};
} else {
if ((_local2 is enemyRockThrower)){
this.x = -20;
this.y = -35;
if (_local2.x <= 230){
this.alpha = 0.01;
};
};
};
};
};
};
};
};
};
};
} else {
this.alpha = 0.01;
};
};
if (!bMultiAttack){
bUsed = true;
};
};
};
} else {
if (this.name == "enemyDragonFire"){
if (Cache.BowWarriors.length > 0){
for each (_local3 in Cache.BowWarriors) {
if (((((this.hitTestObject(_local3)) && ((_local3.Life >= 0)))) && (!((_local3.deadFlag == true))))){
trace(_local3, "=====================", bMultiAttack);
if (!bUsed){
_local3.soldierInjured(this.intDamagePoint);
this.stopFlying();
};
if (!bMultiAttack){
bUsed = true;
};
};
};
} else {
for each (_local4 in Cache.MyActiveWarriors) {
if (((((this.hitTestObject(_local4)) && ((_local4.Life >= 0)))) && (!((_local4.deadFlag == true))))){
if (!bUsed){
_local4.soldierInjured(this.intDamagePoint);
this.stopFlying();
};
if (!bMultiAttack){
bUsed = true;
};
};
};
};
} else {
for each (_local2 in Cache.MyActiveWarriors) {
if (((((this.hitTestObject(_local2)) && ((_local2.Life >= 0)))) && (!((_local2.deadFlag == true))))){
if (!bUsed){
_local2.soldierInjured(this.intDamagePoint);
this.stopFlying();
};
if (!bMultiAttack){
bUsed = true;
};
};
};
};
};
if (this.type == "arrow"){
if (this.y >= (SystemConst.SEA_LEVEL - 10)){
bHitGround = true;
stopFlying();
} else {
if (vy < 18){
vy = (vy + drop_speed);
};
this.rotation = ((Math.atan((vy / vx)) / Math.PI) * 180);
this.y = (this.y + this.vy);
this.x = (this.x + this.vx);
};
} else {
if (this.y >= SystemConst.SEA_LEVEL){
bHitGround = true;
stopFlying();
} else {
if (vy < 18){
vy = (vy + drop_speed);
};
this.rotation = ((Math.atan((vy / vx)) / Math.PI) * 180);
this.y = (this.y + this.vy);
this.x = (this.x + this.vx);
};
};
}
public function stopFlying():void{
this.removeEventListener(Event.ENTER_FRAME, frameHandle);
if (((!((this.parent == null))) && ((this.currentFrame == this.totalFrames)))){
this.parent.removeChild(this);
};
this.gotoAndPlay("fall");
}
public function set Speed(_arg1:Number){
this.speed = _arg1;
}
public function set Angle(_arg1:Number){
this.angle = _arg1;
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, frameHandle);
}
public function fly():void{
Cache.Layers["tool01"].addChild(this);
this.vx = (speed * Math.cos(angle));
this.vy = (-(speed) * Math.sin(angle));
this.addEventListener(Event.ENTER_FRAME, frameHandle);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, frameHandle);
}
}
}//package handjoys.ca.model
Section 52
//BarrierLayer (handjoys.ca.model.BarrierLayer)
package handjoys.ca.model {
import flash.display.*;
public class BarrierLayer extends MovieClip {
public var door02:MovieClip;
public var door03:MovieClip;
public var door04:MovieClip;
public var door05:MovieClip;
public var door01:MovieClip;
public var door06:MovieClip;
public var castle:CastleMovieClip;
public function BarrierLayer(){
this.door01.alpha = 0.01;
this.door02.alpha = 0.01;
this.door03.alpha = 0.01;
this.door04.alpha = 0.01;
this.door05.alpha = 0.01;
this.door06.alpha = 0.01;
}
}
}//package handjoys.ca.model
Section 53
//boor (handjoys.ca.model.boor)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
public class boor extends MovieClip implements RomanceInterface {
private var door1:MovieClip;// = null
private var door2:MovieClip;// = null
private var door3:MovieClip;// = null
private var door6:MovieClip;// = null
private var door5:MovieClip;// = null
private var door4:MovieClip;// = null
private var barrier:Sprite;// = null
private var initFlag:Boolean;// = true
private var direct:int;// = 1
public function boor(){
barrier = null;
door1 = null;
door2 = null;
door3 = null;
door4 = null;
door5 = null;
door6 = null;
initFlag = true;
direct = 1;
super();
this.stop();
barrier = Cache.Layers["barrier"].getChildByName("barrier");
door1 = MovieClip(barrier.getChildByName("door01"));
door2 = MovieClip(barrier.getChildByName("door02"));
door3 = MovieClip(barrier.getChildByName("door03"));
door4 = MovieClip(barrier.getChildByName("door04"));
door5 = MovieClip(barrier.getChildByName("door05"));
door6 = MovieClip(barrier.getChildByName("door06"));
initFlag = true;
}
public function enterFrameHandler(_arg1:Event):void{
if (this.hitTestObject(door4)){
direct = -1;
this.gotoAndPlay("walk");
if (initFlag){
initFlag = false;
} else {
Cache.TotalMoney = (Cache.TotalMoney + 10);
};
RomanceFacotry.refreshToolBarMoney();
} else {
if (this.hitTestObject(door2)){
if (direct == -1){
this.alpha = 1;
};
} else {
if (this.hitTestObject(door1)){
this.alpha = 0.01;
} else {
if (this.hitTestObject(door3)){
if (direct == 1){
this.alpha = 0.01;
};
} else {
if (this.hitTestObject(door5)){
direct = 1;
this.gotoAndPlay("work");
} else {
if (this.hitTestObject(door6)){
if (direct == 1){
this.alpha = 1;
};
};
};
};
};
};
};
this.x = (this.x + (direct * 2));
}
public function startGame():void{
this.gotoAndPlay(this.currentFrame);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function stopWork():void{
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startWork():void{
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function startPause():void{
this.stop();
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model
Section 54
//castle (handjoys.ca.model.castle)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.model.soldiers.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
public class castle extends soldierObject {
private var timer:Timer;
public var pole01:MovieClip;
public var pole02:MovieClip;
public var pole00:MovieClip;
public function castle(){
this.Life = (uint((((Cache.CurrentGate + 10) / 10) * Cache.castle_Life)) + 200);
intDamagePoint = 0;
this.stop();
timer = new Timer(500, 0);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
trace("this.name", this.name);
}
public function timerHandler(_arg1:TimerEvent):void{
if ((((this.Life >= ((Cache.castle_Life * 3) / 5))) && ((this.Life < Cache.castle_Life)))){
if (this.currentFrame == 1){
this.nextFrame();
};
} else {
if ((((this.Life >= ((Cache.castle_Life * 1) / 5))) && ((this.Life < ((Cache.castle_Life * 3) / 5))))){
if (this.currentFrame == 2){
this.nextFrame();
};
} else {
if (this.Life <= 0){
this.timer.removeEventListener(TimerEvent.TIMER, timerHandler);
this.play();
};
};
};
}
public function freshSCastleState():void{
var _local1:int;
var _local2:Archer;
if (this.currentFrame == this.totalFrames){
RomanceFacotry.startPause();
Cache.gamePaused = true;
RomanceFacotry.gameOver();
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
_local1 = 0;
while (_local1 < Cache.MyWarriors.length) {
Cache.MyWarriors[_local1].startPause();
Cache.MyWarriors[_local1].gotoAndStop("stand");
_local1++;
};
_local1 = 0;
while (_local1 < Cache.MyActiveWarriors.length) {
Cache.MyActiveWarriors[_local1].startPause();
Cache.MyActiveWarriors[_local1].gotoAndStop("stand");
_local1++;
};
_local1 = 0;
while (_local1 < Cache.EnemyActiveWarriors.length) {
Cache.EnemyActiveWarriors[_local1].startPause();
Cache.EnemyActiveWarriors[_local1].gotoAndStop("stand");
_local1++;
};
_local1 = 0;
while (_local1 < Cache.EnemyWarriors.length) {
Cache.EnemyWarriors[_local1].startPause();
Cache.EnemyWarriors[_local1].gotoAndStop("stand");
_local1++;
};
} else {
_local1 = 0;
while (_local1 < Cache.BowWarriors.length) {
_local2 = Archer(Cache.BowWarriors[_local1]);
if (_local2.parent != null){
MovieClip(this.getChildByName(_local2.parent.name)).addChildAt(_local2, 0);
};
_local1++;
};
};
}
}
}//package handjoys.ca.model
Section 55
//gamealert (handjoys.ca.model.gamealert)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
public class gamealert extends MovieClip {
public var btnContinue:SimpleButton;
public var btnUpgrades:SimpleButton;
public function gamealert(){
this.addEventListener(MouseEvent.CLICK, clickHandler);
}
public function clickHandler(_arg1:MouseEvent):void{
var _local2:*;
_arg1.stopPropagation();
if (_arg1.target != null){
if (_arg1.target.name != null){
switch (_arg1.target.name){
case "btnUpgrades":
if (this.parent != null){
this.parent.removeChild(this);
};
_local2 = ResourceFactory.getResource("upgrades");
Cache.Layers["alert"].addChild(_local2);
break;
case "btnContinue":
if (this.parent != null){
this.parent.removeChild(this);
};
RomanceFacotry.changeTollGate();
break;
};
};
};
}
}
}//package handjoys.ca.model
Section 56
//helpclass (handjoys.ca.model.helpclass)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
public class helpclass extends MovieClip {
public var mcHelp:MovieClip;
public var btnClose:SimpleButton;
public var btnNext:SimpleButton;
public var type:int;// = 0
public var btnPre:SimpleButton;
public function helpclass(){
type = 0;
super();
this.mcHelp.stop();
this.addEventListener(MouseEvent.CLICK, clickHandler);
this.btnPre.visible = false;
this.btnNext.visible = false;
}
public function clickHandler(_arg1:MouseEvent):void{
_arg1.stopPropagation();
if (_arg1.target){
if (_arg1.target.name != null){
switch (_arg1.target.name){
case "btnClose":
if (this.parent){
this.parent.removeChild(this);
};
RomanceFacotry.startGame();
Cache.gamePaused = false;
break;
case "btnPre":
if (type == 1){
if (this.mcHelp.currentFrame == 2){
} else {
this.mcHelp.prevFrame();
};
} else {
this.mcHelp.prevFrame();
};
break;
case "btnNext":
this.mcHelp.nextFrame();
break;
};
};
};
}
}
}//package handjoys.ca.model
Section 57
//InfoDlg (handjoys.ca.model.InfoDlg)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class InfoDlg extends MovieClip {
public var initY:Number;// = 0
public var txtValue:TextField;
public function InfoDlg(){
initY = 0;
super();
}
public function enterFrameHandler(_arg1:Event):void{
if (this.y < (initY - 40)){
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (this.parent != null){
this.parent.removeChild(this);
};
} else {
this.y = (this.y - 2);
};
}
public function startWork(_arg1:Number):void{
this.initY = this.y;
this.txtValue.htmlText = (("<b>" + _arg1.toString()) + "</b>");
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package handjoys.ca.model
Section 58
//IntegralList (handjoys.ca.model.IntegralList)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.text.*;
import flash.net.*;
public class IntegralList extends MovieClip {
public var btnMainMenu:SimpleButton;
public var urlLoader:URLLoader;
public var txtAlertInfo:TextField;
public var type:int;// = 0
public function IntegralList(){
type = 0;
super();
this.stop();
this.btnMainMenu.addEventListener(MouseEvent.CLICK, clickHandler);
}
public function handleComplete(_arg1:Event):void{
var _local2:String;
var _local3:*;
var _local4:Array;
var _local5:int;
var _local6:Array;
_local2 = urlLoader.data;
trace(_local2, "grade");
if (_local2 != null){
_local4 = _local2.split("|");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("$");
if ((_local5 % 2) == 0){
_local3 = ResourceFactory.getResource("grade01");
} else {
_local3 = ResourceFactory.getResource("grade02");
};
if (_local6[0] == ""){
} else {
_local3.txtName.htmlText = (("<b>" + _local6[0]) + "</b>");
_local3.txtScore.htmlText = (("<b>" + _local6[1]) + "</b>");
_local3.txtDate.htmlText = (("<b>" + _local6[2]) + "</b>");
_local3.txtIndex.htmlText = (("<b>" + (_local5 + 1)) + "</b>");
_local3.x = 405;
_local3.y = (180 + (_local5 * 25));
this.addChild(_local3);
};
_local5++;
};
};
}
public function clickHandler(_arg1:MouseEvent):void{
if (this.parent){
this.parent.removeChild(this);
};
if (this.type == 1){
RomanceFacotry.gameToRead();
};
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
}
public function ioerrHandler(_arg1:IOErrorEvent):void{
}
}
}//package handjoys.ca.model
Section 59
//progressBar (handjoys.ca.model.progressBar)
package handjoys.ca.model {
import flash.display.*;
public class progressBar extends MovieClip {
public var progress_bar:MovieClip;
public function progressBar(){
this.progress_bar.scaleX = 0;
}
}
}//package handjoys.ca.model
Section 60
//restartgame (handjoys.ca.model.restartgame)
package handjoys.ca.model {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
public class restartgame extends MovieClip {
public var txtScore:TextField;
public var btnReplay:SimpleButton;
public var urlLoader:URLLoader;// = null
public var btnMoreGames:SimpleButton;
public var txtAlertInfo:TextField;
public var btnSubmit:SimpleButton;
public var txtPlayerName:TextField;
public var btnQuit:SimpleButton;
public function restartgame(){
urlLoader = null;
super();
this.stop();
txtAlertInfo.visible = false;
this.txtScore.htmlText = (("<b>" + Cache.totalIntegral) + "</b>");
this.btnReplay.addEventListener(MouseEvent.CLICK, replayHandler);
this.btnQuit.addEventListener(MouseEvent.CLICK, btnQuitHandler);
this.btnSubmit.addEventListener(MouseEvent.CLICK, btnSubmitHandler);
this.btnMoreGames.addEventListener(MouseEvent.CLICK, moreGamesClickHandler);
}
public function btnSubmitHandler(_arg1:MouseEvent):void{
var hasNetwork:Boolean;
var event = _arg1;
txtAlertInfo.visible = true;
try {
hasNetwork = MochiAd.sendHighScore({clip:this, id:"ea280c6316c0e9e7", name:String(this.txtPlayerName.text), score:Number(this.txtScore.text)}, null, handleComplete);
if (!hasNetwork){
txtAlertInfo.htmlText = "Local sandbox does not allow network, try playing online.";
};
} catch(e:Error) {
};
}
public function moreGamesClickHandler(_arg1:MouseEvent):void{
Cache.linkPressedTimer = getTimer();
Cache.isLinkPressed = true;
navigateToURL(new URLRequest("http://www.dragongamez.com"), "_self");
}
public function replayHandler(_arg1:MouseEvent):void{
if (this.parent){
this.parent.removeChild(this);
};
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
Cache.sound_flag = true;
RomanceFacotry.startNewGame();
}
public function handleComplete(_arg1, _arg2):void{
var _local3:*;
_local3 = ResourceFactory.getResource("IntegralList");
_local3.type = 1;
Cache.Layers["alert"].addChild(_local3);
if (this.parent){
this.parent.removeChild(this);
};
}
public function ioerrHandler(_arg1:IOErrorEvent):void{
}
public function btnQuitHandler(_arg1:MouseEvent):void{
if (this.parent){
this.parent.removeChild(this);
};
RomanceFacotry.gameToRead();
Cache.soundChannel.stop();
Cache.sound_flag = true;
}
}
}//package handjoys.ca.model
Section 61
//toolbar (handjoys.ca.model.toolbar)
package handjoys.ca.model {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
public class toolbar extends MovieClip implements RomanceInterface {
public var infoCount:int;// = 0
public var txtScore:TextField;
private var count:int;// = 0
public var txtMoney:TextField;
public var sound:Sound;// = null
public var denoteBar:MovieClip;
private var fmCon:MovieClip;// = null
public var txtInfo:TextField;
public var bsContainer:MovieClip;
public var txtSkillLevel:TextField;
private var timer:Timer;
public var txtLevel:TextField;
public var soundChannel:SoundChannel;// = null
public var txtTime:TextField;
public var txtUseGold:TextField;
public var toolButton01:tool01;
public var toolButton03:tool03;
public var btnMoreGames:SimpleButton;
public var toolButton07:tool07;
public var toolButton04:tool04;
public var toolButton05:tool05;
public var toolButton06:tool06;
public var toolButton02:tool02;
public var toolButton08:tool08;
public var toolButton10:tool10;
public var toolButton09:tool09;
private var bsCon:MovieClip;// = null
public var btnHelp:SimpleButton;
public var soundChannel1:SoundChannel;// = null
public var fmContainer:MovieClip;
public var txtSkillCount:TextField;
public var btnOpenSound:MovieClip;
public function toolbar(){
bsCon = null;
fmCon = null;
count = 0;
sound = null;
soundChannel = null;
soundChannel1 = null;
infoCount = 0;
super();
this.stop();
this.btnOpenSound.stop();
this.btnOpenSound.buttonMode = true;
Cache.ToolBarEquip[0] = this.toolButton10;
Cache.ToolBarEquip[1] = this.toolButton01;
Cache.ToolBarEquip[2] = this.toolButton02;
Cache.ToolBarEquip[3] = this.toolButton03;
Cache.ToolBarEquip[4] = this.toolButton04;
Cache.ToolBarEquip[5] = this.toolButton05;
Cache.ToolBarEquip[6] = this.toolButton06;
Cache.ToolBarEquip[7] = this.toolButton07;
Cache.ToolBarEquip[8] = this.toolButton08;
Cache.ToolBarEquip[9] = this.toolButton09;
bsCon = MovieClip(getChildByName("bsContainer"));
fmCon = MovieClip(getChildByName("fmContainer"));
initToolBar();
this.txtScore.htmlText = (("<b>" + Cache.totalIntegral) + "</b>");
this.txtMoney.htmlText = (("<b>" + Cache.TotalMoney) + "</b>");
this.btnHelp.addEventListener(MouseEvent.CLICK, btnHelpClickHandler);
this.btnOpenSound.addEventListener(MouseEvent.CLICK, btnOpenSoundClickHandler);
this.btnMoreGames.addEventListener(MouseEvent.CLICK, moreGamesClickHandler);
trace("Hello", Cache.sound_flag);
if (Cache.sound_flag){
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
Cache.soundChannel = Cache.sound.play(0, 10000000);
trace("Cache.soundChannel", Cache.soundChannel);
} else {
btnOpenSound.gotoAndStop(2);
};
}
public function btnOpenSoundClickHandler(_arg1:MouseEvent):void{
if (btnOpenSound.currentFrame == 1){
Cache.sound_flag = false;
btnOpenSound.gotoAndStop(2);
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
} else {
Cache.sound_flag = true;
btnOpenSound.gotoAndStop(1);
Cache.soundChannel = Cache.sound.play(Cache.soundChannel.position, 100000000);
};
}
public function moreGamesClickHandler(_arg1:MouseEvent):void{
Cache.linkPressedTimer = getTimer();
Cache.isLinkPressed = true;
navigateToURL(new URLRequest("http://www.dragongamez.com"), "_self");
}
public function initToolBar():void{
var _local1:int;
var _local2:int;
var _local3:*;
var _local4:SkillsProperty;
_local1 = 1;
while (_local1 <= 10) {
_local3 = null;
if (_local1 < 10){
_local3 = getChildByName(("toolButton0" + _local1));
} else {
_local3 = getChildByName(("toolButton" + _local1));
};
_local4 = SkillsProperty(Cache.SkillArray[_local1]);
if (_local4.active_flag){
toolButton(_local3).activationSkill();
toolButton(_local3).setRepeatAndDelay(_local4.wait_time, 10);
toolButton(_local3).startTimer();
};
_local1++;
};
while (bsCon.numChildren > 0) {
bsCon.removeChildAt(0);
};
while (fmCon.numChildren > 0) {
fmCon.removeChildAt(0);
};
_local2 = SystemConst.passTollGameTime;
if (timer != null){
timer.reset();
timer.repeatCount = _local2;
timer.delay = 1000;
} else {
timer = new Timer(1000, _local2);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler);
};
this.txtTime.htmlText = (("<b>" + _local2) + "</b>");
this.txtLevel.htmlText = (("<b>Level " + Cache.CurrentGate) + "</b>");
timer.start();
}
private function timerHandler(_arg1:TimerEvent):void{
var _local2:int;
var _local3:*;
var _local4:int;
var _local5:int;
var _local6:int;
count++;
_local2 = SystemConst.passTollGameTime;
this.txtTime.htmlText = (("<b>" + String((_local2 - timer.currentCount))) + "</b>");
if (Cache.tmpBoors.length > 0){
_local3 = Cache.tmpBoors.shift();
Cache.Boors.push(_local3);
_local3.startWork();
};
if (infoCount == 5){
infoCount = 0;
if (txtInfo.text != ""){
txtInfo.text = "";
};
};
infoCount++;
if ((count + 8) > SystemConst.passTollGameTime){
} else {
if ((count % 10) != 0){
trace("fal");
return;
};
if (Cache.EnemyTmpCountOfToll > 0){
if (Cache.EnemyActiveWarriors.length < 8){
_local4 = int((Math.random() * 6));
if (_local4 <= 1){
_local4 = 3;
};
RomanceFacotry.BuySoldier(_local4);
} else {
if (Cache.MyActiveWarriors.length <= 0){
_local5 = int((Math.random() * 6));
if (_local5 <= 1){
_local5 = 3;
};
_local6 = 0;
while (_local6 <= _local5) {
if (Cache.EnemyActiveWarriors.length < 10){
if (Cache.EnemyTmpCountOfToll > 0){
RomanceFacotry.BuySoldier(_local5);
};
};
_local6++;
};
};
};
};
};
}
public function startGame():void{
var _local1:int;
var _local2:*;
this.timer.start();
_local1 = 1;
while (_local1 <= 10) {
_local2 = null;
if (_local1 < 10){
_local2 = getChildByName(("toolButton0" + _local1));
} else {
_local2 = getChildByName(("toolButton" + _local1));
};
_local2.startGame();
_local1++;
};
}
public function startPause():void{
var _local1:int;
var _local2:*;
this.timer.stop();
_local1 = 1;
while (_local1 <= 10) {
_local2 = null;
if (_local1 < 10){
_local2 = getChildByName(("toolButton0" + _local1));
} else {
_local2 = getChildByName(("toolButton" + _local1));
};
_local2.startPause();
_local1++;
};
}
private function timerCompleteHandler(_arg1:TimerEvent):void{
var _local2:*;
var _local3:int;
if (Cache.castle){
if (Cache.castle.Life > 0){
} else {
return;
};
};
Cache.gamePaused = true;
RomanceFacotry.startPause();
this.timer.stop();
_local2 = ResourceFactory.getResource("gameAlert");
if (Cache.soundChannel != null){
Cache.soundChannel.stop();
};
Cache.Layers["alert"].addChild(_local2);
Cache.gameOver = true;
_local3 = 0;
while (_local3 < Cache.MyWarriors.length) {
Cache.MyWarriors[_local3].startPause();
Cache.MyWarriors[_local3].gotoAndStop("stand");
_local3++;
};
_local3 = 0;
while (_local3 < Cache.MyActiveWarriors.length) {
Cache.MyActiveWarriors[_local3].startPause();
Cache.MyActiveWarriors[_local3].gotoAndStop("stand");
_local3++;
};
_local3 = 0;
while (_local3 < Cache.EnemyActiveWarriors.length) {
Cache.EnemyActiveWarriors[_local3].startPause();
Cache.EnemyActiveWarriors[_local3].gotoAndStop("stand");
_local3++;
};
_local3 = 0;
while (_local3 < Cache.EnemyWarriors.length) {
Cache.EnemyWarriors[_local3].startPause();
Cache.EnemyWarriors[_local3].gotoAndStop("stand");
_local3++;
};
}
public function btnHelpClickHandler(_arg1:MouseEvent):void{
var _local2:*;
_local2 = ResourceFactory.getResource("helpClip");
_local2.mcHelp.nextFrame();
_local2.btnPre.visible = true;
_local2.btnNext.visible = true;
_local2.type = 1;
Cache.Layers["alert"].addChild(_local2);
RomanceFacotry.startPause();
Cache.gamePaused = true;
}
}
}//package handjoys.ca.model
Section 62
//toolButton (handjoys.ca.model.toolButton)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.ui.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
public class toolButton extends Sprite implements RomanceInterface {
private var _count:Number;// = 0
public var count:int;// = 0
public var denoteBar:MovieClip;
public var timer:Timer;// = null
public var toolButton01:warriorButClip;
public var toolButton04:fireArrowButClip;
public var toolButton05:cannonButClip;
public var toolButton06:thunderButClip;
public var toolButton07:fireballButClip;
public var toolButton03:iceArrowButClip;
public var toolButton02:knightButClip;
public var toolButton09:cycloneButClip;
private var delay:Number;// = 1000
public var toolButton08:arrowRainButClip;
public var toolButton10:nailBoardButClip;
public var activeFlag:Boolean;// = true
private var repeat:Number;// = 10
public function toolButton(){
var _local1:int;
var _local2:SkillsProperty;
count = 0;
timer = null;
delay = 1000;
repeat = 10;
_count = 0;
activeFlag = true;
super();
this.buttonMode = true;
this.denoteBar.scaleX = 0;
this.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
this.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
_local1 = int(this.name.substr((this.name.length - 2), 2));
_local2 = SkillsProperty(Cache.SkillArray[_local1]);
this.activeFlag = _local2.active_flag;
if (_local2.active_flag){
this.activeFlag = true;
MovieClip(this.getChildByName(this.name)).gotoAndStop(1);
} else {
MovieClip(this.getChildByName(this.name)).gotoAndStop(3);
};
}
public function rollOverHandler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:SkillsProperty;
_local2 = _arg1.currentTarget.name.substr((_arg1.currentTarget.name.length - 2), 2);
if ((((_local2 == 1)) || ((_local2 == 2)))){
_local3 = Cache.SkillArray[_local2];
RomanceFacotry.refreshToolBarSkillPro(_local3.level, _local3.price);
} else {
_local3 = Cache.SkillArray[_local2];
RomanceFacotry.refreshToolBarSkillPro(_local3.level, _local3.price);
};
}
public function startTimer():void{
if (this.activeFlag){
this.denoteBar.scaleX = 0;
timer.reset();
timer.start();
this._count = 0;
};
}
private function timeCompleteHandler(_arg1:TimerEvent):void{
this.count++;
_count = 0;
}
public function startGame():void{
if (this.activeFlag){
if (this._count == 0){
} else {
this.timer.start();
};
};
}
public function rollOutHandler(_arg1:MouseEvent):void{
}
public function setRepeatAndDelay(_arg1:Number, _arg2:int):void{
if (this.activeFlag){
this.delay = _arg1;
this.repeat = _arg2;
this.timer.repeatCount = _arg2;
this.timer.delay = _arg1;
};
}
public function startPause():void{
if (this.activeFlag){
if (this._count == 0){
} else {
this.timer.stop();
};
};
}
private function timeHandler(_arg1:TimerEvent):void{
_count++;
trace(timer.currentCount, this.delay, timer.repeatCount, timer.delay);
trace(denoteBar.scaleX);
denoteBar.scaleX = (_count / timer.repeatCount);
}
public function activationSkill():void{
this.activeFlag = true;
this.timer = new Timer(delay, repeat);
this.timer.addEventListener(TimerEvent.TIMER, timeHandler);
this.timer.addEventListener(TimerEvent.TIMER_COMPLETE, timeCompleteHandler);
}
}
}//package handjoys.ca.model
Section 63
//upgrades (handjoys.ca.model.upgrades)
package handjoys.ca.model {
import flash.display.*;
import flash.events.*;
import handjoys.ca.model.skills.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.text.*;
public class upgrades extends MovieClip {
public var btnClose:SimpleButton;
public var txtLevel:TextField;
public var toolButton01:MovieClip;
public var toolButton03:MovieClip;
public var toolButton06:MovieClip;
public var toolButton07:MovieClip;
public var toolButton04:MovieClip;
public var toolButton05:MovieClip;
private var currentTarge:String;// = ""
public var toolButton02:MovieClip;
public var txtTotalMoney:TextField;
public var toolButton10:MovieClip;
public var toolButton09:MovieClip;
public var txtDescription:TextField;
public var toolButton08:MovieClip;
private var descrtions:Array;
public var txtPrice:TextField;
public function upgrades(){
var _local1:MovieClip;
var _local2:SkillsProperty;
var _local3:int;
descrtions = [];
currentTarge = "";
super();
descrtions["toolButton01"] = "Warrior: fight automatically";
descrtions["toolButton02"] = "Knight: fight automatically";
descrtions["toolButton03"] = "Ice arrow: damage and slow down the enemy which lasting 10 seconds.";
descrtions["toolButton04"] = "Fire arrow: damage and burn the enemy which lasting 10 seconds.";
descrtions["toolButton05"] = "Canon: damage all the enemies in a certain range";
descrtions["toolButton06"] = "Lightning: common for damage the enemy in a certain range which lasting 6 seconds.";
descrtions["toolButton07"] = "Rain of arrows: powerful and damage a big rang of enemies.";
descrtions["toolButton08"] = "Megalith: released out of the castle and damage all the enemies in front.";
descrtions["toolButton09"] = "Hurricane: common to attack the enemies full of the full screen and bring them up and down.";
descrtions["toolButton10"] = "Big board: the most powerful weapon which move ahead and damage all the enemies of the whole screen and slow down them.";
this.addEventListener(MouseEvent.CLICK, clickHandler);
_local1 = null;
_local3 = 1;
while (_local3 < 11) {
if (_local3 < 10){
_local1 = MovieClip(this.getChildByName(("toolButton0" + _local3)));
} else {
_local1 = MovieClip(this.getChildByName(("toolButton" + _local3)));
};
_local1.gotoAndStop(2);
_local1.buttonMode = true;
_local1.addEventListener(MouseEvent.ROLL_OVER, rolloverHandler);
_local1.addEventListener(MouseEvent.ROLL_OUT, rolloutHandler);
_local2 = SkillsProperty(Cache.SkillArray[_local3]);
if (_local2.active_flag){
_local1.gotoAndStop(3);
};
_local3++;
};
}
public function upgrades_skill():void{
var _local1:SkillsProperty;
var _local2:MovieClip;
_local1 = SkillsProperty(Cache.SkillArray[int(currentTarge)]);
if (_local1.upgrades_price > Cache.TotalMoney){
} else {
if (_local1.update_flag){
} else {
_local1.active_flag = true;
_local1.level++;
Cache.TotalMoney = (Cache.TotalMoney - _local1.upgrades_price);
if ((((currentTarge == "1")) || ((currentTarge == "2")))){
} else {
_local1.destroy_degree = uint((1.2 * _local1.destroy_degree));
_local1.life = uint((1.4 * _local1.life));
};
_local1.upgrades_price = uint((1 * _local1.upgrades_price));
if ((((currentTarge == "1")) || ((currentTarge == "2")))){
} else {
_local1.wait_time = uint((1 * _local1.wait_time));
};
_local1.price = uint((1 * _local1.price));
this.txtLevel.htmlText = (("<b>" + _local1.level) + "</b>");
this.txtPrice.htmlText = (("<b>" + _local1.upgrades_price) + "</b>");
this.txtTotalMoney.htmlText = (("<b>" + Cache.TotalMoney) + "</b>");
_local1.update_flag = true;
_local2 = null;
if (int(currentTarge) < 10){
_local2 = MovieClip(this.getChildByName(("toolButton0" + int(currentTarge))));
} else {
_local2 = MovieClip(this.getChildByName(("toolButton" + int(currentTarge))));
};
_local2.gotoAndStop(3);
};
};
}
public function rolloverHandler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:SkillsProperty;
var _local4:int;
var _local5:MovieClip;
_local2 = int(_arg1.target.name.substr((_arg1.target.name.length - 2), 2));
_local3 = SkillsProperty(Cache.SkillArray[_local2]);
if (_local3.active_flag){
_arg1.target.gotoAndStop(3);
} else {
_arg1.target.gotoAndStop(1);
};
currentTarge = _local2.toString();
_local4 = 1;
_local4 = 1;
for (;_local4 < 11;_local4++) {
if (_local4 == _local2){
continue;
} else {
_local3 = Cache.SkillArray[_local4];
if (_local4 < 10){
_local5 = MovieClip(this.getChildByName(("toolButton0" + _local4)));
} else {
_local5 = MovieClip(this.getChildByName(("toolButton" + _local4)));
};
if (_local3.active_flag){
_local5.gotoAndStop("3");
} else {
_local5.gotoAndStop(2);
};
};
};
_local3 = SkillsProperty(Cache.SkillArray[_local2]);
this.txtLevel.htmlText = (("<b>" + _local3.level) + "</b>");
this.txtDescription.text = descrtions[_arg1.target.name];
this.txtPrice.htmlText = (("<b>" + _local3.upgrades_price) + "</b>");
this.txtTotalMoney.htmlText = (("<b>" + Cache.TotalMoney) + "</b>");
}
public function clickHandler(_arg1:MouseEvent):void{
var _local2:String;
if (_arg1.target != null){
if (_arg1.target.name != null){
switch (_arg1.target.name){
case "btnClose":
if (this.parent){
this.parent.removeChild(this);
};
RomanceFacotry.changeTollGate();
break;
case "btnBuy":
upgrades_skill();
break;
default:
_local2 = _arg1.target.name;
if (_local2.indexOf("tool") != -1){
currentTarge = _local2.substr((_local2.length - 2), 2);
upgrades_skill();
};
break;
};
};
};
}
public function rolloutHandler(_arg1:MouseEvent):void{
}
}
}//package handjoys.ca.model
Section 64
//RomanceInterface (handjoys.ca.ui.RomanceInterface)
package handjoys.ca.ui {
public interface RomanceInterface {
function startGame():void;
function startPause():void;
}
}//package handjoys.ca.ui
Section 65
//Cache (handjoys.ca.util.Cache)
package handjoys.ca.util {
import flash.display.*;
import flash.media.*;
import handjoys.ca.main.*;
public class Cache {
public static var loadBoorFlag:Boolean = true;
public static var MyActiveWarriors:Array = [];
public static var castle_Life:Number = 1500;
public static var sound = null;
public static var loadBowFlag:Boolean = true;
public static var EnemyTmpCountOfToll = 20000;
public static var loader:Loader = null;
public static var KeyboardCode:Array = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 32, 37, 38, 39, 40, 187, 27];
public static var Sences:Array = [];
public static var totalIntegral:Number = 0;
public static var sound_flag:Boolean = true;
public static var EnemyActiveWarriors:Array = [];
public static var EnemyCountOfTollGame:int = 20000;
public static var tmpBoors:Array = [];
public static var gameStarted:Boolean = false;
public static var mainPro:main = null;
public static var ToolBarEquip:Array = [];
public static var SkillArray:Array = [];
public static var BowWarriors:Array = [];
public static var gamePaused:Boolean = false;
public static var isLinkPressed:Boolean = false;
public static var TollGate:Array = [];
public static var CurrentGate:int = 1;
public static var MyWarriors = [];
public static var Layers:Array = [];
public static var Boors:Array = [];
public static var Component:Array = [];
public static var gameOver:Boolean = false;
public static var linkPressedTimer:int = 0;
public static var shootAngle:Number = 0;
public static var EnemyWarriors = [];
public static var soundChannel:SoundChannel = null;
public static var TotalMoney:Number = 0;
public static var url:String = "http://192.168.10.23:8088/upgoal.php____test";
public static var castle:MovieClip = null;
}
}//package handjoys.ca.util
Section 66
//HitTest (handjoys.ca.util.HitTest)
package handjoys.ca.util {
import flash.display.*;
import flash.geom.*;
public class HitTest {
protected static function getDrawMatrix(_arg1:DisplayObject, _arg2:Rectangle, _arg3:Number):Matrix{
var _local4:Point;
var _local5:Matrix;
var _local6:Matrix;
_local6 = _arg1.root.transform.concatenatedMatrix;
_local4 = _arg1.localToGlobal(new Point());
_local5 = _arg1.transform.concatenatedMatrix;
_local5.tx = (_local4.x - _arg2.x);
_local5.ty = (_local4.y - _arg2.y);
_local5.a = (_local5.a / _local6.a);
_local5.d = (_local5.d / _local6.d);
if (_arg3 != 1){
_local5.scale(_arg3, _arg3);
};
return (_local5);
}
public static function complexHitTestObject(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=1):Boolean{
return (!((complexIntersectionRectangle(_arg1, _arg2, _arg3).width == 0)));
}
public static function complexIntersectionRectangle(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=1):Rectangle{
var _local4:Rectangle;
var _local5:BitmapData;
var _local6:Rectangle;
if (_arg3 <= 0){
throw (new Error("ArgumentError: Error #5001: Invalid value for accurracy", 5001));
};
if (!_arg1.hitTestObject(_arg2)){
return (new Rectangle());
};
_local4 = intersectionRectangle(_arg1, _arg2);
if (((((_local4.width * _arg3) < 1)) || (((_local4.height * _arg3) < 1)))){
return (new Rectangle());
};
_local5 = new BitmapData((_local4.width * _arg3), (_local4.height * _arg3), false, 0);
_local5.draw(_arg1, HitTest.getDrawMatrix(_arg1, _local4, _arg3), new ColorTransform(1, 1, 1, 1, 0xFF, -255, -255, 0xFF));
_local5.draw(_arg2, HitTest.getDrawMatrix(_arg2, _local4, _arg3), new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0xFF), BlendMode.DIFFERENCE);
_local6 = _local5.getColorBoundsRect(4294967295, 4278255615);
_local5.dispose();
if (_arg3 != 1){
_local6.x = (_local6.x / _arg3);
_local6.y = (_local6.y / _arg3);
_local6.width = (_local6.width / _arg3);
_local6.height = (_local6.height / _arg3);
};
_local6.x = (_local6.x + _local4.x);
_local6.y = (_local6.y + _local4.y);
return (_local6);
}
public static function intersectionRectangle(_arg1:DisplayObject, _arg2:DisplayObject):Rectangle{
var _local3:Rectangle;
var _local4:Rectangle;
var _local5:Rectangle;
if (((((!(_arg1.root)) || (!(_arg2.root)))) || (!(_arg1.hitTestObject(_arg2))))){
return (new Rectangle());
};
_local3 = _arg1.getBounds(_arg1.root);
_local4 = _arg2.getBounds(_arg2.root);
_local5 = new Rectangle();
_local5.x = Math.max(_local3.x, _local4.x);
_local5.y = Math.max(_local3.y, _local4.y);
_local5.width = Math.min(((_local3.x + _local3.width) - _local5.x), ((_local4.x + _local4.width) - _local5.x));
_local5.height = Math.min(((_local3.y + _local3.height) - _local5.y), ((_local4.y + _local4.height) - _local5.y));
return (_local5);
}
}
}//package handjoys.ca.util
Section 67
//MochiAd (handjoys.ca.util.MochiAd)
package handjoys.ca.util {
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 handjoys.ca.util
Section 68
//StageMask (handjoys.ca.util.StageMask)
package handjoys.ca.util {
import flash.display.*;
public class StageMask {
public static function cover(_arg1:DisplayObjectContainer, _arg2:uint=0):void{
var _local3:Shape;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:Number;
_local3 = new Shape();
_arg1.addChild(_local3);
_local4 = -500;
_local5 = _local4;
_local6 = _local4;
_local7 = _arg2;
_local8 = _local7;
_local9 = _local7;
_local10 = -2;
_local3.graphics.lineStyle(0, _local9, 1);
_local3.graphics.drawRect(_local10, _local10, (_arg1.stage.stageWidth + 4), (_arg1.stage.stageHeight + 4));
_local3.graphics.beginFill(_local8, 1);
_local3.graphics.moveTo(_local5, _local6);
_local3.graphics.lineTo(((_local5 + _arg1.stage.stageWidth) + (Math.abs(_local5) * 2)), _local6);
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local10)), _local10);
_local3.graphics.lineTo(_local10, _local10);
_local3.graphics.lineTo(_local5, _local6);
_local3.graphics.endFill();
_local3.graphics.beginFill(_local8, 1);
_local3.graphics.moveTo(_local5, _local6);
_local3.graphics.lineTo(_local5, ((_local6 + _arg1.stage.stageHeight) + (Math.abs(_local5) * 2)));
_local3.graphics.lineTo(_local10, (_arg1.stage.stageHeight + Math.abs(_local10)));
_local3.graphics.lineTo(_local10, _local10);
_local3.graphics.lineTo(_local5, _local6);
_local3.graphics.endFill();
_local3.graphics.beginFill(_local8, 1);
_local3.graphics.moveTo(_local5, (Math.abs(_local6) + _arg1.stage.stageHeight));
_local3.graphics.lineTo(_local10, (_arg1.stage.stageHeight + Math.abs(_local10)));
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local10)), (_arg1.stage.stageHeight + Math.abs(_local10)));
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local5)), (_arg1.stage.stageHeight + Math.abs(_local6)));
_local3.graphics.lineTo(_local5, (Math.abs(_local6) + _arg1.stage.stageHeight));
_local3.graphics.endFill();
_local3.graphics.beginFill(_local8, 1);
_local3.graphics.moveTo((_arg1.stage.stageWidth + Math.abs(_local5)), (_arg1.stage.stageHeight + Math.abs(_local6)));
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local10)), (_arg1.stage.stageHeight + Math.abs(_local10)));
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local10)), _local10);
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local5)), _local6);
_local3.graphics.lineTo((_arg1.stage.stageWidth + Math.abs(_local5)), (_arg1.stage.stageHeight + Math.abs(_local6)));
_local3.graphics.endFill();
}
}
}//package handjoys.ca.util
Section 69
//SystemConst (handjoys.ca.util.SystemConst)
package handjoys.ca.util {
public class SystemConst {
public static const PriceOfNailWall:Number = 20;
public static const upPriceOfRollStone:Number = 400;
public static const upPriceOfNailWall:Number = 300;
public static const upPriceOfCyclone:Number = 360;
public static const WarriorCount:int = 5;
public static const upPriceOfFireArrow:Number = 240;
public static const PriceOfKnightGuard:Number = 60;
public static const PriceOfArrowFall:Number = 20;
public static const PriceOfCyclone:Number = 20;
public static const PriceOfSwordGuard:Number = 40;
public static const upPriceOfArrowFall:Number = 300;
public static const MAX_RIGHT:int = 800;
public static const upPriceOfCannon:Number = 300;
public static const upPriceOfIceArrow:Number = 200;
public static const PriceOfIceArrow:Number = 20;
public static const PriceOfLightning:Number = 20;
public static const SEA_LEVEL:int = 400;
public static const MoveTimes:Number = 2;
public static const BoorCount:int = 3;
public static const upPriceOfLightning:Number = 500;
public static const PriceOfRollStone:Number = 20;
public static const passTollGameTime:int = 100;
public static const upPriceOfSwordGuard:Number = 400;
public static const upPriceOfKnightGuard:Number = 500;
public static const PriceOfFireArrow:Number = 20;
public static const PriceOfCannon:Number = 20;
}
}//package handjoys.ca.util
Section 70
//SystemUtil (handjoys.ca.util.SystemUtil)
package handjoys.ca.util {
import handjoys.ca.model.skills.*;
public class SystemUtil {
public static function msecToDateString(_arg1:Number):String{
var _local2:Date;
_local2 = new Date(_arg1);
return ([_local2.getFullYear(), (((1 + _local2.getMonth()) > 9)) ? (1 + _local2.getMonth()) : ("0" + (1 + _local2.getMonth())), ((_local2.getDate() > 9)) ? _local2.getDate() : ("0" + _local2.getDate())].join("-"));
}
public static function initSkillsProperty(){
Cache.SkillArray.splice(0);
Cache.SkillArray[0] = new SkillsProperty("", 0, 0, true, 0, 10, 1000);
Cache.SkillArray[1] = new SkillsProperty("swordGuid", SystemConst.PriceOfSwordGuard, SystemConst.upPriceOfSwordGuard, true, 0, 30, 400, 200);
Cache.SkillArray[2] = new SkillsProperty("knightGuard", SystemConst.PriceOfKnightGuard, SystemConst.upPriceOfKnightGuard, false, 0, 45, 600, 300);
Cache.SkillArray[3] = new SkillsProperty("skillIceArrow", SystemConst.PriceOfIceArrow, SystemConst.upPriceOfIceArrow, false, 0, 25, 300);
Cache.SkillArray[4] = new SkillsProperty("skillFireArrow", SystemConst.PriceOfFireArrow, SystemConst.upPriceOfFireArrow, false, 0, 25, 200);
Cache.SkillArray[5] = new SkillsProperty("skillCannon", SystemConst.PriceOfCannon, SystemConst.upPriceOfCannon, false, 0, 80, 200);
Cache.SkillArray[6] = new SkillsProperty("lightning", SystemConst.PriceOfLightning, SystemConst.upPriceOfLightning, false, 0, 15, 200);
Cache.SkillArray[7] = new SkillsProperty("rollStone", SystemConst.PriceOfRollStone, SystemConst.upPriceOfRollStone, false, 0, 35, 220);
Cache.SkillArray[8] = new SkillsProperty("arrowsFall", SystemConst.PriceOfArrowFall, SystemConst.upPriceOfArrowFall, false, 0, 20, 180);
Cache.SkillArray[9] = new SkillsProperty("cyclone", SystemConst.PriceOfCyclone, SystemConst.upPriceOfCyclone, false, 0, 30, 250);
Cache.SkillArray[10] = new SkillsProperty("nailWall", SystemConst.PriceOfNailWall, SystemConst.upPriceOfNailWall, false, 0, 25, 220);
Cache.SkillArray[1] = new SkillsProperty("swordGuid", SystemConst.PriceOfSwordGuard, SystemConst.upPriceOfSwordGuard, true, 0, 30, 800, 200);
Cache.SkillArray[2] = new SkillsProperty("knightGuard", SystemConst.PriceOfKnightGuard, SystemConst.upPriceOfKnightGuard, false, 0, 45, 1200, 300);
Cache.SkillArray[3] = new SkillsProperty("skillIceArrow", SystemConst.PriceOfIceArrow, SystemConst.upPriceOfIceArrow, false, 0, 25, 800);
Cache.SkillArray[4] = new SkillsProperty("skillFireArrow", SystemConst.PriceOfFireArrow, SystemConst.upPriceOfFireArrow, false, 0, 25, 800);
Cache.SkillArray[5] = new SkillsProperty("skillCannon", SystemConst.PriceOfCannon, SystemConst.upPriceOfCannon, false, 0, 80, 800);
Cache.SkillArray[6] = new SkillsProperty("lightning", SystemConst.PriceOfLightning, SystemConst.upPriceOfLightning, false, 0, 15, 800);
Cache.SkillArray[7] = new SkillsProperty("rollStone", SystemConst.PriceOfRollStone, SystemConst.upPriceOfRollStone, false, 0, 35, 800);
Cache.SkillArray[8] = new SkillsProperty("arrowsFall", SystemConst.PriceOfArrowFall, SystemConst.upPriceOfArrowFall, false, 0, 20, 600);
Cache.SkillArray[9] = new SkillsProperty("cyclone", SystemConst.PriceOfCyclone, SystemConst.upPriceOfCyclone, false, 0, 30, 850);
Cache.SkillArray[10] = new SkillsProperty("nailWall", SystemConst.PriceOfNailWall, SystemConst.upPriceOfNailWall, false, 0, 25, 800);
}
}
}//package handjoys.ca.util
Section 71
//arrowRainButClip (arrowRainButClip)
package {
import flash.display.*;
public dynamic class arrowRainButClip extends MovieClip {
public function arrowRainButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 72
//arrowsFall (arrowsFall)
package {
import handjoys.ca.model.skills.*;
public dynamic class arrowsFall extends arrowsFall {
public function arrowsFall(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 73
//BarrierLayer (BarrierLayer)
package {
import handjoys.ca.model.*;
public dynamic class BarrierLayer extends BarrierLayer {
}
}//package
Section 74
//BoorMovieClip (BoorMovieClip)
package {
import handjoys.ca.model.*;
public dynamic class BoorMovieClip extends boor {
public function BoorMovieClip(){
addFrameScript(24, frame25, 49, frame50);
}
function frame25(){
gotoAndPlay("work");
}
function frame50(){
gotoAndPlay("walk");
}
}
}//package
Section 75
//bow_soldiers (bow_soldiers)
package {
import flash.display.*;
public dynamic class bow_soldiers extends MovieClip {
}
}//package
Section 76
//cannonBall (cannonBall)
package {
import handjoys.ca.model.*;
public dynamic class cannonBall extends Arrow {
public function cannonBall(){
addFrameScript(22, frame23, 99, frame100);
}
function frame23(){
gotoAndPlay("fire");
}
function frame100(){
stop();
}
}
}//package
Section 77
//cannonButClip (cannonButClip)
package {
import flash.display.*;
public dynamic class cannonButClip extends MovieClip {
public function cannonButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 78
//CastleMovieClip (CastleMovieClip)
package {
import handjoys.ca.model.*;
public dynamic class CastleMovieClip extends castle {
public function CastleMovieClip(){
addFrameScript(1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
this.freshSCastleState();
}
function frame4(){
this.freshSCastleState();
stop();
}
function frame2(){
this.freshSCastleState();
}
}
}//package
Section 79
//cyclone (cyclone)
package {
import handjoys.ca.model.skills.*;
public dynamic class cyclone extends cyclone {
}
}//package
Section 80
//cycloneButClip (cycloneButClip)
package {
import flash.display.*;
public dynamic class cycloneButClip extends MovieClip {
public function cycloneButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 81
//enemyBoss (enemyBoss)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemyBoss extends enemyBoss {
public function enemyBoss(){
addFrameScript(0, frame1, 28, frame29, 57, frame58, 112, frame113, 119, frame120, 121, frame122, 125, frame126, 131, frame132, 137, frame138, 157, frame158, 202, frame203);
}
function frame158(){
this.deadFlag = true;
stop();
}
function frame1(){
stop();
}
function frame113(){
this.deadFlag = true;
stop();
}
function frame120(){
this.container.rotation = 15;
}
function frame203(){
this.deadFlag = true;
stop();
}
function frame126(){
this.container.rotation = 35;
this.container.x = (this.container.x - 5);
}
function frame29(){
gotoAndPlay("walk");
}
function frame138(){
this.container.rotation = 90;
this.container.y = (this.container.y - 10);
this.container.x = (this.container.x + 10);
}
function frame132(){
this.container.rotation = 60;
this.container.x = (this.container.x + 5);
this.container.y = (this.container.y - 5);
}
function frame58(){
gotoAndPlay("walk");
}
function frame122(){
this.container.rotation = 30;
}
}
}//package
Section 82
//enemyDragonFire (enemyDragonFire)
package {
import handjoys.ca.model.*;
public dynamic class enemyDragonFire extends Arrow {
}
}//package
Section 83
//enemyFlyingDragon (enemyFlyingDragon)
package {
import handjoys.ca.model.soldiers.*;
import handjoys.ca.util.*;
public dynamic class enemyFlyingDragon extends enemyFlyingDragon {
public var rockInst:enemyDragonFire;
public function enemyFlyingDragon(){
addFrameScript(0, frame1, 13, frame14, 31, frame32, 38, frame39, 69, frame70, 112, frame113, 117, frame118, 119, frame120, 125, frame126, 128, frame129, 131, frame132, 133, frame134, 138, frame139, 173, frame174);
}
function frame70(){
gotoAndPlay("walk");
}
function frame14(){
gotoAndPlay("walk");
}
function frame1(){
stop();
}
function frame174(){
this.deadFlag = true;
stop();
}
function frame39(){
rockInst = new enemyDragonFire();
rockInst.name = "enemyDragonFire";
rockInst.Angle = (((190 + (Math.random() * 20)) / 180) * Math.PI);
rockInst.Speed = (10 + (Math.random() * 15));
rockInst.intDamagePoint = uint((((Cache.CurrentGate + 10) / 10) * 55));
rockInst.side = "enemy";
rockInst.x = (this.x - 30);
rockInst.y = (this.y - 100);
rockInst.fly();
}
function frame113(){
this.deadFlag = true;
stop();
}
function frame120(){
this.container.x = (this.container.x + 5);
}
function frame126(){
this.container.y = (this.container.y + 3);
}
function frame32(){
gotoAndPlay("walk");
}
function frame129(){
this.container.y = (this.container.y + 40);
}
function frame134(){
this.container.y = (this.container.y + 20);
}
function frame132(){
this.container.y = (this.container.y + 70);
}
function frame118(){
this.container.x = (this.container.x + 3);
this.container.y = (this.container.y + 3);
}
function frame139(){
this.deadFlag = true;
stop();
}
}
}//package
Section 84
//enemyKnight (enemyKnight)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemyKnight extends enemyKnight {
public function enemyKnight(){
addFrameScript(0, frame1, 30, frame31, 44, frame45, 67, frame68, 79, frame80, 81, frame82, 83, frame84, 109, frame110, 114, frame115, 116, frame117, 139, frame140, 177, frame178);
}
function frame140(){
this.deadFlag = true;
stop();
}
function frame80(){
this.container.rotation = -14;
}
function frame84(){
this.container.rotation = -60;
}
function frame82(){
this.container.rotation = -29;
}
function frame178(){
this.deadFlag = true;
stop();
}
function frame1(){
stop();
}
function frame110(){
this.deadFlag = true;
stop();
}
function frame117(){
this.container.rotation = -75;
}
function frame115(){
this.container.rotation = -14.9;
}
function frame31(){
gotoAndPlay("walk");
}
function frame45(){
gotoAndPlay("walk");
}
function frame68(){
gotoAndPlay("walk");
}
}
}//package
Section 85
//enemyKnight1 (enemyKnight1)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemyKnight1 extends enemyKnight {
public function enemyKnight1(){
addFrameScript(0, frame1, 30, frame31, 44, frame45, 67, frame68, 79, frame80, 81, frame82, 83, frame84, 109, frame110, 114, frame115, 116, frame117, 139, frame140, 177, frame178);
}
function frame140(){
this.deadFlag = true;
stop();
}
function frame80(){
this.container.rotation = 14;
}
function frame84(){
this.container.rotation = -60;
}
function frame82(){
this.container.rotation = 29;
}
function frame178(){
this.deadFlag = true;
stop();
}
function frame1(){
stop();
}
function frame110(){
this.deadFlag = true;
stop();
}
function frame117(){
this.container.rotation = -75;
}
function frame115(){
this.container.rotation = -14.9;
}
function frame31(){
gotoAndPlay("walk");
}
function frame45(){
gotoAndPlay("walk");
}
function frame68(){
gotoAndPlay("walk");
}
}
}//package
Section 86
//enemyMonk (enemyMonk)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemyMonk extends enemyMonk {
public function enemyMonk(){
addFrameScript(0, frame1, 26, frame27, 46, frame47, 146, frame147, 156, frame157, 159, frame160, 163, frame164, 166, frame167, 195, frame196, 234, frame235, 274, frame275);
}
function frame157(){
this.container.rotation = 30;
}
function frame275(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame160(){
this.container.rotation = 45;
}
function frame164(){
this.container.rotation = 50;
}
function frame167(){
this.container.rotation = 90;
}
function frame1(){
stop();
}
function frame235(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame27(){
gotoAndPlay("walk");
}
function frame196(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame47(){
gotoAndPlay("walk");
}
function frame147(){
gotoAndPlay("walk");
}
}
}//package
Section 87
//enemyRock (enemyRock)
package {
import handjoys.ca.model.*;
public dynamic class enemyRock extends Arrow {
}
}//package
Section 88
//enemyRockThrower (enemyRockThrower)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.geom.*;
import handjoys.ca.model.soldiers.*;
import flash.utils.*;
import flash.text.*;
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 enemyRockThrower extends enemyRockThrower {
public var rockInst:enemyRock;
public function enemyRockThrower(){
addFrameScript(0, frame1, 40, frame41, 51, frame52, 84, frame85, 93, frame94, 137, frame138);
}
function frame85(){
gotoAndPlay("walk");
}
function frame94(){
this.container.alpha = 0.01;
}
function frame1(){
stop();
}
function frame41(){
gotoAndPlay("walk");
}
function frame138(){
this.deadFlag = true;
stop();
}
function frame52(){
rockInst = new enemyRock();
rockInst.angle = ((90 / 180) * Math.PI);
rockInst.Speed = (-20 - (Math.random() * 10));
rockInst.intDamagePoint = 40;
rockInst.side = "enemy";
rockInst.x = (this.x - 30);
rockInst.y = (this.y - 100);
rockInst.fly();
}
}
}//package
Section 89
//enemySoldier01 (enemySoldier01)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemySoldier01 extends enemySoldier01 {
public function enemySoldier01(){
addFrameScript(0, frame1, 24, frame25, 40, frame41, 59, frame60, 65, frame66, 66, frame67, 67, frame68, 68, frame69, 69, frame70, 109, frame110, 133, frame134, 165, frame166);
}
function frame70(){
this.container.rotation = 90;
}
function frame69(){
this.container.rotation = 70;
}
function frame166(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame25(){
gotoAndPlay("walk");
}
function frame1(){
this.container.rotation = 15;
stop();
}
function frame110(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame41(){
gotoAndPlay("walk");
}
function frame134(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame66(){
this.container.rotation = 15;
}
function frame60(){
gotoAndPlay("walk");
}
function frame68(){
this.container.rotation = 40;
}
function frame67(){
this.container.rotation = 30;
}
}
}//package
Section 90
//enemySoldier02 (enemySoldier02)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemySoldier02 extends enemySoldier02 {
public function enemySoldier02(){
addFrameScript(0, frame1, 24, frame25, 51, frame52, 66, frame67, 121, frame122, 125, frame126, 126, frame127, 128, frame129, 130, frame131, 144, frame145, 174, frame175);
}
function frame25(){
gotoAndPlay("walk");
}
function frame1(){
stop();
}
function frame175(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame126(){
this.container.rotation = 15;
}
function frame127(){
this.container.rotation = 45;
}
function frame129(){
this.container.rotation = 75;
}
function frame131(){
this.container.rotation = 90;
}
function frame52(){
gotoAndPlay("walk");
}
function frame122(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame145(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame67(){
gotoAndPlay("walk");
}
}
}//package
Section 91
//enemySoldier03 (enemySoldier03)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class enemySoldier03 extends enemySoldier03 {
public function enemySoldier03(){
addFrameScript(0, frame1, 24, frame25, 40, frame41, 63, frame64, 111, frame112, 116, frame117, 118, frame119, 120, frame121, 122, frame123, 135, frame136, 166, frame167);
}
function frame64(){
gotoAndPlay("walk");
}
function frame167(){
this.deadFlag = true;
stop();
}
function frame25(){
gotoAndPlay("walk");
}
function frame1(){
stop();
}
function frame117(){
this.container.rotation = 30;
}
function frame123(){
this.container.rotation = 90;
}
function frame41(){
gotoAndPlay("walk");
}
function frame119(){
this.container.rotation = 50;
}
function frame121(){
this.container.rotation = 70;
}
function frame136(){
this.deadFlag = true;
stop();
}
function frame112(){
this.deadFlag = true;
stop();
}
}
}//package
Section 92
//farmer (farmer)
package {
import flash.display.*;
public dynamic class farmer extends MovieClip {
}
}//package
Section 93
//fireArrow (fireArrow)
package {
import flash.events.*;
import handjoys.ca.model.*;
public dynamic class fireArrow extends Arrow {
public function fireArrow(){
addFrameScript(5, frame6, 49, frame50);
}
function frame6(){
gotoAndPlay("flying");
}
function frame50(){
stop();
this.removeEventListener(Event.ENTER_FRAME, frameHandle);
if (((!((this.parent == null))) && ((this.currentFrame == this.totalFrames)))){
this.parent.removeChild(this);
trace("===============删除火箭");
};
}
}
}//package
Section 94
//fireArrowButClip (fireArrowButClip)
package {
import flash.display.*;
public dynamic class fireArrowButClip extends MovieClip {
public function fireArrowButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 95
//fireballButClip (fireballButClip)
package {
import flash.display.*;
public dynamic class fireballButClip extends MovieClip {
public function fireballButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 96
//game_loader (game_loader)
package {
import handjoys.ca.model.*;
public dynamic class game_loader extends progressBar {
}
}//package
Section 97
//gameAlert (gameAlert)
package {
import handjoys.ca.model.*;
public dynamic class gameAlert extends gamealert {
}
}//package
Section 98
//gaming_sound (gaming_sound)
package {
import flash.media.*;
public dynamic class gaming_sound extends Sound {
}
}//package
Section 99
//grade01 (grade01)
package {
import flash.display.*;
import flash.text.*;
public dynamic class grade01 extends MovieClip {
public var txtScore:TextField;
public var txtName:TextField;
public var txtDate:TextField;
public var txtIndex:TextField;
}
}//package
Section 100
//grade02 (grade02)
package {
import flash.display.*;
import flash.text.*;
public dynamic class grade02 extends MovieClip {
public var txtScore:TextField;
public var txtName:TextField;
public var txtDate:TextField;
public var txtIndex:TextField;
}
}//package
Section 101
//helpClip (helpClip)
package {
import handjoys.ca.model.*;
public dynamic class helpClip extends helpclass {
}
}//package
Section 102
//iceArrow (iceArrow)
package {
import flash.events.*;
import handjoys.ca.model.*;
public dynamic class iceArrow extends Arrow {
public function iceArrow(){
addFrameScript(5, frame6, 49, frame50);
}
function frame6(){
gotoAndPlay("flying");
}
function frame50(){
stop();
this.removeEventListener(Event.ENTER_FRAME, frameHandle);
if (((!((this.parent == null))) && ((this.currentFrame == this.totalFrames)))){
this.parent.removeChild(this);
trace("===============删除冰箭");
};
}
}
}//package
Section 103
//iceArrowButClip (iceArrowButClip)
package {
import flash.display.*;
public dynamic class iceArrowButClip extends MovieClip {
public function iceArrowButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 104
//InfoDlg01 (InfoDlg01)
package {
import handjoys.ca.model.*;
public dynamic class InfoDlg01 extends InfoDlg {
}
}//package
Section 105
//InfoDlg02 (InfoDlg02)
package {
import handjoys.ca.model.*;
public dynamic class InfoDlg02 extends InfoDlg {
}
}//package
Section 106
//InfoDlg03 (InfoDlg03)
package {
import handjoys.ca.model.*;
public dynamic class InfoDlg03 extends InfoDlg {
}
}//package
Section 107
//IntegralList (IntegralList)
package {
import flash.display.*;
import flash.media.*;
import flash.events.*;
import flash.geom.*;
import handjoys.ca.util.*;
import handjoys.ca.factory.*;
import flash.utils.*;
import handjoys.ca.model.*;
import flash.text.*;
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 IntegralList extends IntegralList {
public var hasNetwork:Boolean;
public function IntegralList(){
addFrameScript(0, frame1);
}
function frame1(){
try {
hasNetwork = MochiAd.fetchHighScores({clip:this, id:"ea280c6316c0e9e7"}, null, gotScores);
if (!hasNetwork){
txtAlertInfo.htmlText = "Local sandbox does not allow network, try playing online.";
};
} catch(e:Error) {
};
}
public function gotScores(_arg1:Array):void{
var _local2:Array;
var _local3:*;
var _local4:int;
var _local5:Array;
txtAlertInfo.visible = false;
_local2 = _arg1;
trace(_arg1.length, "obj.length");
_local4 = 0;
while (_local4 < _local2.length) {
if (_local4 > 9){
break;
};
_local5 = _local2[_local4];
if ((_local4 % 2) == 0){
_local3 = ResourceFactory.getResource("grade01");
} else {
_local3 = ResourceFactory.getResource("grade02");
};
if (_local5[0] == ""){
} else {
_local3.txtName.htmlText = (("<b>" + _local5[0]) + "</b>");
_local3.txtScore.htmlText = (("<b>" + _local5[1]) + "</b>");
_local3.txtDate.htmlText = (("<b>" + SystemUtil.msecToDateString(_local5[2])) + "</b>");
_local3.txtIndex.htmlText = (("<b>" + (_local4 + 1)) + "</b>");
_local3.x = 405;
_local3.y = (180 + (_local4 * 25));
this.addChild(_local3);
};
_local4++;
};
}
}
}//package
Section 108
//knightButClip (knightButClip)
package {
import flash.display.*;
public dynamic class knightButClip extends MovieClip {
public function knightButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 109
//knightGuard (knightGuard)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class knightGuard extends knightGuard {
public function knightGuard(){
addFrameScript(0, frame1, 29, frame30, 50, frame51, 96, frame97, 121, frame122, 133, frame134);
}
function frame97(){
this.deadFlag = true;
stop();
}
function frame1(){
stop();
}
function frame30(){
gotoAndPlay("walk");
}
function frame134(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame122(){
this.deadFlag = true;
stop();
}
}
}//package
Section 110
//lightning (lightning)
package {
import handjoys.ca.model.skills.*;
public dynamic class lightning extends lightning {
public function lightning(){
addFrameScript(80, frame81);
}
function frame81(){
stop();
}
}
}//package
Section 111
//mcArcher (mcArcher)
package {
import handjoys.ca.model.*;
public dynamic class mcArcher extends Archer {
public function mcArcher(){
addFrameScript(0, frame1, 4, frame5, 23, frame24, 41, frame42, 67, frame68, 92, frame93);
}
function frame93(){
this.deadFlag = true;
this.deadHandler();
stop();
}
function frame24(){
gotoAndStop("walk");
}
function frame5(){
}
function frame42(){
gotoAndStop("walk");
}
function frame1(){
stop();
}
function frame68(){
this.deadFlag = true;
this.deadHandler();
stop();
}
}
}//package
Section 112
//mcArrow (mcArrow)
package {
import flash.events.*;
import handjoys.ca.model.*;
public dynamic class mcArrow extends Arrow {
public function mcArrow(){
addFrameScript(7, frame8, 58, frame59);
}
function frame8(){
gotoAndPlay("flying");
}
function frame59(){
stop();
this.removeEventListener(Event.ENTER_FRAME, frameHandle);
if (((!((this.parent == null))) && ((this.currentFrame == this.totalFrames)))){
this.parent.removeChild(this);
trace("===============删除箭");
};
}
}
}//package
Section 113
//nailBoardButClip (nailBoardButClip)
package {
import flash.display.*;
public dynamic class nailBoardButClip extends MovieClip {
public function nailBoardButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 114
//nailWall (nailWall)
package {
import handjoys.ca.model.skills.*;
public dynamic class nailWall extends nailWall {
}
}//package
Section 115
//restartGameClip (restartGameClip)
package {
import handjoys.ca.model.*;
public dynamic class restartGameClip extends restartgame {
}
}//package
Section 116
//rollStone (rollStone)
package {
import handjoys.ca.model.skills.*;
public dynamic class rollStone extends rollStone {
}
}//package
Section 117
//Sence01 (Sence01)
package {
import flash.display.*;
public dynamic class Sence01 extends MovieClip {
}
}//package
Section 118
//Sence02 (Sence02)
package {
import flash.display.*;
public dynamic class Sence02 extends MovieClip {
}
}//package
Section 119
//Sence03 (Sence03)
package {
import flash.display.*;
public dynamic class Sence03 extends MovieClip {
}
}//package
Section 120
//Sence04 (Sence04)
package {
import flash.display.*;
public dynamic class Sence04 extends MovieClip {
}
}//package
Section 121
//Sence05 (Sence05)
package {
import flash.display.*;
public dynamic class Sence05 extends MovieClip {
}
}//package
Section 122
//skillCannon (skillCannon)
package {
import handjoys.ca.model.skills.*;
public dynamic class skillCannon extends skillCannon {
}
}//package
Section 123
//skillFireArrow (skillFireArrow)
package {
import handjoys.ca.model.skills.*;
public dynamic class skillFireArrow extends skillFireArrow {
}
}//package
Section 124
//skillIceArrow (skillIceArrow)
package {
import handjoys.ca.model.skills.*;
public dynamic class skillIceArrow extends skillIceArrow {
}
}//package
Section 125
//startgame_sound (startgame_sound)
package {
import flash.media.*;
public dynamic class startgame_sound extends Sound {
}
}//package
Section 126
//StartGameMovieClip (StartGameMovieClip)
package {
import handjoys.ca.main.*;
public dynamic class StartGameMovieClip extends startgame {
public function StartGameMovieClip(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package
Section 127
//swordGuard (swordGuard)
package {
import handjoys.ca.model.soldiers.*;
public dynamic class swordGuard extends swordGuard {
public function swordGuard(){
addFrameScript(24, frame25, 35, frame36, 53, frame54, 100, frame101, 124, frame125);
}
function frame25(){
gotoAndPlay("walk");
}
function frame101(){
this.deadFlag = true;
stop();
}
function frame36(){
gotoAndPlay("walk");
}
function frame125(){
this.deadFlag = true;
stop();
}
function frame54(){
gotoAndPlay("walk");
}
}
}//package
Section 128
//thunderButClip (thunderButClip)
package {
import flash.display.*;
public dynamic class thunderButClip extends MovieClip {
public function thunderButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 129
//tool01 (tool01)
package {
import handjoys.ca.model.*;
public dynamic class tool01 extends toolButton {
}
}//package
Section 130
//tool02 (tool02)
package {
import handjoys.ca.model.*;
public dynamic class tool02 extends toolButton {
}
}//package
Section 131
//tool03 (tool03)
package {
import handjoys.ca.model.*;
public dynamic class tool03 extends toolButton {
}
}//package
Section 132
//tool04 (tool04)
package {
import handjoys.ca.model.*;
public dynamic class tool04 extends toolButton {
}
}//package
Section 133
//tool05 (tool05)
package {
import handjoys.ca.model.*;
public dynamic class tool05 extends toolButton {
}
}//package
Section 134
//tool06 (tool06)
package {
import handjoys.ca.model.*;
public dynamic class tool06 extends toolButton {
}
}//package
Section 135
//tool07 (tool07)
package {
import handjoys.ca.model.*;
public dynamic class tool07 extends toolButton {
}
}//package
Section 136
//tool08 (tool08)
package {
import handjoys.ca.model.*;
public dynamic class tool08 extends toolButton {
}
}//package
Section 137
//tool09 (tool09)
package {
import handjoys.ca.model.*;
public dynamic class tool09 extends toolButton {
}
}//package
Section 138
//tool10 (tool10)
package {
import handjoys.ca.model.*;
public dynamic class tool10 extends toolButton {
}
}//package
Section 139
//ToolBarClip (ToolBarClip)
package {
import handjoys.ca.model.*;
public dynamic class ToolBarClip extends toolbar {
}
}//package
Section 140
//upgrades (upgrades)
package {
import handjoys.ca.model.*;
public dynamic class upgrades extends upgrades {
}
}//package
Section 141
//warriorButClip (warriorButClip)
package {
import flash.display.*;
public dynamic class warriorButClip extends MovieClip {
public function warriorButClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package