package skins { import flash.display.GradientType; import flash.display.InterpolationMethod; import flash.display.SpreadMethod; import flash.geom.Matrix; import mx.skins.ProgrammaticSkin; import mx.utils.ColorUtil; public class TitleWindowCloseButton extends ProgrammaticSkin { private var lineAlpha: Number = 1; private var lineColor: uint = 0xFFFFFF; private var lineThickness: int = 2; 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 borderOutWidth: Number = 2; private var colBorderOut: uint; private var colBorderOutAlt: uint; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); var action: String = (name.toLowerCase().indexOf('minimize') == -1) ? 'close' : 'min'; colBorder= getStyle(action + 'Border'); colBackground = getStyle(action + 'Colors')[1]; colBorderOut = ColorUtil.adjustBrightness(colBackground, 0); colBorderOutAlt = ColorUtil.adjustBrightness(colBorderOut, 150); if (getStyle(action + 'Colors').length) { if (name.toLowerCase().indexOf('over') != -1) { colBackground = ColorUtil.adjustBrightness(getStyle(action + 'Colors')[1], 60); } else if (name.toLowerCase().indexOf('down') != -1) { colBackground = getStyle(action + 'ColorsPress')[1]; } else { colBackground = getStyle(action + 'Colors')[1]; } } colAlt = ColorUtil.adjustBrightness(colBackground, 90); graphics.lineStyle(borderThickness, colBorder, borderAlpha); var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2, 0, 0); graphics.lineStyle(0,0,0); drawRoundRect( 0, 0, unscaledWidth, unscaledHeight, 3, [colBorderOut, colBorderOutAlt], [1, 1], matrix, GradientType.LINEAR, [0, 255]); colBorder = colBackground; graphics.lineStyle(1, colBorder, 0.5); drawRoundRect( borderOutWidth, borderOutWidth, unscaledWidth-borderOutWidth*2 - 1, unscaledHeight-borderOutWidth*2 - 1, 2, [colAlt, colBackground], [backgroundAlpha, backgroundAlpha], matrix, GradientType.LINEAR, [0, 255]); var cX: Number = unscaledWidth/2; var cY: Number = unscaledHeight/2; var rad: Number = 2; with (graphics) { lineStyle(lineThickness, lineColor, lineAlpha); if ('min' == action) { moveTo(cX - rad, cY); lineTo(cX + rad, cY); } else { moveTo(cX - rad, cY - rad); lineTo(cX + rad, cY + rad); moveTo(cX + rad, cY - rad); lineTo(cX - rad, cY + rad); } } } } }