Path |
The ‘Path’ class stores a collection of path segments, thus forming a path.
Path | The ‘Path’ class stores a collection of path segments, thus forming a path. |
Variables | |
m_aSegments | An array for storing path segments that form this path. |
m_objLocation | Stores a coordinate of the current location inside this path. |
Functions | |
Path | Constructor. |
reset | Resets and clears this object back to new. |
clear | Clears the data being stored by this object. |
moveTo | Moves the current location to the specified coordinate. |
lineTo | Creates a line from the current location to the specified coordinate. |
curveTo | Creates a curve from the current location to the specified coordinate. |
Properties | |
start | Gets the starting point of the path. |
end | Gets the end point of the path. |
Functions | |
getPointAt | 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. |
getAngleAt | 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. |
draw | Uses the data stored by this object to draw a path into the specified graphics object. |
dispose | Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc. |
init | Initializes this object. |
addSegment | Adds a new segment to this path. |
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.
param | nX The ‘x’ position for the line to end at. |
param | nY The ‘y’ position for the line to end at. |
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.
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. |
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.
param | nPosition The position along this path (0.0 to 1.0) to get a coordinate from. |
The coordinate at the specified position.
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.
param | nPosition The position along this path (0.0 to 1.0) to get the angle from. |
The angle of the path at the specified position.
An array for storing path segments that form this path.
protected var m_aSegments: Array
Stores a coordinate of the current location inside this path.
protected var m_objLocation: Point
Constructor.
public function Path()
Resets and clears this object back to new.
public function reset():void
Clears the data being stored by this object.
public function clear():void
Moves the current location to the specified coordinate.
public function moveTo( nX: Number, nY: Number ):void
Creates a line from the current location to the specified coordinate.
public function lineTo( nX: Number, nY: Number ):void
Creates a curve from the current location to the specified coordinate.
public function curveTo( nControlX: Number, nControlY: Number, nX: Number, nY: Number ):void
Gets the starting point of the path.
public function get start():Point
Gets the end point of the path.
public function get end():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 getPointAt( nPosition: Number ):Point
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 getAngleAt( nPosition: Number ):Number
Uses the data stored by this object to draw a path into the specified graphics object.
public function draw( objGraphics: Graphics ):void
Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
public function dispose():void
Initializes this object.
protected function init():void
Adds a new segment to this path.
protected function addSegment( objSegment: IPathSegment ):void