1 Reply Latest reply on Sep 19, 2006 6:31 AM by inlineblue

    Combo and SelectedItem property

    Freeseb
      I want to bind a combo with a database. When reading the value from the database I want the the combo is initialised with the right item so I use the selectedItem property. But no way to select the item like that despite i don't see where is the problem. I can NOT use use selectedIndex property because the data values are not necessary numbers.

      here is a code example : clicking on the button should select one item...but not. where am i wrong ?

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:ComboBox x="94" y="43" width="250" id="combo" >
      <mx:ArrayCollection>
      <mx:Object label="Select..." data=""/>
      <mx:Object label="Item a" data="1"/>
      <mx:Object label="Item b" data="4"/>
      <mx:Object label="Item c" data="9"/>
      </mx:ArrayCollection>
      </mx:ComboBox>
      <mx:Button label="Button" click="{combo.selectedItem.data=4}"/>
      </mx:Application>