Gear Documentation
Author: Alex Uhlmann
Last Modified: 09/23/05 19:46:04
Summary
Gear class:
Gear Properties:
Gear Methods:
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.
Example 2: (Example .swf) draw a gear with custom parameters.var myGear:Gear = new Gear(); myGear.draw();
Example 3:var myGear:Gear = new Gear(275,200,40,50,10,8,15); 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,40,25,10); myGear.lineStyle(2,0xff0000,100); myGear.fillStyle(0xff0000,100); myGear.draw();
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:
(Number)(static) default property. Radius of the indent of the teeth.
(Number)(static) default property. Outer radius of the teeth.
(Number)(static) default property. Number of teeth on gear. (must be > 2). Defaults to 10.
(Number)(static) default property. draw a polygonal hole with this many sides (must be > 2). Defaults to 8.
(MovieClip) 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 gears.
usage:
myGear.draw();
returns: Void.
description: Draws the shape without clearing the movieclip.
usage:
myInstance.drawBy();
returns: Void.
description: Return the radius of the indent of the teeth.
usage:
myGear.getInnerRadius();
returns: Number of the radius of the indent of the teeth.
description: Sets the radius of the indent of the teeth.
usage:
myGear.setInnerRadius(innerRadius);
parameters:
returns: Void.
description: Return the outer radius of the teeth.
usage:
myGear.getOuterRadius();
returns: Number of the outer radius of the teeth.
description: Sets the outer radius of the teeth.
usage:
myGear.setOuterRadius(outerRadius);
parameters:
returns: Void.
description: Return the number of sides of the inner polygonal hole.
usage:
myGear.getHoleSides();
returns: Number of sides of the inner polygonal hole.
description: Sets the number of sides of the inner polygonal hole.
usage:
myGear.setHoleSides(holeSides);
parameters:
returns: Void.
description: Return the size of hole.
usage:
myGear.getHoleRadius();
returns: Number of the size of hole in pixels.
description: Sets the size of hole.
usage:
myGear.setHoleRadius(holeRadius);
parameters:
returns: Void.
description: Return the sides of the drawing.
usage:
myGear.getSides();
returns: Number of sides.
description: Sets the sides of the drawing.
usage:
myGear.setSides(sides);
parameters:
returns: Void.
description: define outline.
usage:
myGear.lineStyle();
myGear.lineStyle(lineThickness, lineRGB, lineAlpha);
parameters:
returns: Void.
description: define fill.
usage:
myGear.fillStyle();
myGear.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