4 Replies Latest reply on Dec 6, 2011 7:42 AM by A.kameshwaran

    combo box listing

    A.kameshwaran Level 1



           I am having the combo box and the editable property is set to true. What i want is the combo box listing has to change according to the text typed in the combo box. How can i achive it.



      Kameshwaran A.

        • 1. Re: combo box listing
          Ned Murphy Adobe Community Professional & MVP

          Look in the Flash help documentation for the ComboBox class.  Select the 'editable' property link in there and it should open a section that explains that property that that has an example explaining how to add a new item to the ComboBox when the user enters one.

          • 2. Re: combo box listing
            A.kameshwaran Level 1

            That i know. What i want is, I have added 6 items in combo box and i am making it editable property as true.


            for example items are,


            1. test

            2. apple

            3. mangao

            4. tier

            5. mask

            6. ant




            default these 6 items will be listed in my combo box. If i press "m" then in combo box listing there should be only two(mangao & mask). if i remove "m" then all the six has to be displayed. I don't want to add new things. Purpose of this is i may have 100 - 200 things in the listing. So user can select easily by typing the known keyword.


            How can i do it

            • 3. Re: combo box listing
              Ned Murphy Adobe Community Professional & MVP

              You will need to add all your entries into some form of data structure so that they are all available for filling the combobox and for being scruntinzed for matches against what the user entrers.  An array would work.  So first get your combobox filled using the array.


              Since you say you know how to do what I offered the first time, then you should know how to modify it so that instead of adding an item, it calls upon a function that tests the string the user entered against each entry in the array and empties and refills the the comboibox accordingly with array elements that match. YOu probably only need the change listener from that example, but still want to make use of the evt_obj.target.value for testing what the user entered.


              For testing the user entry for matches you can use the String.indexOf() method while looping thru the array to see which elements of the array start with the letter entered by the user.  After that check is done and the combobox is rewritten, in case nothing matched you can just refill it with the entrie array again.

              • 4. Re: combo box listing
                A.kameshwaran Level 1

                Ya you are right. I have done all this. I have  done it using keyup even. But the problem now were i am facing is, listing is comming perfect.


                if i want to select the item from the listed list(ex 4 items and i want to select 3rd item) i can do it by using the mouse. if i try to select through keyboard, then my key event  obviously got triggered and i can't select 3rd item.. because, if press the down key 1st got selected. how to overcome from this.