Wiki

Clone wiki

dsair / Tooltip

HOWTO: Tooltip: Adding tooltips to objects

Introduction

You can use tooltips to give more info on different symbols or objects in your app. With the Tooltip class, this becomes trivial.

Details

Check out the TestTooltip.as file for the full details.

As with all examples, you need to init the framework before doing anything:

#!actionscript

DSAir.init( this ); // "this" is your Document class

Adding a tooltip

To add a tooltip to an InteractiveObject, simply call:

#!actionscript

var myObj:Sprite = new Sprite;
Tooltip.instance.add( myObj, "The tooltip for the sprite" );

By default, if you click on the object the tooltip is removed, with the exception that the tooltip changes (i.e. a high/low quality button that changes depending on the current quality can have a different tooltip for each state). To change the tooltip, simply make another call to the add() function.

Removing a tooltip

To remove a tooltip, call:

#!actionscript

Tooltip.instance.remove( myObj );

Updated