Border outline class in Actionscript 3
This is code for creating a solid black border outline around the edges of the swf. I have used the AS3 drawing API’s lineStyle() and drawRect() methods to create the border outline.
/**
* CREATEBORDER CLASS
* CREATED BY ILIKE2FLASH.COM
*
**/
package com.ilike2flash
{
import flash.display.Shape;
public function createBorder(w:uint, h:uint, col:uint = 0x000000):Shape
{
var border:Shape = new Shape();
border.graphics.lineStyle(2, 0x000000);
border.graphics.drawRect(0, 0, w, h);
border.graphics.endFill();
return border;
}
}
To create a border, you call the createBorder function like below.
var border:Shape = new createBorder(stage.stageWidth, stage.stageHeight); addChild(border);



0 comments:
Post a Comment