ComboBox用法绑定取值

ComboBox用法绑定取值,注意第4条
1.定义后绑定[Bindable]
  private var Field1:ArrayCollection=new ArrayCollection(
  [{label:"省份",data:"Province"},
   {label:"地区",data:"County"},
   {label:"邮编",data:"Zipcode"},
   {label:"区号",data:"Areacode"}]);

<mx:ComboBox id=”strField” width=”70″ dataProvider=”{Field1}”/>

2.直接绑定
<mx:ComboBox id=”strField” width=”70″>
    <mx:dataProvider>
     <mx:Array>
      <mx:Object label=”省份” data=”Province”/>
      <mx:Object label=”地区” data=”County”/>
      <mx:Object label=”邮编” data=”Zipcode”/>
      <mx:Object label=”区号” data=”Areacode”/>
     </mx:Array>
    </mx:dataProvider>
    </mx:ComboBox>

3.改变ComboBox值变化

<mx:ComboBox dataProvider=”{cards}” width=”150″
            close=”closeHandler(event);”/>
private function closeHandler(event:Event):void {
                myLabel.text = “You selected: ” +  ComboBox(event.target).selectedItem.label;
                myData.text = “Data: ” +  ComboBox(event.target).selectedItem.data;
            }

4.查询的时候取值比如定义了第1条后 strField.value——–ID.value这个特别要注意。

你可能感兴趣的:(combobox)