package skins { import flash.filters.GlowFilter; import mx.skins.ProgrammaticSkin; import mx.utils.ColorUtil; public class ButtonSkin extends ProgrammaticSkin { private var backgroundColor: uint = 0xFFFFFF; private var borderColor: 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(); borderColor = getStyle('borderColor'); backgroundColor = getStyle('fillColors')[0]; var cols: Array; cols = [0xFFFFFF, borderColor]; switch (name) { case "upSkin": break; case "overSkin": backgroundColor = ColorUtil.adjustBrightness(backgroundColor, 30); break; case "downSkin": filters = [new GlowFilter(16711680, 1, 5, 5, 1, 1)]; cols = [borderColor, 0xFFFFFF]; break; case "disabledSkin": alpha = 0.3; break; } drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 0, backgroundColor, backgroundAlpha); with (graphics) { lineStyle(borderThickness, cols[0], borderAlpha); moveTo(0, unscaledHeight); lineTo(0, 0); lineTo(unscaledWidth, 0); lineStyle(borderThickness, cols[1], borderAlpha); lineTo(unscaledWidth, unscaledHeight); lineTo(0, unscaledHeight); } } } }