ComboBox中使用事件

 

代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initCB();">
    
<mx:Script>
        
<![CDATA[
            
import mx.events.DropdownEvent;
            
private function initCB():void{
                var info:Array 
= new Array();
                info.push({label:
"", data: "red"});
                info.push({label:
"绿", data: "green"});
                info.push({label:
"", data: "blue"});
                _cb.dataProvider 
= info;
                
                _cb.addEventListener(DropdownEvent.CLOSE, chooseCB);
            }
            
private function chooseCB(evt:DropdownEvent):void{
                var obj:Object 
= _cb.selectedItem;
                _tip.text 
= "label:" + obj.label + " data:" + obj.data;
            }
        ]]
>
    
</mx:Script>
    
<mx:ComboBox x="62" y="51" id="_cb"></mx:ComboBox>
    
<mx:TextArea x="62" y="81" height="114" id="_tip"/>
    
</mx:Application>

 

 

相关文章:

  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-09-19
  • 2022-12-23
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-06-19
  • 2021-09-04
  • 2022-12-23
相关资源
相似解决方案