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 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; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colBorder= getStyle('borderColor'); colBackground = getStyle('fillColors')[0]; switch (name) { case "upSkin": break; case "overSkin": colBackground = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 60); break; case "downSkin": break; case "disabledSkin": alpha = 0.3; break; } graphics.lineStyle(borderThickness, colBorder, borderAlpha); var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2, 0, 0); colAlt = ColorUtil.adjustBrightness(colBackground, 90); drawRoundRect( 0, 0, unscaledWidth, unscaledHeight, 0, [colBackground, colAlt, colBackground], [backgroundAlpha, 1, backgroundAlpha], matrix, GradientType.LINEAR, [0, 60, 190]); } } }