I'm creating a custom tooltip and there's not enough room in the 
bottom right 
corner to display it, how do I change the x and y coordinates in 
order to 
move it someplace so it's not off screen and fits?
There are examples on how to reposition for a text tooltip in the 
help, 
but none for a custom tooltip.
thanks,
-steve
here's a live example: 
http://designwithflex.com/projects/tooltip/

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
 height="300" width="300" layout="absolute">    
<mx:Script >
<![CDATA[
 import mx.controls.ToolTip;    
 import mx.events.ToolTipEvent; 
private function createToolTip(event:ToolTipEvent):void {
 var mytooltip:mycustomtooltip = new mycustomtooltip();
 mytooltip.x = 20;  /* can I set x here? */
 mytooltip.y = 20;  /* this doesn't work? */ 
 event.toolTip = mytooltip;
}
]]>
</mx:Script>
<mx:Canvas  id="mycanvas">
  <mx:Label id="centerlabel" text="custom tooltip works great here" 
   toolTip=" " toolTipCreate="createToolTip(event)" />          
 <mx:Label id="bottomlabel" x="119" y="251" text="no room for tooltip 
down here" 
   toolTip=" " toolTipCreate="createToolTip(event)"/>
</mx:Canvas>
</mx:Application>

<?xml version="1.0" encoding="utf-8"?>
<!-- mycustomtooltip.mxml -->
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="200" 
 backgroundColor="red" implements="mx.core.IToolTip"  height="100">
<mx:Script >
<![CDATA[
  //  Implement required methods of the IToolTip interface; these 
  //  methods are not used, though.
  public var _text:String;
  public function get text():String { 
   return _text; 
  } 
  public function set text(value:String):void {
  } 
 ]]>
</mx:Script>      
<mx:Label   id="tooltiplabel" text="This is a custom tooltip" />
</mx:Canvas>


Reply via email to