A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Combobox help

  1. #1
    Junior Member
    Join Date
    Mar 2005
    Posts
    15

    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

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center