tags:

views:

307

answers:

1

How to make list items as tool tips for combo box items?

A: 

import mx.events.ListEvent; import mx.managers.ToolTipManager; import mx.controls.ToolTip;

  public var myTip:ToolTip;

  private function fnInit():void
  {
   cmb.addEventListener(ListEvent.ITEM_ROLL_OVER,fnCreToolTip);
   cmb.addEventListener(ListEvent.ITEM_ROLL_OUT,fnCreToolTip);
   cmb.addEventListener(ListEvent.CHANGE,fnCreToolTip);
  }
  private function fnCreToolTip(e:ListEvent):void
  {
   switch(e.type)
   {
    case ListEvent.ITEM_ROLL_OVER:
    {
     //creates a tooltip.
     myTip = ToolTipManager.createToolTip(array2[e.rowIndex].tooltip,stage.mouseX+10,stage.mouseY) as ToolTip; // array2 is id of arraylist  
     break;
    }
    case ListEvent.ITEM_ROLL_OUT:
    {
     //destroy the created tooltip, so that we can create a new one for others.
     ToolTipManager.destroyToolTip(myTip);
     break;
    }
    case ListEvent.CHANGE:
    {
     //destroy the created tooltip, so that we can create a new one for others.
     ToolTipManager.destroyToolTip(myTip);
     break;
    }
   }

  }
sabeerdeen