tip: change ScrollBar colors

This information applies ONLY to the old ScrollBar component that came with Flash MX and to the "Flash MX Components for Flash 2004." If you are using the new UIScrollBar component for Flash MX 2004, this will not work. Please see the other Tips page about using a scrollbar in MX 2004.

Seven lines of ActionScript will allow you to change the colors in Macromedia's ScrollBar component for Flash MX:

sbar.setStyleProperty("arrow", 0xFF0000); sbar.setStyleProperty("highlight", 0xFFFFFF); sbar.setStyleProperty("highlight3D", 0xFF0000); sbar.setStyleProperty("shadow", 0xFF99CC); sbar.setStyleProperty("darkshadow", 0xFF0000); sbar.setStyleProperty("scrollTrack", 0xCC6666); sbar.setStyleProperty("face", 0xFFCCCC);

In this case, the ScrollBar instance name is "sbar."

The attributes map as follows:

  • arrow: Both little triangles
  • highlight: Left & top edge, inner
  • highlight3D: Left & top edge, outer
  • shadow: Right & bottom edge, inner
  • darkshadow: Right & bottom edge, outer
  • scrollTrack: Slide area
  • face: Dragger bar & both buttons

Version: Flash MX, not MX 2004

> More tips