你可以通过剥皮来实现这一点。整个滚动条是可定制的。您只需要将HScrollBar的trackSkin样式设置为编程皮肤。然后你的皮肤基本上是两个长方形。0到
parent.scrollPosition
.另一个来自
父母亲滚动位置
到
height
.以下是一个可能有效的例子。我还没有测试。你可能需要修改一些数字。
public class ScrollBarSkin extends Border
{
//maybe needed as a hack for the flex internals. Values may need to be changed for specific cases
override public function get measuredWidth():Number {return 16; }
override public function get measuredHeight():Number {return 10;}
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w,h);
if(this.parent) {
var g:Graphics = this.graphics;
g.clear();
//top
g.beginFill(0xFF0000);
g.drawRoundRect(1,1, w, parent.scrollPosition);
g.endFill();
//bottom
g.beginFill(0x00FF00);
g.drawRoundRect(0, parent.scrollPosition, w, h);
g.endFill();
}
}
}