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

  1. package ENGINE.INTERFACE.ANIMATORS
  2. {
  3.    import ENGINE.INTERFACE.OIObject;
  4.    import flash.display.DisplayObject;
  5.    
  6.    public class OA_AlphaInd extends OAnimator
  7.    {
  8.        
  9.       
  10.       public var iEAlpha:Number;
  11.       
  12.       private var iCurAlpha:Number;
  13.       
  14.       private var iEndAlpha:Array;
  15.       
  16.       private var iDAlpha:Array;
  17.       
  18.       public var iInd:Array;
  19.       
  20.       public var iSAlpha:Number;
  21.       
  22.       public var iPIter:int;
  23.       
  24.       public function OA_AlphaInd(param1:Object, param2:OIObject = null)
  25.       {
  26.          super(param1,param2);
  27.       }
  28.       
  29.       public static function Make(param1:Object, param2:OIObject = null) : OA_AlphaInd
  30.       {
  31.          return new OA_AlphaInd(param1,param2);
  32.       }
  33.       
  34.       override protected function Start() : int
  35.       {
  36.          var _loc1_:int = 0;
  37.          var _loc2_:int = 0;
  38.          var _loc3_:DisplayObject = null;
  39.          var _loc4_:Number = NaN;
  40.          if(!this.iInd || this.iInd.length == 0)
  41.          {
  42.             return stEnd;
  43.          }
  44.          _loc1_ = int(this.iInd.length);
  45.          this.iEndAlpha = new Array(_loc1_);
  46.          this.iDAlpha = new Array(_loc1_);
  47.          _loc2_ = 0;
  48.          while(_loc2_ < _loc1_)
  49.          {
  50.             _loc3_ = this.iTarget.getChildAt(this.iInd[_loc2_]);
  51.             _loc4_ = this.iSAlpha >= 0 ? this.iSAlpha : _loc3_.alpha;
  52.             this.iEndAlpha[_loc2_] = this.iEAlpha >= 0 ? this.iEAlpha : _loc3_.alpha;
  53.             this.iDAlpha[_loc2_] = (this.iEndAlpha[_loc2_] - _loc4_) / iPIter;
  54.             _loc3_.visible = true;
  55.             _loc3_.alpha = _loc4_;
  56.             _loc2_++;
  57.          }
  58.          this.iCurAlpha = this.iTarget.getChildAt(this.iInd[0]).alpha;
  59.          return Math.abs(this.iDAlpha[0]) > 0.001 ? stPlay : stEnd;
  60.       }
  61.       
  62.       override public function Play() : void
  63.       {
  64.          var _loc1_:int = 0;
  65.          var _loc2_:int = 0;
  66.          var _loc3_:DisplayObject = null;
  67.          this.iCurAlpha += this.iDAlpha[0];
  68.          _loc1_ = int(this.iInd.length);
  69.          if(this.iDAlpha[0] > 0 && this.iCurAlpha >= this.iEndAlpha[0] || this.iDAlpha[0] <= 0 && this.iCurAlpha <= this.iEndAlpha[0])
  70.          {
  71.             _loc2_ = 0;
  72.             while(_loc2_ < _loc1_)
  73.             {
  74.                _loc3_ = this.iTarget.getChildAt(this.iInd[_loc2_]);
  75.                _loc3_.alpha = this.iEndAlpha[_loc2_];
  76.                _loc3_.visible = _loc3_.alpha > 0;
  77.                _loc2_++;
  78.             }
  79.             this.State = stEnd;
  80.          }
  81.          else
  82.          {
  83.             _loc2_ = 0;
  84.             while(_loc2_ < _loc1_)
  85.             {
  86.                _loc3_ = this.iTarget.getChildAt(this.iInd[_loc2_]);
  87.                _loc3_.alpha += this.iDAlpha[_loc2_];
  88.                _loc2_++;
  89.             }
  90.          }
  91.       }
  92.    }
  93. }
  94.