home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2011 May / ME_2011_05.iso / Galileo-Video-Tutorial / system / player.swf / scripts / com / greensock / plugins / TintPlugin.as < prev    next >
Encoding:
Text File  |  2010-11-30  |  2.3 KB  |  75 lines

  1. package com.greensock.plugins
  2. {
  3.    import com.greensock.*;
  4.    import com.greensock.core.*;
  5.    import flash.display.*;
  6.    import flash.geom.ColorTransform;
  7.    import flash.geom.Transform;
  8.    
  9.    public class TintPlugin extends TweenPlugin
  10.    {
  11.       public static const API:Number = 1;
  12.       
  13.       protected static var _props:Array = ["redMultiplier","greenMultiplier","blueMultiplier","alphaMultiplier","redOffset","greenOffset","blueOffset","alphaOffset"];
  14.       
  15.       protected var _transform:Transform;
  16.       
  17.       protected var _ct:ColorTransform;
  18.       
  19.       protected var _ignoreAlpha:Boolean;
  20.       
  21.       public function TintPlugin()
  22.       {
  23.          super();
  24.          this.propName = "tint";
  25.          this.overwriteProps = ["tint"];
  26.       }
  27.       
  28.       override public function onInitTween(param1:Object, param2:*, param3:TweenLite) : Boolean
  29.       {
  30.          if(!(param1 is DisplayObject))
  31.          {
  32.             return false;
  33.          }
  34.          var _loc4_:ColorTransform = new ColorTransform();
  35.          if(param2 != null && param3.vars.removeTint != true)
  36.          {
  37.             _loc4_.color = uint(param2);
  38.          }
  39.          this._ignoreAlpha = true;
  40.          this.init(param1 as DisplayObject,_loc4_);
  41.          return true;
  42.       }
  43.       
  44.       public function init(param1:DisplayObject, param2:ColorTransform) : void
  45.       {
  46.          var _loc4_:String = null;
  47.          this._transform = param1.transform;
  48.          this._ct = this._transform.colorTransform;
  49.          var _loc3_:int = int(_props.length);
  50.          while(_loc3_--)
  51.          {
  52.             _loc4_ = _props[_loc3_];
  53.             if(this._ct[_loc4_] != param2[_loc4_])
  54.             {
  55.                _tweens[_tweens.length] = new PropTween(this._ct,_loc4_,this._ct[_loc4_],param2[_loc4_] - this._ct[_loc4_],"tint",false);
  56.             }
  57.          }
  58.       }
  59.       
  60.       override public function set changeFactor(param1:Number) : void
  61.       {
  62.          var _loc2_:ColorTransform = null;
  63.          updateTweens(param1);
  64.          if(this._ignoreAlpha)
  65.          {
  66.             _loc2_ = this._transform.colorTransform;
  67.             this._ct.alphaMultiplier = _loc2_.alphaMultiplier;
  68.             this._ct.alphaOffset = _loc2_.alphaOffset;
  69.          }
  70.          this._transform.colorTransform = this._ct;
  71.       }
  72.    }
  73. }
  74.  
  75.