package skins { 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 colBackground: uint = 0xFFFFFF; private var colStrip: uint = 0x444444; private var padding: uint = 1; private var stripAlpha: Number = 0.3; private var borderThickness: uint = 1; private var borderAlpha: Number = 0.5; private var backgroundAlpha: Number = 0.9; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colStrip = getStyle('borderColor'); colBackground = getStyle('fillColors')[0]; switch (name) { case "skin": break; case "overSkin": borderAlpha = 0.6; stripAlpha = 0.5; break; case "downSkin": borderAlpha = 0.8; backgroundAlpha = 1; stripAlpha = 0.7; break; } drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 0, 0, 0); with (graphics) { beginFill(colBackground, backgroundAlpha); lineStyle(borderThickness, colStrip, borderAlpha); drawRect(0, 0, unscaledWidth, unscaledHeight); endFill(); } graphics.lineStyle(1, colStrip, stripAlpha); //right - left var sX: int, sY: int, eX: int, eY: int, next: int; var tmp: Number; sY = -unscaledWidth; while (sY < unscaledHeight) { next = sY + 7; sX = unscaledWidth; eX = 0; eY = sY + Math.abs(eX - sX); sX += Math.random()*2-1; sY += Math.random()*2-1; eX += Math.random()*2-1; eY += Math.random()*2-1; if (sY < 0) { tmp = 0 - sY; sY = 0; sX -= tmp; } if (eY > unscaledHeight) { tmp = eY - unscaledHeight; eY = unscaledHeight; eX += tmp; } graphics.moveTo(sX, sY); graphics.lineTo(eX, eY); sY = next; } graphics.lineStyle(3, colStrip, stripAlpha); graphics.moveTo(0, unscaledHeight - 2); graphics.lineTo(unscaledWidth, unscaledHeight-2); } } }