title: Flex - prevent tooltips from hiding. Persistent tooltips
body: <p>I'm trying to prevent a custom tooltip from disappearing.  I've tried three runs at this, borrowing from the usual suspects: Peter Dehann, MonkeyPatch and others.  As you can see from the code below I'd like to stay within the tool tip paradigm and not go to popups.  </p>
  
  <p>Can anyone suggest a way to persist a tooltip?  The intent here is to have a component which can be cut and paste from.</p>
  
  <p>Thanks,
  Doug</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application minHeight="600" creationComplete="application1_creationCompleteHandler(event)"
   minWidth="955"
   xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   xmlns:s="library://ns.adobe.com/flex/spark"&gt;
   &lt;fx:Script&gt;
    &lt;![CDATA[
     import mx.events.FlexEvent;
     import mx.events.ToolTipEvent;
  
     protected function button1_clickHandler(event:MouseEvent):void {
      // TODO Auto-generated method stub
     }
  
     protected function button1_toolTipCreateHandler(event:ToolTipEvent):void {
      createCustomToolTip("title", "", event);
     }
  
     // TODO Auto-generated method stub
     private function createCustomToolTip(title:String, body:String, event:ToolTipEvent):void {
      var ptt:CustomToolTip = new CustomToolTip();
      ptt.title = title;
      ptt.bodyText = (event.currentTarget as Button).toolTip;
      event.toolTip = ptt;
     }
  
     protected function button1_toolTipHideHandler(event:ToolTipEvent):void
     {
      // TODO Auto-generated method stub
      event.stopPropagation();
      event.preventDefault();
      event.stopImmediatePropagation();
     }
  
     import mx.managers.ToolTipManager;
  
     private var tt:CustomToolTip;
     private var cc:CustomToolTip;
  
     private function create_toolTip():void {
      var str:String = "Tooltip text goes here...";
      // We only want one tooltip.
      if (tt == null) {
       tt = ToolTipManager.createToolTip(str, 100, 50) as CustomToolTip;
      }
     }
  
     protected function application1_creationCompleteHandler(event:FlexEvent):void
     {
      // TODO Auto-generated method stub
      mx.managers.ToolTipManager.toolTipClass = CustomToolTip;
      //mx.managers.ToolTipManager.scrubDelay = 100000;
      //mx.managers.ToolTipManager.hideDelay = 1000000;
     }
  
  
     protected function button1_toolTipEndHandler(event:ToolTipEvent):void
     {
      event.preventDefault();
      event.stopImmediatePropagation();
      // TODO Auto-generated method stub
     }
  
    ]]&gt;
   &lt;/fx:Script&gt;
   &lt;fx:Declarations&gt;
    &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
   &lt;/fx:Declarations&gt;
   &lt;mx:VBox&gt;
  
   &lt;mx:Button click="button1_clickHandler(event)" 
    toolTip="helloWorld" toolTipHide="button1_toolTipHideHandler(event)" toolTipEnd="button1_toolTipEndHandler(event)" 
    toolTipCreate="button1_toolTipCreateHandler(event)" &gt;
   &lt;/mx:Button&gt;
  
   &lt;mx:Button label="create tool tip" click="create_toolTip();" /&gt;
  
   &lt;mx:Button toolTip="hello world" label="hello"&gt;
  
   &lt;/mx:Button&gt;
   &lt;/mx:VBox&gt;
  &lt;/s:Application&gt;
  </code></pre>