package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.skins.Border; import mx.utils.ColorUtil; public class AccordionButton extends Border { private var colBackground: uint = 0xFFFFFF; private var colBorder: uint = 0; private var borderThickness: uint = 1; private var borderAlpha: Number = 1; private var backgroundAlpha: Number = 1; private var arrColor: uint = 0xFFFFFF; private var isUp: Boolean = false; private var radius: Number = 7; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colBorder= getStyle('borderColor'); arrColor = ColorUtil.adjustBrightness(colBorder, -50); colBackground = getStyle('fillColors')[0]; unscaledWidth -= 2; unscaledHeight -= 1; var cols: Array; switch (name) { case "overSkin": colBackground = getStyle('downFillColors')[0]; case "downSkin": cols = [ColorUtil.adjustBrightness(colBackground, 80), colBackground]; arrColor = cols[0]; break; default: cols = [ColorUtil.adjustBrightness(colBackground, 80), colBackground]; arrColor = cols[1]; break; } if (name.indexOf('elected') > 0) { isUp = true; } var matrix: Matrix = new Matrix(); matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI/2); with (graphics) { lineStyle(borderThickness, colBorder, borderAlpha); beginGradientFill( GradientType.LINEAR, cols, [1, 1], [0,255], matrix ); moveTo(1, unscaledHeight); lineTo(1, radius); lineTo(radius, 1); lineTo(unscaledWidth, 1); lineTo(unscaledWidth, unscaledHeight); lineTo(1, unscaledHeight); endFill(); } var cX: Number = unscaledWidth - 15; var cY: Number = unscaledHeight / 2; with (graphics) { beginFill(arrColor, 1); if (isUp) { cY -= 4; lineStyle(1, colBorder, borderAlpha); moveTo(cX - 5, cY + 7); lineTo(cX, cY); lineTo(cX + 5, cY + 7); lineTo(cX - 5, cY + 7); } else { cY += 4; lineStyle(1, colBorder, borderAlpha); moveTo(cX - 5, cY - 7); lineTo(cX, cY); lineTo(cX + 5, cY - 7); lineTo(cX - 5, cY - 7); } endFill(); } } } }