package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.skins.ProgrammaticSkin; import mx.utils.ColorUtil; public class ComboSkin extends ProgrammaticSkin { private var colBackground: uint = 0xFFFFFF; private var colAlt: uint = 0xFFFFFF; private var colBorder: uint = 0; private var borderThickness: uint = 1; private var borderAlpha: Number = 1; private var backgroundAlpha: Number = 1; private var borderOutThickness: Number = 2; private var colBorderOut: uint; private var colBorderOutAlt: uint; private var colArrow: uint; private var arrowZoneWidth: Number = 16; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colBorder= getStyle('borderColor'); colBackground = getStyle('fillColors')[0]; colBorderOut = ColorUtil.adjustBrightness(colBackground, 0); colBorderOutAlt = ColorUtil.adjustBrightness(colBorderOut, 150); graphics.lineStyle(borderThickness, colBorder, borderAlpha); drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 0, colBackground, 1); colArrow = getStyle('arrColor'); switch (name) { case "upSkin": break; case "overSkin": colBackground = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 60); colArrow = ColorUtil.adjustBrightness(colArrow, -150); break; case "downSkin": break; case "disabledSkin": alpha = 0.3; break; } colAlt = ColorUtil.adjustBrightness(colBackground, 90); var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2, 0, 0); var arrZoneX: Number = unscaledWidth - arrowZoneWidth; graphics.lineStyle(0,0,0); drawRoundRect( arrZoneX, 0, arrowZoneWidth, unscaledHeight, 2, [colBorderOut, colBorderOutAlt], [1, 1], matrix, GradientType.LINEAR, [0, 255]); colBorder = colBackground; graphics.lineStyle(1, colBorder, 0.5); drawRoundRect( arrZoneX+borderOutThickness, borderOutThickness, arrowZoneWidth-borderOutThickness*2 - 1, unscaledHeight-borderOutThickness*2 - 1, 2, [colAlt, colBackground], [backgroundAlpha, backgroundAlpha], matrix, GradientType.LINEAR, [0, 255]); var cX: Number = unscaledWidth - arrowZoneWidth/2 ; var cY: Number = unscaledHeight/2; with (graphics) { lineStyle(2, colArrow, 1); moveTo(cX - 3, cY - 3); lineTo(cX, cY + 2); lineTo(cX + 3, cY - 3); } } } }