Rajesh asked me this question today and I thought I’ll share with everyone…
I have done the following example using CSS that was generated from the Flex Style Explorer App
This is what this will achieve

This is how we can achieve it. We know that the dropDown on the ComboBox is actually a List. So if you can set the scrollbar onto the List and then set the List style onto the ComboBox, we are done.
- The style on List verticalScrollBarStyleName can be used to skin the List’s scrollbar
- Once this is done, use the dropdownStyleName style on ComboBox to style the dropDown List
As simple as that
Let’s look at the CSS now.
.myVScrollBar {
cornerRadius: 16;
highlightAlphas: 0, 0;
fillColors: #0099ff, #0033ff, #000000, #ffffff;
trackColors: #000000, #ffffff;
themeColor: #009dff;
}.myList {
cornerRadius: 10;
verticalScrollBarStyleName: myVScrollBar
}
A CSS style declaration called myVScrollBar is used to skin the scrollbar (generated from the Style Explorer App). Another style declaration called myList is defined and here, as you see we nest the style declarations, by setting myVScrollBar to the verticalScrollBarStyleName style of the List.
Once this CSS file is saved (as say, test.css), just do the following to get this onto your App
< mx:Style source=”test.css”/>
<mx:ComboBox dataProvider=”{cards}” dropdownStyleName=”myList”/>
Enjoy


July 25, 2007 at 10:33 am |
Is there a way to change the scroll bar styles globally in a Flex 2 app., without having to specify it explicitly for each component ?
July 25, 2007 at 10:41 am |
very simple… set VScrollBar directly in the CSS, it gets applied to the whole app…
VScrollBar {
cornerRadius: 16;
highlightAlphas: 0, 0;
fillColors: #ab99ff, #cd33ff, #ef0000, #ffffff;
trackColors: #000000, #ffffff;
themeColor: #009dff;
}
September 5, 2007 at 5:48 pm |
hi! i have one simple question.. how can i do this in flash? or its only for flex..?
September 6, 2007 at 4:57 am |
@ukw – This sure can be done in Flash. But my knowledge of flash is very limited.
I’m a Java/C++ programmer converted to Flex. This should help you in your quest – http://www.kirupa.com/developer/mx/skinning_scrollbar.htm
October 11, 2007 at 10:07 am |
Dear Sir,
is it possible to override only the THICKNESS of a scrollbar (public static const THICKNESS:Number=16 in Scrollbar.as) ?
thanks for a quick answer.
October 11, 2007 at 10:11 am |
I am actually working with Flex.
I have sucessfully skinned my scollbar, the problem is that i just want to reduce the thickness of the thumb.
Here is the style (comments are in french, sorry…) :
.myScrollStyle {
borderColor: #000000;
/* fond du scrollbar */
trackDownSkin : Embed(“fonds/fd_scrollbar.png”);
trackDisabledSkin : Embed(“fonds/fd_scrollbar.png”);
trackOverSkin : Embed(“fonds/fd_scrollbar.png”);
trackUpSkin : Embed(“fonds/fd_scrollbar.png”);
/* onglet du scrollbar */
thumbDisabledSkin : Embed(“boutons/bt_thumb.png”);
thumbDownSkin : Embed(“boutons/bt_thumb.png”);
thumbOverSkin : Embed(“boutons/bt_thumb.png”);
thumbUpSkin : Embed(“boutons/bt_thumb.png”);
thumbIcon : Embed(“boutons/bt_thumb.png”);
/* fleche montante */
upArrowDisabledSkin : Embed(“boutons/bt_arrow_up.png”);
upArrowDownSkin : Embed(“boutons/bt_arrow_up.png”);
upArrowOverSkin : Embed(“boutons/bt_arrow_up.png”);
upArrowUpSkin : Embed(“boutons/bt_arrow_up.png”);
/* fleche descendante */
downArrowDisabledSkin : Embed(“boutons/bt_arrow_down.png”);
downArrowDownSkin : Embed(“boutons/bt_arrow_down.png”);
downArrowOverSkin : Embed(“boutons/bt_arrow_down.png”);
downArrowUpSkin : Embed(“boutons/bt_arrow_down.png”);
}
December 27, 2007 at 4:44 pm |
Thanks for the tutorial, is very interesting, but how can I change the scroolBar width in a comboBox?. Thanks
January 28, 2008 at 12:45 pm |
I tried to skin the scrollbar in TileList using skin image, but , I was not able to do so. I get the default scrollbar instead of my image. How to solve this problem. need an urgent reply.
February 5, 2008 at 2:00 am |
Me too, I aqm looking for the way to change the width of scrollbar in Tcombobox.
Anybody pls help
February 22, 2008 at 1:28 am |
I was able to change the width of the scrollbar. The scrollbar has a THICKNESS constant which is 16. The mx.skins.halo.ScrollArrowSkin has getters for this constant. I just skinned all four arrow skins with smaller images and my scroll bar’s width was determined by those images.
May 17, 2008 at 11:09 am |
Hi, I have one question, if you know the response you are my saver!! How its possible to change the style dynamically of ScrollBar (same for AccordionHeader) ??
I tried with getStyleDeclaration function from StyleManager but I have the felling that these Flex objects doesnt bind the style changements??
Thanks a lot
May 17, 2008 at 11:13 am |
Sorry, StyleManager.getStyleDeclaration(“VScrollBar”).setStyle(“cornerRadius”, 0); works (only if VScrollBar is already definied in a classic CSS), but for Accordion headers, this seems impossible to do because header are built when the accordion is built and header doesnt listen the changement of the style rule. Is it good ??
August 11, 2008 at 6:44 pm |
CSS “Cascading Style Sheets” Lessons
css list style Properties and examples — http://css-lessons.ucoz.com/list-css-examples.htm
August 22, 2008 at 4:28 pm |
Hey, that’s great artcile, Just solved my problems with overiding the global scroll bar I made… Good stuff. Cheers.
August 30, 2008 at 8:18 am |
Hi,
Useful tips and tutorials..
How to change the color of the Scrollbar(I have changed its skin) when I select a color from Standard ColorPicker
Note:
I know this will work if we didn’t skin the Scrollbar
(vs.getChildAt(i)as UIComponent).setStyle(‘backgroundColor’, cP.selectedColor);
But how can i change its color If I skin the scrollbar
April 1, 2009 at 3:18 pm |
Hi,
Very useful. Do you have any idea how to change the background colour of the input box on a combobox when editable is set to true?
Many thanks
Darren.
May 6, 2009 at 12:22 pm |
I am facing a problem in flex.I have a combobox in my application,and when i am trying to scrolling the scroll bar of that combobox,it is closing the list.(It is not at all scrolling).Now i am not able to see the list of combobox,while scrolling.please provide a solution.