0 Replies Latest reply on Nov 24, 2009 11:17 AM by manofspirit

    Custom Tooltip Positioning Problem

    manofspirit Level 1

      Hi

       

      I created a sample project to illustrate my problem. Right now my custom tooltip is positioned according to Mouse.

      I want it to draw exactly over its parent, which is button , regardless of the mouse pointer's position.

       

      Here is the Code

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
           <mx:Script>
                <![CDATA[
                     import mx.events.ToolTipEvent;
                          
                          private function tooltipCreator(event:ToolTipEvent):void{
                                    var customTooltip:CustomTooltip     = new CustomTooltip();
                                    customTooltip.myTooltip =     "Good Morning";
                                    event.toolTip = customTooltip;
                                    
                                    var myBtnPt:Point = new Point(myBtn.x, myBtn.y);          
                                    var tooltipPt:Point = myBtn.localToGlobal(myBtnPt);
                                    
                                  event.toolTip.x = tooltipPt.x;
                                  event.toolTip.y = tooltipPt.y;     
                          }
                     
                ]]>
           </mx:Script>
           <mx:Canvas x="108" y="94" width="200" height="200">
                <mx:Button id="myBtn" toolTip=" " toolTipCreate="tooltipCreator(event)" y="70" label="Mouse Over" x="39"/>
           </mx:Canvas>
      </mx:Application>
      
      

       

       

      please look at the attached project for experiencing it.

       

      Thanks