RoundRectangle Documentation

Author: Alex Uhlmann
Last Modified: 09/23/05 19:46:27


Summary

RoundRectangle class:

- description

RoundRectangle Properties:

- width_def
- height_def
- cornerRadii_def
- movieclip
- lineThickness
- lineRGB
- lineAlpha
- fillRGB
- fillAlpha

RoundRectangle Methods:

- draw
- drawBy
- getCornerRadius
- setCornerRadius
- getCornerRadii
- setCornerRadii
- getSize
- setSize
- lineStyle
- fillStyle
- gradientStyle
- setRegistrationPoint
- clear
- getID
- toString


RoundRectangle class

version: Documentation not provided.

description:

RoundRectangle is a class for creating rectangles and rounded rectangles. The rounding is very much like that of the rectangle tool in Flash where if the rectangle is smaller in either dimension than the rounding would permit, the rounding scales down to fit. If you specify a movieclip as first parameter, the shape will be drawn inside this movieclip. If you omit the mc parameter, the class will create a new movieclip in _root.apContainer_mc.

Example 1: draw a rectangle with default parameters.

			var myRoundRectangle:RoundRectangle = new RoundRectangle();			
			myRoundRectangle.draw();
			
Example 2: draw a rectangle with custom parameters.
			var myRoundRectangle:RoundRectangle = new RoundRectangle(275,200,200,100);
			myRoundRectangle.setCornerRadius(60);
			myRoundRectangle.lineStyle(2,0xff0000,100);
			myRoundRectangle.fillStyle(0x000000,100);
			myRoundRectangle.draw();
			
Example 3: Draw another rounded rectangle with each corner different.
			var myRoundRectangle:RoundRectangle = new RoundRectangle(275,200,200,100);
			myRoundRectangle.setCornerRadii({tl:5,tr:10,bl:20,br:40});
			myRoundRectangle.lineStyle(5,0xff0000,100);
			myRoundRectangle.fillStyle(0x000000,100);
			myRoundRectangle.draw();
			

Example 4: Take a look at example 3 of the Rectangle class documentation. Same applies to RoundRectangle.

usage:

var myRoundRectangle:RoundRectangle = new RoundRectangle();
var myRoundRectangle:RoundRectangle = new RoundRectangle(x, y, width, height, cornerRadius);
var myRoundRectangle:RoundRectangle = new RoundRectangle(x, y, width, height, cornerRadii);
var myRoundRectangle:RoundRectangle = new RoundRectangle(mc, x, y, width, height, cornerRadius);
var myRoundRectangle:RoundRectangle = new RoundRectangle(mc, x, y, width, height, cornerRadii);

parameters:


RoundRectangle Properties:

width_def

(Number)(static) default property. width of rectangle. Defaults to 100.

height_def

(Number)(static) default property. height of rectangle. Defaults to 100.

cornerRadii_def

(Object)(static) default property. corner radii of rectangle. Defaults to 25 degrees each.

movieclip

(MovieClip)(read only) Movieclip that contains the drawing.

lineThickness

(Number) Outline thickness.

lineRGB

(Number) Outline color of the drawing as hex number.

lineAlpha

(Number) Outline transparency (alpha).

fillRGB

(Number) Fill color of the drawing.

fillAlpha

(Number) Fill transparency.


RoundRectangle Methods:

draw

description: Draws the rectangle.

usage:

myRoundRectangle.draw();

returns: Void.

drawBy

description: Draws the shape without clearing the movieclip.

usage:

myInstance.drawBy();

returns: Void.

getCornerRadius

description: returns the corner radius of the rectangle in degrees.

usage:

myRoundRectangle.getCornerRadius();

returns: Number

setCornerRadius

description: sets the corner radius of the rectangle in degrees.

usage:

myRoundRectangle.getCornerRadius();

parameters:

returns: Void.

getCornerRadii

description: returns the corner radii (plural of radius) of the rectangle in degrees.

usage:

myRoundRectangle.setCornerRadii();

returns: Object

setCornerRadii

description: sets the corner radii (plural of radius) of the rectangle in degrees. Only accepts objects with tl (top left), tr (top right), bl (bottom left) and br (bottom right) properties.

usage:

myRoundRectangle.setCornerRadii();

parameters:

returns: Void.

getSize

description: Returns the dimensions of the rectangle.

usage:

myRectangle.getSize();

returns: Object that contains w for with and h for height properties that define the dimension of the drawing in pixels.

setSize

description: Sets the dimensions of the rectangle.

usage:

myRectangle.setSize(width, height);

parameters:

returns: Void.

lineStyle

description: define outline.

usage:

myRoundRectangle.lineStyle();
myRoundRectangle.lineStyle(lineThickness, lineRGB, lineAlpha);

parameters:

returns: Void.

fillStyle

description: define fill.

usage:

myRoundRectangle.fillStyle();
myRoundRectangle.fillStyle(fillRGB, fillAlpha);

parameters:

returns: Void.

gradientStyle

description: Same interface as MovieClip.beginGradientFill(). See manual.

usage:

myShapeComposite.gradientStyle(fillType, colors, alphas, ratios, matrix);

parameters:

returns: Void.

setRegistrationPoint

description: Sets the registration point of the shape. Defaults to center. Top left is 0,0. The parameter object accepts either a position property with the value of "CENTER" or x and y properties of with coordinates as values of the registration point.

Example 1: Set the registration point of an ellipse to the upper left corner (0,0) instead of center.

				var myEllipse:Ellipse = new Ellipse(275,200,100,50);
				myEllipse.setRegistrationPoint( {x:0,y:0} );
				myEllipse.draw();
				

internally AnimationPackage centers all shapes with

				myInstance.setRegistrationPoint( {position:"CENTER"} );
				

usage:

myInstance.setRegistrationPoint(registrationObj);

parameters:

returns: Void.

clear

description: removes all drawings. Identical to myInstance.movieclip.clear();

usage:

myInstance.clear();

returns: Void.

getID

description: returns a unique ID of the instance. Usefull for associative arrays.

usage: myInstance.getID();

returns: Number

toString

description: returns the name of the class.

usage: myInstance.toString();

returns: String




generated with AS2docGenerator beta 0.5.3