2 Replies Latest reply on Aug 26, 2007 11:43 AM by stephan.k

    comboBox selectedIndex doesn't work

    stephan.k Level 1
      Hello forum

      I'm having problems with the comboBox. It must be a a bug of some sort and I was wondering if anyone out there knows of a workaround.

      I am using 2 movieclips which each contain a comboBox instance. I'm using the same code for both of boxes to fill them with data from an xml file. Everything works fine. The only strange thing is when I use the selectedIndex property once it doesn't seem to work again, meaning everytime I reload either one of the movieClips the comboBox has no selected value (first text in the box, visible before it opens).

      Any pros out there aware of this issue and could pin point the bug, what creates it and how to get around it?

      Any insight appreciated.

      Much thanks

      stephank
        • 1. Re: comboBox selectedIndex doesn't work
          stephan.k Level 1
          The item is selected (green background color) in the drop down list, however it does not appear in the text field above the drop down list as selected item.
          • 2. Re: comboBox selectedIndex doesn't work
            stephan.k Level 1
            I did some more testing:

            Does it have something to do with some initiation delay of the comboBox possibly? Let's say for example the comboBox is not properly initiated/loaded when I set the selectedIndex?

            The following code doesn't work when I attach the movieClip mc which contains the comboBox. It works though if the comboBox is on the root to begin with/it is not attached.


            function init(){
            _root.attachMovie("mc","mc",1);

            _root.mc.comboBox.labelField = "name";
            _root.mc.comboBox.addItem({name: "Nina", age: 25});
            _root.mc.comboBox.addItem({name: "Patrick", age: 24});
            _root.mc.comboBox.addItem({name: "Luciano", age: 35});

            _root.mc.comboBox.selectedIndex = 2;

            }


            button.onRelease = function(){
            init();
            }