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 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], 30); } else if (name.toLowerCase().indexOf('down') != -1) { backgroundColor = getStyle(action + 'ColorsPress')[1]; } else { backgroundColor = getStyle(action + 'Colors')[1]; } } var typeGlare:String = GradientType.RADIAL; var colors:Array = [ ColorUtil.adjustBrightness(backgroundColor, 150), backgroundColor]; var spreadMethodGlare:String = SpreadMethod.PAD; var interpGlare:String = InterpolationMethod.LINEAR_RGB; var focalPtRatioGlare:Number = 0; var matrixGlare:Matrix = new Matrix(); var boxWidthGlare:Number = unscaledHeight; var boxHeightGlare:Number = unscaledHeight; var boxRotationGlare:Number = Math.PI/2; // 90˚ var txGlare:Number = - unscaledHeight/2 + 4; var tyGlare:Number = - unscaledHeight/2 + 5; matrixGlare.createGradientBox(boxWidthGlare, boxHeightGlare, boxRotationGlare, txGlare, tyGlare); graphics.beginGradientFill(typeGlare, colors, [1, 1], [0, 0x90], matrixGlare, spreadMethodGlare, interpGlare, focalPtRatioGlare); graphics.drawRoundRect( 0, 0, unscaledWidth, unscaledHeight, 8, 8); graphics.endFill(); 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); } } } } }