2 Replies Latest reply on Nov 18, 2009 8:57 AM by stoopkid

    ComboBox eventListener problem

    stoopkid

      Hello fellow flexers,

       

      I'm having issues with a ComboBox, when the user selects an item from the ComboBox I need Flex to change to another state. I'm attempting to do this through an eventListener. Here is my code:

       

      <mx:ComboBox id="step3_cb_primary_income" dataProvider="{income}" change="step3_cb_primary_income.addEventListener(MouseEvent.CLICK, prrimaryIncomeResult, false, 0) "> </mx:ComboBox>

       

       

      private function primaryIncomeResult(event:Event) {

           if(step3_cb_primary_income.selectedIndex==1) {

                currentState='income';

                }

       

           if(step3_cb_primary_income.selectedIndex==2) {

                currentState='finance';

                }

       

      }

       

      When the ComboBox selectedIndex changes, nothing happens. I'd really appreciate some help on this. I've gone through Adobe's addEventListener examples and tutorials to no avail. I feel like I'm just missing the obvious, but I've spent a few hours trying to figure this out and am all out of options.

       

      Thanks,

       

      Michael

        • 1. Re: ComboBox eventListener problem
          RK... Level 3

          Am not clear about your requirement. If you want to invoke change event listener, try this

           

           

          <mx:ComboBox id="step3_cb_primary_income" dataProvider="{income}" change="primaryIncomeResult(event)"> </mx:ComboBox>

           

           

          private function primaryIncomeResult(event: Event): void {

               if(step3_cb_primary_income.selectedIndex == 1) {

                    currentState='income';

               }

               if(step3_cb_primary_income.selectedIndex == 2) {

                    currentState='finance';

               }

          }

          • 2. Re: ComboBox eventListener problem
            stoopkid Level 1

            Thank you much RK. Works perfectly now =)

             

            I love Adobe forums!