package skins { import mx.skins.Border; public class VScroll extends Border { override public function get measuredWidth():Number { return 15; } override public function get measuredHeight():Number { return 11; } 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.2; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); graphics.clear(); colStrip = getStyle('borderColor'); colBackground = getStyle('fillColors')[0]; switch (name) { case "thumbDownSkin": stripAlpha = 0.8; borderThickness = 2; borderAlpha = 0.3; break; case "thumbOverSkin": stripAlpha = 0.5; borderAlpha = 0.4; break; default: break; } var sX: int, sY: int, eX: int, eY: int, next: int; var tmp: Number; graphics.lineStyle(borderThickness, colStrip, borderAlpha); drawRoundRect(padding, 1, unscaledWidth-padding-2, unscaledHeight-1, 0, colBackground, 1); graphics.lineStyle(1, colStrip, stripAlpha); //left - right sY = -measuredWidth; 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 = -measuredWidth; 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; } //3 lines if (unscaledHeight > 15) { with (graphics) { var cX: int = unscaledWidth/2; var cY: int = unscaledHeight/2; lineStyle(2, colStrip, 0.8); moveTo(cX - 3, cY - 5); lineTo(cX + 3, cY - 4); moveTo(cX - 2, cY); lineTo(cX + 3, cY - 1); moveTo(cX - 3, cY + 5); lineTo(cX + 3, cY + 4); } } } } }