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 = 2; private var backgroundColor: uint; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); 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], 60); } else if (name.toLowerCase().indexOf('down') != -1) { backgroundColor = getStyle(action + 'ColorsPress')[1]; } else { backgroundColor = getStyle(action + 'Colors')[1]; } var paddingTop: Number = 2; var cols: Array = [0x333333, 0xA3B8CC, 0xDDDDDD]; drawRoundRect(0, paddingTop, unscaledWidth, unscaledHeight, 0, backgroundColor, 1); with (graphics) { lineStyle(1, cols[0], 1); moveTo(0, paddingTop + unscaledHeight - 1); lineTo(0, paddingTop); lineTo(unscaledWidth - 1, paddingTop); lineStyle(1, cols[2], 1); moveTo(unscaledWidth, paddingTop + 1); lineTo(unscaledWidth, paddingTop + unscaledHeight); lineTo(1, paddingTop + unscaledHeight); } graphics.lineStyle(1, cols[1], 1); drawRoundRect(1, paddingTop+1, unscaledWidth-2, unscaledHeight-2, 0); var cX: Number = unscaledWidth/2; var cY: Number = unscaledHeight/2 + paddingTop; var radius: Number = 5; var radiusInner: Number = 2; with (graphics) { if ('min' == action) { lineStyle(1, cols[0], 1); moveTo(cX - radius, cY); lineTo(cX + radius, cY); cY ++; lineStyle(1, cols[1], 1); moveTo(cX - radius, cY); lineTo(cX + radius, cY); } else { lineStyle(1, cols[0], 1); moveTo(cX - radius, cY - radius); lineTo(cX + radius, cY + radius); cX ++; lineStyle(1, cols[1], 1); moveTo(cX - radius, cY - radius); lineTo(cX + radius, cY + radius); moveTo(cX + radius, cY - radius); lineTo(cX + radiusInner, cY - radiusInner); moveTo(cX - radiusInner, cY + radiusInner); lineTo(cX - radius, cY + radius); cX --; lineStyle(1, cols[0], 1); moveTo(cX + radius, cY - radius); lineTo(cX + radiusInner, cY - radiusInner); moveTo(cX - radiusInner, cY + radiusInner); lineTo(cX - radius, cY + radius); } } } } }