package skins.Aqua { 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 { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { unscaledWidth = 14; unscaledHeight = 14; graphics.clear(); var cols: Array = [0x550c19, 0x8b111d]; var borderColor : uint = cols[0]; var action: String = (name.toLowerCase().indexOf('minimize') == -1) ? 'close' : 'min'; if (getStyle(action + 'Colors')) { borderColor = getStyle(action + 'Border'); if (name.toLowerCase().indexOf('over') != -1) { cols = [ ColorUtil.adjustBrightness(getStyle(action + 'Colors')[0], 30), ColorUtil.adjustBrightness(getStyle(action + 'Colors')[1], 30) ]; } else if (name.toLowerCase().indexOf('down') != -1) { cols = getStyle(action + 'ColorsPress'); } else { cols = getStyle(action + 'Colors'); } } var mainColor : uint = cols[0]; var brighterColor : uint = cols[1]; var colTop: uint = mainColor; var colBot: uint = brighterColor; var ratTop: uint = 0x0; var ratBot: uint = 0xbb; var colors:Array = [ colTop, colBot]; var alphas:Array = [1, 1]; var ratios:Array = [ratTop, ratBot]; var matrix:Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, 90*Math.PI/180, 0, 0); graphics.lineStyle(1, borderColor, 1); drawRoundRect(0,0,unscaledWidth, unscaledHeight, unscaledHeight, colors, alphas, matrix, GradientType.LINEAR, ratios); var typeGlare:String = GradientType.RADIAL; var colorsGlare:Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF]; var alphasGlare:Array = [0.9, 0.9, 0]; var ratiosGlare:Array = [0, 60, 255]; var spreadMethodGlare:String = SpreadMethod.PAD; var interpGlare:String = InterpolationMethod.LINEAR_RGB; var focalPtRatioGlare:Number = 0; var matrixGlare:Matrix = new Matrix(); var boxWidthGlare:Number = unscaledWidth*1.3; var boxHeightGlare:Number = unscaledHeight; var boxRotationGlare:Number = Math.PI/2; // 90˚ var txGlare:Number = -0.15*unscaledWidth; var tyGlare:Number = -boxHeightGlare*0.55; matrixGlare.createGradientBox(boxWidthGlare, boxHeightGlare, boxRotationGlare, txGlare, tyGlare); graphics.beginGradientFill(typeGlare, colorsGlare, alphasGlare, ratiosGlare, matrixGlare, spreadMethodGlare, interpGlare, focalPtRatioGlare); graphics.drawRoundRect(0, 0, unscaledWidth, unscaledHeight, unscaledHeight, unscaledHeight); graphics.endFill(); var typeGlareBottom: String = GradientType.RADIAL; var colorsGlareBottom: Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF]; var alphasGlareBottom: Array = [0.5, 0.5, 0]; var ratiosGlareBottom: Array = [0, 70, 255]; var spreadMethodGlareBottom: String = SpreadMethod.PAD; var interpGlareBottom: String = InterpolationMethod.LINEAR_RGB; var focalPtRatioGlareBottom: Number = 0; var matrixGlareBottom:Matrix = new Matrix(); var newRadPerc: Number = 0.9; var boxWidthGlareBottom:Number = unscaledWidth*newRadPerc; var boxHeightGlareBottom:Number = unscaledHeight*newRadPerc; var boxRotationGlareBottom:Number = Math.PI/2; // 90˚ var txGlareBottom:Number = unscaledWidth/2-unscaledWidth*newRadPerc/2; var tyGlareBottom:Number = boxHeightGlareBottom*0.4; matrixGlareBottom.createGradientBox(boxWidthGlareBottom, boxHeightGlareBottom, boxRotationGlareBottom, txGlareBottom, tyGlareBottom); graphics.beginGradientFill(typeGlareBottom, colorsGlareBottom, alphasGlareBottom, ratiosGlareBottom, matrixGlareBottom, spreadMethodGlareBottom, interpGlareBottom, focalPtRatioGlareBottom); graphics.drawRoundRect(0, 0, unscaledWidth, unscaledHeight, unscaledHeight, unscaledHeight); graphics.endFill(); var thickness: uint = 2; var color: uint = 0xCCCCCC; if (name.toLowerCase().indexOf('down') != -1) { thickness = 3; color = 0xFFFFFF; } else if (name.toLowerCase().indexOf('over') != -1) { drawRoundRect(0,0,unscaledWidth,unscaledHeight, unscaledHeight, 0xFFFFFF, 0.25); with (graphics) { lineStyle(thickness, color, 1); if ('min' == action) { moveTo(5, unscaledHeight/2); lineTo(unscaledWidth-5, unscaledHeight/2); } else { moveTo(5, 5); lineTo(unscaledWidth-5, unscaledHeight-5); moveTo(unscaledWidth-5, 5); lineTo(5, unscaledHeight-5); } } } } } }