// this code assumes the existance of a ComboBox (Components -> User Interface -> ComboBox)
// on the stage with an instance name of "MY_DROPDOWN_INSTANCE_NAME" plus two items defined in its properties
// named "Choice One" and "Choice Two"
var MY_DROPDOWN_LISTENER:Object=new Object(); // a new listener
MY_DROPDOWN_INSTANCE_NAME.addEventListener("change", MY_DROPDOWN_LISTENER); //add listener to combobox
MY_DROPDOWN_LISTENER.change=function(){ //function called
// do something based on the selected item's label
switch(MY_DROPDOWN_INSTANCE_NAME.getSelectedItem().label) {
case "Choice One":
trace("one");
break;
case "Choice Two":
trace("two");
break;
}
// do something based on the selected item's value
switch(MY_DROPDOWN_INSTANCE_NAME.getSelectedItem().data) {
case "Choice One":
trace("one");
break;
case "Choice Two":
trace("two");
break;
}
}