Poly Documentation

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


Summary

Poly class:

- description

Poly Properties:

- radius_def
- sides_def
- movieclip
- lineThickness
- lineRGB
- lineAlpha
- fillRGB
- fillAlpha

Poly Methods:

- draw
- drawBy
- getRadius
- setRadius
- getSides
- setSides
- lineStyle
- fillStyle
- gradientStyle
- setRegistrationPoint
- clear
- getID
- toString


Poly class

version: Documentation not provided.

description:

Poly is a class for creating regular polygons. Negative values for sides will draw the polygon in the reverse direction, which allows for creating knock-outs in masks. 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 poly with default parameters.

			var myPoly:Poly = new Poly();
			myPoly.draw();
			
Example 2: (Example .swf) draw a poly with custom parameters.
			var myPoly:Poly = new Poly(275,200,100,6);
			myPoly.lineStyle(2,0xff0000,100);
			myPoly.fillStyle(0xff0000,100);
			myPoly.draw();
			
Example 3. A triangle.
			var myPoly:Poly = new Poly(275,200,100,3);
			myPoly.lineStyle(2,0xff0000,100);
			myPoly.fillStyle(0xff0000,100);
			myPoly.draw();
			
Example 4. A circle.
			var myPoly:Poly = new Poly(275,200,50,50);
			myPoly.lineStyle(2,0xff0000,100);
			myPoly.fillStyle(0xff0000,100);
			myPoly.draw();
			

usage:

var myPoly:Poly = new Poly();
var myPoly:Poly = new Poly(x, y, radius, sides);
var myPoly:Poly = new Poly(mc, x, y, radius, sides);

parameters:


Poly Properties:

radius_def

(Number)(static) default property. radius of poly.

sides_def

(Number)(static) default property. sides of poly. Defaults to 4.

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.


Poly Methods:

draw

description: Draws it.

usage:

myPoly.draw();

returns: Void.

drawBy

description: Draws the shape without clearing the movieclip.

usage:

myInstance.drawBy();

returns: Void.

getRadius

description: Returns the radius.

usage:

myPoly.getRadius();

returns: Number that represents the radius in pixels.

setRadius

description: Sets the radius of the drawing.

usage:

myPoly.setRadius(radius);

parameters:

returns: Void.

getSides

description: Return the sides of the drawing.

usage:

myPoly.getSides();

returns: Number of sides.

setSides

description: Sets the sides of the drawing.

usage:

myPoly.setSides(sides);

parameters:

returns: Void.

lineStyle

description: define outline.

usage:

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

parameters:

returns: Void.

fillStyle

description: define fill.

usage:

myPoly.fillStyle();
myPoly.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