<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
<!-- 组合框默认以label作为标签字段,data作为值字段 -->
<mx:Array id="comboData1">
<mx:Object label="男" data="M" icon="@Embed(source='images/nan.gif')"/>
<mx:Object label="女" data="FM" icon="@Embed(source='images/nv.gif')"/>
</mx:Array>
<mx:Script>
<![CDATA[
//下拉框菜单项包含图标
private function init():void{
combo1.dropdown.iconField = "icon";
}
private function comboChange():void{
msg1.text = combo1.value.toString();
}
]]>
</mx:Script>
<mx:ComboBox id="combo1" x="10" y="10" width="150" fontSize="12"
prompt="请选择..."
labelField="label"
dataProvider="{comboData1}"
alternatingItemColors="['#EEEEEE', '#FFFFFF']"
textIndent="5"
creationComplete="init()"
change="comboChange()"/>
</mx:Application>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
<!-- 组合框默认以label作为标签字段,data作为值字段 -->
<mx:Array id="comboData1">
<mx:Object label="男" data="M" icon="@Embed(source='images/nan.gif')"/>
<mx:Object label="女" data="FM" icon="@Embed(source='images/nv.gif')"/>
</mx:Array>
<mx:Script>
<![CDATA[
//下拉框菜单项包含图标
private function init():void{
combo1.dropdown.iconField = "icon";
}
private function comboChange():void{
msg1.text = combo1.value.toString();
}
]]>
</mx:Script>
<mx:ComboBox id="combo1" x="10" y="10" width="150" fontSize="12"
prompt="请选择..."
labelField="label"
dataProvider="{comboData1}"
alternatingItemColors="['#EEEEEE', '#FFFFFF']"
textIndent="5"
creationComplete="init()"
change="comboChange()"/>
</mx:Application>