반응형
ComboArrcol.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel width="250" height="200" layout="absolute" horizontalCenter="0" verticalCenter="0">
<mx:ComboBox horizontalCenter="0" verticalCenter="0" dataProvider="{season}" close="closeHandler();" id="cb"></mx:ComboBox>
</mx:Panel>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
public var season:ArrayCollection = new ArrayCollection(
[{label:"Spring", data:1},{label:"Summer", data:2},
{label:"Autumn", data:3},{label:"Winter", data:4}]);
private function closeHandler():void{
mx.controls.Alert.show("season: "+cb.selectedLabel+"\n"+"data: "+cb.selectedItem.data);
}
]]>
</mx:Script>
</mx:Application>
반응형