@Khalid I'll try what you said. @Rakesh, buddy I know that using selectedIndex we can select an item but I dont have index, I have the data of arraycollection i.e. in my variable I have item3 not 2.
var selected: String = ''item3; (this is what I have) var selected: int= 2; (I dont have this) So using item3 which is the data field of arraycollection, how can I select Item3 in combobox. I hope u got what I want to say. Thanks, JT On Jul 30, 7:06 am, rakesh amety <[email protected]> wrote: > In combo box creation complete add this code myCombo.selectedIndex = 2 > > On Fri, Jul 30, 2010 at 1:24 AM, JT <[email protected]> wrote: > > It friends, > > > How can I load a drop down box with pre-selected item? > > > Here is my dropdown box > > > [Bindable] > > public var items:ArrayCollection = new ArrayCollection( > > [ {label:"Item 1", data:"item1"}, > > {label:"Item2", data:"item2"}, > > {label:"Item3", data:"item3"}, > > {label:"Item4", data:"item4"}, > > {label:"Item5", data:"item5"} ]); > > > <mx:ComboBox id="myCombo" dataProvider="{items}" width="121"></ > > mx:ComboBox> > > > Now lets say I have a variable which have a value item3, than I want > > that when the mxml loads the Item 3 should be pre selected, I am doing > > something like this > > > var selected: String = ''item3; > > myCombo.selectedItem.data = selected; > > > Could you please suggest what I am doing wrong, or what should I do ? > > > Thanks, > > Jaswant > > > -- > > You received this message because you are subscribed to the Google Groups > > "Flex India Community" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<flex_india%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/flex_india?hl=en. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

