package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.skins.ProgrammaticSkin; import mx.utils.ColorUtil; public class ButtonSkin extends ProgrammaticSkin { private var backgroundColor: uint = 0xFFFFFF; private var backgroundColorAlt: uint = 0xFFFFFF; private var borderColor: uint = 0; private var borderThickness: Number = 1; private var borderAlpha: Number = 0.8; private var backgroundAlpha: Number = 1; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); borderColor = 0xCCCCCC;//getStyle('borderColor'); backgroundColor = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 30); backgroundColorAlt = ColorUtil.adjustBrightness(backgroundColor, 120); switch (name) { case "upSkin": break; case "overSkin": backgroundColor = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 10); break; case "downSkin": break; case "disabledSkin": alpha = 0.3; break; } var radius: Number = 6; graphics.lineStyle(0, 0, 0); drawRoundRect( -1, -1, unscaledWidth + 4, unscaledHeight + 4, 10, ColorUtil.adjustBrightness(backgroundColor, -40), 0.5); var cols: Array = [backgroundColor, backgroundColorAlt, backgroundColor]; var alphas: Array = [1, 1, 1]; var ratios: Array = [10, 90, 200]; var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2); graphics.lineStyle(1, borderColor, borderAlpha); drawRoundRect(0, 0, unscaledWidth, unscaledHeight, radius, cols, alphas, matrix, GradientType.LINEAR, ratios); } } }