home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2012 April / ME_04_2012.iso / Video-Tutorial / iPhoto / media / player.swf / scripts / mx / effects / CompositeEffect.as next >
Encoding:
Text File  |  2011-11-11  |  10.3 KB  |  326 lines

  1. package mx.effects
  2. {
  3.    import mx.core.mx_internal;
  4.    import mx.effects.effectClasses.CompositeEffectInstance;
  5.    import mx.effects.effectClasses.PropertyChanges;
  6.    
  7.    use namespace mx_internal;
  8.    
  9.    public class CompositeEffect extends Effect
  10.    {
  11.       mx_internal static const VERSION:String = "4.5.0.20967";
  12.       
  13.       private var childTargets:Array;
  14.       
  15.       private var _affectedProperties:Array;
  16.       
  17.       private var _children:Array = [];
  18.       
  19.       public function CompositeEffect(param1:Object = null)
  20.       {
  21.          super(param1);
  22.          instanceClass = CompositeEffectInstance;
  23.       }
  24.       
  25.       public function get children() : Array
  26.       {
  27.          return this._children;
  28.       }
  29.       
  30.       public function set children(param1:Array) : void
  31.       {
  32.          var _loc2_:int = 0;
  33.          if(this._children)
  34.          {
  35.             _loc2_ = 0;
  36.             while(_loc2_ < this._children.length)
  37.             {
  38.                if(this._children[_loc2_])
  39.                {
  40.                   Effect(this._children[_loc2_]).mx_internal::parentCompositeEffect = null;
  41.                }
  42.                _loc2_++;
  43.             }
  44.          }
  45.          this._children = param1;
  46.          if(this._children)
  47.          {
  48.             _loc2_ = 0;
  49.             while(_loc2_ < this._children.length)
  50.             {
  51.                if(this._children[_loc2_])
  52.                {
  53.                   Effect(this._children[_loc2_]).mx_internal::parentCompositeEffect = this;
  54.                }
  55.                _loc2_++;
  56.             }
  57.          }
  58.       }
  59.       
  60.       public function get compositeDuration() : Number
  61.       {
  62.          return duration;
  63.       }
  64.       
  65.       override public function getAffectedProperties() : Array
  66.       {
  67.          var _loc1_:Array = null;
  68.          var _loc2_:int = 0;
  69.          var _loc3_:int = 0;
  70.          if(!this._affectedProperties)
  71.          {
  72.             _loc1_ = [];
  73.             _loc2_ = int(this.children.length);
  74.             _loc3_ = 0;
  75.             while(_loc3_ < _loc2_)
  76.             {
  77.                _loc1_ = _loc1_.concat(this.children[_loc3_].getAffectedProperties());
  78.                _loc3_++;
  79.             }
  80.             this._affectedProperties = _loc1_;
  81.          }
  82.          return this._affectedProperties;
  83.       }
  84.       
  85.       override public function createInstance(param1:Object = null) : IEffectInstance
  86.       {
  87.          if(!this.childTargets)
  88.          {
  89.             this.childTargets = [param1];
  90.          }
  91.          var _loc2_:IEffectInstance = super.createInstance(param1);
  92.          this.childTargets = null;
  93.          return _loc2_;
  94.       }
  95.       
  96.       override public function createInstances(param1:Array = null) : Array
  97.       {
  98.          if(!param1)
  99.          {
  100.             param1 = this.targets;
  101.          }
  102.          this.childTargets = param1;
  103.          var _loc2_:IEffectInstance = this.createInstance();
  104.          this.childTargets = null;
  105.          return !!_loc2_ ? [_loc2_] : [];
  106.       }
  107.       
  108.       override protected function filterInstance(param1:Array, param2:Object) : Boolean
  109.       {
  110.          var _loc3_:Array = null;
  111.          var _loc4_:int = 0;
  112.          var _loc5_:int = 0;
  113.          if(mx_internal::filterObject)
  114.          {
  115.             _loc3_ = targets;
  116.             if(_loc3_.length == 0)
  117.             {
  118.                _loc3_ = this.childTargets;
  119.             }
  120.             _loc4_ = int(_loc3_.length);
  121.             _loc5_ = 0;
  122.             while(_loc5_ < _loc4_)
  123.             {
  124.                if(mx_internal::filterObject.filterInstance(param1,effectTargetHost,_loc3_[_loc5_]))
  125.                {
  126.                   return true;
  127.                }
  128.                _loc5_++;
  129.             }
  130.             return false;
  131.          }
  132.          return true;
  133.       }
  134.       
  135.       override protected function initInstance(param1:IEffectInstance) : void
  136.       {
  137.          var _loc4_:int = 0;
  138.          var _loc5_:int = 0;
  139.          var _loc6_:Effect = null;
  140.          super.initInstance(param1);
  141.          var _loc2_:CompositeEffectInstance = CompositeEffectInstance(param1);
  142.          var _loc3_:Object = this.childTargets;
  143.          if(!(_loc3_ is Array))
  144.          {
  145.             _loc3_ = [_loc3_];
  146.          }
  147.          if(this.children)
  148.          {
  149.             _loc4_ = int(this.children.length);
  150.             _loc5_ = 0;
  151.             while(_loc5_ < _loc4_)
  152.             {
  153.                _loc6_ = this.children[_loc5_];
  154.                if(mx_internal::propertyChangesArray != null)
  155.                {
  156.                   _loc6_.mx_internal::propertyChangesArray = mx_internal::propertyChangesArray;
  157.                }
  158.                if(_loc6_.mx_internal::filterObject == null && Boolean(mx_internal::filterObject))
  159.                {
  160.                   _loc6_.mx_internal::filterObject = mx_internal::filterObject;
  161.                }
  162.                if(effectTargetHost)
  163.                {
  164.                   _loc6_.effectTargetHost = effectTargetHost;
  165.                }
  166.                if(_loc6_.targets.length == 0)
  167.                {
  168.                   _loc2_.addChildSet(this.children[_loc5_].createInstances(_loc3_));
  169.                }
  170.                else
  171.                {
  172.                   _loc2_.addChildSet(this.children[_loc5_].createInstances(_loc6_.targets));
  173.                }
  174.                _loc5_++;
  175.             }
  176.          }
  177.       }
  178.       
  179.       override public function captureStartValues() : void
  180.       {
  181.          var _loc1_:Array = this.getChildrenTargets();
  182.          mx_internal::propertyChangesArray = [];
  183.          var _loc2_:int = int(_loc1_.length);
  184.          var _loc3_:int = 0;
  185.          while(_loc3_ < _loc2_)
  186.          {
  187.             mx_internal::propertyChangesArray.push(new PropertyChanges(_loc1_[_loc3_]));
  188.             _loc3_++;
  189.          }
  190.          mx_internal::propertyChangesArray = this.mx_internal::captureValues(mx_internal::propertyChangesArray,true);
  191.          endValuesCaptured = false;
  192.       }
  193.       
  194.       override mx_internal function captureValues(param1:Array, param2:Boolean, param3:Array = null) : Array
  195.       {
  196.          var _loc6_:Effect = null;
  197.          var _loc4_:int = int(this.children.length);
  198.          var _loc5_:int = 0;
  199.          while(_loc5_ < _loc4_)
  200.          {
  201.             _loc6_ = this.children[_loc5_];
  202.             param1 = _loc6_.mx_internal::captureValues(param1,param2,Boolean(_loc6_.targets) && _loc6_.targets.length > 0 ? _loc6_.targets : param3);
  203.             _loc5_++;
  204.          }
  205.          return param1;
  206.       }
  207.       
  208.       override mx_internal function applyStartValues(param1:Array, param2:Array) : void
  209.       {
  210.          var _loc5_:Effect = null;
  211.          var _loc6_:Array = null;
  212.          var _loc3_:int = int(this.children.length);
  213.          var _loc4_:int = 0;
  214.          while(_loc4_ < _loc3_)
  215.          {
  216.             _loc5_ = this.children[_loc4_];
  217.             _loc6_ = _loc5_.targets.length > 0 ? _loc5_.targets : param2;
  218.             if(_loc5_.mx_internal::filterObject == null && Boolean(mx_internal::filterObject))
  219.             {
  220.                _loc5_.mx_internal::filterObject = mx_internal::filterObject;
  221.             }
  222.             _loc5_.mx_internal::applyStartValues(param1,_loc6_);
  223.             _loc4_++;
  224.          }
  225.       }
  226.       
  227.       override mx_internal function applyEndValues(param1:Array, param2:Array) : void
  228.       {
  229.          var _loc5_:Effect = null;
  230.          var _loc6_:Array = null;
  231.          var _loc3_:int = int(this.children.length);
  232.          var _loc4_:int = 0;
  233.          while(_loc4_ < _loc3_)
  234.          {
  235.             _loc5_ = this.children[_loc4_];
  236.             _loc6_ = _loc5_.targets.length > 0 ? _loc5_.targets : param2;
  237.             if(_loc5_.mx_internal::filterObject == null && Boolean(mx_internal::filterObject))
  238.             {
  239.                _loc5_.mx_internal::filterObject = mx_internal::filterObject;
  240.             }
  241.             _loc5_.mx_internal::applyEndValues(param1,_loc6_);
  242.             _loc4_++;
  243.          }
  244.       }
  245.       
  246.       override mx_internal function set transitionInterruption(param1:Boolean) : void
  247.       {
  248.          var _loc4_:Effect = null;
  249.          super.mx_internal::transitionInterruption = param1;
  250.          var _loc2_:int = int(this.children.length);
  251.          var _loc3_:int = 0;
  252.          while(_loc3_ < _loc2_)
  253.          {
  254.             _loc4_ = this.children[_loc3_];
  255.             _loc4_.mx_internal::transitionInterruption = param1;
  256.             _loc3_++;
  257.          }
  258.       }
  259.       
  260.       public function addChild(param1:IEffect) : void
  261.       {
  262.          this.children.push(param1);
  263.          this._affectedProperties = null;
  264.          Effect(param1).mx_internal::parentCompositeEffect = this;
  265.       }
  266.       
  267.       private function getChildrenTargets() : Array
  268.       {
  269.          var _loc3_:Array = null;
  270.          var _loc4_:Effect = null;
  271.          var _loc5_:int = 0;
  272.          var _loc6_:int = 0;
  273.          var _loc7_:int = 0;
  274.          var _loc8_:int = 0;
  275.          var _loc1_:Array = [];
  276.          var _loc2_:Object = {};
  277.          _loc5_ = int(this.children.length);
  278.          _loc6_ = 0;
  279.          while(_loc6_ < _loc5_)
  280.          {
  281.             _loc4_ = this.children[_loc6_];
  282.             if(_loc4_ is CompositeEffect)
  283.             {
  284.                _loc3_ = CompositeEffect(_loc4_).getChildrenTargets();
  285.                _loc7_ = int(_loc3_.length);
  286.                _loc8_ = 0;
  287.                while(_loc8_ < _loc7_)
  288.                {
  289.                   if(_loc3_[_loc8_] != null && _loc1_.indexOf(_loc3_[_loc8_]) < 0)
  290.                   {
  291.                      _loc1_.push(_loc3_[_loc8_]);
  292.                   }
  293.                   _loc8_++;
  294.                }
  295.             }
  296.             else if(_loc4_.targets != null)
  297.             {
  298.                _loc7_ = int(_loc4_.targets.length);
  299.                _loc8_ = 0;
  300.                while(_loc8_ < _loc7_)
  301.                {
  302.                   if(_loc4_.targets[_loc8_] != null && _loc1_.indexOf(_loc4_.targets[_loc8_]) < 0)
  303.                   {
  304.                      _loc1_.push(_loc4_.targets[_loc8_]);
  305.                   }
  306.                   _loc8_++;
  307.                }
  308.             }
  309.             _loc6_++;
  310.          }
  311.          _loc5_ = int(targets.length);
  312.          _loc6_ = 0;
  313.          while(_loc6_ < _loc5_)
  314.          {
  315.             if(targets[_loc6_] != null && _loc1_.indexOf(targets[_loc6_]) < 0)
  316.             {
  317.                _loc1_.push(targets[_loc6_]);
  318.             }
  319.             _loc6_++;
  320.          }
  321.          return _loc1_;
  322.       }
  323.    }
  324. }
  325.  
  326.