flex中的combo组件。
获取属性时,可以使用id.property的方式。
<
mx:Script
>
<![CDATA[
import mx.controls.Alert;
import mx.events.MenuEvent;
public function comboHandle():void
{
Alert.show(co.selectedItem["label"]);
Alert.show(co.selectedItem["data"]);
}
]]>
</ mx:Script >
< mx:ComboBox fontSize ="12" editable ="true" id ="co" close ="comboHandle()" >
< mx:ArrayCollection >
< mx:Object label ="工程师1" data ="l1" />
< mx:Object label ="工程师2" data ="l2" />
</ mx:ArrayCollection >
</ mx:ComboBox >
<![CDATA[
import mx.controls.Alert;
import mx.events.MenuEvent;
public function comboHandle():void
{
Alert.show(co.selectedItem["label"]);
Alert.show(co.selectedItem["data"]);
}
]]>
</ mx:Script >
< mx:ComboBox fontSize ="12" editable ="true" id ="co" close ="comboHandle()" >
< mx:ArrayCollection >
< mx:Object label ="工程师1" data ="l1" />
< mx:Object label ="工程师2" data ="l2" />
</ mx:ArrayCollection >
</ mx:ComboBox >
定义comboBox的id,通过id获取组件,再通过组件访问到其属性值。
触发事件使用:close方法
转载于:https://blog.51cto.com/xiaosa/152771