7 Replies Latest reply on Aug 20, 2009 6:23 AM by csr_1978

    ComboBox with default item selected

    csr_1978

      Hi,

       

      I am trying to display combobox with an item selected by default. Is it possible to use selectedItem instead of selectedIndex to acheive this?

       

      Here is the code and I want User2 to be selected by default:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
      <mx:HBox id="box">
          <mx:Label text="User:"/>
          <mx:ComboBox prompt="Select" selectedItem="User2">
              <mx:dataProvider>
                  <mx:String>User1</mx:String>
                  <mx:String>User2</mx:String>
                  <mx:String>User3</mx:String>
              </mx:dataProvider>
          </mx:ComboBox>
      </mx:HBox>   
      </mx:Application>

       

      Please let me know if this is possible?

       

      Thanks,