Packageflare.vis.controls
Classpublic class TooltipControl
InheritanceTooltipControl Inheritance Control Inheritance flash.events.EventDispatcher

Interactive control for displaying a tooltip in response to mouse hovers exceeding a minimum time interval. By default, a flare.display.TextSprite instance is used to show a tooltip. To change the tooltip text, clients can set either the text or htmlText properties of this TextSprite. For example:
  // create a new tooltip control and set the text
  var ttc:TooltipControl = new TooltipControl();
  TextSprite(ttc.tooltip).text = "The tooltip text";
  

Furthermore, this control fires events corresponding to tooltip show, update (move), and hide events. Listeners can be added to dynamically change the tooltip text when these events occur. Additionally, the default text tooltip can be replaced with an arbitrary DisplyObject to provide completely customized tooltips.

See also

flare.vis.events.TooltipEvent
flare.display.TextSprite


Public Properties
 PropertyDefined by
  fadeDuration : Number = 0.3
Duration of fade animations (in seconds) for tooltip show and hide.
TooltipControl
 Inheritedfilter : Function
Boolean function indicating the items considered by the control.
Control
  followMouse : Boolean = true
Indicates if the tooltip should follow the mouse pointer.
TooltipControl
  hideDelay : Number
The delay before hiding a tooltip, in milliseconds.
TooltipControl
 Inheritedobject : InteractiveObject
The interactive object this control is attached to.
Control
  showDelay : Number
The tooltip delay, in milliseconds.
TooltipControl
  tipBounds : Rectangle = null
The legal bounds for the tooltip in stage coordinates.
TooltipControl
  tooltip : DisplayObject = null
The display object presented as a tooltip.
TooltipControl
  xOffset : Number = 0
The x-offset from the mouse at which to place the tooltip.
TooltipControl
  yOffset : Number = 25
The y-offset from the mouse at which to place the tooltip.
TooltipControl
Public Methods
 MethodDefined by
  
TooltipControl(filter:* = null, tooltip:DisplayObject = null, show:Function = null, update:Function = null, hide:Function = null, delay:Number = 500)
Creates a new TooltipControl.
TooltipControl
  
attach(obj:InteractiveObject):void
Attach this control to the given interactive object.
TooltipControl
  
[static] Generates a default TextSprite tooltip
TooltipControl
  
detach():InteractiveObject
Detach this control.
TooltipControl
Protected Methods
 MethodDefined by
  
layout(tip:DisplayObject, obj:DisplayObject):void
Calculates the tooltip layout.
TooltipControl
Events
 EventSummaryDefined by
    TooltipControl
    TooltipControl
    TooltipControl
Property detail
fadeDurationproperty
public var fadeDuration:Number = 0.3

Duration of fade animations (in seconds) for tooltip show and hide. If less than or equal to zero, no fade will be performed.

followMouseproperty 
public var followMouse:Boolean = true

Indicates if the tooltip should follow the mouse pointer.

hideDelayproperty 
hideDelay:Number  [read-write]

The delay before hiding a tooltip, in milliseconds.

Implementation
    public function get hideDelay():Number
    public function set hideDelay(value:Number):void
showDelayproperty 
showDelay:Number  [read-write]

The tooltip delay, in milliseconds.

Implementation
    public function get showDelay():Number
    public function set showDelay(value:Number):void
tipBoundsproperty 
public var tipBounds:Rectangle = null

The legal bounds for the tooltip in stage coordinates. If null (the default), the full stage bounds are used.

tooltipproperty 
public var tooltip:DisplayObject = null

The display object presented as a tooltip.

xOffsetproperty 
public var xOffset:Number = 0

The x-offset from the mouse at which to place the tooltip.

yOffsetproperty 
public var yOffset:Number = 25

The y-offset from the mouse at which to place the tooltip.

Constructor detail
TooltipControl()constructor
public function TooltipControl(filter:* = null, tooltip:DisplayObject = null, show:Function = null, update:Function = null, hide:Function = null, delay:Number = 500)

Creates a new TooltipControl.

Parameters
filter:* (default = null) — a Boolean-valued filter function indicating which items should receive tooltip handling
 
tooltip:DisplayObject (default = null)
 
show:Function (default = null)
 
update:Function (default = null)
 
hide:Function (default = null)
 
delay:Number (default = 500)
Method detail
attach()method
public override function attach(obj:InteractiveObject):void

Attach this control to the given interactive object. This method will automatically detach if already attached to another object.

Parameters
obj:InteractiveObject — the display object to attach to
createDefaultTooltip()method 
public static function createDefaultTooltip():TextSprite

Generates a default TextSprite tooltip

Returns
TextSprite — a new default tooltip object
detach()method 
public override function detach():InteractiveObject

Detach this control.

Returns
InteractiveObject — the interactive object this control was attached to, or null if this control was not attached.
layout()method 
protected function layout(tip:DisplayObject, obj:DisplayObject):void

Calculates the tooltip layout.

Parameters
tip:DisplayObject — the tooltip object
 
obj:DisplayObject — the currently moused-over object
Event detail
hideevent 
Event object type: flare.vis.events.TooltipEvent

showevent  
Event object type: flare.vis.events.TooltipEvent

updateevent  
Event object type: flare.vis.events.TooltipEvent