Search code examples
apache-flexflex3combobox

flex 3 combobox selected item


I have a combobox with arrayCollection dataprovider, it has nothing selected after creation. I want to add some text as first option when nothing is selected, just to indicate that the user didn't select an option yet.


Solution

  • If I understood you correctly, prompt property is what you are looking for. To quote the ComboBox documentation from Flex 3:

    The prompt for the ComboBox control. A prompt is a String that is displayed in the TextInput portion of the ComboBox when selectedIndex = -1. It is usually a String like "Select one...". If there is no prompt, the ComboBox control sets selectedIndex to 0 and displays the first item in the dataProvider.

    Quote from ComboBox documentation