我在过去使用编程皮肤完成了这项工作。您需要创建自己的ProgressBarSkin和ProgressBarMaskSkin版本以及可选的ProgressBarTrackSkin。在你ProgressBarSkin,你可以重写方法的updateDisplayList像这样:
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w, h);
graphics.clear();
var fullWidth:int = w;
if (parent != null && (parent as UIComponent).mask != null)
fullWidth = (parent as UIComponent).mask.width;
var matrix:Matrix = new Matrix();
matrix.createGradientBox(fullWidth, h);
var colors:Array = [0xd00000, 0xf0d000, 0x00ff00];
this.graphics.lineStyle();
this.graphics.beginGradientFill(GradientType.LINEAR, colors, [1,1,1], [0,128,255], matrix);
this.graphics.drawRoundRect(2, 2, w - 4, h - 4, h - 4);
}
而在你ProgressBarMaskSkin做到这一点:
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w, h);
graphics.clear();
this.drawRoundRect(2, 2, w - 4, h - 4, (h - 4)/2, 0xffffff, 1);
}
然后你分配你的皮肤类的进度条和你设置。希望有所帮助。
非常感谢你!那正是我一直在寻找的:) – Tinelise 2010-09-30 06:30:03
太棒了,很高兴我能帮上忙! – 2010-09-30 15:42:00