Packageorg.as3utils
Classpublic class DrawUtil
InheritanceDrawUtil Inheritance Object

A utility class for working with drawings.



Public Methods
 MethodDefined By
  
DrawUtil is a static class and shouldn't be instantiated.
DrawUtil
  
border(bounds:Rectangle, thickness:Number = 1, color:uint = 0xFFFFFF, alpha:Number = 1):Shape
[static]
DrawUtil
  
circ(x:Number, y:Number, radius:Number, color:uint = 0xFFFFFF, alpha:Number = 1):Shape
[static] Returns a Shape object using the Shape.Graphics.drawCircle method.
DrawUtil
  
rect(x:Number, y:Number, w:Number, h:Number, color:uint = 0xFFFFFF, alpha:Number = 1):Shape
[static] Returns a Shape object using the Shape.Graphics.drawRect method.
DrawUtil
Constructor Detail
DrawUtil()Constructor
public function DrawUtil()

DrawUtil is a static class and shouldn't be instantiated.


Throws
IllegalOperationError — DrawUtil is a static class and shouldn't be instantiated.
Method Detail
border()method
public static function border(bounds:Rectangle, thickness:Number = 1, color:uint = 0xFFFFFF, alpha:Number = 1):Shape

Parameters

bounds:Rectangle
 
thickness:Number (default = 1)
 
color:uint (default = 0xFFFFFF)
 
alpha:Number (default = 1)

Returns
Shape
circ()method 
public static function circ(x:Number, y:Number, radius:Number, color:uint = 0xFFFFFF, alpha:Number = 1):Shape

Returns a Shape object using the Shape.Graphics.drawCircle method.

Parameters

x:Number — the x location of the center of the circle relative to the registration point of the Shape object (in pixels).
 
y:Number — the y location of the center of the circle relative to the registration point of the Shape object (in pixels).
 
radius:Number — the radius of the circle (in pixels).
 
color:uint (default = 0xFFFFFF) — the color of the Shape.
 
alpha:Number (default = 1) — the alpha of the Shape.

Returns
Shape — a Shape object using the Shape.Graphics.drawCircle method.

Example
         import flash.display.Shape;
         import org.as3coreaddendum.utils.DrawUtil;
         
         var s:Shape = DrawUtil.circ(0, 0, 50, 0xFF0000);
         addChild(s);
         
rect()method 
public static function rect(x:Number, y:Number, w:Number, h:Number, color:uint = 0xFFFFFF, alpha:Number = 1):Shape

Returns a Shape object using the Shape.Graphics.drawRect method.

Parameters

x:Number — a number indicating the horizontal position relative to the registration point of the Shape object (in pixels).
 
y:Number — a number indicating the vertical position relative to the registration point of the Shape object (in pixels).
 
w:Number — the width of the Shape (in pixels).
 
h:Number — the height of the Shape (in pixels).
 
color:uint (default = 0xFFFFFF) — the color of the Shape.
 
alpha:Number (default = 1) — the alpha of the Shape.

Returns
Shape — a Shape object using the Shape.Graphics.drawRect method.

Example
         import flash.display.Shape;
         import org.as3coreaddendum.utils.DrawUtil;
         
         var s:Shape = DrawUtil.rect(0, 0, 250, 250, 0xFF0000);
         addChild(s);