This content has been marked as final. Show 3 replies
Unless you combo box dataProvider items are primitive values, like string or number, you cannot set currentItem.
Instead, you must loop over the dataProvider and compare the value in the appropriate property to the value you want to match. When you find a match, use the loop index to set the ComboBox.selectedIndex.
Doing this one-off is simple. If you need it often, consider extending ComboBox. The difficulty with this is that the dataProvider can be anything and it is difficult to generically handle all the possibilities. I suspect that this is why ComboBox does not handle it natively.
I have an example here.
My Combobox contains only text strings in XMLListCollection, but the
mx:ComboBox's selectedIndex does not work with dataProvider.
XMLListCollection items are XML nodes, not strings. selectedItem will not work.
selectedIndex will work.