xacttech
07-31-2007, 05:30 PM
Hey guys I've got another comboBox one for you...
I'm having a comboBox selection run a function of the same name.
ie:
comboBox.addItem({data:"NAME", label:"Item number 1"});
comboBox.addItem({data:"NAME_2", label:"Item number 2"});
So two items on a comboBox... I need to execute a function after a section is made. here's what I've been doing
var modelListener:Object = new Object();
this.comboBox.addEventListener("change", comboChange);
comboChange.change = function(model_evtObj:Object) {
if (comboBox.selectedItem.data == "NAME") {
NAME();
}
if (comboBox.selectedItem.data == "NAME_2") {
NAME_2();
}
If I could create a listener that automatically executed a function of the same string held in the comboBox data, I'd be set.
Here's my Dummy Logic:
if combo box selected data = something, run something();
No matter what the data is, run a function of the same name.
Thanks Guys!!
I'm having a comboBox selection run a function of the same name.
ie:
comboBox.addItem({data:"NAME", label:"Item number 1"});
comboBox.addItem({data:"NAME_2", label:"Item number 2"});
So two items on a comboBox... I need to execute a function after a section is made. here's what I've been doing
var modelListener:Object = new Object();
this.comboBox.addEventListener("change", comboChange);
comboChange.change = function(model_evtObj:Object) {
if (comboBox.selectedItem.data == "NAME") {
NAME();
}
if (comboBox.selectedItem.data == "NAME_2") {
NAME_2();
}
If I could create a listener that automatically executed a function of the same string held in the comboBox data, I'd be set.
Here's my Dummy Logic:
if combo box selected data = something, run something();
No matter what the data is, run a function of the same name.
Thanks Guys!!