| Package | pegas.draw |
| Class | public dynamic class StarPen |
| Inheritance | StarPen Pen flash.utils.Proxy |
Example :
import pegas.draw.Align ;
import pegas.draw.StarPen ;
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:StarPen = new StarPen( shape.graphics ) ;
pen.align = Align.CENTER ;
pen.fill = new FillStyle( 0xEBD936 , 0.6 ) ;
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, 5, 40, 60 , 0, Align.LEFT ) ;
break ;
}
case Keyboard.RIGHT :
{
pen.draw( 0, 0, 5, 80, 40 , 0, Align.RIGHT ) ;
break ;
}
case Keyboard.UP :
{
pen.draw( 0, 0, 20, 100, 40 , 0 , Align.TOP ) ;
break ;
}
case Keyboard.DOWN :
{
pen.draw( 0, 0, 10 , 100, 60 , 0, Align.BOTTOM ) ;
break ;
}
case Keyboard.SPACE :
{
pen.x = 10 ;
pen.y = 40 ;
pen.points = 8 ;
pen.innerRadius = 100 ;
pen.outerRadius = 50 ;
pen.angle = 40 ;
pen.align = Align.TOP_RIGHT ;
pen.draw() ;
break ;
}
}
}
var enterFrame:Function = function( e:Event ):void
{
pen.angle += 10 ;
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 = 0
Starting angle in degrees (default to 0).
| StarPen | ||
![]() | 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 | |
| innerRadius : Number
The radius of the indent of the points
| StarPen | ||
![]() | line : ILineStyle
Determinates the line style object of the pen.
| Pen | |
| outerRadius : Number
The radius of the tips of the points
| StarPen | ||
| points : uint
The number of points of the star.
| StarPen | ||
![]() | 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.
| StarPen | ||
| y : Number
The offset y value of the center of the circle.
| StarPen | ||
| Method | Defined by | ||
|---|---|---|---|
|
StarPen(graphic:*, x:Number = 0, y:Number = 0, points:uint = 5, innerRadius:Number = 20, outerRadius:Number = 40, angle:Number = 20, align:uint = 10)
Creates a new StarPen instance.
| StarPen | ||
![]() |
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.
| StarPen | ||
|
drawShape():void
This method contains the basic drawing shape algorithm.
| StarPen | ||
![]() |
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.
| StarPen | ||
![]() |
toString():String
Returns the string representation of this object.
| Pen | |
| angle | property |
public var angle:Number = 0Starting angle in degrees (default to 0).
| innerRadius | property |
public var innerRadius:NumberThe radius of the indent of the points
| outerRadius | property |
public var outerRadius:NumberThe radius of the tips of the points
| points | property |
points:uint [read-write]The number of points of the star. This value is always > 2.
Implementation public function get points():uint
public function set points(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.
| StarPen | () | constructor |
public function StarPen(graphic:*, x:Number = 0, y:Number = 0, points:uint = 5, innerRadius:Number = 20, outerRadius:Number = 40, angle:Number = 20, 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 points (Math.abs(sides) must be > 2)
|
|
innerRadius:Number (default = 20) — (optional) The radius of the indent of the points.
|
|
outerRadius:Number (default = 40) — (optional) The radius of the tips of the points.
|
|
angle:Number (default = 20) — (optional) The starting angle in degrees. (defaults to 0)
|
|
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).
|