Path

The ‘Path’ class stores a collection of path segments, thus forming a path.

Summary
PathThe ‘Path’ class stores a collection of path segments, thus forming a path.
Variables
m_aSegmentsAn array for storing path segments that form this path.
m_objLocationStores a coordinate of the current location inside this path.
Functions
PathConstructor.
resetResets and clears this object back to new.
clearClears the data being stored by this object.
moveToMoves the current location to the specified coordinate.
lineToCreates a line from the current location to the specified coordinate.
curveToCreates a curve from the current location to the specified coordinate.
Properties
startGets the starting point of the path.
endGets the end point of the path.
Functions
getPointAtGets the coordinate of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.
getAngleAtGets the angle of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.
drawUses the data stored by this object to draw a path into the specified graphics object.
disposePerforms any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
initInitializes this object.
addSegmentAdds a new segment to this path.

Variables

m_aSegments

protected var m_aSegments: Array

An array for storing path segments that form this path.

m_objLocation

protected var m_objLocation: Point

Stores a coordinate of the current location inside this path.

Functions

Path

public function Path()

Constructor.

reset

public function reset():void

Resets and clears this object back to new.

clear

public function clear():void

Clears the data being stored by this object.

moveTo

public function moveTo(nX: Number,
nY: Number):void

Moves the current location to the specified coordinate.  This location represents the starting point segments and gets updated each time a new segment is added.

Parameters

param nX The ‘x’ position to move to.
param nY The ‘y’ position to move to. 

lineTo

public function lineTo(nX: Number,
nY: Number):void

Creates a line from the current location to the specified coordinate.  The current location picks up from wherever the last segment ended or can be set manually using the ‘MoveTo’ method.

Parameters

param nX The ‘x’ position for the line to end at.
param nY The ‘y’ position for the line to end at. 

See Also

moveTo

curveTo

public function curveTo(nControlX: Number,
nControlY: Number,
nX: Number,
nY: Number):void

Creates a curve from the current location to the specified coordinate.  The current location picks up from wherever the last segment ended or can be set manually using the ‘MoveTo’ method.

Parameters

param nControlX The ‘x’ position for the control point.
param nControlY The ‘y’ position for the control point.
param nX The ‘x’ position for the curve to end at.
param nY The ‘y’ position for the curve to end at. 

See Also

moveTo

Properties

start

public function get start():Point

Gets the starting point of the path.

Returns

A point object containing information about the point. 

end

public function get end():Point

Gets the end point of the path.

Returns

A point object containing information about the point. 

Functions

getPointAt

public function getPointAt(nPosition: Number):Point

Gets the coordinate of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.

Parameters

param nPosition The position along this path (0.0 to 1.0) to get a coordinate from. 

Returns

The coordinate at the specified position. 

getAngleAt

public function getAngleAt(nPosition: Number):Number

Gets the angle of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.

Parameters

param nPosition The position along this path (0.0 to 1.0) to get the angle from. 

Returns

The angle of the path at the specified position. 

draw

public function draw(objGraphics: Graphics):void

Uses the data stored by this object to draw a path into the specified graphics object.

Parameters

param objGraphics The graphics object to draw the path into. 

dispose

public function dispose():void

Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.

init

protected function init():void

Initializes this object.

addSegment

protected function addSegment(objSegment: IPathSegment):void

Adds a new segment to this path.

Parameters

param objSegment The segment to add to this path. 
The ‘IDisposable’ interface defines a common interface for all objects to encorporate garbage collection.
protected var m_aSegments: Array
An array for storing path segments that form this path.
protected var m_objLocation: Point
Stores a coordinate of the current location inside this path.
public function Path()
Constructor.
public function reset():void
Resets and clears this object back to new.
public function clear():void
Clears the data being stored by this object.
public function moveTo(nX: Number,
nY: Number):void
Moves the current location to the specified coordinate.
public function lineTo(nX: Number,
nY: Number):void
Creates a line from the current location to the specified coordinate.
public function curveTo(nControlX: Number,
nControlY: Number,
nX: Number,
nY: Number):void
Creates a curve from the current location to the specified coordinate.
public function get start():Point
Gets the starting point of the path.
public function get end():Point
Gets the end point of the path.
public function getPointAt(nPosition: Number):Point
Gets the coordinate of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.
public function getAngleAt(nPosition: Number):Number
Gets the angle of a position along this path using a float value of ‘0.0’ to ‘1.0’ where ‘0.0’ is the start of the path and ‘1.0’ is the end of the path.
public function draw(objGraphics: Graphics):void
Uses the data stored by this object to draw a path into the specified graphics object.
public function dispose():void
Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
protected function init():void
Initializes this object.
protected function addSegment(objSegment: IPathSegment):void
Adds a new segment to this path.
Close