2009-12-24 91 views
0

我的Flex應用程序有各種自定義組件。我希望所有人的工具提示可以顯示在右上角。 是否有一個應用程序設置,我可以做到這一點?或者我必須在組件級別執行此操作。 無論哪種方式,它將如何完成?工具提示位置設置

回答

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