-
Combobox help
Hi,
I have a combobox which has a list of countries in it. I want to change the combobox value into a variable so that I can use it later on in the application. How is the best way to do this.
Thanks,
Jon
-
I'm assuming you're using MX 2004...
Try this:
// These are the variables that will keep track of what is selected in the combo box
var comboChoiceLabel;
var comboChoiceData;
// This creates a listener for the combo box
var myComboBoxListener = new Object();
myComboBoxListener.change = function(change)
{
// When the user selects an item in the combo box, the variable is changed
comboChoiceLabel = myComboBox.selectedItem.label;
comboChoiceData = myComboBox.selectedItem.data;
trace("comboChoiceLabel = " + comboChoiceLabel);
trace("comboChoiceData = " + comboChoiceData);
}
// This adds the event listener to myComboBox
myComboBox.addEventListener("change", myComboBoxListener);
Hope that helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|