Forked from: bradsedito's Dark Background diff:72 forked from: Dark Background Added resize handler xor forked:0favorite:2lines:54license : MIT License modified : 2012-01-25 01:39:42 Embed Tweet package { import flash.display.Sprite; import flash.events.Event; import flash.display.*; import flash.events.*; import flash.filters.*; import flash.geom.*; // forked from bradsedito's Dark Background // Added resize handler public class Main extends Sprite { private static const s:Number = 10. / 0x4000; private var sh:Shape; private var back:Shape; private var light:Shape; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point stage.align = "TL"; stage.scaleMode = "noScale"; light = new Shape(); addChild(light); addBox(); stage.addEventListener(Event.RESIZE, draw); draw(); } public function addBox(e:Event = null):void { back = new Shape(); back.filters = [new DropShadowFilter(2, 90, 0x000000, 0.5, 8, 8, 1, BitmapFilterQuality.HIGH)]; back.graphics.beginFill(0x282828); back.graphics.drawRoundRect(0, 0, 260, 164, 12, 12); back.graphics.endFill(); addChild(back); //sh = new Shape(); //sh.filters = [new DropShadowFilter(1, 90, 0x000000, 0.2, 0, 0, 1, 0, true)]; // addChild(sh); } public function draw(e:Event = null):void { graphics.clear(); graphics.beginGradientFill(GradientType.LINEAR, [0x607080, 0x404060], [1, 1], [0, 255], new Matrix(0, stage.stageWidth * s, 1, 0, stage.stageWidth/2, stage.stageHeight/2)); graphics.drawRect(0, 0, stage.stageWidth , stage.stageHeight ); graphics.endFill(); back.x = stage.stageWidth / 2 - back.width/2; back.y = stage.stageHeight / 2- back.height/2; light.graphics.clear(); light.graphics.beginGradientFill(GradientType.RADIAL, [0x000000, 0x000000], [0, 0.75], [0, 255], new Matrix(0, -stage.stageWidth * s, stage.stageWidth * s, 0, stage.stageWidth/2, stage.stageHeight/2), SpreadMethod.PAD, InterpolationMethod.RGB, 0.27); light.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); light.graphics.endFill(); } } } Code Fullscreen Preview Fullscreen flashmafia bradsedito stageWidth Shape stageHeight draw InterpolationMethod.RGB SpreadMethod.PAD BitmapFilterQuality.HIGH Event.ADDED_TO_STAGE drawRoundRect GradientType.RADIAL Event.RESIZE stage filters removeEventListener beginGradientFill align scaleMode DropShadowFilter clear Matrix