/ Published in: ActionScript 3

This static class can be used to draw a coloured border around the edge of your SWF.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package com.adrianparr.utils { import flash.display.Stage; import flash.display.Shape; public class DrawPixelBorderAroundStage { public static function draw($stage:Stage, $colour:uint, $width:uint, $alpha:Number):Shape { var border:Shape = new Shape(); border.graphics.beginFill($colour, $alpha); border.graphics.drawRect($width, 0, $stage.stageWidth-$width, $width); border.graphics.drawRect($stage.stageWidth-$width, $width, $width, $stage.stageHeight-$width); border.graphics.drawRect(0, $stage.stageHeight-$width, $stage.stageWidth-$width, $width); border.graphics.drawRect(0, 0, $width, $stage.stageHeight-$width); border.graphics.endFill(); return border; } } } // Usage example // // import com.adrianparr.utils.DrawPixelBorderAroundStage; // private var _border:Shape; // _border = DrawPixelBorderAroundStage.draw(stage, 0x036CB4, 1, 1); // addChild(_border);
Comments
