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

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