| Package | graphics.drawing |
| Class | public dynamic class PolygonPen |
| Inheritance | PolygonPen Pen flash.utils.Proxy |
Example :
package examples
{
import graphics.Align;
import graphics.FillStyle;
import graphics.drawing.PolygonPen;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class ExamplePolygonPen extends Sprite
{
public function ExamplePolygonPen()
{
stage.scaleMode = StageScaleMode.NO_SCALE ;
stage.align = "" ;
var shape:Shape = new Shape() ;
shape.x = 740 / 2 ;
shape.y = 420 / 2 ;
pen = new PolygonPen( shape , 0, 0, 10 , 100, 0 , Align.CENTER ) ;
pen.fill = new FillStyle( 0xEBD936 ) ;
pen.draw() ;
addChild( shape ) ;
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
}
public var pen:PolygonPen ;
public function keyDown( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.LEFT :
{
pen.draw( 0, 0, 10 , 100, 0 , Align.LEFT ) ;
break ;
}
case Keyboard.RIGHT :
{
pen.draw( 0, 0, 10 , 100, 20 , Align.RIGHT ) ;
break ;
}
case Keyboard.UP :
{
pen.draw( 0, 0, 3 , 100, 40 , Align.TOP ) ;
break ;
}
case Keyboard.DOWN :
{
pen.draw( 0, 0, 4 , 100, 60 , Align.BOTTOM ) ;
break ;
}
case Keyboard.SPACE :
{
pen.x = 10 ;
pen.y = 40 ;
pen.sides = 8 ;
pen.radius = 50 ;
pen.angle = 40 ;
pen.align = Align.TOP_RIGHT ;
pen.draw() ;
break ;
}
}
}
}
}
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
Determinates the align value of the pen. | Pen | |
| angle : Number = 0
Starting angle in degrees (default to 0). | PolygonPen | ||
![]() | fill : IFillStyle
Determinates the fill style object of the pen. | Pen | |
![]() | graphics : *
Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur. | Pen | |
![]() | line : ILineStyle
Determinates the line style object of the pen. | Pen | |
| radius : Number
The radius value of the pen. | PolygonPen | ||
| sides : uint
The number of sides (Math.abs(sides) must be > 2)
| PolygonPen | ||
![]() | 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. | PolygonPen | ||
| y : Number
The offset y value of the center of the circle. | PolygonPen | ||
| Method | Defined By | ||
|---|---|---|---|
PolygonPen(graphic:*, x:Number = 0, y:Number = 0, sides:uint = 6, radius:Number = 20, angle:Number = 0, align:uint = 1)
Creates a new PolygonPen. | PolygonPen | ||
![]() | 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 [override]
Draws the shape. | PolygonPen | ||
drawShape():void [override]
This method contains the basic drawing shape algorithm. | PolygonPen | ||
![]() | 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. | PolygonPen | ||
| angle | property |
public var angle:Number = 0Starting angle in degrees (default to 0).
| radius | property |
public var radius:NumberThe radius value of the pen.
| sides | property |
sides:uintThe number of sides (Math.abs(sides) must be > 2)
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.
| PolygonPen | () | Constructor |
public function PolygonPen(graphic:*, x:Number = 0, y:Number = 0, sides:uint = 6, radius:Number = 20, angle:Number = 0, align:uint = 1)Creates a new PolygonPen. The Pen class use composition to control a Graphics reference and draw custom vector graphic shapes.
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).
| |
sides:uint (default = 6) — (optional) The number of sides (Math.abs(sides) must be > 2)
| |
radius:Number (default = 20) — (optional) The radius of the circle (in pixels).
| |
angle:Number (default = 0) — (optional) The starting angle in degrees. (defaults to 0)
| |
align:uint (default = 1) — (optional) The Align value to align the shape.
|
| draw | () | method |
override public 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 |
override public 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).
|