home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2012 April / ME_04_2012.iso / Video-Tutorial / iPhoto / media / player.swf / scripts / mx / managers / ToolTipManagerImpl.as < prev   
Encoding:
Text File  |  2011-11-11  |  28.1 KB  |  834 lines

  1. package mx.managers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.events.Event;
  5.    import flash.events.EventDispatcher;
  6.    import flash.events.MouseEvent;
  7.    import flash.events.TimerEvent;
  8.    import flash.geom.Point;
  9.    import flash.geom.Rectangle;
  10.    import flash.utils.Timer;
  11.    import mx.controls.ToolTip;
  12.    import mx.core.FlexGlobals;
  13.    import mx.core.IFlexModule;
  14.    import mx.core.IInvalidating;
  15.    import mx.core.ILayoutDirectionElement;
  16.    import mx.core.IToolTip;
  17.    import mx.core.IUIComponent;
  18.    import mx.core.LayoutDirection;
  19.    import mx.core.mx_internal;
  20.    import mx.effects.EffectManager;
  21.    import mx.effects.IAbstractEffect;
  22.    import mx.events.DynamicEvent;
  23.    import mx.events.EffectEvent;
  24.    import mx.events.ToolTipEvent;
  25.    import mx.styles.IStyleClient;
  26.    import mx.validators.IValidatorListener;
  27.    
  28.    use namespace mx_internal;
  29.    
  30.    public class ToolTipManagerImpl extends EventDispatcher implements IToolTipManager2
  31.    {
  32.       private static var instance:IToolTipManager2;
  33.       
  34.       public static var mixins:Array;
  35.       
  36.       mx_internal static const VERSION:String = "4.5.0.20967";
  37.       
  38.       mx_internal var initialized:Boolean = false;
  39.       
  40.       mx_internal var showTimer:Timer;
  41.       
  42.       mx_internal var hideTimer:Timer;
  43.       
  44.       mx_internal var scrubTimer:Timer;
  45.       
  46.       mx_internal var currentText:String;
  47.       
  48.       mx_internal var isError:Boolean;
  49.       
  50.       mx_internal var previousTarget:DisplayObject;
  51.       
  52.       private var _currentTarget:DisplayObject;
  53.       
  54.       mx_internal var _currentToolTip:DisplayObject;
  55.       
  56.       private var _enabled:Boolean = true;
  57.       
  58.       private var _hideDelay:Number = 10000;
  59.       
  60.       private var _hideEffect:IAbstractEffect;
  61.       
  62.       private var _scrubDelay:Number = 100;
  63.       
  64.       private var _showDelay:Number = 500;
  65.       
  66.       private var _showEffect:IAbstractEffect;
  67.       
  68.       private var _toolTipClass:Class;
  69.       
  70.       public function ToolTipManagerImpl()
  71.       {
  72.          var _loc1_:int = 0;
  73.          var _loc2_:int = 0;
  74.          this._toolTipClass = ToolTip;
  75.          super();
  76.          if(instance)
  77.          {
  78.             throw new Error("Instance already exists.");
  79.          }
  80.          if(mixins)
  81.          {
  82.             _loc1_ = int(mixins.length);
  83.             _loc2_ = 0;
  84.             while(_loc2_ < _loc1_)
  85.             {
  86.                new mixins[_loc2_](this);
  87.                _loc2_++;
  88.             }
  89.          }
  90.          if(hasEventListener("initialize"))
  91.          {
  92.             dispatchEvent(new Event("initialize"));
  93.          }
  94.       }
  95.       
  96.       public static function getInstance() : IToolTipManager2
  97.       {
  98.          if(!instance)
  99.          {
  100.             instance = new ToolTipManagerImpl();
  101.          }
  102.          return instance;
  103.       }
  104.       
  105.       public function get currentTarget() : DisplayObject
  106.       {
  107.          return this._currentTarget;
  108.       }
  109.       
  110.       public function set currentTarget(param1:DisplayObject) : void
  111.       {
  112.          this._currentTarget = param1;
  113.       }
  114.       
  115.       public function get currentToolTip() : IToolTip
  116.       {
  117.          return this.mx_internal::_currentToolTip as IToolTip;
  118.       }
  119.       
  120.       public function set currentToolTip(param1:IToolTip) : void
  121.       {
  122.          this.mx_internal::_currentToolTip = param1 as DisplayObject;
  123.          if(hasEventListener("currentToolTip"))
  124.          {
  125.             dispatchEvent(new Event("currentToolTip"));
  126.          }
  127.       }
  128.       
  129.       public function get enabled() : Boolean
  130.       {
  131.          return this._enabled;
  132.       }
  133.       
  134.       public function set enabled(param1:Boolean) : void
  135.       {
  136.          this._enabled = param1;
  137.       }
  138.       
  139.       public function get hideDelay() : Number
  140.       {
  141.          return this._hideDelay;
  142.       }
  143.       
  144.       public function set hideDelay(param1:Number) : void
  145.       {
  146.          this._hideDelay = param1;
  147.       }
  148.       
  149.       public function get hideEffect() : IAbstractEffect
  150.       {
  151.          return this._hideEffect;
  152.       }
  153.       
  154.       public function set hideEffect(param1:IAbstractEffect) : void
  155.       {
  156.          this._hideEffect = param1 as IAbstractEffect;
  157.       }
  158.       
  159.       public function get scrubDelay() : Number
  160.       {
  161.          return this._scrubDelay;
  162.       }
  163.       
  164.       public function set scrubDelay(param1:Number) : void
  165.       {
  166.          this._scrubDelay = param1;
  167.       }
  168.       
  169.       public function get showDelay() : Number
  170.       {
  171.          return this._showDelay;
  172.       }
  173.       
  174.       public function set showDelay(param1:Number) : void
  175.       {
  176.          this._showDelay = param1;
  177.       }
  178.       
  179.       public function get showEffect() : IAbstractEffect
  180.       {
  181.          return this._showEffect;
  182.       }
  183.       
  184.       public function set showEffect(param1:IAbstractEffect) : void
  185.       {
  186.          this._showEffect = param1 as IAbstractEffect;
  187.       }
  188.       
  189.       public function get toolTipClass() : Class
  190.       {
  191.          return this._toolTipClass;
  192.       }
  193.       
  194.       public function set toolTipClass(param1:Class) : void
  195.       {
  196.          this._toolTipClass = param1;
  197.       }
  198.       
  199.       mx_internal function initialize() : void
  200.       {
  201.          if(!this.mx_internal::showTimer)
  202.          {
  203.             this.mx_internal::showTimer = new Timer(0,1);
  204.             this.mx_internal::showTimer.addEventListener(TimerEvent.TIMER,this.mx_internal::showTimer_timerHandler);
  205.          }
  206.          if(!this.mx_internal::hideTimer)
  207.          {
  208.             this.mx_internal::hideTimer = new Timer(0,1);
  209.             this.mx_internal::hideTimer.addEventListener(TimerEvent.TIMER,this.mx_internal::hideTimer_timerHandler);
  210.          }
  211.          if(!this.mx_internal::scrubTimer)
  212.          {
  213.             this.mx_internal::scrubTimer = new Timer(0,1);
  214.          }
  215.          this.mx_internal::initialized = true;
  216.       }
  217.       
  218.       public function registerToolTip(param1:DisplayObject, param2:String, param3:String) : void
  219.       {
  220.          if(!param2 && Boolean(param3))
  221.          {
  222.             param1.addEventListener(MouseEvent.MOUSE_OVER,this.mx_internal::toolTipMouseOverHandler);
  223.             param1.addEventListener(MouseEvent.MOUSE_OUT,this.mx_internal::toolTipMouseOutHandler);
  224.             if(this.mouseIsOver(param1))
  225.             {
  226.                this.showImmediately(param1);
  227.             }
  228.          }
  229.          else if(Boolean(param2) && !param3)
  230.          {
  231.             param1.removeEventListener(MouseEvent.MOUSE_OVER,this.mx_internal::toolTipMouseOverHandler);
  232.             param1.removeEventListener(MouseEvent.MOUSE_OUT,this.mx_internal::toolTipMouseOutHandler);
  233.             if(this.mouseIsOver(param1))
  234.             {
  235.                this.hideImmediately(param1);
  236.             }
  237.          }
  238.       }
  239.       
  240.       public function registerErrorString(param1:DisplayObject, param2:String, param3:String) : void
  241.       {
  242.          if(!param2 && Boolean(param3))
  243.          {
  244.             param1.addEventListener(MouseEvent.MOUSE_OVER,this.mx_internal::errorTipMouseOverHandler);
  245.             param1.addEventListener(MouseEvent.MOUSE_OUT,this.mx_internal::errorTipMouseOutHandler);
  246.             if(this.mouseIsOver(param1))
  247.             {
  248.                this.showImmediately(param1);
  249.             }
  250.          }
  251.          else if(Boolean(param2) && !param3)
  252.          {
  253.             param1.removeEventListener(MouseEvent.MOUSE_OVER,this.mx_internal::errorTipMouseOverHandler);
  254.             param1.removeEventListener(MouseEvent.MOUSE_OUT,this.mx_internal::errorTipMouseOutHandler);
  255.             if(this.mouseIsOver(param1))
  256.             {
  257.                this.hideImmediately(param1);
  258.             }
  259.          }
  260.       }
  261.       
  262.       private function mouseIsOver(param1:DisplayObject) : Boolean
  263.       {
  264.          if(!param1 || !param1.stage)
  265.          {
  266.             return false;
  267.          }
  268.          if(param1.stage.mouseX == 0 && param1.stage.mouseY == 0)
  269.          {
  270.             return false;
  271.          }
  272.          if(param1 is ILayoutManagerClient && !ILayoutManagerClient(param1).initialized)
  273.          {
  274.             return false;
  275.          }
  276.          return param1.hitTestPoint(param1.stage.mouseX,param1.stage.mouseY,true);
  277.       }
  278.       
  279.       private function showImmediately(param1:DisplayObject) : void
  280.       {
  281.          var _loc2_:Number = ToolTipManager.showDelay;
  282.          ToolTipManager.showDelay = 0;
  283.          this.mx_internal::checkIfTargetChanged(param1);
  284.          ToolTipManager.showDelay = _loc2_;
  285.       }
  286.       
  287.       private function hideImmediately(param1:DisplayObject) : void
  288.       {
  289.          this.mx_internal::checkIfTargetChanged(null);
  290.       }
  291.       
  292.       mx_internal function checkIfTargetChanged(param1:DisplayObject) : void
  293.       {
  294.          if(!this.enabled)
  295.          {
  296.             return;
  297.          }
  298.          this.mx_internal::findTarget(param1);
  299.          if(this.currentTarget != this.mx_internal::previousTarget)
  300.          {
  301.             this.mx_internal::targetChanged();
  302.             this.mx_internal::previousTarget = this.currentTarget;
  303.          }
  304.       }
  305.       
  306.       mx_internal function findTarget(param1:DisplayObject) : void
  307.       {
  308.          var _loc2_:Boolean = false;
  309.          while(param1)
  310.          {
  311.             if(param1 is IValidatorListener)
  312.             {
  313.                this.mx_internal::currentText = IValidatorListener(param1).errorString;
  314.                if(param1 is IStyleClient)
  315.                {
  316.                   _loc2_ = IStyleClient(param1).getStyle("showErrorTip");
  317.                }
  318.                if(this.mx_internal::currentText != null && this.mx_internal::currentText != "" && _loc2_)
  319.                {
  320.                   this.currentTarget = param1;
  321.                   this.mx_internal::isError = true;
  322.                   return;
  323.                }
  324.             }
  325.             if(param1 is IToolTipManagerClient)
  326.             {
  327.                this.mx_internal::currentText = IToolTipManagerClient(param1).toolTip;
  328.                if(this.mx_internal::currentText != null)
  329.                {
  330.                   this.currentTarget = param1;
  331.                   this.mx_internal::isError = false;
  332.                   return;
  333.                }
  334.             }
  335.             param1 = param1.parent;
  336.          }
  337.          this.mx_internal::currentText = null;
  338.          this.currentTarget = null;
  339.       }
  340.       
  341.       mx_internal function targetChanged() : void
  342.       {
  343.          var _loc1_:ToolTipEvent = null;
  344.          if(!this.mx_internal::initialized)
  345.          {
  346.             this.mx_internal::initialize();
  347.          }
  348.          if(Boolean(this.mx_internal::previousTarget) && Boolean(this.currentToolTip))
  349.          {
  350.             if(this.currentToolTip is IToolTip)
  351.             {
  352.                _loc1_ = new ToolTipEvent(ToolTipEvent.TOOL_TIP_HIDE);
  353.                _loc1_.toolTip = this.currentToolTip;
  354.                this.mx_internal::previousTarget.dispatchEvent(_loc1_);
  355.             }
  356.             else if(hasEventListener(ToolTipEvent.TOOL_TIP_HIDE))
  357.             {
  358.                dispatchEvent(new Event(ToolTipEvent.TOOL_TIP_HIDE));
  359.             }
  360.          }
  361.          this.mx_internal::reset();
  362.          if(this.currentTarget)
  363.          {
  364.             if(this.mx_internal::currentText == "")
  365.             {
  366.                return;
  367.             }
  368.             _loc1_ = new ToolTipEvent(ToolTipEvent.TOOL_TIP_START);
  369.             this.currentTarget.dispatchEvent(_loc1_);
  370.             if(this.showDelay == 0 || this.mx_internal::scrubTimer.running)
  371.             {
  372.                this.mx_internal::createTip();
  373.                this.mx_internal::initializeTip();
  374.                this.mx_internal::positionTip();
  375.                this.mx_internal::showTip();
  376.             }
  377.             else
  378.             {
  379.                this.mx_internal::showTimer.delay = this.showDelay;
  380.                this.mx_internal::showTimer.start();
  381.             }
  382.          }
  383.       }
  384.       
  385.       mx_internal function createTip() : void
  386.       {
  387.          var _loc1_:ToolTipEvent = new ToolTipEvent(ToolTipEvent.TOOL_TIP_CREATE);
  388.          this.currentTarget.dispatchEvent(_loc1_);
  389.          if(_loc1_.toolTip)
  390.          {
  391.             this.currentToolTip = _loc1_.toolTip;
  392.          }
  393.          else
  394.          {
  395.             this.currentToolTip = new this.toolTipClass();
  396.          }
  397.          this.currentToolTip.visible = false;
  398.          if(this.currentToolTip is IFlexModule && IFlexModule(this.currentToolTip).moduleFactory == null && this.currentTarget is IFlexModule)
  399.          {
  400.             IFlexModule(this.currentToolTip).moduleFactory = IFlexModule(this.currentTarget).moduleFactory;
  401.          }
  402.          if(hasEventListener("createTip"))
  403.          {
  404.             if(!dispatchEvent(new Event("createTip",false,true)))
  405.             {
  406.                return;
  407.             }
  408.          }
  409.          var _loc2_:ISystemManager = this.mx_internal::getSystemManager(this.currentTarget) as ISystemManager;
  410.          _loc2_.topLevelSystemManager.toolTipChildren.addChild(this.currentToolTip as DisplayObject);
  411.       }
  412.       
  413.       mx_internal function initializeTip() : void
  414.       {
  415.          if(this.currentToolTip is IToolTip)
  416.          {
  417.             IToolTip(this.currentToolTip).text = this.mx_internal::currentText;
  418.          }
  419.          if(this.mx_internal::isError && this.currentToolTip is IStyleClient)
  420.          {
  421.             IStyleClient(this.currentToolTip).setStyle("styleName","errorTip");
  422.          }
  423.          this.sizeTip(this.currentToolTip);
  424.          if(this.currentToolTip is IStyleClient)
  425.          {
  426.             if(this.showEffect)
  427.             {
  428.                IStyleClient(this.currentToolTip).setStyle("showEffect",this.showEffect);
  429.             }
  430.             if(this.hideEffect)
  431.             {
  432.                IStyleClient(this.currentToolTip).setStyle("hideEffect",this.hideEffect);
  433.             }
  434.          }
  435.          if(Boolean(this.showEffect) || Boolean(this.hideEffect))
  436.          {
  437.             this.currentToolTip.addEventListener(EffectEvent.EFFECT_END,this.mx_internal::effectEndHandler);
  438.          }
  439.       }
  440.       
  441.       public function sizeTip(param1:IToolTip) : void
  442.       {
  443.          if(param1 is IInvalidating)
  444.          {
  445.             IInvalidating(param1).validateNow();
  446.          }
  447.          param1.setActualSize(param1.getExplicitOrMeasuredWidth(),param1.getExplicitOrMeasuredHeight());
  448.       }
  449.       
  450.       mx_internal function positionTip() : void
  451.       {
  452.          var _loc1_:String = null;
  453.          var _loc3_:Number = NaN;
  454.          var _loc4_:Number = NaN;
  455.          var _loc7_:ILayoutDirectionElement = null;
  456.          var _loc8_:Rectangle = null;
  457.          var _loc9_:Boolean = false;
  458.          var _loc10_:Number = NaN;
  459.          var _loc11_:Number = NaN;
  460.          var _loc12_:ISystemManager = null;
  461.          var _loc13_:Number = NaN;
  462.          var _loc14_:Number = NaN;
  463.          var _loc15_:Point = null;
  464.          if(this.currentTarget is ILayoutDirectionElement)
  465.          {
  466.             _loc1_ = ILayoutDirectionElement(this.currentTarget).layoutDirection;
  467.          }
  468.          else
  469.          {
  470.             _loc1_ = LayoutDirection.LTR;
  471.          }
  472.          var _loc2_:* = _loc1_ == LayoutDirection.RTL;
  473.          var _loc5_:Number = this.currentToolTip.screen.width;
  474.          var _loc6_:Number = this.currentToolTip.screen.height;
  475.          if(this.mx_internal::isError)
  476.          {
  477.             _loc7_ = this.currentToolTip as ILayoutDirectionElement;
  478.             if((Boolean(_loc7_)) && _loc7_.layoutDirection != _loc1_)
  479.             {
  480.                _loc7_.layoutDirection = _loc1_;
  481.                _loc7_.invalidateLayoutDirection();
  482.             }
  483.             _loc8_ = this.getGlobalBounds(this.currentTarget,this.currentToolTip.root,_loc2_);
  484.             _loc3_ = _loc2_ ? _loc8_.left - 4 : _loc8_.right + 4;
  485.             _loc4_ = _loc8_.top - 1;
  486.             _loc9_ = _loc2_ ? _loc3_ < this.currentToolTip.width : _loc3_ + this.currentToolTip.width > _loc5_;
  487.             if(_loc9_)
  488.             {
  489.                _loc10_ = NaN;
  490.                _loc11_ = NaN;
  491.                _loc3_ = _loc2_ ? _loc8_.right + 2 - this.currentToolTip.width : _loc8_.left - 2;
  492.                if(_loc2_)
  493.                {
  494.                   if(_loc3_ < this.currentToolTip.width + 4)
  495.                   {
  496.                      _loc3_ = 4;
  497.                      _loc10_ = _loc8_.right - 2;
  498.                   }
  499.                }
  500.                else if(_loc3_ + this.currentToolTip.width + 4 > _loc5_)
  501.                {
  502.                   _loc10_ = _loc5_ - _loc3_ - 4;
  503.                }
  504.                if(!isNaN(_loc10_))
  505.                {
  506.                   _loc11_ = Number(Object(this.toolTipClass).maxWidth);
  507.                   Object(this.toolTipClass).maxWidth = _loc10_;
  508.                   if(this.currentToolTip is IStyleClient)
  509.                   {
  510.                      IStyleClient(this.currentToolTip).setStyle("borderStyle","errorTipAbove");
  511.                   }
  512.                   this.currentToolTip["text"] = this.currentToolTip["text"];
  513.                }
  514.                else
  515.                {
  516.                   if(this.currentToolTip is IStyleClient)
  517.                   {
  518.                      IStyleClient(this.currentToolTip).setStyle("borderStyle","errorTipAbove");
  519.                   }
  520.                   this.currentToolTip["text"] = this.currentToolTip["text"];
  521.                }
  522.                if(this.currentToolTip.height + 2 < _loc8_.top)
  523.                {
  524.                   _loc4_ = _loc8_.top - (this.currentToolTip.height + 2);
  525.                }
  526.                else
  527.                {
  528.                   _loc4_ = _loc8_.bottom + 2;
  529.                   if(!isNaN(_loc10_))
  530.                   {
  531.                      Object(this.toolTipClass).maxWidth = _loc10_;
  532.                   }
  533.                   if(this.currentToolTip is IStyleClient)
  534.                   {
  535.                      IStyleClient(this.currentToolTip).setStyle("borderStyle","errorTipBelow");
  536.                   }
  537.                   this.currentToolTip["text"] = this.currentToolTip["text"];
  538.                }
  539.             }
  540.             this.sizeTip(this.currentToolTip);
  541.             if(!isNaN(_loc11_))
  542.             {
  543.                Object(this.toolTipClass).maxWidth = _loc11_;
  544.             }
  545.             else if(_loc2_)
  546.             {
  547.                _loc3_ = _loc8_.right + 2 - this.currentToolTip.width;
  548.             }
  549.          }
  550.          else
  551.          {
  552.             _loc12_ = this.mx_internal::getSystemManager(this.currentTarget);
  553.             _loc3_ = DisplayObject(_loc12_).mouseX + 11;
  554.             if(_loc2_)
  555.             {
  556.                _loc3_ -= this.currentToolTip.width;
  557.             }
  558.             _loc4_ = DisplayObject(_loc12_).mouseY + 22;
  559.             _loc13_ = Number(this.currentToolTip.width);
  560.             if(_loc2_)
  561.             {
  562.                if(_loc3_ < 2)
  563.                {
  564.                   _loc3_ = 2;
  565.                }
  566.             }
  567.             else if(_loc3_ + _loc13_ > _loc5_)
  568.             {
  569.                _loc3_ = _loc5_ - _loc13_;
  570.             }
  571.             _loc14_ = Number(this.currentToolTip.height);
  572.             if(_loc4_ + _loc14_ > _loc6_)
  573.             {
  574.                _loc4_ = _loc6_ - _loc14_;
  575.             }
  576.             _loc15_ = new Point(_loc3_,_loc4_);
  577.             _loc15_ = DisplayObject(_loc12_).localToGlobal(_loc15_);
  578.             _loc15_ = DisplayObject(_loc12_.getSandboxRoot()).globalToLocal(_loc15_);
  579.             _loc3_ = _loc15_.x;
  580.             _loc4_ = _loc15_.y;
  581.          }
  582.          this.currentToolTip.move(_loc3_,_loc4_);
  583.       }
  584.       
  585.       mx_internal function showTip() : void
  586.       {
  587.          var _loc2_:ISystemManager = null;
  588.          var _loc1_:ToolTipEvent = new ToolTipEvent(ToolTipEvent.TOOL_TIP_SHOW);
  589.          _loc1_.toolTip = this.currentToolTip;
  590.          this.currentTarget.dispatchEvent(_loc1_);
  591.          if(this.mx_internal::isError)
  592.          {
  593.             this.currentTarget.addEventListener(Event.CHANGE,this.mx_internal::changeHandler);
  594.          }
  595.          else
  596.          {
  597.             _loc2_ = this.mx_internal::getSystemManager(this.currentTarget);
  598.             _loc2_.addEventListener(MouseEvent.MOUSE_DOWN,this.mx_internal::systemManager_mouseDownHandler);
  599.          }
  600.          this.currentToolTip.visible = true;
  601.          if(!this.showEffect)
  602.          {
  603.             this.mx_internal::showEffectEnded();
  604.          }
  605.       }
  606.       
  607.       mx_internal function hideTip() : void
  608.       {
  609.          var _loc1_:ToolTipEvent = null;
  610.          var _loc2_:ISystemManager = null;
  611.          if(this.mx_internal::previousTarget)
  612.          {
  613.             _loc1_ = new ToolTipEvent(ToolTipEvent.TOOL_TIP_HIDE);
  614.             _loc1_.toolTip = this.currentToolTip;
  615.             this.mx_internal::previousTarget.dispatchEvent(_loc1_);
  616.          }
  617.          if(this.currentToolTip)
  618.          {
  619.             this.currentToolTip.visible = false;
  620.          }
  621.          if(this.mx_internal::isError)
  622.          {
  623.             if(this.currentTarget)
  624.             {
  625.                this.currentTarget.removeEventListener(Event.CHANGE,this.mx_internal::changeHandler);
  626.             }
  627.          }
  628.          else if(this.mx_internal::previousTarget)
  629.          {
  630.             _loc2_ = this.mx_internal::getSystemManager(this.mx_internal::previousTarget);
  631.             _loc2_.removeEventListener(MouseEvent.MOUSE_DOWN,this.mx_internal::systemManager_mouseDownHandler);
  632.          }
  633.          if(!this.hideEffect)
  634.          {
  635.             this.mx_internal::hideEffectEnded();
  636.          }
  637.       }
  638.       
  639.       mx_internal function reset() : void
  640.       {
  641.          var _loc1_:DynamicEvent = null;
  642.          var _loc2_:ISystemManager = null;
  643.          this.mx_internal::showTimer.reset();
  644.          this.mx_internal::hideTimer.reset();
  645.          if(this.currentToolTip)
  646.          {
  647.             if(Boolean(this.showEffect) || Boolean(this.hideEffect))
  648.             {
  649.                this.currentToolTip.removeEventListener(EffectEvent.EFFECT_END,this.mx_internal::effectEndHandler);
  650.             }
  651.             EffectManager.endEffectsForTarget(this.currentToolTip);
  652.             if(hasEventListener("removeChild"))
  653.             {
  654.                _loc1_ = new DynamicEvent("removeChild",false,true);
  655.                _loc1_.sm = this.currentToolTip.systemManager;
  656.                _loc1_.toolTip = this.currentToolTip;
  657.             }
  658.             if(!_loc1_ || dispatchEvent(_loc1_))
  659.             {
  660.                _loc2_ = this.currentToolTip.systemManager as ISystemManager;
  661.                _loc2_.topLevelSystemManager.toolTipChildren.removeChild(this.currentToolTip as DisplayObject);
  662.             }
  663.             this.currentToolTip = null;
  664.             this.mx_internal::scrubTimer.delay = this.scrubDelay;
  665.             this.mx_internal::scrubTimer.reset();
  666.             if(this.scrubDelay > 0)
  667.             {
  668.                this.mx_internal::scrubTimer.delay = this.scrubDelay;
  669.                this.mx_internal::scrubTimer.start();
  670.             }
  671.          }
  672.       }
  673.       
  674.       public function createToolTip(param1:String, param2:Number, param3:Number, param4:String = null, param5:IUIComponent = null) : IToolTip
  675.       {
  676.          var _loc8_:DynamicEvent = null;
  677.          var _loc6_:ToolTip = new ToolTip();
  678.          var _loc7_:ISystemManager = !!param5 ? param5.systemManager as ISystemManager : FlexGlobals.topLevelApplication.systemManager as ISystemManager;
  679.          if(param5 is IFlexModule)
  680.          {
  681.             _loc6_.moduleFactory = IFlexModule(param5).moduleFactory;
  682.          }
  683.          else
  684.          {
  685.             _loc6_.moduleFactory = _loc7_;
  686.          }
  687.          if(hasEventListener("addChild"))
  688.          {
  689.             _loc8_ = new DynamicEvent("addChild",false,true);
  690.             _loc8_.sm = _loc7_;
  691.             _loc8_.toolTip = _loc6_;
  692.          }
  693.          if(!_loc8_ || dispatchEvent(_loc8_))
  694.          {
  695.             _loc7_.topLevelSystemManager.toolTipChildren.addChild(_loc6_ as DisplayObject);
  696.          }
  697.          if(param4)
  698.          {
  699.             _loc6_.setStyle("styleName","errorTip");
  700.             _loc6_.setStyle("borderStyle",param4);
  701.          }
  702.          _loc6_.text = param1;
  703.          this.sizeTip(_loc6_);
  704.          _loc6_.move(param2,param3);
  705.          return _loc6_ as IToolTip;
  706.       }
  707.       
  708.       public function destroyToolTip(param1:IToolTip) : void
  709.       {
  710.          var _loc2_:DynamicEvent = null;
  711.          var _loc3_:ISystemManager = null;
  712.          if(hasEventListener("removeChild"))
  713.          {
  714.             _loc2_ = new DynamicEvent("removeChild",false,true);
  715.             _loc2_.sm = param1.systemManager;
  716.             _loc2_.toolTip = param1;
  717.          }
  718.          if(!_loc2_ || dispatchEvent(_loc2_))
  719.          {
  720.             _loc3_ = param1.systemManager as ISystemManager;
  721.             _loc3_.topLevelSystemManager.toolTipChildren.removeChild(param1 as DisplayObject);
  722.          }
  723.       }
  724.       
  725.       mx_internal function showEffectEnded() : void
  726.       {
  727.          var _loc1_:ToolTipEvent = null;
  728.          if(this.hideDelay == 0)
  729.          {
  730.             this.mx_internal::hideTip();
  731.          }
  732.          else if(this.hideDelay < Infinity)
  733.          {
  734.             this.mx_internal::hideTimer.delay = this.hideDelay;
  735.             this.mx_internal::hideTimer.start();
  736.          }
  737.          if(this.currentTarget)
  738.          {
  739.             _loc1_ = new ToolTipEvent(ToolTipEvent.TOOL_TIP_SHOWN);
  740.             _loc1_.toolTip = this.currentToolTip;
  741.             this.currentTarget.dispatchEvent(_loc1_);
  742.          }
  743.       }
  744.       
  745.       mx_internal function hideEffectEnded() : void
  746.       {
  747.          var _loc1_:ToolTipEvent = null;
  748.          this.mx_internal::reset();
  749.          if(this.mx_internal::previousTarget)
  750.          {
  751.             _loc1_ = new ToolTipEvent(ToolTipEvent.TOOL_TIP_END);
  752.             _loc1_.toolTip = this.currentToolTip;
  753.             this.mx_internal::previousTarget.dispatchEvent(_loc1_);
  754.          }
  755.       }
  756.       
  757.       mx_internal function getSystemManager(param1:DisplayObject) : ISystemManager
  758.       {
  759.          return param1 is IUIComponent ? IUIComponent(param1).systemManager : null;
  760.       }
  761.       
  762.       private function getGlobalBounds(param1:DisplayObject, param2:DisplayObject, param3:Boolean) : Rectangle
  763.       {
  764.          var _loc4_:Point = new Point(0,0);
  765.          _loc4_ = param1.localToGlobal(_loc4_);
  766.          if(param3)
  767.          {
  768.             _loc4_.x -= param1.width;
  769.          }
  770.          _loc4_ = param2.globalToLocal(_loc4_);
  771.          return new Rectangle(_loc4_.x,_loc4_.y,param1.width,param1.height);
  772.       }
  773.       
  774.       mx_internal function toolTipMouseOverHandler(param1:MouseEvent) : void
  775.       {
  776.          this.mx_internal::checkIfTargetChanged(DisplayObject(param1.target));
  777.       }
  778.       
  779.       mx_internal function toolTipMouseOutHandler(param1:MouseEvent) : void
  780.       {
  781.          this.mx_internal::checkIfTargetChanged(param1.relatedObject);
  782.       }
  783.       
  784.       mx_internal function errorTipMouseOverHandler(param1:MouseEvent) : void
  785.       {
  786.          this.mx_internal::checkIfTargetChanged(DisplayObject(param1.target));
  787.       }
  788.       
  789.       mx_internal function errorTipMouseOutHandler(param1:MouseEvent) : void
  790.       {
  791.          this.mx_internal::checkIfTargetChanged(param1.relatedObject);
  792.       }
  793.       
  794.       mx_internal function showTimer_timerHandler(param1:TimerEvent) : void
  795.       {
  796.          if(this.currentTarget)
  797.          {
  798.             this.mx_internal::createTip();
  799.             this.mx_internal::initializeTip();
  800.             this.mx_internal::positionTip();
  801.             this.mx_internal::showTip();
  802.          }
  803.       }
  804.       
  805.       mx_internal function hideTimer_timerHandler(param1:TimerEvent) : void
  806.       {
  807.          this.mx_internal::hideTip();
  808.       }
  809.       
  810.       mx_internal function effectEndHandler(param1:EffectEvent) : void
  811.       {
  812.          if(param1.effectInstance.effect == this.showEffect)
  813.          {
  814.             this.mx_internal::showEffectEnded();
  815.          }
  816.          else if(param1.effectInstance.effect == this.hideEffect)
  817.          {
  818.             this.mx_internal::hideEffectEnded();
  819.          }
  820.       }
  821.       
  822.       mx_internal function systemManager_mouseDownHandler(param1:MouseEvent) : void
  823.       {
  824.          this.mx_internal::reset();
  825.       }
  826.       
  827.       mx_internal function changeHandler(param1:Event) : void
  828.       {
  829.          this.mx_internal::reset();
  830.       }
  831.    }
  832. }
  833.  
  834.