Flex 2.0.1 ComboBox with icon support.
April 28th, 2007
Sometimes a ComboBox with icons in the list as well as in the text display area can be useful. However the out of the box Flex ComboBox component dosn’t support this. Here is one way of doing it.
![]()
Basically I’ve extended the existing ComboBox adding iconField and iconFunction properties. I had to instance my own ClassFactory for the internal list that is used as the dropdown so that I could pre-initialize the required properties. I override the measuredWidth so that I can make room for the icon, and adjust the x position of the internal textInput to compensate.
A little addition to the toolbox that can come in really handy.
Sample and Source : IconComboBox
Enjoy.
Jason Hawryluk
April 29th, 2007 at 5:22 pm
When I click view source and it goes to delicious. what’s happening?
April 29th, 2007 at 6:50 pm
Seems to be working fine here? Weird.
Anyone else having trouble ?
jason
May 7th, 2007 at 3:23 pm
View Source appears to be working fine here. Thanks for the code!
July 5th, 2007 at 2:27 pm
[…] Flex 2.0.1 ComboBox with icon support. « Flexible Experiments […]
August 4th, 2007 at 5:08 pm
Source link seems to be not working
August 4th, 2007 at 5:19 pm
Seems to be working for me.
Ben, try again, and let me know.
Jason
October 19th, 2007 at 9:00 am
Do you have embed the icons? I need to load them dynamically. But it keeps throwing an error in measuredWidth (null object reference)
…
var l:String = element.@nld+” - “+element.@nom;
var ic:String = “images/flags/”+String(element.@nld).toLowerCase()+”.png”; trace(ic);
countryArr[cntr] = {label:l, data:ic};
…
…