Tooltips in detached windows with Adobe AIR

Posted at — Jan 10, 2013

I just had an issue where we display a tooltip on a custom component in Flex. This worked fine until we also used this component in a detached window in Adobe AIR. We never saw the tooltip in the detached window.

This is the code we used before in the custom component:

m_tooltip = ToolTipManager.createToolTip( tooltip, event.stageX + 10, event.stageY + 10 );

This is what fixed it:

m_tooltip = ToolTipManager.createToolTip( tooltip, event.stageX + 10, event.stageY + 10, null, this );

The important part is the this parameter passed into the createToolTip method. If not passed into the method, the framework will always use the FlexGlobals.topLevelApplication, which is not your detached window. By passing in the reference to custom component to the tooltip manager, it will use the correct native window to display the tooltip in.

If you want to be notified in the future about new articles, as well as other interesting things I'm working on, join my mailing list!
I send emails quite infrequently, and will never share your email address with anyone else.