package skins { 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 = 1; private var backgroundColor: uint; private var borderColor: uint; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); unscaledWidth = 20; unscaledHeight = 20; borderColor = getStyle('borderColor'); var action: String = (name.toLowerCase().indexOf('minimize') == -1) ? 'close' : 'min'; if (getStyle(action + 'Colors').length) { if (name.toLowerCase().indexOf('over') != -1) { backgroundColor = ColorUtil.adjustBrightness(getStyle(action + 'Colors')[1], 30); } else if (name.toLowerCase().indexOf('down') != -1) { backgroundColor = getStyle(action + 'ColorsPress')[1]; } else { backgroundColor = getStyle(action + 'Colors')[1]; } } drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 0, backgroundColor, 1); var nX: int, nY: int, nW: int, nH: int; nW = nH = ('min' == action) ? 6 : 10; nX = (unscaledWidth-nW)/2; nY = (unscaledHeight-nH)/2; var cols: Array; cols = [0xFFFFFF, borderColor]; with (graphics) { //inner lineStyle(1, cols[0], 1) moveTo(nX, nY+nH); lineTo(nX, nY); lineTo(nX + nW, nY); lineStyle(1, cols[1], 1); lineTo(nX + nW, nY + nH); lineTo(nX, nY+nH); //outter if (name.toLowerCase().indexOf('down') != -1) { cols = [borderColor, 0xFFFFFF]; } else { cols = [0xFFFFFF, borderColor]; } nX = nY = 0; nW = unscaledWidth; nH = unscaledHeight; lineStyle(1, cols[0], 1) moveTo(nX, nY+nH); lineTo(nX, nY); lineTo(nX + nW, nY); lineStyle(1, cols[1], 1); lineTo(nX + nW, nY + nH); lineTo(nX, nY+nH); if ('min' != action) { } } } } }