Tooltips in detached windows with Adobe AIR

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s