工具提示放置设置

时间:2009-12-24 17:02:44

标签: flex actionscript-3 mxml

我的flex应用程序有各种自定义组件。我希望所有这些工具提示显示在右上角。 我可以使用应用程序设置吗?或者我必须在组件级别执行此操作。 无论哪种方式,它将如何完成?

1 个答案:

答案 0 :(得分:0)

ToolTipManager.createToolTip函数接受工具提示的位置(x和y坐标)以及要显示的消息。您需要计算组件右上角相对于其父组件中位置的位置。例如:

// 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 );