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.

Reply via email to