- Needed to be able to load XML with a standard format “label” as the value you see and “data” as the value of the selection.
- Needed a way to set the selected value, so the correct “label” shows as selected (borrowed).
- Load the XML dynamically by setting the XML path during runtime.
- XML list in the ComboBox may change without recompiling the application.
I extended the ComboBox in actionscript and added two new properties to be able to accomplish the requirements.
xmlFile=”xml/somefile.xml” sets the files path.
selectedValue=”somecode” sets the value of the data to be selected.
This example uses Country and State/Province. When you select “United States” as the country, the States xml will load. When you select “Canada” as the country, the Provinces xml will load. The selectedValue can be changed during runtime as in the example using the TextInput component and change event.