Tooltip placement setting
My flex app has various Custom components. I want the tooltips for all of them to show at the top-right corner. Is there a Applica开发者_运维百科tion setting that I can do this with? Or do I have to do this at the component level. Either ways, how will it be done?
The ToolTipManager.createToolTip function accepts the position (x and y coordinates) of the tooltip along with the message to display. You'll need to calculate the position of the top-right corner of the components relative to their position within their parent component. For example:
// position the tooltip to the top right of the component
var p:Point = new Point();
p.x = component.x + length; // may want to add some padding i.e. +5 pixels
p.y = component.y;
// find coordinates in the global coordinate space
p = component.localToGlobal( p );
var tip:IToolTip = ToolTipManager.createToolTip( "tooltip message", p.x, p.y );
精彩评论