package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.skins.Border; import mx.utils.ColorUtil; public class TabBar extends Border { private var colBackground: uint = 0xFFFFFF; private var colBorder: uint = 0; private var borderThickness: uint = 1; private var borderAlpha: Number = 1; private var backgroundAlpha: Number = 1; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colBorder= getStyle('borderColor'); colBackground = getStyle('downFillColors')[0]; var radius: Number = 0; var width: Number = unscaledWidth; var lineWidth: Number = unscaledWidth; var cols: Array = [ColorUtil.adjustBrightness(colBackground, 60), colBackground]; var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2); var lineAlpha: Number = 0; //if last tab if (getStyle('rightCorner')) { radius = unscaledHeight; lineWidth -= radius; } //first tab else if (getStyle('leftCorner')) { lineAlpha = 1; } with (graphics) { lineStyle(1, cols[0], 1); beginGradientFill(GradientType.LINEAR, cols, [1, 1], [1, 255], matrix); moveTo(0,0); lineTo(unscaledWidth - radius, 0); curveTo(unscaledWidth, 0, unscaledWidth, unscaledHeight); lineTo(0, unscaledHeight); lineStyle(1, cols[0], lineAlpha); lineTo(0, 0); endFill(); } switch (name) { case 'selectedOverSkin': case 'selectedDownSkin': case 'selectedUpSkin': colBackground = getStyle('fillColors')[0]; cols = [ColorUtil.adjustBrightness(colBackground, 60), colBackground]; radius = unscaledHeight; with (graphics) { lineStyle(0, 0, 0); beginGradientFill(GradientType.LINEAR, cols, [1, 1], [1, 255], matrix); moveTo(0,0); lineTo(unscaledWidth - radius, 0); curveTo(unscaledWidth, 0, unscaledWidth, unscaledHeight); lineTo(0, unscaledHeight); lineStyle(1, cols[0], lineAlpha); lineTo(0, 0); endFill(); } break; case 'overSkin': case 'downSkin': default : //if not last tab if (!getStyle('rightCorner')) { with (graphics) { lineStyle(2, cols[0], 1); moveTo(unscaledWidth-2, 6); lineTo(unscaledWidth-2, unscaledHeight - 6); } } break; } colBackground = getStyle('downFillColors')[0]; cols = [ColorUtil.adjustBrightness(colBackground, 60), colBackground]; with (graphics) { /*lineStyle(1, cols[0], 1); moveTo(0, unscaledHeight); lineTo(unscaledWidth, unscaledHeight);*/ lineStyle(2, cols[1], 0.6); moveTo(0, 0); lineTo(lineWidth, 0); } } } }