3 Replies Latest reply on Sep 4, 2006 5:12 PM by

    Combobox change event

      i have 2 comboboxes heightcombo and lengthcombo. I want to assign their current values to variables when combobox values changed. But only one of them works:( Other one doesnt work ( i changed their order i remove one and then other)( if there is only 1 of them then no problem)

      function change(eventObject:Object):Void {
      if (eventObject.target._name == "lengthcombo") {
      length = lengthcombo.getValue();

      heigthcombo.addEventListener("change", this);
      function change(eventObject:Object):Void {
      if (eventObject.target._name == "heigthcombo") {
      heigth = heigthcombo.getValue();

      what is problem???? please need help
        • 1. Re: Combobox change event
          Craig Grummitt Level 3
          how interesting. i just replied to yeddish with a very similar problem.

          you've just defined two functions - both of them called 'change'. the second time you define the function 'change', you overwrite the previous definition.
          • 2. Re: Combobox change event
            ok i solve problem but i leave my mistake here to be an example;

            i need to declare listener object such as;

            var heigthListener:Object = new Object();
            heigthcombo.addEventListener("change", heigthListener); //i used "this" here
            ..... code goes on
            • 3. Re: Combobox change event
              wooow Craig you are rigthh..... it is really another perspective to solve this problem it works too last code is;(i merged 2 functions)

              function change(eventObject:Object):Void {
              if (eventObject.target._name == "encombo") {
              en = encombo.getValue();
              if (eventObject.target._name == "boycombo") {
              boy = boycombo.getValue();

              boycombo.addEventListener("change", this);

              thank you for this experience...