Hi FlexCoders,
I would want to create a generic function to be able to set a ComboBox item.
The function I have goes like this:
private function selectComboItem(itemID:String, dataProv:XMLListCollection,
cmb:ComboBox, dpID:String) :void
{
for (var i:int = 0; i< dataProv.length; i++)
{
var item:String = dataProv.getItemAt(i).dpID;
if(itemID == item)
{
cmb.selectedIndex = i;
break;
}
}
}
dpID is the data item in the XML List collection which should match the passed
itemID. But I can't seem to get properly the item.
Any suggestions highly appreciated. Thanks.