2009-12-01 78 views

回答

0

import mx.events.ListEvent;導入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; 
       } 
      } 

     } 
0

Flex中創建自己的項目渲染:

<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" 
       autoDrawBackground = "true" 
       toolTip="{data.description}"> 
<...> 

</s:ItemRenderer> 

這裏描述的是你通過的addItem傳遞給ComboBox對象的屬性()。 (例如,我傳遞一個XML,所以我做數據。@說明)

相關問題