DrawUtil

Kind of class:class
Inherits from:none
Version:09/19/08
Author:Aaron Clinger
Classpath:org.casalib.util.DrawUtil
File last modified:Monday, 01 December 2008, 13:34:40

Summary


Class methods
  • drawWedge (target_mc:MovieClip, ellipse:Ellipse, startAngle:Number, arc:Number) : Void
    • Draws a circular wedge into a MovieClip.
  • drawEllipse (target_mc:MovieClip, ellipse:Ellipse) : Void
    • Draws an ellipse (circle or oval) into a MovieClip.
  • drawRectangle (target_mc:MovieClip, rectangle:Rectangle) : Void
    • Draws a rectangle (or square) into a MovieClip.
  • drawRoundedRectangle (target_mc:MovieClip, rectangle:Rectangle, cornerRadius:Number) : Void
    • Draws a rectangle with rounded corners into a MovieClip.

Class methods

drawEllipse

static function drawEllipse (
target_mc:MovieClip, ellipse:Ellipse) : Void

Draws an ellipse (circle or oval) into a MovieClip.
Parameters:
target_mc:
MovieClip in which to draw the ellipse.
ellipse :
Defined Ellipse object that contains the size and position of the shape.
Usage:
  • this.createEmptyMovieClip('oval_mc', this.getNextHighestDepth());
    var myOval:Ellipse = new Ellipse(10, 10, 150, 50);
    
    this.oval_mc.beginFill(0xFF00FF);
    DrawUtil.drawEllipse(this.oval_mc, myOval);
    this.oval_mc.endFill();

drawRectangle

static function drawRectangle (
target_mc:MovieClip, rectangle:Rectangle) : Void

Draws a rectangle (or square) into a MovieClip.
Parameters:
target_mc:
MovieClip in which to draw the rectangle.
rectangle:
Defined Rectangle object that contains the size and position of the shape.
Usage:
  • this.createEmptyMovieClip('rect_mc', this.getNextHighestDepth());
    var myRect:Rectangle = new Rectangle(10, 10, 150, 50);
    
    this.rect_mc.beginFill(0xFF00FF);
    DrawUtil.drawRectangle(this.rect_mc, myRect);
    this.rect_mc.endFill();

drawRoundedRectangle

static function drawRoundedRectangle (
target_mc:MovieClip, rectangle:Rectangle, cornerRadius:Number) : Void

Draws a rectangle with rounded corners into a MovieClip.
Parameters:
target_mc :
MovieClip in which to draw the rectangle.
rectangle :
Defined Rectangle object that contains the size and position of the shape.
cornerRadius:
The rounded radius of the rectangle's corners.
Usage:
  • this.createEmptyMovieClip('rect_mc', this.getNextHighestDepth());
    var myRect:Rectangle = new Rectangle(10, 10, 150, 50);
    
    this.rect_mc.beginFill(0xFF00FF);
    DrawUtil.drawRoundedRectangle(this.rect_mc, myRect, 15);
    this.rect_mc.endFill();

drawWedge

static function drawWedge (
target_mc:MovieClip, ellipse:Ellipse, startAngle:Number, arc:Number) : Void

Draws a circular wedge into a MovieClip.
Parameters:
target_mc :
MovieClip in which to draw the wedge.
ellipse :
Defined Ellipse object that contains the size and position of the shape.
startAngle:
The starting angle of wedge in degrees.
arc :
The sweep of the wedge in degrees.
Usage:
  • this.createEmptyMovieClip('wedge_mc', this.getNextHighestDepth());
    var myOval:Ellipse = new Ellipse(10, 10, 150, 50);
    
    this.wedge_mc.beginFill(0xFF00FF);
    DrawUtil.drawWedge(this.wedge_mc, myOval, 0, 270);
    this.wedge_mc.endFill();