| Package | pegas.draw |
| Class | public dynamic class GearPen |
| Inheritance | GearPen Pen flash.utils.Proxy |
Example :
import pegas.draw.Align ;
import pegas.draw.GearPen ;
import pegas.draw.FillStyle ;
stage.scaleMode = StageScaleMode.NO_SCALE ;
stage.align = "" ;
var shape:Shape = new Shape() ;
shape.x = 740 / 2 ;
shape.y = 420 / 2 ;
var pen:GearPen = new GearPen( shape.graphics ) ;
pen.align = Align.CENTER ;
pen.fill = new FillStyle( 0xEBD936 , 1 ) ;
pen.draw() ;
addChild( shape ) ;
var keyDown:Function = function( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.LEFT :
{
pen.draw( 0, 0, 6, 150, 70 , 0, 5, 40, Align.LEFT ) ;
break ;
}
case Keyboard.RIGHT :
{
pen.draw( 0, 0, 5, 80, 40 , 0, 5, 10, Align.RIGHT ) ;
break ;
}
case Keyboard.UP :
{
pen.draw( 0, 0, 8, 100, 40 , 0 , 5, 5, Align.TOP ) ;
break ;
}
case Keyboard.DOWN :
{
pen.draw( 0, 0, 10 , 100, 60 , 0, 30, 5, Align.BOTTOM ) ;
break ;
}
case Keyboard.SPACE :
{
pen.x = 10 ;
pen.y = 40 ;
pen.sides = 8 ;
pen.holeRadius = 40 ;
pen.holeSides = 6 ;
pen.innerRadius = 120 ;
pen.outerRadius = 80 ;
pen.angle = 40 ;
pen.align = Align.TOP_RIGHT ;
pen.draw() ;
break ;
}
}
}
var enterFrame:Function = function( e:Event ):void
{
pen.angle += 15 ;
pen.draw() ;
}
var mouseDown:Function = function( e:MouseEvent ):void
{
stage.addEventListener( Event.ENTER_FRAME , enterFrame ) ;
}
var mouseUp:Function = function( e:MouseEvent ):void
{
stage.removeEventListener( Event.ENTER_FRAME , enterFrame ) ;
}
stage.addEventListener( MouseEvent.MOUSE_DOWN , mouseDown ) ;
stage.addEventListener( MouseEvent.MOUSE_UP , mouseUp ) ;
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
| Property | Defined by | ||
|---|---|---|---|
![]() | align : uint
(read-write) Determinates the align value of the pen.
| Pen | |
| angle : Number
Starting angle in degrees (default to 0).
| GearPen | ||
![]() | fill : IFillStyle
Determinates the fill style object of the pen.
| Pen | |
![]() | graphics : Graphics
Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
| Pen | |
| holeRadius : Number
The size of hole.
| GearPen | ||
| holeSides : Number
Draw a polygonal hole with this many sides (must be > 2)
| GearPen | ||
| innerRadius : Number
The radius of the indent of the teeth.
| GearPen | ||
![]() | line : ILineStyle
Determinates the line style object of the pen.
| Pen | |
| outerRadius : Number
The outer radius of the teeth.
| GearPen | ||
| sides : uint
The number of points of the star.
| GearPen | ||
![]() | useClear : Boolean = true
Indicates if the clear() method is invoked at the end of the draw method.
| Pen | |
![]() | useEndFill : Boolean = true
Indicates if the endFill() method is invoked at the end of the draw method.
| Pen | |
| x : Number
The offset x value of the center of the circle.
| GearPen | ||
| y : Number
The offset y value of the center of the circle.
| GearPen | ||
| Method | Defined by | ||
|---|---|---|---|
|
GearPen(graphic:*, x:Number = 0, y:Number = 0, points:uint = 5, innerRadius:Number = 30, outerRadius:Number = 40, angle:Number = 0, holeSides:Number = 3, holeRadius:Number, align:uint = 10)
Creates a new StarPen instance.
| GearPen | ||
![]() |
BF(... arguments):void
Defines a shortcut reference to used the
beginBitmapFill method. | Pen | |
![]() |
C(... arguments):void
Defines a shortcut reference to used the
curveTo method. | Pen | |
![]() |
CL():void
Defines a shortcut reference to used the
clear method. | Pen | |
|
draw(... arguments):void
Draws the shape.
| GearPen | ||
|
drawShape():void
This method contains the basic drawing shape algorithm.
| GearPen | ||
![]() |
EF():void
Defines a shortcut reference to used the
endFill method. | Pen | |
![]() |
F(... arguments):void
Defines a shortcut reference to used the
beginFill method. | Pen | |
![]() |
GF(... arguments):void
Defines a shortcut reference to used the
beginGradientFill method. | Pen | |
![]() |
GS(... arguments):void
Defines a shortcut reference to used the
lineGradientStyle method. | Pen | |
![]() |
L(... arguments):void
Defines a shortcut reference to used the
lineTo method. | Pen | |
![]() |
M(... arguments):void
Defines a shortcut reference to used the
moveTo method. | Pen | |
![]() |
S(... arguments):void
Defines a shortcut reference to used the
lineStyle method. | Pen | |
|
setPen(... arguments):void
Sets the shape options to defined all values to draw the shape.
| GearPen | ||
![]() |
toString():String
Returns the string representation of this object.
| Pen | |
| angle | property |
public var angle:NumberStarting angle in degrees (default to 0).
| holeRadius | property |
public var holeRadius:NumberThe size of hole.
| holeSides | property |
public var holeSides:NumberDraw a polygonal hole with this many sides (must be > 2)
| innerRadius | property |
public var innerRadius:NumberThe radius of the indent of the teeth.
| outerRadius | property |
public var outerRadius:NumberThe outer radius of the teeth.
| sides | property |
sides:uint [read-write]The number of points of the star. This value is always > 2.
Implementation public function get sides():uint
public function set sides(value:uint):void
| x | property |
public var x:NumberThe offset x value of the center of the circle.
| y | property |
public var y:NumberThe offset y value of the center of the circle.
| GearPen | () | constructor |
public function GearPen(graphic:*, x:Number = 0, y:Number = 0, points:uint = 5, innerRadius:Number = 30, outerRadius:Number = 40, angle:Number = 0, holeSides:Number = 3, holeRadius:Number, align:uint = 10)Creates a new StarPen instance.
Parametersgraphic:* — The Graphics reference to control with this helper. You can passed-in a Shape or Sprite/MovieClip reference in argument.
|
|
x:Number (default = 0) — (optional) The x location of the center of the circle relative to the registration point of the parent display object (in pixels).
|
|
y:Number (default = 0) — (optional) The y location of the center of the circle relative to the registration point of the parent display object (in pixels).
|
|
points:uint (default = 5) — (optional) The number of teeth on gear. (must be > 2)
|
|
innerRadius:Number (default = 30) — (optional) The radius of the indent of the teeth.
|
|
outerRadius:Number (default = 40) — (optional) The outer radius of the teeth.
|
|
angle:Number (default = 0) — (optional) The starting angle in degrees. (defaults to 0)
|
|
holeSides:Number (default = 3) — (optional) draw a polygonal hole with this many sides (must be > 2)
|
|
holeRadius:Number — (optional) size of hole. Default = innerRadius/3.
|
|
align:uint (default = 10) — (optional) The Align value to align the shape.
|
| draw | () | method |
public override function draw(... arguments):voidDraws the shape.
Parameters... arguments — (optional) The x location of the center of the circle relative to the registration point of the parent display object (in pixels).
|
| drawShape | () | method |
public override function drawShape():voidThis method contains the basic drawing shape algorithm.
| setPen | () | method |
public function setPen(... arguments):voidSets the shape options to defined all values to draw the shape.
Parameters... arguments — (optional) The x location of the center of the circle relative to the registration point of the parent display object (in pixels).
|