RoundRectangle Documentation
Author: Alex Uhlmann
Last Modified: 09/23/05 19:46:27
Summary
RoundRectangle class:
RoundRectangle Properties:
RoundRectangle Methods:
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.
Example 2: draw a rectangle with custom parameters.var myRoundRectangle:RoundRectangle = new RoundRectangle(); myRoundRectangle.draw();
Example 3: Draw another rounded rectangle with each corner different.var myRoundRectangle:RoundRectangle = new RoundRectangle(275,200,200,100); myRoundRectangle.setCornerRadius(60); myRoundRectangle.lineStyle(2,0xff0000,100); myRoundRectangle.fillStyle(0x000000,100); myRoundRectangle.draw();
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:
(Number)(static) default property. width of rectangle. Defaults to 100.
(Number)(static) default property. height of rectangle. Defaults to 100.
(Object)(static) default property. corner radii of rectangle. Defaults to 25 degrees each.
(MovieClip)(read only) Movieclip that contains the drawing.
(Number) Outline thickness.
(Number) Outline color of the drawing as hex number.
(Number) Outline transparency (alpha).
(Number) Fill color of the drawing.
(Number) Fill transparency.
description: Draws the rectangle.
usage:
myRoundRectangle.draw();
returns: Void.
description: Draws the shape without clearing the movieclip.
usage:
myInstance.drawBy();
returns: Void.
description: returns the corner radius of the rectangle in degrees.
usage:
myRoundRectangle.getCornerRadius();
returns: Number
description: sets the corner radius of the rectangle in degrees.
usage:
myRoundRectangle.getCornerRadius();
parameters:
returns: Void.
description: returns the corner radii (plural of radius) of the rectangle in degrees.
usage:
myRoundRectangle.setCornerRadii();
returns: Object
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.
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.
description: Sets the dimensions of the rectangle.
usage:
myRectangle.setSize(width, height);
parameters:
returns: Void.
description: define outline.
usage:
myRoundRectangle.lineStyle();
myRoundRectangle.lineStyle(lineThickness, lineRGB, lineAlpha);
parameters:
returns: Void.
description: define fill.
usage:
myRoundRectangle.fillStyle();
myRoundRectangle.fillStyle(fillRGB, fillAlpha);
parameters:
returns: Void.
description: Same interface as MovieClip.beginGradientFill(). See manual.
usage:
myShapeComposite.gradientStyle(fillType, colors, alphas, ratios, matrix);
parameters:
returns: Void.
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.
description: removes all drawings. Identical to myInstance.movieclip.clear();
usage:
myInstance.clear();
returns: Void.
description: returns a unique ID of the instance. Usefull for associative arrays.
usage: myInstance.getID();
returns: Number
description: returns the name of the class.
usage: myInstance.toString();
returns: String