Revision: 38937
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 10, 2011 22:11 by adrianparr
Initial Code
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);
Initial URL
Initial Description
This static class can be used to draw a coloured border around the edge of your SWF.
Initial Title
AS3 DrawPixelBorderAroundStage Static Class
Initial Tags
Initial Language
ActionScript 3