I’ve got an onChange event in which I’d like to test if a comboBox is empty, if it is, I want to change the colour of the comboBox. I can find a value e.g. “Fred Bloggs” but not test to see if it’s empty:
if (e.target.selectedItem.label == ""){ // This doesn't work
trace("EMPTY");
my_color.color = 0x002222;
instructorList.transform.colorTransform = my_color;
}
The selectedItem property will be null if no item is selected:
Note the CHANGE event won’t be fired if there are no items in the ComboBox because it’s not possible to ‘change’ it to anything. Instead, add this test to the CLICK handler.
UPDATE: Given the new information in the comments below, simply test if the index matches the blank item at the top of the list.