1 Reply Latest reply on Feb 6, 2007 5:00 AM by MotionMaker

    Need some help with scripting a button and a combo box

    satrop Level 1
      Right this is what I have, about 50 buttons that show a _mc of a shoe style, color etc.. then next to that I have combo boxes with a list of the stlye, colors etc.. I what to be able to add some code to the buttons so that you only have to click the button on the style you want and it select's that style for you in the combo box not make a note of the style on that button then go find it in the combo box. Can any one help?
        • 1. Re: Need some help with scripting a button and a combo box
          MotionMaker Level 1
          The final step is to select the index of the ComboBox using the selectIndex property..

          For example
          myComboBox.selectedIndex = 3;

          Now how you get to the index value can vary. You might have the index value previously stored with your buttons. This you did when setting up the UI.

          Or perhaps your buttons store the label in the ComboBox. In this case you would loop through the ComboBox using the length property. In side the loop you would use the getItemAt() method. and compare the label value stored in your button and the one in the return value of getItemAt(). If a match then the loop counter would be the index. See the example below for ideas on this tact. Assumes the labels on the buttons are Red, Green and Blue.