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

  1. package com.greensock
  2. {
  3.    import com.greensock.core.*;
  4.    
  5.    public class OverwriteManager
  6.    {
  7.       public static var mode:int;
  8.       
  9.       public static var enabled:Boolean;
  10.       
  11.       public static const version:Number = 6.02;
  12.       
  13.       public static const NONE:int = 0;
  14.       
  15.       public static const ALL_IMMEDIATE:int = 1;
  16.       
  17.       public static const AUTO:int = 2;
  18.       
  19.       public static const CONCURRENT:int = 3;
  20.       
  21.       public static const ALL_ONSTART:int = 4;
  22.       
  23.       public static const PREEXISTING:int = 5;
  24.       
  25.       public function OverwriteManager()
  26.       {
  27.          super();
  28.       }
  29.       
  30.       public static function init(param1:int = 2) : int
  31.       {
  32.          if(TweenLite.version < 11.1)
  33.          {
  34.             throw new Error("Warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com.");
  35.          }
  36.          TweenLite.overwriteManager = OverwriteManager;
  37.          mode = param1;
  38.          enabled = true;
  39.          return mode;
  40.       }
  41.       
  42.       public static function manageOverwrites(param1:TweenLite, param2:Object, param3:Array, param4:uint) : Boolean
  43.       {
  44.          var _loc5_:int = 0;
  45.          var _loc6_:Boolean = false;
  46.          var _loc7_:TweenLite = null;
  47.          var _loc13_:uint = 0;
  48.          var _loc14_:Number = NaN;
  49.          var _loc15_:Number = NaN;
  50.          var _loc16_:TweenCore = null;
  51.          var _loc17_:Number = NaN;
  52.          var _loc18_:SimpleTimeline = null;
  53.          if(param4 >= 4)
  54.          {
  55.             _loc13_ = param3.length;
  56.             _loc5_ = 0;
  57.             while(_loc5_ < _loc13_)
  58.             {
  59.                _loc7_ = param3[_loc5_];
  60.                if(_loc7_ != param1)
  61.                {
  62.                   if(_loc7_.setEnabled(false,false))
  63.                   {
  64.                      _loc6_ = true;
  65.                   }
  66.                }
  67.                else if(param4 == 5)
  68.                {
  69.                   break;
  70.                }
  71.                _loc5_++;
  72.             }
  73.             return _loc6_;
  74.          }
  75.          var _loc8_:Number = param1.cachedStartTime + 1e-10;
  76.          var _loc9_:Array = [];
  77.          var _loc10_:Array = [];
  78.          var _loc11_:uint = 0;
  79.          var _loc12_:uint = 0;
  80.          _loc5_ = int(param3.length);
  81.          while(--_loc5_ > -1)
  82.          {
  83.             _loc7_ = param3[_loc5_];
  84.             if(!(_loc7_ == param1 || _loc7_.gc))
  85.             {
  86.                if(_loc7_.timeline != param1.timeline)
  87.                {
  88.                   if(!getGlobalPaused(_loc7_))
  89.                   {
  90.                      var _loc19_:*;
  91.                      _loc10_[_loc19_ = _loc11_++] = _loc7_;
  92.                   }
  93.                }
  94.                else if(_loc7_.cachedStartTime <= _loc8_ && _loc7_.cachedStartTime + _loc7_.totalDuration + 1e-10 > _loc8_ && !getGlobalPaused(_loc7_))
  95.                {
  96.                   _loc9_[_loc19_ = _loc12_++] = _loc7_;
  97.                }
  98.             }
  99.          }
  100.          if(_loc11_ != 0)
  101.          {
  102.             _loc14_ = param1.cachedTimeScale;
  103.             _loc15_ = _loc8_;
  104.             _loc18_ = param1.timeline;
  105.             while(_loc18_)
  106.             {
  107.                _loc14_ *= _loc18_.cachedTimeScale;
  108.                _loc15_ += _loc18_.cachedStartTime;
  109.                _loc18_ = _loc18_.timeline;
  110.             }
  111.             _loc8_ = _loc14_ * _loc15_;
  112.             _loc5_ = int(_loc11_);
  113.             while(--_loc5_ > -1)
  114.             {
  115.                _loc16_ = _loc10_[_loc5_];
  116.                _loc14_ = _loc16_.cachedTimeScale;
  117.                _loc15_ = _loc16_.cachedStartTime;
  118.                _loc18_ = _loc16_.timeline;
  119.                while(_loc18_)
  120.                {
  121.                   _loc14_ *= _loc18_.cachedTimeScale;
  122.                   _loc15_ += _loc18_.cachedStartTime;
  123.                   _loc18_ = _loc18_.timeline;
  124.                }
  125.                _loc17_ = _loc14_ * _loc15_;
  126.                if(_loc17_ <= _loc8_ && (_loc17_ + _loc16_.totalDuration * _loc14_ + 1e-10 > _loc8_ || _loc16_.cachedDuration == 0))
  127.                {
  128.                   _loc9_[_loc19_ = _loc12_++] = _loc16_;
  129.                }
  130.             }
  131.          }
  132.          if(_loc12_ == 0)
  133.          {
  134.             return _loc6_;
  135.          }
  136.          _loc5_ = int(_loc12_);
  137.          if(param4 == 2)
  138.          {
  139.             while(--_loc5_ > -1)
  140.             {
  141.                _loc7_ = _loc9_[_loc5_];
  142.                if(_loc7_.killVars(param2))
  143.                {
  144.                   _loc6_ = true;
  145.                }
  146.                if(_loc7_.cachedPT1 == null && _loc7_.initted)
  147.                {
  148.                   _loc7_.setEnabled(false,false);
  149.                }
  150.             }
  151.          }
  152.          else
  153.          {
  154.             while(--_loc5_ > -1)
  155.             {
  156.                if(TweenLite(_loc9_[_loc5_]).setEnabled(false,false))
  157.                {
  158.                   _loc6_ = true;
  159.                }
  160.             }
  161.          }
  162.          return _loc6_;
  163.       }
  164.       
  165.       public static function getGlobalPaused(param1:TweenCore) : Boolean
  166.       {
  167.          while(param1)
  168.          {
  169.             if(param1.cachedPaused)
  170.             {
  171.                return true;
  172.             }
  173.             param1 = param1.timeline;
  174.          }
  175.          return false;
  176.       }
  177.    }
  178. }
  179.  
  180.