home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / ENGINE / INTERFACE / ANIMATORS / OA_Scale.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  2.2 KB  |  68 lines

  1. package ENGINE.INTERFACE.ANIMATORS
  2. {
  3.    import ENGINE.INTERFACE.OIObject;
  4.    
  5.    public class OA_Scale extends OAnimator
  6.    {
  7.        
  8.       
  9.       public var iSScale:Number;
  10.       
  11.       private var iEndScale:Number;
  12.       
  13.       public var iEScale:Number;
  14.       
  15.       private var iDScale:Number;
  16.       
  17.       public var iPIter:int;
  18.       
  19.       public function OA_Scale(param1:Object, param2:OIObject = null)
  20.       {
  21.          super(param1,param2);
  22.       }
  23.       
  24.       public static function Make(param1:Object, param2:OIObject = null) : OA_Scale
  25.       {
  26.          return new OA_Scale(param1,param2);
  27.       }
  28.       
  29.       override protected function Start() : int
  30.       {
  31.          var _loc1_:Number = NaN;
  32.          var _loc2_:Number = NaN;
  33.          var _loc3_:Number = NaN;
  34.          _loc1_ = this.iSScale >= 0 ? this.iSScale : Number(this.iTarget.scaleX);
  35.          this.iEndScale = this.iEScale >= 0 ? this.iEScale : Number(this.iTarget.scaleX);
  36.          this.iDScale = (this.iEndScale - _loc1_) / iPIter;
  37.          _loc2_ = Number(this.iTarget.prWidth);
  38.          _loc3_ = Number(this.iTarget.prHeight);
  39.          this.iTarget.scaleX = _loc1_;
  40.          this.iTarget.scaleY = _loc1_;
  41.          this.iTarget.Move((_loc2_ - this.iTarget.prWidth) / 2,(_loc3_ - this.iTarget.prHeight) / 2);
  42.          return Math.abs(this.iDScale) > 0.00001 ? stPlay : stEnd;
  43.       }
  44.       
  45.       override public function Play() : void
  46.       {
  47.          var _loc1_:Number = NaN;
  48.          var _loc2_:Number = NaN;
  49.          var _loc3_:Number = NaN;
  50.          _loc1_ = Number(this.iTarget.prWidth);
  51.          _loc2_ = Number(this.iTarget.prHeight);
  52.          _loc3_ = this.iTarget.scaleX + this.iDScale;
  53.          if(this.iDScale > 0 && _loc3_ >= this.iEndScale || this.iDScale <= 0 && _loc3_ <= this.iEndScale)
  54.          {
  55.             this.iTarget.scaleX = this.iEndScale;
  56.             this.iTarget.scaleY = this.iEndScale;
  57.             this.State = OAnimator.stEnd;
  58.          }
  59.          else
  60.          {
  61.             this.iTarget.scaleX += this.iDScale;
  62.             this.iTarget.scaleY += this.iDScale;
  63.          }
  64.          this.iTarget.Move((_loc1_ - this.iTarget.prWidth) / 2,(_loc2_ - this.iTarget.prHeight) / 2);
  65.       }
  66.    }
  67. }
  68.