hello experts My goal is to create a generic function that selects a value in a combobox accoring to a value. (My comoBox holds arrayCollection as dataProvider.)
The difficulty is infact to get a propertyname in runtime mode
public function selectComboByLabel(combo:ComboBox , propetryName:String, value:String):void {
var dp:ArrayCollection = combo.dataProvider as ArrayCollection;
for (var i:int=0;i<dp.length;i++) {
if (dp.getItemAt(i).propertyName==value) {
combo.selectedIndex = i;
return;
}
}
}
the line if (dp.getItemAt(i).propertyName==value) is of course incorrect. It should be arther something like: dp.getItemAt(i).getPropertyByName(propertyName)
Any clue on how to that ?