package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.controls.scrollClasses.ScrollBar; import mx.skins.Border; import mx.utils.ColorUtil; public class VScrollArrow extends Border { override public function get measuredWidth():Number { return ScrollBar.THICKNESS; } override public function get measuredHeight():Number { return ScrollBar.THICKNESS; } private var backgroundColor: uint; private var backgroundColorAlt: uint; private var borderColor: uint; private var arrowColor: uint; private var padding: Number = 1; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); graphics.clear(); borderColor = getStyle('borderColor'); backgroundColor = getStyle('fillColors')[0]; arrowColor = ColorUtil.adjustBrightness(backgroundColor, -100); var isUp: Boolean = (name.indexOf('up') != -1); switch (name) { case "upArrowUpSkin": case "downArrowUpSkin": break; case "upArrowOverSkin": case "downArrowOverSkin": break; case "upArrowDownSkin": case "downArrowDownSkin": backgroundColor = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 60); break; default: break; } backgroundColorAlt = ColorUtil.adjustBrightness(backgroundColor, 120); graphics.lineStyle(1, borderColor, 1); var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/4, 0, 0); graphics.lineStyle(1, borderColor, 1); drawRoundRect( padding, padding, unscaledWidth-padding*2, unscaledHeight-padding*2, unscaledHeight-padding*2, [backgroundColor, backgroundColorAlt], [1, 1], matrix, GradientType.LINEAR, [0, 225]); with (graphics) { var cX: int = unscaledWidth/2; var cY: int; lineStyle(0, arrowColor, 0.4); beginFill(arrowColor, 1); if (isUp) { cY = unscaledHeight/2 - 2; moveTo(cX - 3, cY + 3); lineTo(cX, cY-1); lineTo(cX + 3, cY + 3); lineTo(cX - 3, cY + 3); } else { cY = unscaledHeight/2 + 2; moveTo(cX - 3, cY - 3); lineTo(cX, cY + 1); lineTo(cX + 3, cY - 3); lineTo(cX - 3, cY - 3); } endFill(); } } } }