home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 161 / MOBICLIC161.ISO / pc / DATA / DSS161 / DSS161_00 / DSS161_00.swf / scripts / dss161 / engineaddons / gamesprotos / actors / actorClip / ActorClip.as next >
Text File  |  2014-01-15  |  43KB  |  1,356 lines

  1. package dss161.engineaddons.gamesprotos.actors.actorClip
  2. {
  3.    import com.milanpresse.engine.medias.MediaSwf;
  4.    import com.milanpresse.engine.typeargument.NoiseObject;
  5.    import com.milanpresse.tools.GlobalesFunctions;
  6.    import dss161.engineaddons.facades.GameEngine;
  7.    import dss161.engineaddons.gamesprotos.Actor;
  8.    import dss161.engineaddons.gamesprotos.CollisionTest;
  9.    import dss161.engineaddons.gamesprotos.DragDropParams;
  10.    import dss161.engineaddons.timelines.TimelineController;
  11.    import dss161.engineaddons.timelines.TimelineLinear;
  12.    import dss161.engineaddons.timers.TimerChild;
  13.    import flash.display.DisplayObject;
  14.    import flash.display.DisplayObjectContainer;
  15.    import flash.display.MovieClip;
  16.    import flash.events.Event;
  17.    import flash.events.MouseEvent;
  18.    import flash.events.TimerEvent;
  19.    import flash.geom.Point;
  20.    import flash.geom.Rectangle;
  21.    import flash.utils.Timer;
  22.    import flash.utils.getTimer;
  23.    
  24.    public dynamic class ActorClip extends Actor implements IActorClip
  25.    {
  26.        
  27.       
  28.       protected var _clip:MovieClip;
  29.       
  30.       protected var _initialState:Object;
  31.       
  32.       protected var _lastClickState:Object;
  33.       
  34.       protected var _timeline:TimelineLinear;
  35.       
  36.       protected var _timelineController:TimelineController;
  37.       
  38.       protected var _onClickState:Object;
  39.       
  40.       protected var _onRollOverState:Object;
  41.       
  42.       protected var _onRollOutState:Object;
  43.       
  44.       protected var _onClick:Function = null;
  45.       
  46.       protected var _onRollOver:Function = null;
  47.       
  48.       protected var _onRollOut:Function = null;
  49.       
  50.       protected var _onRelease:Function = null;
  51.       
  52.       protected var _onDragStart:Function = null;
  53.       
  54.       protected var _onDrag:Function = null;
  55.       
  56.       protected var _onDrop:Function = null;
  57.       
  58.       protected var _clickMode:String = "ondown";
  59.       
  60.       protected var _interactiveZone:MovieClip;
  61.       
  62.       protected var _dragDrop:DragDropParams;
  63.       
  64.       protected var dragTimer:Timer;
  65.       
  66.       protected var _limitZone = null;
  67.       
  68.       protected var _dragEnabled:Boolean = false;
  69.       
  70.       protected var _collision:Object;
  71.       
  72.       public var collisionTest:CollisionTest;
  73.       
  74.       protected var hitTestDistanceParams:Object;
  75.       
  76.       public var hitZones:Array;
  77.       
  78.       private var playLabelTemp:Object;
  79.       
  80.       protected var _onFrameExit:Function = null;
  81.       
  82.       protected var _onFrameEnter:Function = null;
  83.       
  84.       protected var _onLabelEnter:Function = null;
  85.       
  86.       protected var _onLabelExit:Function = null;
  87.       
  88.       public function ActorClip(param1:DisplayObject, param2:GameEngine, param3:Object = null)
  89.       {
  90.          var _loc4_:* = null;
  91.          var _loc5_:Boolean = false;
  92.          this._onClickState = {};
  93.          this._onRollOverState = {};
  94.          this._onRollOutState = {};
  95.          this._dragDrop = new DragDropParams();
  96.          this.dragTimer = new Timer(10);
  97.          this._collision = {
  98.             "type":"object",
  99.             "testFunc":this.hitTestObjects
  100.          };
  101.          this.hitTestDistanceParams = {"distanceMini":100000};
  102.          this.hitZones = [];
  103.          this.playLabelTemp = {
  104.             "firstFrameOrLabel":0,
  105.             "lastFrameOrLabel":null,
  106.             "callback":null
  107.          };
  108.          super(param2,param3.parentActor == undefined ? null : param3.parentActor);
  109.          this._clip = this._interactiveZone = param1 as MovieClip;
  110.          this.initialState = {
  111.             "x":this._clip.x,
  112.             "y":this._clip.y,
  113.             "scaleX":this._clip.scaleX,
  114.             "scaleY":this._clip.scaleY,
  115.             "parent":this._clip.parent,
  116.             "depthIndex":(this._clip.parent == null ? -1 : this._clip.parent.getChildIndex(this._clip))
  117.          };
  118.          if(param3.parent != undefined && this._clip.parent != param3.parent)
  119.          {
  120.             param3.parent.addChild(this._clip);
  121.          }
  122.          if(this._clip is MovieClip)
  123.          {
  124.             this.hitZones = this.getHitZones(this._clip);
  125.             _name = this._clip.name;
  126.             this._timeline = new TimelineLinear(this._clip,_e.engine,this,_e.timelineManager,{});
  127.             this._timelineController = new TimelineController(this._clip,_e.engine,this,_e.timelineManager);
  128.             this.collisionTest = new CollisionTest(this);
  129.             this.gotoAndStop({"labelStop":1});
  130.          }
  131.          if(param3 != null)
  132.          {
  133.             for(_loc4_ in param3)
  134.             {
  135.                if(_loc4_ != "mc" && _loc4_ != "onClickState" && _loc4_ != "onRollOverState" && _loc4_ != "onRollOutState" && _loc4_ != "enabled")
  136.                {
  137.                   this[_loc4_] = param3[_loc4_];
  138.                }
  139.             }
  140.             _loc5_ = param3.onClickState || param3.onRollOverState || param3.onRollOutState || param3.enabled != undefined;
  141.             if(_loc5_)
  142.             {
  143.                this.stateChange("onClickState",param3.onClickState);
  144.                this.stateChange("onRollOutState",param3.onRollOutState);
  145.                this.stateChange("onRollOverState",param3.onRollOverState);
  146.                this.initAs();
  147.             }
  148.             if(param3.enabled != undefined)
  149.             {
  150.                this.enabled = param3.enabled;
  151.             }
  152.          }
  153.       }
  154.       
  155.       public static function create(param1:GameEngine, param2:*) : ActorClip
  156.       {
  157.          var _loc3_:MovieClip = null;
  158.          if(param2.mc != undefined)
  159.          {
  160.             _loc3_ = param2.mc;
  161.             if(_loc3_ == null)
  162.             {
  163.                return null;
  164.             }
  165.          }
  166.          else if(param2.id != undefined)
  167.          {
  168.             _loc3_ = (param1.engine.getMedia(param2) as MediaSwf).swfContent as MovieClip;
  169.             if(_loc3_ == null)
  170.             {
  171.                return null;
  172.             }
  173.          }
  174.          else if(param2.code != undefined)
  175.          {
  176.             _loc3_ = (param1.engine.getMediaSwf(param2.code) as MediaSwf).swfContent as MovieClip;
  177.             if(_loc3_ == null)
  178.             {
  179.                return null;
  180.             }
  181.          }
  182.          else if(param2.name != undefined)
  183.          {
  184.             _loc3_ = (param1.engine.getMediaSwf(param2.name) as MediaSwf).swfContent as MovieClip;
  185.             if(_loc3_ == null)
  186.             {
  187.                return null;
  188.             }
  189.          }
  190.          if(_loc3_ == null)
  191.          {
  192.             return null;
  193.          }
  194.          return new ActorClip(_loc3_,param1,param2);
  195.       }
  196.       
  197.       public function getGlobalCoord() : Point
  198.       {
  199.          return this._clip.parent.localToGlobal(new Point(this._clip.x,this._clip.y));
  200.       }
  201.       
  202.       public function getObjectCoordToLocal(param1:DisplayObject) : Point
  203.       {
  204.          return this._clip.parent.globalToLocal(param1.parent.localToGlobal(new Point(param1.x,param1.y)));
  205.       }
  206.       
  207.       public function setToDO(param1:DisplayObject) : void
  208.       {
  209.          var _loc2_:Point = param1.parent.localToGlobal(this.getLocPoint(param1));
  210.          _loc2_ = this.parent.globalToLocal(_loc2_);
  211.          this.x = _loc2_.x;
  212.          this.y = _loc2_.y;
  213.       }
  214.       
  215.       public function setToLocalPos(param1:Number, param2:Number, param3:Number, param4:Function) : void
  216.       {
  217.          var posInitial:Point = null;
  218.          var startTime:Number = NaN;
  219.          var tempTime:Number = NaN;
  220.          var timer:TimerChild = null;
  221.          var xDest:Number = param1;
  222.          var yDest:Number = param2;
  223.          var time:Number = param3;
  224.          var callback:Function = param4;
  225.          posInitial = this.getLocPoint(this._clip);
  226.          startTime = getTimer();
  227.          tempTime = getTimer();
  228.          timer = game.mainTimer.addFromObj({
  229.             "id":"tween1",
  230.             "delay":10,
  231.             "loop":0,
  232.             "onDelay":function(param1:TimerChild = null):void
  233.             {
  234.                tempTime = getTimer();
  235.                clip.x = posInitial.x + (tempTime - startTime) / time * (xDest - posInitial.x);
  236.                clip.y = posInitial.y + (tempTime - startTime) / time * (yDest - posInitial.y);
  237.                if(tempTime - startTime >= time)
  238.                {
  239.                   clip.x = xDest;
  240.                   clip.y = yDest;
  241.                   timer.stop();
  242.                   callback();
  243.                }
  244.             }
  245.          });
  246.          timer.start();
  247.       }
  248.       
  249.       public function setToActorClip(param1:ActorClip) : void
  250.       {
  251.          var _loc2_:Point = this._clip.parent.globalToLocal(param1.getGlobalCoord());
  252.          this.x = _loc2_.x;
  253.          this.y = _loc2_.y;
  254.       }
  255.       
  256.       public function getLocPoint(param1:DisplayObject) : Point
  257.       {
  258.          return new Point(param1.x,param1.y);
  259.       }
  260.       
  261.       public function getPos(param1:String = null) : Point
  262.       {
  263.          var _loc2_:DisplayObject = null;
  264.          if(param1 != null && this._clip.getChildByName(param1) != null)
  265.          {
  266.             _loc2_ = this._clip.getChildByName(param1);
  267.             return this._clip.localToGlobal(new Point(_loc2_.x,_loc2_.y));
  268.          }
  269.          return this._clip.parent.localToGlobal(this.getLocPoint(this._clip));
  270.       }
  271.       
  272.       public function getBounds(param1:DisplayObject) : Rectangle
  273.       {
  274.          return this._clip.getRect(param1);
  275.       }
  276.       
  277.       public function bringToFront() : void
  278.       {
  279.          if(this.parent != null && this._clip != null)
  280.          {
  281.             this.parent.setChildIndex(this._clip,this.parent.numChildren - 1);
  282.          }
  283.       }
  284.       
  285.       public function setToPos(param1:Number = 0, param2:Number = 0, param3:String = null) : void
  286.       {
  287.          var _loc5_:Point = null;
  288.          var _loc6_:DisplayObject = null;
  289.          var _loc7_:Rectangle = null;
  290.          var _loc8_:* = undefined;
  291.          var _loc9_:Point = null;
  292.          var _loc4_:Point = this._clip.parent.globalToLocal(new Point(param1,param2));
  293.          if(param3 != null && this._clip.getChildByName(param3) != null)
  294.          {
  295.             _loc5_ = new Point(this._clip.x,this._clip.y);
  296.             _loc6_ = this._clip.getChildByName(param3);
  297.             _loc4_ = _loc5_.add(_loc4_.subtract(this._clip.parent.globalToLocal(this._clip.localToGlobal(new Point(_loc6_.x,_loc6_.y)))));
  298.          }
  299.          if(this._limitZone != null)
  300.          {
  301.             this._clip.x = _loc4_.x;
  302.             this._clip.y = _loc4_.y;
  303.             if((_loc8_ = this._clip.getChildByName("BTN")) != null)
  304.             {
  305.                _loc7_ = _loc8_.getBounds(_e.stage);
  306.                if(_loc7_.x < this._limitZone.x)
  307.                {
  308.                   _loc9_ = new Point(_loc7_.x,_loc7_.y).subtract(new Point(this._limitZone.x,this._limitZone.y));
  309.                   _loc4_.x -= _loc9_.x * this._clip.scaleX;
  310.                }
  311.                else if(_loc7_.x > this._limitZone.x + this._limitZone.width - _loc7_.width)
  312.                {
  313.                   _loc9_ = new Point(_loc7_.x + _loc7_.width,_loc7_.y).subtract(new Point(this._limitZone.x + this._limitZone.width,this._limitZone.height));
  314.                   _loc4_.x -= _loc9_.x * this._clip.scaleX;
  315.                }
  316.                if(_loc7_.y < this._limitZone.y)
  317.                {
  318.                   _loc4_.y -= this._clip.scaleY * new Point(_loc7_.x,_loc7_.y).subtract(new Point(this._limitZone.x,this._limitZone.y)).y;
  319.                }
  320.                else if(_loc7_.y > this._limitZone.y + this._limitZone.height - _loc7_.height)
  321.                {
  322.                   _loc4_.y -= this._clip.scaleY * new Point(_loc7_.x,_loc7_.y + _loc7_.height).subtract(new Point(this._limitZone.width,this._limitZone.y + this._limitZone.height)).y;
  323.                }
  324.             }
  325.             else
  326.             {
  327.                _loc7_ = this._clip.getBounds(_e.stage);
  328.                if(_loc7_.x < this._limitZone.x)
  329.                {
  330.                   _loc4_.x -= this._clip.parent.globalToLocal(new Point(_loc7_.x,_loc7_.y)).x - this._clip.parent.globalToLocal(new Point(this._limitZone.x,this._limitZone.y)).x;
  331.                }
  332.                else if(_loc7_.x > this._limitZone.x + this._limitZone.width - _loc7_.width)
  333.                {
  334.                   _loc4_.x -= this._clip.parent.globalToLocal(new Point(_loc7_.x + _loc7_.width,_loc7_.y)).x - this._clip.parent.globalToLocal(new Point(this._limitZone.x + this._limitZone.width,this._limitZone.height)).x;
  335.                }
  336.                if(_loc7_.y < this._limitZone.y)
  337.                {
  338.                   _loc4_.y -= this._clip.parent.globalToLocal(new Point(_loc7_.x,_loc7_.y)).y - this._clip.parent.globalToLocal(new Point(this._limitZone.x,this._limitZone.y)).y;
  339.                }
  340.                else if(_loc7_.y > this._limitZone.y + this._limitZone.height - _loc7_.height)
  341.                {
  342.                   _loc4_.y -= this._clip.parent.globalToLocal(new Point(_loc7_.x,_loc7_.y + _loc7_.height)).y - this._clip.parent.globalToLocal(new Point(this._limitZone.width,this._limitZone.y + this._limitZone.height)).y;
  343.                }
  344.             }
  345.          }
  346.          this._clip.x = _loc4_.x;
  347.          this._clip.y = _loc4_.y;
  348.       }
  349.       
  350.       public function initAs(param1:* = null) : void
  351.       {
  352.          this.initCommonStateActions(this.onRollOutState);
  353.          this.initCommonStateActions(this.onClickState);
  354.          this.initCommonStateActions(this.onRollOverState);
  355.          if(this._clip.BTN != undefined)
  356.          {
  357.             this._interactiveZone = this._clip.BTN;
  358.             this._interactiveZone.alpha = 0;
  359.          }
  360.          if(this._clip.getChildByName("BTN") != null)
  361.          {
  362.             this._interactiveZone = this._clip.BTN;
  363.             this._interactiveZone.alpha = 0;
  364.          }
  365.          else
  366.          {
  367.             this._interactiveZone = this._clip;
  368.          }
  369.          this.gotoAndStop(this.onRollOutState.label == undefined ? 1 : this.onRollOutState.label);
  370.          this.addListeners();
  371.       }
  372.       
  373.       protected function addListeners() : void
  374.       {
  375.          this.removeListeners();
  376.          if(this._clickMode == "ondown")
  377.          {
  378.             this._interactiveZone.addEventListener(MouseEvent.MOUSE_DOWN,this.clickHandler);
  379.          }
  380.          else
  381.          {
  382.             this._interactiveZone.addEventListener(MouseEvent.CLICK,this.clickHandler);
  383.          }
  384.          this._interactiveZone.addEventListener(MouseEvent.MOUSE_UP,this.releaseHandler);
  385.          this._interactiveZone.addEventListener(MouseEvent.ROLL_OVER,this.rollOverHandler);
  386.          this._interactiveZone.addEventListener(MouseEvent.ROLL_OUT,this.rollOutHandler);
  387.          (this._interactiveZone as MovieClip).mouseChildren = false;
  388.       }
  389.       
  390.       protected function removeListeners() : void
  391.       {
  392.          if(this._interactiveZone != null)
  393.          {
  394.             this._interactiveZone.removeEventListener(MouseEvent.MOUSE_DOWN,this.clickHandler);
  395.             this._interactiveZone.removeEventListener(MouseEvent.CLICK,this.clickHandler);
  396.             this._interactiveZone.removeEventListener(MouseEvent.MOUSE_UP,this.releaseHandler);
  397.             this._interactiveZone.removeEventListener(MouseEvent.ROLL_OVER,this.rollOverHandler);
  398.             this._interactiveZone.removeEventListener(MouseEvent.ROLL_OUT,this.rollOutHandler);
  399.          }
  400.       }
  401.       
  402.       protected function clickHandler(param1:MouseEvent) : void
  403.       {
  404.          var _loc2_:int = 0;
  405.          if(this._clip.enabled == false)
  406.          {
  407.             return;
  408.          }
  409.          this._clip.enabled = false;
  410.          if(this._dragEnabled)
  411.          {
  412.             game.stage.addEventListener(MouseEvent.MOUSE_UP,this.releaseHandler);
  413.             this.dragStart();
  414.             if(this.onClickState.actions != undefined)
  415.             {
  416.                _loc2_ = 0;
  417.                while(_loc2_ < this.onClickState.actions.length)
  418.                {
  419.                   if(this.onClickState.actions[_loc2_].args != null)
  420.                   {
  421.                      this.onClickState.actions[_loc2_].method(this.onClickState.actions[_loc2_].args);
  422.                   }
  423.                   else
  424.                   {
  425.                      this.onClickState.actions[_loc2_].method();
  426.                   }
  427.                   _loc2_++;
  428.                }
  429.             }
  430.          }
  431.          else
  432.          {
  433.             if(this.onClickState.actions != undefined)
  434.             {
  435.                _loc2_ = 0;
  436.                while(_loc2_ < this.onClickState.actions.length)
  437.                {
  438.                   if(this.onClickState.actions[_loc2_].args != null)
  439.                   {
  440.                      this.onClickState.actions[_loc2_].method(this.onClickState.actions[_loc2_].args);
  441.                   }
  442.                   else
  443.                   {
  444.                      this.onClickState.actions[_loc2_].method();
  445.                   }
  446.                   _loc2_++;
  447.                }
  448.             }
  449.             this._clip.enabled = true;
  450.          }
  451.          if(this._onClick != null)
  452.          {
  453.             this._onClick(this);
  454.          }
  455.          param1.updateAfterEvent();
  456.       }
  457.       
  458.       public function dragStart() : void
  459.       {
  460.          if(this._dragDrop.isDragging == false)
  461.          {
  462.             this._dragDrop.isDragging = true;
  463.             this._lastClickState = {
  464.                "x":this._clip.x,
  465.                "y":this._clip.y,
  466.                "scaleX":this._clip.scaleX,
  467.                "scaleY":this._clip.scaleY,
  468.                "parent":this._clip.parent,
  469.                "depthIndex":(this._clip.parent == null ? -1 : this._clip.parent.getChildIndex(this._clip))
  470.             };
  471.             this.dragTimer.addEventListener(TimerEvent.TIMER,this.dragHandler);
  472.             this.dragTimer.start();
  473.             if(this.onDragStart != null)
  474.             {
  475.                this.onDragStart(this);
  476.             }
  477.          }
  478.       }
  479.       
  480.       public function setCollision(param1:String, param2:Object = null) : void
  481.       {
  482.          switch(param1)
  483.          {
  484.             case "distance":
  485.                this._collision.type = "distance";
  486.                this._collision.testFunc = this.hitTestDistance;
  487.                if(param2 != null)
  488.                {
  489.                   this.hitTestDistanceParams = param2;
  490.                }
  491.                break;
  492.             case "object":
  493.                this._collision.type = "object";
  494.                this._collision.testFunc = this.hitTestObjects;
  495.          }
  496.       }
  497.       
  498.       public function getNearestClip(param1:Array) : *
  499.       {
  500.          var _loc8_:Point = null;
  501.          var _loc2_:Number = -1;
  502.          var _loc3_:Number = 0;
  503.          var _loc4_:* = null;
  504.          var _loc5_:Point = this.getLocPoint(this._clip);
  505.          var _loc6_:Point = new Point(0,0);
  506.          var _loc7_:int = 0;
  507.          while(_loc7_ < param1.length)
  508.          {
  509.             _loc8_ = new Point(param1[_loc7_].x,param1[_loc7_].y);
  510.             _loc5_ = this.getPos();
  511.             _loc6_ = param1[_loc7_].parent.localToGlobal(_loc8_);
  512.             _loc3_ = Point.distance(_loc5_,_loc6_);
  513.             if(_loc3_ <= this.hitTestDistanceParams.distanceMini && (_loc2_ < 0 || _loc3_ < _loc2_))
  514.             {
  515.                _loc2_ = _loc3_;
  516.                _loc4_ = param1[_loc7_];
  517.             }
  518.             _loc7_++;
  519.          }
  520.          return _loc4_;
  521.       }
  522.       
  523.       protected function hitTestDistance(param1:Array) : *
  524.       {
  525.          var _loc7_:Point = null;
  526.          var _loc2_:Number = -1;
  527.          var _loc3_:Number = 0;
  528.          var _loc4_:* = null;
  529.          var _loc5_:Point = this.getLocPoint(this._clip);
  530.          var _loc6_:Point = new Point(0,0);
  531.          var _loc8_:int = 0;
  532.          while(_loc8_ < param1.length)
  533.          {
  534.             if(param1[_loc8_].getChildByName("REP_CENTRE") != null)
  535.             {
  536.                _loc7_ = new Point(param1[_loc8_].getChildByName("REP_CENTRE").x,param1[_loc8_].getChildByName("REP_CENTRE").y);
  537.                _loc7_ = param1[_loc8_].clip.localToGlobal(_loc7_);
  538.                _loc7_ = param1[_loc8_].parent.globalToLocal(_loc7_);
  539.             }
  540.             else
  541.             {
  542.                _loc7_ = new Point(param1[_loc8_].x,param1[_loc8_].y);
  543.             }
  544.             _loc6_.x = _loc7_.x;
  545.             _loc6_.y = _loc7_.y;
  546.             _loc3_ = Point.distance(_loc5_,_loc6_);
  547.             if(_loc3_ <= this.hitTestDistanceParams.distanceMini && (_loc2_ < 0 || _loc3_ < _loc2_))
  548.             {
  549.                _loc2_ = _loc3_;
  550.                _loc4_ = param1[_loc8_];
  551.             }
  552.             _loc8_++;
  553.          }
  554.          return _loc4_;
  555.       }
  556.       
  557.       protected function getHitZones(param1:DisplayObjectContainer) : Array
  558.       {
  559.          var _loc4_:DisplayObject = null;
  560.          var _loc5_:int = 0;
  561.          var _loc2_:Array = [];
  562.          var _loc3_:DisplayObjectContainer = param1.getChildByName("HIT_AREA") as DisplayObjectContainer;
  563.          if(_loc3_ != null && _loc3_.numChildren > 0)
  564.          {
  565.             _loc3_.alpha = 0;
  566.             _loc5_ = 0;
  567.             while(_loc5_ < _loc3_.numChildren)
  568.             {
  569.                _loc4_ = _loc3_.getChildAt(_loc5_);
  570.                if(_loc4_.name.search(/^REP_AREA/) != -1)
  571.                {
  572.                   _loc2_.push(_loc4_);
  573.                }
  574.                _loc5_++;
  575.             }
  576.          }
  577.          return _loc2_;
  578.       }
  579.       
  580.       protected function hitTestObjects(param1:Array) : *
  581.       {
  582.          var _loc2_:DisplayObject = null;
  583.          var _loc3_:DisplayObject = null;
  584.          var _loc4_:int = 0;
  585.          var _loc5_:int = 0;
  586.          var _loc6_:int = 0;
  587.          var _loc7_:Array = [];
  588.          if(this.hitZones.length > 0)
  589.          {
  590.             _loc4_ = 0;
  591.             while(_loc4_ < this.hitZones.length)
  592.             {
  593.                _loc2_ = this.hitZones[_loc4_];
  594.                _loc5_ = 0;
  595.                while(_loc5_ < param1.length)
  596.                {
  597.                   if(param1[_loc5_].hitZones.length > 0)
  598.                   {
  599.                      _loc6_ = 0;
  600.                      while(_loc6_ < param1[_loc5_].hitZones.length)
  601.                      {
  602.                         _loc3_ = param1[_loc5_].hitZones[_loc6_];
  603.                         if(_loc2_.hitTestObject(_loc3_))
  604.                         {
  605.                            _loc7_.push(param1[_loc5_]);
  606.                         }
  607.                         _loc6_++;
  608.                      }
  609.                   }
  610.                   else if(_loc2_.hitTestObject(param1[_loc5_].clip))
  611.                   {
  612.                      _loc7_.push(param1[_loc5_]);
  613.                   }
  614.                   _loc5_++;
  615.                }
  616.                _loc4_++;
  617.             }
  618.             return this.getNearestClip(_loc7_);
  619.          }
  620.          _loc5_ = 0;
  621.          while(_loc5_ < param1.length)
  622.          {
  623.             if(param1[_loc5_].hitZones.length > 0)
  624.             {
  625.                _loc6_ = 0;
  626.                while(_loc6_ < param1[_loc5_].hitZones.length)
  627.                {
  628.                   _loc3_ = param1[_loc5_].hitZones[_loc6_];
  629.                   if(this._clip.hitTestObject(_loc3_))
  630.                   {
  631.                      _loc7_.push(param1[_loc5_]);
  632.                   }
  633.                   _loc6_++;
  634.                }
  635.             }
  636.             else if(this._clip.hitTestObject(param1[_loc5_].clip))
  637.             {
  638.                _loc7_.push(param1[_loc5_]);
  639.             }
  640.             _loc5_++;
  641.          }
  642.          return this.getNearestClip(_loc7_);
  643.       }
  644.       
  645.       protected function dragHandler(param1:TimerEvent) : void
  646.       {
  647.          this._dragDrop.dropTarget = this._collision.testFunc(this._dragDrop.dropTargets);
  648.          if(this._onDrag != null)
  649.          {
  650.             this._onDrag(this);
  651.          }
  652.          param1.updateAfterEvent();
  653.       }
  654.       
  655.       protected function rollOverHandler(param1:MouseEvent) : void
  656.       {
  657.          var _loc2_:int = 0;
  658.          if(this._clip.enabled == false)
  659.          {
  660.             return;
  661.          }
  662.          if(this.onRollOverState.actions != undefined)
  663.          {
  664.             this._clip.enabled = false;
  665.             this._interactiveZone.removeEventListener(MouseEvent.ROLL_OVER,this.rollOverHandler);
  666.             _loc2_ = 0;
  667.             while(_loc2_ < this.onRollOverState.actions.length)
  668.             {
  669.                if(this.onRollOverState.actions[_loc2_].args != null)
  670.                {
  671.                   this.onRollOverState.actions[_loc2_].method(this.onRollOverState.actions[_loc2_].args);
  672.                }
  673.                else
  674.                {
  675.                   this.onRollOverState.actions[_loc2_].method();
  676.                }
  677.                _loc2_++;
  678.             }
  679.             param1.updateAfterEvent();
  680.             this._interactiveZone.addEventListener(MouseEvent.ROLL_OVER,this.rollOverHandler);
  681.             this._clip.enabled = true;
  682.          }
  683.          if(this._onRollOver != null)
  684.          {
  685.             this._onRollOver(this);
  686.          }
  687.       }
  688.       
  689.       protected function rollOutHandler(param1:MouseEvent) : void
  690.       {
  691.          var _loc2_:int = 0;
  692.          if(this._clip.enabled == false)
  693.          {
  694.             return;
  695.          }
  696.          if(this.onRollOutState.actions != undefined)
  697.          {
  698.             this._clip.enabled = false;
  699.             _loc2_ = 0;
  700.             while(_loc2_ < this.onRollOutState.actions.length)
  701.             {
  702.                if(this.onRollOutState.actions[_loc2_].args != null)
  703.                {
  704.                   this.onRollOutState.actions[_loc2_].method(this.onRollOutState.actions[_loc2_].args);
  705.                }
  706.                else
  707.                {
  708.                   this.onRollOutState.actions[_loc2_].method();
  709.                }
  710.                _loc2_++;
  711.             }
  712.             param1.updateAfterEvent();
  713.             this._clip.enabled = true;
  714.          }
  715.          if(this._onRollOut != null)
  716.          {
  717.             this._onRollOut(this);
  718.          }
  719.       }
  720.       
  721.       public function dragStop() : void
  722.       {
  723.          if(this._dragDrop.isDragging == true)
  724.          {
  725.             this._dragDrop.isDragging = false;
  726.             this.dragListenersRemove();
  727.             if(this._onDrop != null)
  728.             {
  729.                this._onDrop(this);
  730.             }
  731.          }
  732.       }
  733.       
  734.       protected function releaseHandler(param1:MouseEvent) : void
  735.       {
  736.          if(this._dragEnabled)
  737.          {
  738.             this._clip.enabled = true;
  739.             this.dragStop();
  740.          }
  741.          else
  742.          {
  743.             if(this._clip.enabled == false)
  744.             {
  745.                return;
  746.             }
  747.             this._clip.enabled = true;
  748.             if(this._onRelease != null)
  749.             {
  750.                this._onRelease(this);
  751.             }
  752.          }
  753.          param1.updateAfterEvent();
  754.       }
  755.       
  756.       public function stateChange(param1:String, param2:Object) : void
  757.       {
  758.          var _loc3_:* = null;
  759.          if(param2 is Object)
  760.          {
  761.             for(_loc3_ in param2)
  762.             {
  763.                this[param1][_loc3_] = param2[_loc3_];
  764.             }
  765.          }
  766.          this.initCommonStateActions(this[param1]);
  767.       }
  768.       
  769.       protected function initCommonStateActions(param1:Object) : void
  770.       {
  771.          var _loc2_:Object = null;
  772.          param1.actions = [];
  773.          if(param1.noiseCode != undefined && param1.noiseCode != "")
  774.          {
  775.             param1.actions.push({
  776.                "method":_e.noisePlay,
  777.                "args":new NoiseObject({"code":param1.noiseCode})
  778.             });
  779.          }
  780.          if(param1.ibId != undefined && param1.ibId != "")
  781.          {
  782.             _loc2_ = {
  783.                "id":param1.ibId,
  784.                "reference":this._clip
  785.             };
  786.             if(param1.ibRef != undefined)
  787.             {
  788.                if(param1.ibRef.position != undefined)
  789.                {
  790.                   _loc2_.position = param1.ibRef.position;
  791.                }
  792.                _loc2_.x = param1.ibRef.x;
  793.                _loc2_.y = param1.ibRef.y;
  794.             }
  795.             param1.actions.push({
  796.                "method":_e.ibShow,
  797.                "args":_loc2_
  798.             });
  799.             this.onRollOutState.actions.push({
  800.                "method":_e.ibHide,
  801.                "args":null
  802.             });
  803.             this.onClickState.actions.push({
  804.                "method":_e.ibHide,
  805.                "args":null
  806.             });
  807.          }
  808.          if(param1.label != undefined)
  809.          {
  810.             param1.actions.push({
  811.                "method":this.gotoAndStop,
  812.                "args":param1.label
  813.             });
  814.          }
  815.       }
  816.       
  817.       public function hasLabel(param1:String) : Boolean
  818.       {
  819.          var _loc2_:int = 0;
  820.          while(_loc2_ < this._clip.currentLabels.length)
  821.          {
  822.             if(param1 == this._clip.currentLabels[_loc2_].name)
  823.             {
  824.                return true;
  825.             }
  826.             _loc2_++;
  827.          }
  828.          return false;
  829.       }
  830.       
  831.       public function gotoAndStop(param1:*, param2:Object = null) : void
  832.       {
  833.          var frameOrLabel:* = param1;
  834.          var params:Object = param2;
  835.          if(params == null)
  836.          {
  837.             params = {};
  838.          }
  839.          params.labelStop = frameOrLabel;
  840.          params.labelLastCallback = params.labelLastCallback != undefined ? params.labelLastCallback : function():void
  841.          {
  842.          };
  843.          this._timeline.GotoAndPlayUntil(params);
  844.       }
  845.       
  846.       private function playEnterFrameHandler(param1:Event) : void
  847.       {
  848.          if(this.playLabelTemp.lastFrameOrLabel is String)
  849.          {
  850.             if(this._clip.currentLabel != this.playLabelTemp.lastFrameOrLabel)
  851.             {
  852.                return;
  853.             }
  854.          }
  855.          else if(this._clip.currentFrame != this.playLabelTemp.lastFrameOrLabel)
  856.          {
  857.             return;
  858.          }
  859.          this._clip.removeEventListener(Event.ENTER_FRAME,this.playEnterFrameHandler);
  860.          this.stop();
  861.          if(this.playLabelTemp.callback != null)
  862.          {
  863.             this.playLabelTemp.callback();
  864.          }
  865.       }
  866.       
  867.       public function play(param1:* = null, param2:* = null, param3:Function = null) : void
  868.       {
  869.          if(param2 != null)
  870.          {
  871.             this.playLabelTemp = {
  872.                "firstFrameOrLabel":param1,
  873.                "lastFrameOrLabel":param2,
  874.                "callback":param3
  875.             };
  876.             this._clip.addEventListener(Event.ENTER_FRAME,this.playEnterFrameHandler);
  877.          }
  878.          this._timelineController.play(param1);
  879.       }
  880.       
  881.       public function stop() : void
  882.       {
  883.          if(this._clip != null)
  884.          {
  885.             this._clip.removeEventListener(Event.ENTER_FRAME,this.playEnterFrameHandler);
  886.             this._timelineController.stop();
  887.             this._timeline.Stop();
  888.          }
  889.       }
  890.       
  891.       public function gotoAndPlay(param1:*, param2:Object = null) : void
  892.       {
  893.          if(param2 == null)
  894.          {
  895.             param2 = {};
  896.          }
  897.          if(param1 == "nextLabel")
  898.          {
  899.             param1 = this._clip.currentLabels[this._timeline.getPosFrameLabelByName(this._clip,this._clip.currentLabel) + 1].name;
  900.          }
  901.          else if(param1 == "firstLabel")
  902.          {
  903.             param1 = this._clip.currentLabels[0].name;
  904.          }
  905.          param2.labelStop = param1;
  906.          this._timeline.GotoAndPlayUntil(param2);
  907.       }
  908.       
  909.       public function getChildByName(param1:String) : DisplayObject
  910.       {
  911.          var _loc2_:Array = param1.split(".");
  912.          var _loc3_:* = this._clip;
  913.          var _loc4_:int = 0;
  914.          while(_loc4_ < _loc2_.length)
  915.          {
  916.             _loc3_ = _loc3_.getChildByName(_loc2_[_loc4_]);
  917.             if(_loc3_ == null)
  918.             {
  919.                return null;
  920.             }
  921.             _loc4_++;
  922.          }
  923.          return _loc3_;
  924.       }
  925.       
  926.       public function getChildByPatternName(param1:String, param2:int, param3:int) : Array
  927.       {
  928.          var _loc5_:DisplayObject = null;
  929.          var _loc4_:Array = [];
  930.          var _loc6_:int = param2;
  931.          while(_loc6_ <= param3)
  932.          {
  933.             _loc5_ = this.clip.getChildByName(param1 + GlobalesFunctions.gimme2digits(_loc6_));
  934.             _loc4_.push(_loc5_);
  935.             _loc6_++;
  936.          }
  937.          return _loc4_;
  938.       }
  939.       
  940.       public function get totalFrames() : int
  941.       {
  942.          return this._clip.totalFrames;
  943.       }
  944.       
  945.       public function get currentFrame() : int
  946.       {
  947.          return this._clip.currentFrame;
  948.       }
  949.       
  950.       public function get currentLabel() : String
  951.       {
  952.          return this._clip.currentLabel;
  953.       }
  954.       
  955.       public function get currentLabels() : Array
  956.       {
  957.          return this._clip.currentLabels;
  958.       }
  959.       
  960.       public function get enabled() : Boolean
  961.       {
  962.          return this._interactiveZone.enabled;
  963.       }
  964.       
  965.       public function set enabled(param1:Boolean) : void
  966.       {
  967.          this._interactiveZone.enabled = param1;
  968.          this._interactiveZone.mouseChildren = param1;
  969.          this._interactiveZone.mouseEnabled = param1;
  970.          this._interactiveZone.buttonMode = param1;
  971.          this._interactiveZone.useHandCursor = param1;
  972.          if(param1 && this._interactiveZone != null)
  973.          {
  974.             this.addListeners();
  975.          }
  976.          else
  977.          {
  978.             this.removeListeners();
  979.          }
  980.       }
  981.       
  982.       public function set depthIndex(param1:int) : void
  983.       {
  984.          if(this.parent != null && this.parent.getChildIndex(this._clip) != param1)
  985.          {
  986.             this.parent.setChildIndex(this._clip,param1 > this.parent.numChildren - 1 ? int(this.parent.numChildren - 1) : int(param1));
  987.          }
  988.       }
  989.       
  990.       public function get depthIndex() : int
  991.       {
  992.          return this.parent != null ? int(this.parent.getChildIndex(this._clip)) : -1;
  993.       }
  994.       
  995.       public function comeBack() : void
  996.       {
  997.          var _loc1_:* = null;
  998.          for(_loc1_ in this._lastClickState)
  999.          {
  1000.             this[_loc1_] = this._lastClickState[_loc1_];
  1001.          }
  1002.       }
  1003.       
  1004.       override public function dissociate() : void
  1005.       {
  1006.          super.dissociate();
  1007.          this._clip = null;
  1008.       }
  1009.       
  1010.       protected function dragListenersRemove() : void
  1011.       {
  1012.          this.dragTimer.stop();
  1013.          this.dragTimer.removeEventListener(TimerEvent.TIMER,this.dragHandler);
  1014.          game.stage.removeEventListener(MouseEvent.MOUSE_UP,this.releaseHandler);
  1015.       }
  1016.       
  1017.       override protected function _destroy() : void
  1018.       {
  1019.          super._destroy();
  1020.          this.dragListenersRemove();
  1021.          this.removeListeners();
  1022.          this.stop();
  1023.          if(this._timelineController != null)
  1024.          {
  1025.             this._timelineController.destroy();
  1026.          }
  1027.          if(this._timeline != null)
  1028.          {
  1029.             this._timeline.destroy();
  1030.          }
  1031.          if(this._clip != null)
  1032.          {
  1033.             if(this._initialState.parent != null && this._initialState.depthIndex != -1 && (this.depthIndex != this._initialState.depthIndex || this.parent != this._initialState.parent))
  1034.             {
  1035.                this.restore();
  1036.             }
  1037.             this.enabled = false;
  1038.             if(this.initialState.parent == null)
  1039.             {
  1040.                this.parent = null;
  1041.             }
  1042.          }
  1043.          this._clip = null;
  1044.          this._interactiveZone = null;
  1045.          this._timeline = null;
  1046.          this._timelineController = null;
  1047.          this.collisionTest.destroy();
  1048.          this.collisionTest = null;
  1049.       }
  1050.       
  1051.       override public function restore() : void
  1052.       {
  1053.          var _loc1_:* = null;
  1054.          super.restore();
  1055.          for(_loc1_ in this.initialState)
  1056.          {
  1057.             this[_loc1_] = this.initialState[_loc1_];
  1058.          }
  1059.       }
  1060.       
  1061.       public function get alpha() : Number
  1062.       {
  1063.          return this._clip.alpha;
  1064.       }
  1065.       
  1066.       public function set alpha(param1:Number) : void
  1067.       {
  1068.          this._clip.alpha = param1;
  1069.       }
  1070.       
  1071.       public function get height() : Number
  1072.       {
  1073.          return this._clip.height;
  1074.       }
  1075.       
  1076.       public function set height(param1:Number) : void
  1077.       {
  1078.          this._clip.height = param1;
  1079.       }
  1080.       
  1081.       public function get visible() : Boolean
  1082.       {
  1083.          return this._clip.visible;
  1084.       }
  1085.       
  1086.       public function set visible(param1:Boolean) : void
  1087.       {
  1088.          this._clip.visible = param1;
  1089.       }
  1090.       
  1091.       public function get width() : Number
  1092.       {
  1093.          return this._clip.width;
  1094.       }
  1095.       
  1096.       public function set width(param1:Number) : void
  1097.       {
  1098.          this._clip.width = param1;
  1099.       }
  1100.       
  1101.       public function get x() : Number
  1102.       {
  1103.          return this._clip.x;
  1104.       }
  1105.       
  1106.       public function set x(param1:Number) : void
  1107.       {
  1108.          this._clip.x = param1;
  1109.       }
  1110.       
  1111.       public function get y() : Number
  1112.       {
  1113.          return this._clip.y;
  1114.       }
  1115.       
  1116.       public function set y(param1:Number) : void
  1117.       {
  1118.          this._clip.y = param1;
  1119.       }
  1120.       
  1121.       public function set parent(param1:DisplayObjectContainer) : void
  1122.       {
  1123.          if(this._clip != null && param1 !== this._clip.parent)
  1124.          {
  1125.             if(this._clip.parent != null)
  1126.             {
  1127.                this._clip.parent.removeChild(this._clip);
  1128.             }
  1129.             if(param1 != null)
  1130.             {
  1131.                param1.addChild(this._clip);
  1132.             }
  1133.          }
  1134.       }
  1135.       
  1136.       public function get parent() : DisplayObjectContainer
  1137.       {
  1138.          return this._clip.parent;
  1139.       }
  1140.       
  1141.       public function get clip() : MovieClip
  1142.       {
  1143.          return this._clip;
  1144.       }
  1145.       
  1146.       override public function get name() : String
  1147.       {
  1148.          return _name;
  1149.       }
  1150.       
  1151.       override public function set name(param1:String) : void
  1152.       {
  1153.          _name = param1;
  1154.          if(this._clip != null)
  1155.          {
  1156.             this._clip.name = param1;
  1157.          }
  1158.       }
  1159.       
  1160.       public function set onFrameExit(param1:Function) : void
  1161.       {
  1162.          this._onFrameExit = param1;
  1163.       }
  1164.       
  1165.       public function get onFrameExit() : Function
  1166.       {
  1167.          return this._onFrameExit;
  1168.       }
  1169.       
  1170.       public function set onFrameEnter(param1:Function) : void
  1171.       {
  1172.          this._onFrameEnter = param1;
  1173.       }
  1174.       
  1175.       public function get onFrameEnter() : Function
  1176.       {
  1177.          return this._onFrameEnter;
  1178.       }
  1179.       
  1180.       public function set onLabelEnter(param1:Function) : void
  1181.       {
  1182.          this._onLabelEnter = param1;
  1183.       }
  1184.       
  1185.       public function get onLabelEnter() : Function
  1186.       {
  1187.          return this._onLabelEnter;
  1188.       }
  1189.       
  1190.       public function set onLabelExit(param1:Function) : void
  1191.       {
  1192.          this._onLabelExit = param1;
  1193.       }
  1194.       
  1195.       public function get onLabelExit() : Function
  1196.       {
  1197.          return this._onLabelExit;
  1198.       }
  1199.       
  1200.       public function set onLabelEnd(param1:Function) : void
  1201.       {
  1202.          this._timeline.onLabelEnd = param1;
  1203.       }
  1204.       
  1205.       public function get onLabelEnd() : Function
  1206.       {
  1207.          return this._timeline.onLabelEnd;
  1208.       }
  1209.       
  1210.       public function get onClickState() : Object
  1211.       {
  1212.          return this._onClickState;
  1213.       }
  1214.       
  1215.       public function set onClickState(param1:Object) : void
  1216.       {
  1217.          this._onClickState = param1;
  1218.       }
  1219.       
  1220.       public function get onRollOverState() : Object
  1221.       {
  1222.          return this._onRollOverState;
  1223.       }
  1224.       
  1225.       public function set onRollOverState(param1:Object) : void
  1226.       {
  1227.          this._onRollOverState = param1;
  1228.       }
  1229.       
  1230.       public function get onClick() : Function
  1231.       {
  1232.          return this._onClick;
  1233.       }
  1234.       
  1235.       public function set onClick(param1:Function) : void
  1236.       {
  1237.          this._onClick = param1;
  1238.       }
  1239.       
  1240.       public function get onRollOver() : Function
  1241.       {
  1242.          return this._onRollOver;
  1243.       }
  1244.       
  1245.       public function set onRollOver(param1:Function) : void
  1246.       {
  1247.          this._onRollOver = param1;
  1248.       }
  1249.       
  1250.       public function get onRollOut() : Function
  1251.       {
  1252.          return this._onRollOut;
  1253.       }
  1254.       
  1255.       public function set onRollOut(param1:Function) : void
  1256.       {
  1257.          this._onRollOut = param1;
  1258.       }
  1259.       
  1260.       public function get clickMode() : String
  1261.       {
  1262.          return this._clickMode;
  1263.       }
  1264.       
  1265.       public function set clickMode(param1:String) : void
  1266.       {
  1267.          this._clickMode = param1;
  1268.       }
  1269.       
  1270.       public function get initialState() : Object
  1271.       {
  1272.          return this._initialState;
  1273.       }
  1274.       
  1275.       public function set initialState(param1:Object) : void
  1276.       {
  1277.          this._initialState = param1;
  1278.       }
  1279.       
  1280.       public function get onRollOutState() : Object
  1281.       {
  1282.          return this._onRollOutState;
  1283.       }
  1284.       
  1285.       public function set onRollOutState(param1:Object) : void
  1286.       {
  1287.          this._onRollOutState = param1;
  1288.       }
  1289.       
  1290.       public function get onDragStart() : Function
  1291.       {
  1292.          return this._onDragStart;
  1293.       }
  1294.       
  1295.       public function set onDragStart(param1:Function) : void
  1296.       {
  1297.          this._onDragStart = param1;
  1298.       }
  1299.       
  1300.       public function get onDrag() : Function
  1301.       {
  1302.          return this._onDrag;
  1303.       }
  1304.       
  1305.       public function set onDrag(param1:Function) : void
  1306.       {
  1307.          this._onDrag = param1;
  1308.       }
  1309.       
  1310.       public function get onDrop() : Function
  1311.       {
  1312.          return this._onDrop;
  1313.       }
  1314.       
  1315.       public function set onDrop(param1:Function) : void
  1316.       {
  1317.          this._onDrop = param1;
  1318.       }
  1319.       
  1320.       public function get onRelease() : Function
  1321.       {
  1322.          return this._onRelease;
  1323.       }
  1324.       
  1325.       public function set onRelease(param1:Function) : void
  1326.       {
  1327.          this._onRelease = param1;
  1328.       }
  1329.       
  1330.       public function get dragDrop() : DragDropParams
  1331.       {
  1332.          return this._dragDrop;
  1333.       }
  1334.       
  1335.       public function get dragEnabled() : Boolean
  1336.       {
  1337.          return this._dragEnabled;
  1338.       }
  1339.       
  1340.       public function set dragEnabled(param1:Boolean) : void
  1341.       {
  1342.          this._dragEnabled = param1;
  1343.       }
  1344.       
  1345.       public function get limitZone() : *
  1346.       {
  1347.          return this._limitZone;
  1348.       }
  1349.       
  1350.       public function set limitZone(param1:*) : void
  1351.       {
  1352.          this._limitZone = param1;
  1353.       }
  1354.    }
  1355. }
  1356.