Packagegraphics.drawing
Classpublic class ArrowPen
InheritanceArrowPen Inheritance LinePen Inheritance Pen Inheritance flash.utils.Proxy

This pen is the basic tool to draw an arrow shape.

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 ) ;
     



Public Properties
 PropertyDefined By
 Inheritedalign : 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
 Inheritedend : Vector2
The end vector object of this line pen.
LinePen
 Inheritedfill : IFillStyle
Determinates the fill style object of the pen.
Pen
 Inheritedgraphics : *
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
 Inheritedline : 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
 Inheritedstart : Vector2
The start vector object of this line pen.
LinePen
 InheriteduseClear : Boolean = true
Indicates if the clear() method is invoked at the end of the draw method.
Pen
 InheriteduseEndFill : Boolean = true
Indicates if the endFill() method is invoked at the end of the draw method.
Pen
Public Methods
 MethodDefined By
  
ArrowPen(graphic:*, start:* = null, end:* = null, init:Object = null)
Creates a new ArrowPen instance.
ArrowPen
 Inherited
BF(... arguments):void
Defines a shortcut reference to used the beginBitmapFill method.
Pen
 Inherited
C(... arguments):void
Defines a shortcut reference to used the curveTo method.
Pen
 Inherited
CL():void
Defines a shortcut reference to used the clear method.
Pen
 Inherited
draw(... args):void
[override] Draws the shape.
LinePen
  
drawShape():void
[override] This method contains the basic drawing shape algorithm.
ArrowPen
 Inherited
EF():void
Defines a shortcut reference to used the endFill method.
Pen
 Inherited
F(... arguments):void
Defines a shortcut reference to used the beginFill method.
Pen
 Inherited
Returns the Line reference of this pen.
LinePen
 Inherited
GF(... arguments):void
Defines a shortcut reference to used the beginGradientFill method.
Pen
 Inherited
GS(... arguments):void
Defines a shortcut reference to used the lineGradientStyle method.
Pen
 Inherited
L(... arguments):void
Defines a shortcut reference to used the lineTo method.
Pen
 Inherited
M(... arguments):void
Defines a shortcut reference to used the moveTo method.
Pen
 Inherited
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
Property Detail
edgeControlPositionproperty
public var edgeControlPosition:Number = .5

The edge control position.

edgeControlSizeproperty 
public var edgeControlSize:Number = .5

The edge control size.

headSizeproperty 
public var headSize:Number = 10

Indicates the relative width of arrow head.

headWidthproperty 
public var headWidth:Number = -1

Indicates the pixel Length of arrow head.

shaftPositionproperty 
public var shaftPosition:Number = 0

The shaft position value.

shaftThicknessproperty 
public var shaftThickness:Number = 0.5

The shaft thickness value.

Constructor Detail
ArrowPen()Constructor
public function ArrowPen(graphic:*, start:* = null, end:* = null, init:Object = null)

Creates a new ArrowPen instance.

Parameters
graphic:* — 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.
Method Detail
drawShape()method
override public function drawShape():void

This method contains the basic drawing shape algorithm.

setPen()method 
override public function setPen(... args):void

Sets 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)