Change Color of Scrollbar

99 views
Skip to first unread message

Ganga Ambika

unread,
Aug 30, 2008, 4:45:03 AM8/30/08
to flex_...@googlegroups.com

Hello Everyone,

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

<mx:Script>
private function init():void  {                   
                vs.setScrollProperties(300,0,310,300);
                vs.lineScrollSize = 300;
 }
private function changed(event:ColorPickerEvent):void  {                 
                for(var i:int=0; i< vs.numChildren; i++) {
                          (vs.getChildAt(i)as UIComponent).setStyle('backgroundColor', cP.selectedColor);
                }
}
]]>
</mx:Script>
   
<mx:VScrollBar width="20" height="300" x="100" id="vs" />
<mx:ColorPicker change="changed(event)" id="cP" x="235" y="45" />

But how to change its color If I skin the scrollbar.

Thanks,
Ganga

Venkat Viswanathan

unread,
Aug 30, 2008, 12:52:41 PM8/30/08
to flex_...@googlegroups.com
Hi Ganga,

What kind of skinning have you done? Have you put the skin as an image or as an SWF?

Regards,
Venkat

Ganga Ambika

unread,
Sep 1, 2008, 5:17:45 AM9/1/08
to flex_...@googlegroups.com
I have put the image(.png) as a skin for the scrollbar

Thanks,
Ganga
--
Thanks,
Ganga

"Start by doing what is necessary, then what is possible, and suddenly
you are doing the impossible."


Ganga Ambika

unread,
Sep 1, 2008, 5:18:42 AM9/1/08
to flex_...@googlegroups.com
This is how I have skinned the Scrollbar

ScrollBar
{
  upArrowSkin: ClassReference(null);
  downArrowSkin: ClassReference(null);
  thumbDownSkin: Embed(source="../assets/scroll.png", scaleGridLeft="9", scaleGridTop="14",scaleGridRight="10", scaleGridBottom="25");
  thumbUpSkin: Embed(source="../assets/scroll.png",scaleGridLeft="9", scaleGridTop="14",scaleGridRight="10", scaleGridBottom="25");      
  thumbOverSkin: Embed(source="../assets/scroll.png",scaleGridLeft="9", scaleGridTop="14",scaleGridRight="10", scaleGridBottom="25");      
  trackSkin: Embed(source="../assets/scrolloverlay.png", scaleGridLeft="9", scaleGridTop="14",scaleGridRight="10", scaleGridBottom="43");   

Venkat Viswanathan

unread,
Sep 1, 2008, 12:50:01 PM9/1/08
to flex_...@googlegroups.com
Hi,

When you skin with png, I dont think it is possible. One option could be if you could use vector graphics for skinning the scrollbar. Again I am not sure if it would work, but you can give a try.

Regards,
Venkat
www.venkatv.com
Reply all
Reply to author
Forward
0 new messages