package skins { import flash.display.GradientType; import flash.geom.Matrix; import mx.containers.TitleWindow; import mx.controls.Alert; import mx.skins.Border; import mx.utils.ColorUtil; public class TitleBorder extends Border { private var colBackground: uint = 0xFFFFFF; private var colAlt: uint = 0xFFFFFF; private var colStrip: uint = 0x444444; private var padding: uint = 1; private var stripAlpha: Number = 0.3; private var borderThickness: uint = 3; private var borderAlpha: Number = 0.5; private var backgroundAlpha: Number = 1; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { graphics.clear(); colStrip = getStyle('borderColor'); colBackground = getStyle('backgroundColor'); colAlt = ColorUtil.adjustBrightness(colBackground, 90); super.updateDisplayList(unscaledWidth, unscaledHeight); drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 3, colBackground, 1); var headerHeight: Number = getStyle('headerHeight'); var headerPadding: Number = 5; var matrix: Matrix = new Matrix(); var cols: Array = [0xFFFFFF, 0x6382bf]; var cX: Number, cY: Number, w: Number = unscaledWidth - headerPadding; if (getStyle('headerHeight') > headerPadding) { matrix.createGradientBox(unscaledWidth, headerHeight-headerPadding, Math.PI/2, headerPadding, headerPadding); drawRoundRect( headerPadding, headerPadding, unscaledWidth - headerPadding*2, headerHeight - headerPadding, 3, [colBackground, colAlt, colBackground], [1, 1, 1], matrix, GradientType.LINEAR, [0, 60, 255]); var col: uint = 0; var lineIndex: uint = 0; cX = 0; while (cX < unscaledWidth) { lineIndex ++; cX = 5*lineIndex; cY = headerPadding; col = 0; while (cY < headerHeight-5 && cX < w-w*0.25) { cX++; cY++; if (cX > headerPadding+w*0.25 && cY > headerPadding+5) { with (graphics) { beginFill(cols[col%2],1); lineStyle(0, 0, 0); drawRect(cX, cY, 1, 1); endFill() } } col++; } } } //lines cols = [0x333333, 0xA3B8CC]; //top cX = headerPadding*3; cY = headerPadding - 2; with (graphics) { lineStyle(1, cols[1], 1); moveTo(cX, cY); lineTo(unscaledWidth-cX, cY); cY--; lineStyle(1, cols[0], 1); moveTo(cX, cY); lineTo(unscaledWidth-cX, cY); } //bottom cX = headerPadding*3; cY = unscaledHeight - headerPadding + 3; with (graphics) { lineStyle(1, cols[1], 1); moveTo(cX, cY); lineTo(unscaledWidth-cX, cY); cY--; lineStyle(1, cols[0], 1); moveTo(cX, cY); lineTo(unscaledWidth-cX, cY); } //left cY = headerPadding*3; cX = headerPadding - 2; with (graphics) { lineStyle(1, cols[1], 1); moveTo(cX, cY); lineTo(cX, unscaledHeight - cY); cX--; lineStyle(1, cols[0], 1); moveTo(cX, cY); lineTo(cX, unscaledHeight - cY); } //right //left cY = headerPadding*3; cX = unscaledWidth - headerPadding +3; with (graphics) { lineStyle(1, cols[1], 1); moveTo(cX, cY); lineTo(cX, unscaledHeight - cY); cX--; lineStyle(1, cols[0], 1); moveTo(cX, cY); lineTo(cX, unscaledHeight - cY); } } } }