4 Replies Latest reply on May 11, 2008 3:28 PM by Ned Murphy

    ComboBox doesn't update value

    kalibahlu Level 1
      Hi all,
      I can find tutorial that tell me how to trace the selected item from a combobox, but can't figure out how to pass that information into a useful variable. The trace works fine, over and over, but the other part will only execute first time there's a change, and not again. Could anyone please give me a clue as to why that might be? Thank you very much in advance! Here's the code:
        • 1. Re: ComboBox doesn't update value
          Ned Murphy Adobe Community Professional & MVP
          I copied your code and tried it, placing a text box on the stage. It didn't work at first, then I tried doing a few things and got it working, then I removed those things I did and it kept working. Then I copied your code again and pasted it over everything and it worked fine... it's a mystery!

          You may have just been doing that for test purposes, but you don't meed all of the if statements since you can assign textbox.text the value of the label of my_cb.
          • 2. Re: ComboBox doesn't update value
            kalibahlu Level 1
            HI Ned! Thanks so much for testing it and replying! Yes, you're right, I did the if statements as a test, because when/if this works, I'll change those statements to something else. What I really need to do is pass the data to a string which will complete a URL.

            I guess the fact that this works sometimes and not other times isn't a good thing ;-) but it's important to know. Your testing sure helps to offer a clue toward the answer... whatever it might be. Does anyone have any idea why this code would work sometimes and not others? Or if anyone can point to the another way to reliably collect data from a combobox and put it into a variable, it would be most appreciated. Thanks all!
            • 3. Re: ComboBox doesn't update value
              kalibahlu Level 1
              Ned, it's so strange. I thought I'd try what you did and I changed a few things and then changed them back and now it works... I don't get it, but I'm going with it for now! Specifically, I gave the textbox a variable of my_cb, and then took it away again, and now its happy. Thanks again for your help!
              • 4. Re: ComboBox doesn't update value
                Ned Murphy Adobe Community Professional & MVP
                The only things I did were first... changed the following line as such...

                var itemNumber = Number(my_cb.getSelectedItem().data);

                which worked, then I changed it again to...

                var itemNumber:Number = my_cb.getSelectedItem().data;

                which worked, then I just changed it back to...

                var itemNumber = my_cb.getSelectedItem().data;

                ala just repasting your entire code segment, which worked... so???

                Maybe it just didn't feel like working on a weekend, but finally gave in?