Hi All

I am having some issues with ToolTips on items in a List control. I am 
currently using FlexBuilder 3.

What I need to do is create a tooltip when a user rolls over the item in a 
list. The list stores a list of Metrics, and should show the definition 
associated with that metric when you roll over the item in the list.

The tooltip is created fine, and the tooltip disappears when the user moves the 
mouse to another item.

The problem comes in when the user rolls the mouse wheel to scroll the list 
down. The event doesn't fire,so the tooltip stays there, and another tooltip is 
created as the user is now pointing to a different item. You can now end up 
with multiple tooltips for different items.

I have tried using itemFocusIn and itemFocusOut as well, but this doesn't work 
either.

Not sure if there is another event I need to use, or if there is code I could 
use to destroy all tooltips on the screen. Either way would work.

Any help would be appreciated.

D


MXML:
-----

<mx:List dataProvider="{arrMetrics}" id="cboMetric" labelField="MetricName"     
                                                                        
width="100%"  itemRollOver="{showTip(event);}"
itemRollOut="{destroyTip();}"></mx:List>


ActionScript:
-------------

private function showTip(event:Object):void {
    s = event.itemRenderer.data.Definition;
    var pt:Point = new Point(
        event.currentTarget.x, 
        event.currentTarget.y);
    
    // Call this method to convert the object's
    // coordinates inside its container to the stage's 
    // global coordinates.
    pt = event.currentTarget.contentToGlobal(pt);
    tip = ToolTipManager.createToolTip(s, 
        pt.x - event.currentTarget.width, 
        pt.y
    ) as ToolTip;
}

private function destroyTip():void {     
     ToolTipManager.destroyToolTip(tip);               
}            

Reply via email to