| Package | graphics.drawing |
| Class | public class ArrowPen |
| Inheritance | ArrowPen LinePen Pen flash.utils.Proxy |
Example :
import flash.display.CapsStyle ;
import flash.display.JointStyle ;
import flash.display.LineScaleMode ;
import flash.display.Sprite ;
import graphics.FillStyle ;
import graphics.LineStyle ;
import graphics.drawing.ArrowPen ;
import graphics.geom.Vector2 ;
stage.scaleMode = StageScaleMode.NO_SCALE ;
stage.align = "" ;
var shape:Sprite = new Sprite() ;
var start : Vector2 = new Vector2( 740 / 2, 420 / 2) ;
var end : Vector2 = new Vector2( start.x + 100, start.y + 100) ;
var pen:ArrowPen = new ArrowPen( shape , start , end ) ;
pen.fill = new FillStyle( 0xFAFA74 ) ;
pen.line = new LineStyle( 2, 0xFAFA74 , 1 , true, LineScaleMode.NORMAL , CapsStyle.SQUARE, JointStyle.MITER ) ;
pen.setPen( null, null, { headSize:20 , headWidth:8 } ) ; // initialize
pen.draw() ;
addChild( shape ) ;
var refresh:Function = function( e:MouseEvent )
{
pen.end.x = e.localX ;
pen.end.y = e.localY ;
pen.draw() ;
}
stage.addEventListener( MouseEvent.MOUSE_MOVE , refresh ) ;
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
Determinates the align value of the pen. | Pen | |
| edgeControlPosition : Number = .5
The edge control position. | ArrowPen | ||
| edgeControlSize : Number = .5
The edge control size. | ArrowPen | ||
![]() | end : Vector2
The end vector object of this line pen. | LinePen | |
![]() | 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 | |
| headSize : Number = 10
Indicates the relative width of arrow head. | ArrowPen | ||
| headWidth : Number = -1
Indicates the pixel Length of arrow head. | ArrowPen | ||
![]() | line : ILineStyle
Determinates the line style object of the pen. | Pen | |
| shaftPosition : Number = 0
The shaft position value. | ArrowPen | ||
| shaftThickness : Number = 0.5
The shaft thickness value. | ArrowPen | ||
![]() | start : Vector2
The start vector object of this line pen. | LinePen | |
![]() | 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 | |
| Method | Defined By | ||
|---|---|---|---|
ArrowPen(graphic:*, start:* = null, end:* = null, init:Object = null)
Creates a new ArrowPen instance. | ArrowPen | ||
![]() | 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(... args):void [override]
Draws the shape. | LinePen | |
drawShape():void [override]
This method contains the basic drawing shape algorithm. | ArrowPen | ||
![]() | 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 | |
![]() |
Returns the Line reference of this pen. | LinePen | |
![]() | 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(... args):void [override]
Sets the arc options to defined all values to draw the arc shape in the movieclip reference of this pen. | ArrowPen | ||
| edgeControlPosition | property |
public var edgeControlPosition:Number = .5The edge control position.
| edgeControlSize | property |
public var edgeControlSize:Number = .5The edge control size.
| headSize | property |
public var headSize:Number = 10Indicates the relative width of arrow head.
| headWidth | property |
public var headWidth:Number = -1Indicates the pixel Length of arrow head.
| shaftPosition | property |
public var shaftPosition:Number = 0The shaft position value.
| shaftThickness | property |
public var shaftThickness:Number = 0.5The shaft thickness value.
| ArrowPen | () | Constructor |
public function ArrowPen(graphic:*, start:* = null, end:* = null, init:Object = null)Creates a new ArrowPen instance.
Parametersgraphic:* — The Graphics reference to control with this helper. You can passed-in a Shape or Sprite/MovieClip reference in argument.
| |
start:* (default = null) — The default start Vector object.
| |
end:* (default = null) — The default end Vector object.
| |
init:Object (default = null) — This optional object is used to initialize all properties of the pen.
|
| drawShape | () | method |
override public function drawShape():voidThis method contains the basic drawing shape algorithm.
| setPen | () | method |
override public function setPen(... args):voidSets the arc options to defined all values to draw the arc shape in the movieclip reference of this pen.
Parameters
... args — (optional) The end vector value (flash.geom.Point or graphics.geom.Vector2)
|