package skins.Aqua { import flash.display.GradientType; import flash.display.InterpolationMethod; import flash.display.SpreadMethod; import flash.geom.Matrix; import mx.skins.Border; import mx.utils.ColorUtil; public class AccordionButton extends Border { private var radius: uint = 7; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); with (graphics) { clear(); var cols : Array = getStyle('fillColors'); var borderColor : uint = getStyle('borderColor'); var alphas:Array = [1, 1]; var ratios:Array = [0, 0xFF]; var matrix:Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, 90*Math.PI/180, 0, 0); lineStyle(1, borderColor, 1); beginGradientFill(GradientType.LINEAR, cols, alphas, ratios, matrix); drawRoundRectComplex(1, 1, unscaledWidth-2, unscaledHeight-2, radius, radius, 0, 0); endFill(); } var w: uint = unscaledHeight *0.7, h: uint = w, tx : uint = unscaledWidth - w - 5, ty: uint = unscaledHeight/2-h/2; //circle var brighterColor : uint = cols[0]; switch (name) { case 'skin': case 'overSkin': case 'downSkin': brighterColor = ColorUtil.adjustBrightness(brighterColor, -70); break; } var mainColor : uint = ColorUtil.adjustBrightness(brighterColor, -70); var colTop: uint = mainColor; var colBot: uint = brighterColor; var ratTop: uint = 0x0; var ratBot: uint = 0xbb; cols = [ colTop, colBot]; alphas = [1, 1]; ratios = [ratTop, ratBot]; matrix = new Matrix(); matrix.createGradientBox(w, h, 90*Math.PI/180, 0, 0); graphics.lineStyle(1, borderColor, 1); drawRoundRect(tx, ty, w, h, h, cols, alphas, matrix, GradientType.LINEAR, ratios); var typeGlare:String = GradientType.RADIAL; var colorsGlare:Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF]; var alphasGlare:Array = [0.8, 0.8, 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 = w*1.3; var boxHeightGlare:Number = h; var boxRotationGlare:Number = Math.PI/2; // 90˚ var txGlare:Number = tx-0.15*w; var tyGlare:Number = ty-boxHeightGlare*0.55; matrixGlare.createGradientBox(boxWidthGlare, boxHeightGlare, boxRotationGlare, txGlare, tyGlare); graphics.beginGradientFill(typeGlare, colorsGlare, alphasGlare, ratiosGlare, matrixGlare, spreadMethodGlare, interpGlare, focalPtRatioGlare); graphics.drawRoundRect(tx, ty, w, h, h, h); graphics.endFill(); var typeGlareBottom: String = GradientType.RADIAL; var colorsGlareBottom: Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF]; var alphasGlareBottom: Array = [0.6, 0.6, 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 = w*newRadPerc; var boxHeightGlareBottom:Number = h*newRadPerc; var boxRotationGlareBottom:Number = Math.PI/2; // 90˚ var txGlareBottom:Number = tx+w/2-w*newRadPerc/2; var tyGlareBottom:Number = ty+boxHeightGlareBottom*0.4; matrixGlareBottom.createGradientBox(boxWidthGlareBottom, boxHeightGlareBottom, boxRotationGlareBottom, txGlareBottom, tyGlareBottom); graphics.beginGradientFill(typeGlareBottom, colorsGlareBottom, alphasGlareBottom, ratiosGlareBottom, matrixGlareBottom, spreadMethodGlareBottom, interpGlareBottom, focalPtRatioGlareBottom); graphics.drawRoundRect(tx, ty, w, h, h, h); graphics.endFill(); } } }