I've got an application in Flex 1.5 that uses constants
stored in XML files (see attached). The XML files are loaded into
mx:Models and used as dataProviders on ComboBoxes with "abbr" as
the labelItem. The business objects store only the numeric ID of
the constants. When a business object is loaded, I need to set the
selectedItem of the ComboBox using the numeric ID but I can't
because it doesn't match the items in the dataProvider.
Is it possible to intercept the selectedItem property change
and process the dataProvider items in order to compare the numeric
values instead of having to process it in a function outside of the
control itself? I'd like to write this code only once.
Okay, instead of trying to do any magic with property
changes, I decided to just create my own property (selectedValue).
When this property is set, it iterates through the dataProvider and
finds the index of the item that matches. The selectedValue
property sets the value of selectedIndex to that item.