Gear Documentation

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


Summary

Gear class:

- description

Gear Properties:

- innerRadius_def
- outerRadius_def
- sides_def
- holeSides_def_def
- movieclip
- lineThickness
- lineRGB
- lineAlpha
- fillRGB
- fillAlpha

Gear Methods:

- draw
- drawBy
- getInnerRadius
- setInnerRadius
- getOuterRadius
- setOuterRadius
- getHoleSides
- setHoleSides
- getHoleRadius
- setHoleRadius
- getSides
- setSides
- lineStyle
- fillStyle
- gradientStyle
- setRegistrationPoint
- clear
- getID
- toString


Gear class

version: Documentation not provided.

description:

Gear is a class for drawing gears... you know, cogs with teeth and a hole in the middle where the axle goes? FYI: if you modify this to draw the hole polygon in the opposite direction, it will remain transparent if the gear is used for a mask. 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 gear with default parameters.

			var myGear:Gear = new Gear();
			myGear.draw();
			
Example 2: (Example .swf) draw a gear with custom parameters.
			var myGear:Gear = new Gear(275,200,40,50,10,8,15);
			myGear.lineStyle(2,0xff0000,100);
			myGear.fillStyle(0xff0000,100);
			myGear.draw();
			
Example 3:
			var myGear:Gear = new Gear(275,200,40,25,10);
			myGear.lineStyle(2,0xff0000,100);
			myGear.fillStyle(0xff0000,100);
			myGear.draw();
			
Example 4: (Example .swf) Kind of a sun.
			var myGear:Gear = new Gear(275,200,30,100,10);
			myGear.lineStyle(2,0xff0000,100);
			myGear.fillStyle(0xff0000,100);
			myGear.draw();
			

usage:

var myGear:Gear = new Gear();
var myGear:Gear = new Gear(x, y, innerRadius, outerRadius, sides, holeSides, holeRadius);
var myGear:Gear = new Gear(mc, x, y, innerRadius, outerRadius, sides, holeSides, holeRadius);

parameters:


Gear Properties:

innerRadius_def

(Number)(static) default property. Radius of the indent of the teeth.

outerRadius_def

(Number)(static) default property. Outer radius of the teeth.

sides_def

(Number)(static) default property. Number of teeth on gear. (must be > 2). Defaults to 10.

holeSides_def_def

(Number)(static) default property. draw a polygonal hole with this many sides (must be > 2). Defaults to 8.

movieclip

(MovieClip) 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.


Gear Methods:

draw

description: Draws gears.

usage:

myGear.draw();

returns: Void.

drawBy

description: Draws the shape without clearing the movieclip.

usage:

myInstance.drawBy();

returns: Void.

getInnerRadius

description: Return the radius of the indent of the teeth.

usage:

myGear.getInnerRadius();

returns: Number of the radius of the indent of the teeth.

setInnerRadius

description: Sets the radius of the indent of the teeth.

usage:

myGear.setInnerRadius(innerRadius);

parameters:

returns: Void.

getOuterRadius

description: Return the outer radius of the teeth.

usage:

myGear.getOuterRadius();

returns: Number of the outer radius of the teeth.

setOuterRadius

description: Sets the outer radius of the teeth.

usage:

myGear.setOuterRadius(outerRadius);

parameters:

returns: Void.

getHoleSides

description: Return the number of sides of the inner polygonal hole.

usage:

myGear.getHoleSides();

returns: Number of sides of the inner polygonal hole.

setHoleSides

description: Sets the number of sides of the inner polygonal hole.

usage:

myGear.setHoleSides(holeSides);

parameters:

returns: Void.

getHoleRadius

description: Return the size of hole.

usage:

myGear.getHoleRadius();

returns: Number of the size of hole in pixels.

setHoleRadius

description: Sets the size of hole.

usage:

myGear.setHoleRadius(holeRadius);

parameters:

returns: Void.

getSides

description: Return the sides of the drawing.

usage:

myGear.getSides();

returns: Number of sides.

setSides

description: Sets the sides of the drawing.

usage:

myGear.setSides(sides);

parameters:

returns: Void.

lineStyle

description: define outline.

usage:

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

parameters:

returns: Void.

fillStyle

description: define fill.

usage:

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