package skins { import mx.skins.Border; import mx.utils.ColorUtil; public class AccordionButton extends Border { private var backgroundColor: uint = 0xFFFFFF; private var borderColor: 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; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); unscaledWidth -= 2; borderColor = 0xFFFFFF;//getStyle('borderColor'); arrColor = getStyle('borderColor'); backgroundColor = ColorUtil.adjustBrightness(getStyle('fillColors')[0], 60); var cols: Array = [0xFFFFFF, arrColor]; switch (name) { case "skin": break; case "overSkin": backgroundColor = getStyle('downFillColors')[0]; cols = [cols[1], cols[0]]; case "downSkin": arrColor = borderColor; break; } if (name.indexOf('elected') > 0) { isUp = true; } var radius: uint = 6; with (graphics) { beginFill(backgroundColor, 1); lineStyle(1, borderColor, 1); moveTo(1, unscaledHeight); lineTo(1, radius); curveTo(1, 0, radius, 0); lineTo(unscaledWidth - radius, 0); curveTo(unscaledWidth, 0, unscaledWidth, radius); lineTo(unscaledWidth, unscaledHeight); if (!isUp) { lineTo(1, unscaledHeight); } endFill(); } var cX: Number = unscaledWidth - 8; var cY: Number = unscaledHeight / 2; with (graphics) { if (isUp) { lineStyle(1, cols[0], 1); moveTo(cX - 5, cY + 3); lineTo(cX, cY - 3); lineStyle(1, cols[1], 1); lineTo(cX + 5, cY + 3); lineTo(cX - 5, cY + 3); } else { lineStyle(1, cols[0], 1); moveTo(cX, cY + 3); lineTo(cX - 5, cY - 3); lineTo(cX + 5, cY - 3); lineStyle(1, cols[1], 1); lineTo(cX, cY + 3); } } } } }