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 { private var thickness: Number = ScrollBar.THICKNESS; override public function get measuredWidth():Number { return thickness;// } override public function get measuredHeight():Number { return thickness;//ScrollBar.THICKNESS; } private var colBackground: uint; private var colBorder: uint; private var colAlt: uint; private var colArrow: uint; private var borderOutWidth: Number = 1; private var colBorderOut: uint; private var colBorderOutAlt: uint; private var padding: Number = 2; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); graphics.clear(); colBorder= getStyle('borderColor'); colBackground = getStyle('fillColors')[0]; colArrow = getStyle('arrColor'); colBorderOut = ColorUtil.adjustBrightness(colBackground, 0); colBorderOutAlt = ColorUtil.adjustBrightness(colBorderOut, 150); var isUp: Boolean = (name.indexOf('up') != -1); switch (name) { case "upArrowUpSkin": case "downArrowUpSkin": break; case "upArrowOverSkin": case "downArrowOverSkin": break; case "upArrowDownSkin": case "downArrowDownSkin": colBackground = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 60); break; default: break; } colAlt = ColorUtil.adjustBrightness(colBackground, 90); graphics.lineStyle(1, colBorder, 1); var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2, 0, 0); graphics.lineStyle(0,0,0); drawRoundRect( padding, padding, unscaledWidth-padding*2, unscaledHeight-padding*2, 3, [colBorderOut, colBorderOutAlt], [1, 1], matrix, GradientType.LINEAR, [0, 255]); colBorder = colBackground; graphics.lineStyle(1, colBorder, 0.5); drawRoundRect( padding+borderOutWidth, padding+borderOutWidth, unscaledWidth-borderOutWidth*2 - padding*2 - 1, unscaledHeight-borderOutWidth*2 - padding*2 - 1, 2, [colAlt, colBackground], [1, 1], matrix, GradientType.LINEAR, [0, 255]); with (graphics) { var cX: int = unscaledWidth/2; var cY: int; lineStyle(0, colArrow, 0.4); beginFill(colArrow, 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(); } } } }