Star Documentation

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


Summary

Star class:

- description

Star Properties:

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

Star Methods:

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


Star class

version: Documentation not provided.

description:

Star is a class for drawing star shaped polygons. Note that the stars by default 'point' to the right. This is because the method starts drawing at 0 degrees by default, putting the first point to the right of center. Negative values for sides draws the star in reverse direction, allowing for knock-outs when used as part of 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 star with default parameters.

			var myStar:Star = new Star();
			myStar.draw();
			
Example 2: draw a star with custom parameters.
			var myStar:Star = new Star(275,200,100,25,6);
			myStar.lineStyle(2,0xff0000,100);
			myStar.fillStyle(0xff0000,100);
			myStar.draw();
			
Example 3. (Example .swf) A star that only consists of straight lines.
			var myStar:Star = new Star(275,200,100,0,6);
			myStar.lineStyle(2,0xff0000,100);
			myStar.fillStyle(0xff0000,100);
			myStar.draw();
			

usage:

var myStar:Star = new Star();
var myStar:Star = new Star(x, y, innerRadius, outerRadius, sides);
var myStar:Star = new Star(mc, x, y, innerRadius, outerRadius, sides);

parameters:


Star Properties:

innerRadius_def

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

outerRadius_def

(Number)(static) default property. Radius of the tips of the sides.

sides_def

(Number)(static) default property. Number of sides (must be > 2). 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.


Star Methods:

draw

description: Draws stars.

usage:

myStar.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 sides.

usage:

myStar.getInnerRadius();

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

setInnerRadius

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

usage:

myStar.setInnerRadius(innerRadius);

parameters:

returns: Void.

getOuterRadius

description: Return the radius of the tips of the sides.

usage:

myStar.getOuterRadius();

returns: Number of the radius of the tips of the sides.

setOuterRadius

description: Sets the radius of the tips of the sides.

usage:

myStar.setOuterRadius(outerRadius);

parameters:

returns: Void.

getSides

description: Return the sides of the drawing.

usage:

myStar.getSides();

returns: Number of sides.

setSides

description: Sets the sides of the drawing.

usage:

myStar.setSides(sides);

parameters:

returns: Void.

lineStyle

description: define outline.

usage:

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

parameters:

returns: Void.

fillStyle

description: define fill.

usage:

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