package skins.Aqua { import flash.display.GradientType; import flash.display.InterpolationMethod; import flash.display.SpreadMethod; import flash.geom.Matrix; import mx.skins.ProgrammaticSkin; public class ButtonSkin extends ProgrammaticSkin { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); var cols: Array = getStyle('fillColors'); var colTop: uint = cols[1]; var colMid: uint = cols[0]; var colBot: uint = 0xEEEEEE; var ratTop: uint = 0x00; var ratMid: uint = 0x55; var ratBot: uint = 0xFF; graphics.lineStyle(1, getStyle('borderColor'), 1); switch (name) { case "upSkin": break; case "overSkin": break; case "downSkin": if (getStyle('downFillColors')) { var colsDown: Array = getStyle('downFillColors'); colTop = colsDown[1]; colMid = colsDown[0]; colBot = 0xEEEEEE; } break; case "disabledSkin": alpha = 0.7; break; } var colors:Array = [ colTop, colMid, colBot]; var alphas:Array = [1, 1, 1]; var ratios:Array = [ratTop, ratMid, ratBot]; var matrix:Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, 90*Math.PI/180, 0, 0); graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix); var radius: uint = unscaledHeight; graphics.drawRoundRect(0, 0, unscaledWidth, unscaledHeight, radius, radius); graphics.endFill(); var typeGlare:String = GradientType.RADIAL; var colorsGlare:Array = [0xFFFFFF, 0xFFFFFF, 0xFFFFFF]; var alphasGlare:Array = [0.4, 0.4, 0]; var ratiosGlare:Array = [0, 220, 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.5; matrixGlare.createGradientBox(boxWidthGlare, boxHeightGlare, boxRotationGlare, txGlare, tyGlare); graphics.beginGradientFill(typeGlare, colorsGlare, alphasGlare, ratiosGlare, matrixGlare, spreadMethodGlare, interpGlare, focalPtRatioGlare); graphics.drawRoundRect(0, 0, unscaledWidth, unscaledHeight, radius, radius); graphics.endFill(); } } }