StrokeItem

Defines a stroke item structure, that is a curve or line segment point or an object such as a circle, ellipse or rectangle.

Summary
StrokeItemDefines a stroke item structure, that is a curve or line segment point or an object such as a circle, ellipse or rectangle.
Public enumeration constants
SEGMENT_STARTStart of a line segment/path.
SEGMENT_POINTContinuation of a line segment/path.
CIRCLECircle shaped object.
ELLIPSEEllipse shaped object.
RECTRectangle shaped object.
ROUND_RECTRectangle shaped object with rounded corners.
Public data structure
typeType of item, one of the Public enumeration constants.
styleLine and fill StrokeStyle in effect for the item.
strokePointPrimary stroke point for the item.
controlPointSecondary control point for the item.
cornerPointTertiary corner point only used to define a rounded rectangle’s corner size.
strokeSpriteSprite representing the primary stroke point.
controlSpriteSprite representing the secondary control point.
cornerSpriteSprite representing the tertiary corner point.
isDefaultItemState set to true when a default segment start item is created.
Structure creation
StrokeItemConstructor for creation of a StrokeItem.
updateItemChange type and points on the existing StrokeItem.
cloneReturns a deep copy of the StrokeItem instance.
createPointSpriteCreates a point sprite representing one of the points defined in a StrokeItem.
Structure destruction
disposeRemoves all referenced data from the instance.
removeSpritesRemove all point sprites from the display list and the StrokeItem.
removeControlPointRemove a control point sprite from the display list and the StrokeItem.
Structure manipulation
moveMoves the StrokeItem to a new position.
scaleScale the position of a StrokeItem.

Public enumeration constants

SEGMENT_START

public static const SEGMENT_START: String

Start of a line segment/path.

SEGMENT_POINT

public static const SEGMENT_POINT: String

Continuation of a line segment/path.

CIRCLE

public static const CIRCLE: String

Circle shaped object.

ELLIPSE

public static const ELLIPSE: String

Ellipse shaped object.

RECT

public static const RECT: String

Rectangle shaped object.

ROUND_RECT

public static const ROUND_RECT: String

Rectangle shaped object with rounded corners.

Public data structure

type

public var type: String

Type of item, one of the Public enumeration constants.

style

public var style: StrokeStyle

Line and fill StrokeStyle in effect for the item.

strokePoint

public var strokePoint: Point

Primary stroke point for the item.

controlPoint

public var controlPoint: Point

Secondary control point for the item.

cornerPoint

public var cornerPoint: Point

Tertiary corner point only used to define a rounded rectangle’s corner size.

strokeSprite

public var strokeSprite: Sprite

Sprite representing the primary stroke point.

controlSprite

public var controlSprite: Sprite

Sprite representing the secondary control point.

cornerSprite

public var cornerSprite: Sprite

Sprite representing the tertiary corner point.

isDefaultItem

public var isDefaultItem: Boolean

State set to true when a default segment start item is created.

Used to eliminate the default item if the subsequent operation does not require it.  That is when the next operation is to create a graphics object instead of a line ccontinuation.

Structure creation

StrokeItem

public function StrokeItem(itemParent: DisplayObjectContainer,  
itemType: String,  
itemStyle: StrokeStyle,  
strokePt: Point,  
controlPt: Point = null,
cornerPt: Point = null)

Constructor for creation of a StrokeItem.

Parameters

itemParentdisplay object list parent
itemTypetype of item, one of the Public enumeration constants
itemStyleline and fill StrokeStyle for the item
strokePtstroke point for the item
controlPtoptional control point (default null)
cornerPtoptional corner point (default null)

updateItem

public function updateItem(itemType: String,  
strokePt: Point,  
controlPt: Point = null,
cornerPt: Point = null):void

Change type and points on the existing StrokeItem.

Parameters

itemTypetype of item, one of the Public enumeration constants
strokePtstroke point for the item
controlPtoptional control point (default null)
cornerPtoptional corner point (default null)

clone

public function clone():StrokeItem

Returns a deep copy of the StrokeItem instance.

createPointSprite

private function createPointSprite(itemParent: DisplayObjectContainer,
pos: Point,
spriteName: String):Sprite

Creates a point sprite representing one of the points defined in a StrokeItem.

Parameters

itemParentdisplay object list parent
posa Point position
spriteNamea point type name as defined in <Stroke point names>

Returns

A colored point sprite

Structure destruction

dispose

public function dispose():void

Removes all referenced data from the instance.

removeSprites

public function removeSprites():void

Remove all point sprites from the display list and the StrokeItem.

removeControlPoint

public function removeControlPoint():void

Remove a control point sprite from the display list and the StrokeItem.

Structure manipulation

move

public function move(xPos: Number,  
yPos: Number,  
mirrorX: Boolean = false,
mirrorY: Boolean = false):void

Moves the StrokeItem to a new position.

Parameters

xPosnew X-axis position
yPosnew Y-axis position
mirrorXtrue if mirrored in the X-axis (default false)
mirrorYtrue if mirrored in the Y-axis (default false)

scale

public function scale(xScale: Number,
yScale: Number):void

Scale the position of a StrokeItem.  Calls on the StrokeStyle.scale method to scale the style as well.

Parameters

xScalehorizontal scale factor
yScalevertical scale factor
public static const SEGMENT_START: String
Start of a line segment/path.
public static const SEGMENT_POINT: String
Continuation of a line segment/path.
public static const CIRCLE: String
Circle shaped object.
public static const ELLIPSE: String
Ellipse shaped object.
public static const RECT: String
Rectangle shaped object.
public static const ROUND_RECT: String
Rectangle shaped object with rounded corners.
public var type: String
Type of item, one of the Public enumeration constants.
public var style: StrokeStyle
Line and fill StrokeStyle in effect for the item.
Defines a stroke line and fill style for a line segment, a curve or a graphics primitive object.
public var strokePoint: Point
Primary stroke point for the item.
public var controlPoint: Point
Secondary control point for the item.
public var cornerPoint: Point
Tertiary corner point only used to define a rounded rectangle’s corner size.
public var strokeSprite: Sprite
Sprite representing the primary stroke point.
public var controlSprite: Sprite
Sprite representing the secondary control point.
public var cornerSprite: Sprite
Sprite representing the tertiary corner point.
public var isDefaultItem: Boolean
State set to true when a default segment start item is created.
public function StrokeItem(itemParent: DisplayObjectContainer,  
itemType: String,  
itemStyle: StrokeStyle,  
strokePt: Point,  
controlPt: Point = null,
cornerPt: Point = null)
Constructor for creation of a StrokeItem.
public function updateItem(itemType: String,  
strokePt: Point,  
controlPt: Point = null,
cornerPt: Point = null):void
Change type and points on the existing StrokeItem.
public function clone():StrokeItem
Returns a deep copy of the StrokeItem instance.
private function createPointSprite(itemParent: DisplayObjectContainer,
pos: Point,
spriteName: String):Sprite
Creates a point sprite representing one of the points defined in a StrokeItem.
public function dispose():void
Removes all referenced data from the instance.
public function removeSprites():void
Remove all point sprites from the display list and the StrokeItem.
public function removeControlPoint():void
Remove a control point sprite from the display list and the StrokeItem.
public function move(xPos: Number,  
yPos: Number,  
mirrorX: Boolean = false,
mirrorY: Boolean = false):void
Moves the StrokeItem to a new position.
public function scale(xScale: Number,
yScale: Number):void
Scale the position of a StrokeItem.
public function scale(xScale: Number,
yScale: Number):void
Scale the width of the line according the requested scaling and the setting of the LineScaleMode property.
Close