Flex: Enhanced search filtering Flex3 ComboBox
Long time ago I’ve created a custom search ComboBox in Java Swing for an enterprise application. Exploring the Flex framework I tried to find the same kind of ComboBox component. First place to look for special components is probably the flexlib, another good resource is Flex Examples. I was not lucky, so I searched the Web - here’s what I found:
Demo
Ok, a lot of cool stuff, especially the Autocomplete TextInput component, but not exactly what I was looking for. Anyway, I thought it’s a nice exercise to see how easy or difficult it is to customize a Flex Combobox (btw, in Swing it was not easy at all
) and this is my result so far:
You can get the source from here, but please be careful - the component was not heavily tested and so far not used in any application.
Open issues
-
Actually it’s a non-editable combobox, but it still looks like an editable combobox. I’ve tried to fix this by switching from non-editable to editable and back on the fly via an approach more or less like this:
override protected function focusInHandler(event:FocusEvent):void { editable = true; super.focusInHandler(event); } override protected function focusOutHandler(event:FocusEvent):void { editable = false; super.focusOutHandler(event); }
But unfortunately it’s not that easy. I run into several problems and fixing one issue was causing another. Maybe it’s a better idea to change the skin dynamically, but I’m not sure if this is the way to go.
-
Setting the
promptproperty is not working correctly. - Start editing in the input field will open the dropdown list, but when you resize the window so the dropdown list will close the dropdown list will stay invisible (see bug issue)
Flex 4
I’m sure there are more open issues, but maybe the code is a good starting point - or should we rather wait for FxComboBox in Flex 4 - Gumbo (to be continued…).

How about a binary combobox? Where you have a labelFunction that’s what is shown, but a behind-the-scene Identifier. How would that apply to this control?
Joseph
20 Jan 09 at 9:28 pm
Joseph, what do you mean with a ‘behind-the-scene’ identifier and what should be the use case for such a component?
Stefan Bistram
22 Jan 09 at 7:27 pm
Very helpful article. Nice job. Thank you !
Taras
17 Apr 09 at 4:50 pm
If you want to hear a reader’s feedback
, I rate this post for four from five. Detailed info, but I just have to go to that damn msn to find the missed parts. Thanks, anyway!
Ted Burrett
24 Apr 09 at 1:08 pm
how can I modify your component such that by default the first item in the drop down list is selected and when I press ‘ENTER’ the first item becomes the ’selectedItem’ ?
Tee
19 Nov 09 at 12:47 am
Hi
I searched the web for the right autocomplete combo box solution. Yours is definitely the best.
Thank you
name later gator
yourfan
28 Dec 09 at 8:01 pm
Hey,
This post is really helpful..
Keep it up
nits
4 Jan 10 at 8:16 pm
Very God!!!
Felipe
17 Jan 10 at 6:06 am
very very good,
thanks so mush for your helpful code …
ehab
21 Jan 10 at 5:15 pm
Great job
thank you
stefan M
9 Feb 10 at 2:43 am
Awesome thank you verymuch, this is exactly what I was looking for..you rock
mark
17 Jun 10 at 6:20 pm