package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.skins.ProgrammaticSkin; public class ComboSkin extends ProgrammaticSkin { 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 = 2; 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 "upSkin": break; case "overSkin": borderAlpha += 0.2; break; case "downSkin": borderAlpha += 0.5; backgroundAlpha = 1; break; case "disabledSkin": alpha = 0.3; break; } drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 0, 0, 0); with (graphics) { beginFill(colBackground, backgroundAlpha); lineStyle(borderThickness, colStrip, borderAlpha); moveTo(2, Math.random()*4-2); lineTo(unscaledWidth, 0); lineTo(unscaledWidth - Math.random()*4-2, unscaledHeight); lineTo(0, unscaledHeight + Math.random()*4-2); lineTo(1, 2+Math.random()*4-2); endFill(); } if ('downSkin' == name) { graphics.lineStyle(1, colStrip, stripAlpha); //left - right var sX: int, sY: int, eX: int, eY: int, next: int; var tmp: Number; sY = -unscaledWidth; while (sY < unscaledHeight) { next = sY + 7; sX = 0; eX = sX + unscaledWidth; eY = sY + (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; } //right - left 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(1, colStrip, borderAlpha + 0.3); } var cX: int = unscaledWidth - 12; var cY: int = unscaledHeight/2; with (graphics) { //Up moveTo(cX, cY - 4); lineTo(cX + 3, cY + 4); lineTo(cX - 3, cY + 5); lineTo(cX-2, cY - 4+2); //Down cX = unscaledWidth - 20; moveTo(cX + 3, cY - 4); lineTo(cX - 3, cY - 5); lineTo(cX, cY + 4); lineTo(cX + 2, cY - 4 + 2); } } } }