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 stripAlpha: Number = 0.3; private var borderColor: uint; private var borderThickness: uint = 1; private var borderAlpha: Number = 0.5; private var backgroundAlpha: Number = 0.9; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); backgroundColor = getStyle('fillColors')[0]; var cols: Array = [ 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF ]; var colsBorder: Array; var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2); colsBorder = [0xFFFFFF, ColorUtil.adjustBrightness(backgroundColor, 10)]; switch (name) { case "upSkin": break; case "overSkin": backgroundColor = ColorUtil.adjustBrightness(backgroundColor, 30); break; case "downSkin": colsBorder = [0xFFFFFF, ColorUtil.adjustBrightness(backgroundColor, -20)]; backgroundAlpha = 1; break; case "disabledSkin": alpha = 0.3; break; } graphics.lineStyle(borderThickness, colsBorder[1], 0.8, true); drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 2, backgroundColor, 1); graphics.lineStyle(1, colsBorder[0], 0.55, true); drawRoundRect(borderThickness, borderThickness, unscaledWidth-borderThickness*2, unscaledHeight-borderThickness*2, 2, cols, [0.4, 0.4, 0.25, 0.25], matrix, GradientType.LINEAR, [0, 100, 130, 255]); } } }