home *** CD-ROM | disk | FTP | other *** search
- package ENGINE.INTERFACE
- {
- import ENGINE.CORE.OGlobal;
- import ENGINE.DISPLAY.IDisplayObject;
- import ENGINE.DISPLAY.OSprite;
- import ENGINE.INTERFACE.ANIMATORS.OAnimatorManager;
- import flash.display.DisplayObject;
- import flash.events.*;
- import flash.geom.Rectangle;
-
- public class OIObject extends OSprite
- {
-
- public static var trActive:uint = 2;
-
- public static var trPress:uint = 16;
-
- public static var trRool:uint = 8;
-
- public static var trFocus:uint = 3;
-
- public static var trVisible:uint = 1;
-
-
- protected var iTrigger:uint;
-
- protected var iAEnabled:Boolean = true;
-
- protected var iAManager:OAnimatorManager;
-
- protected var iState:int;
-
- protected var iAParams:Array;
-
- protected var iParam:Array;
-
- public function OIObject(param1:Array, param2:Array = null)
- {
- iTrigger = trVisible | trActive;
- iAEnabled = true;
- super();
- this.iParam = param1;
- this.iAParams = param2;
- this.Init();
- }
-
- public function get prMouseEnabled() : Boolean
- {
- return this.prVisible && this.prActive;
- }
-
- public function get prRool() : Boolean
- {
- return (this.iTrigger & trRool) > 0;
- }
-
- public function set prFocus(param1:Boolean) : void
- {
- if(param1)
- {
- this.iTrigger |= trFocus;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anFocusIn]);
- }
- }
- else
- {
- this.iTrigger &= ~trFocus;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anFocusOut]);
- }
- }
- }
-
- override public function get prVisible() : Boolean
- {
- return (this.iTrigger & trVisible) > 0;
- }
-
- public function set prRool(param1:Boolean) : void
- {
- if(param1)
- {
- this.iTrigger |= trRool;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anRoolOver]);
- }
- }
- else
- {
- this.iTrigger &= ~trRool;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anRoolOut]);
- }
- }
- }
-
- override public function set prVisible(param1:Boolean) : void
- {
- if(param1)
- {
- this.iTrigger |= trVisible;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anShow],false);
- }
- }
- else
- {
- this.iTrigger &= ~trVisible;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anHide],false);
- }
- }
- if(!this.iAManager || !this.iAEnabled)
- {
- this.visible = param1;
- }
- this.mouseEnabled = this.prMouseEnabled;
- this.mouseChildren = this.mouseEnabled;
- }
-
- public function OnRollOver(param1:MouseEvent) : void
- {
- this.prRool = true;
- }
-
- public function Init() : void
- {
- var _loc1_:int = 0;
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- var _loc4_:DisplayObject = null;
- var _loc5_:String = null;
- if(this.iParam)
- {
- _loc1_ = int(this.iParam.length);
- _loc2_ = 0;
- while(_loc2_ < _loc1_)
- {
- _loc3_ = int(this.iParam[_loc2_].length);
- _loc4_ = this.iParam[_loc2_][0](this.iParam[_loc2_]);
- if(_loc5_ = String(this.iParam[_loc2_][_loc3_ - 3]))
- {
- if(this[_loc5_] is Array)
- {
- this[_loc5_][this.iParam[_loc2_][_loc3_ - 2]] = _loc4_;
- }
- else
- {
- this[_loc5_] = _loc4_;
- }
- }
- if(_loc4_ is OIObject)
- {
- (_loc4_ as OIObject).SetVisible(this.iParam[_loc2_][_loc3_ - 1]);
- }
- else if(_loc4_ is IDisplayObject)
- {
- (_loc4_ as IDisplayObject).prVisible = this.iParam[_loc2_][_loc3_ - 1];
- }
- else
- {
- _loc4_.visible = this.iParam[_loc2_][_loc3_ - 1];
- }
- this.addChild(_loc4_);
- _loc2_++;
- }
- }
- this.iAManager = !!this.iAParams ? new OAnimatorManager(this) : null;
- this.tabEnabled = false;
- this.addEventListener(Event.ENTER_FRAME,OnEnterFrame);
- this.addEventListener(MouseEvent.ROLL_OVER,OnRollOver);
- this.addEventListener(MouseEvent.ROLL_OUT,OnRollOut);
- this.addEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
- this.addEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
- }
-
- public function get prAnimationEnabled() : Boolean
- {
- return this.iAEnabled;
- }
-
- public function set prActive(param1:Boolean) : void
- {
- if(param1)
- {
- this.iTrigger |= trActive;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anActivate]);
- }
- }
- else
- {
- this.iTrigger &= ~trActive;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anDeactivate]);
- }
- }
- this.mouseEnabled = this.prMouseEnabled;
- this.mouseChildren = this.mouseEnabled;
- }
-
- public function OnMouseUp(param1:MouseEvent) : void
- {
- this.prPress = false;
- }
-
- public function get prPress() : Boolean
- {
- return (this.iTrigger & trPress) > 0;
- }
-
- public function get State() : int
- {
- return this.iState;
- }
-
- public function OnPress(param1:Event, param2:*) : void
- {
- }
-
- public function OnRollOut(param1:MouseEvent) : void
- {
- this.prRool = false;
- }
-
- override public function Free() : void
- {
- this.removeEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
- this.removeEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
- this.removeEventListener(MouseEvent.ROLL_OUT,OnRollOut);
- this.removeEventListener(MouseEvent.ROLL_OVER,OnRollOver);
- this.removeEventListener(Event.ENTER_FRAME,OnEnterFrame);
- super.Free();
- if(this.iAManager)
- {
- this.iAManager.Free();
- }
- this.iAManager = null;
- }
-
- public function get prAnimation() : Boolean
- {
- var _loc1_:int = 0;
- if(Boolean(this.iAManager) && this.iAManager.prAnimation)
- {
- return true;
- }
- _loc1_ = 0;
- while(_loc1_ < this.numChildren)
- {
- if(this.getChildAt(_loc1_) is OIObject)
- {
- if((this.getChildAt(_loc1_) as OIObject).prAnimation)
- {
- return true;
- }
- }
- _loc1_++;
- }
- return false;
- }
-
- public function get prActive() : Boolean
- {
- return (this.iTrigger & trActive) > 0;
- }
-
- public function PosCenter(param1:Number = 800, param2:Number = 600) : void
- {
- var _loc3_:Rectangle = null;
- _loc3_ = this.getBounds(this);
- this.Pos(OGlobal.ScaleFloor((param1 - this.prWidth - OGlobal.ToLocal(_loc3_.x) * 2) / 2),OGlobal.ScaleFloor((param2 - this.prHeight - OGlobal.ToLocal(_loc3_.y) * 2) / 2));
- }
-
- public function AddAnimator(param1:Object, param2:Boolean = true) : void
- {
- var _loc3_:Boolean = false;
- _loc3_ = param2 ? Boolean(this.iAManager) && this.prVisible && this.iAEnabled : Boolean(this.iAManager) && this.iAEnabled;
- if(_loc3_)
- {
- this.iAManager.AddAnimator(param1);
- }
- }
-
- public function set prAnimationEnabled(param1:Boolean) : void
- {
- this.iAEnabled = param1;
- }
-
- public function set prPress(param1:Boolean) : void
- {
- if(param1)
- {
- this.iTrigger |= trPress;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anPress]);
- }
- }
- else
- {
- this.iTrigger &= ~trPress;
- if(this.iAManager)
- {
- this.AddAnimator(this.iAParams[OAnimatorManager.anUnpress]);
- }
- }
- }
-
- public function OnMouseDown(param1:MouseEvent) : void
- {
- this.prPress = true;
- }
-
- public function OnEnterFrame(param1:Event) : void
- {
- if(this.iAManager)
- {
- this.iAManager.OnEnterFrame();
- }
- }
-
- public function SetVisible(param1:Boolean) : void
- {
- this.prAnimationEnabled = false;
- this.prVisible = param1;
- this.prAnimationEnabled = true;
- }
-
- public function set prAnimatorParams(param1:Array) : void
- {
- this.iAParams = param1;
- if(!this.iAManager)
- {
- this.iAManager = new OAnimatorManager(this);
- }
- }
-
- public function set State(param1:int) : void
- {
- this.iState = param1;
- }
-
- public function get prAnimatorParams() : Array
- {
- return this.iAParams;
- }
-
- public function get prFocus() : Boolean
- {
- return (this.iTrigger & trFocus) > 0;
- }
- }
- }
-