Sprite |
Stroke |
Defines a stroke object consisting of curves, line segments and primitive graphics objects.
Stroke | Defines a stroke object consisting of curves, line segments and primitive graphics objects. |
Static properties | |
strokeName | Display object name of a stroke. |
enableChangeCallbacks | Set to false to disable callback and render calls. |
Stroke class types | |
classSprite | Class type sprite, it is a branch node with children |
classShape | Class type shape, it is a leat node with no children |
classPath | Class type path, it is a leaf with a motion or advanced value path |
Stroke point names | |
pointName | Display object name of a stroke point sprite. |
controlName | Display object name of a control point sprite. |
cornerName | Display object name of a corner point sprite. |
Public properties | |
classType | Stroke class type, see Stroke class types |
items | Array of StrokeItem objects |
shape | Display object used as render target to display the stroke |
filter | Stroke bitmap filter effects |
isMask | Set to true if the stroke acts as a mask for its parent |
parentName | Name of the stroke’s parent in the scene graph |
position | Offset position in parent |
coordinateSystem | Local reference coordinate system |
viewRectangle | Zoomed view rectangle |
strokeRotation | Rotation of the stroke relative to parent |
selectedIndex | Index of currently selected point in the stroke |
Selection state | |
selectPoint | Point selection |
selectSegment | Segment selection |
selectShape | Shape selection |
Private properties | |
points | Sprite with control point children |
indicator | Selection indicator sprite |
isHidingControlView | Set to true if the control view is hidden |
hiddenPointsState | Stored state for view of control points when hidden |
hiddenIndicatorState | Stored state for view of selection indicator when hidden |
selectionChangeCallback | Callback invoked on selection index change |
Construction/ | |
Stroke | Create a stroke object for a graphics shape or path. |
setSelectionChangeCallback | Change the callback invoked when the selectedIndex in the stroke is changed. |
dispose | Dispose of all resources used or referenced in the instance. |
Property methods | |
shapeName | Change the name of the stroke asset. |
shapeName | Returns the name of the stroke asset. |
showPoints | Change whether control points are shown (true) or not. |
showPoints | Returns true if control points are shown, false if not. |
showIndicator | Change whether the selection indicator is shown (true) or not. |
showIndicator | Returns true if the selection indicator is shown, false if not. |
Control view | |
hideControlView | Store the control view state and hide the control points and indicator. |
restoreControlView | Restore the control points and indicator to their state before a call to hideControlView. |
Point sprites | |
createPoints | Returns a new point sprite with buttonMode set. |
removePoints | Removes the points sprite from the display list and deletes it. |
Scaling | |
scale | Scale all items in the stroke. |
Render methods | |
render | Renders the stroke onto the shape display object. |
renderTo | Renders the stroke onto the target display object. |
renderAction | Renders an item’s graphics action primitive on the render target. |
Selection indicator | |
updateIndicator | Change position of the indicator to the selectedIndex stroke point position. |
createIndicator | createIndicator code generated by µShape. |
Item list methods | |
updateSelectedIndex | Change the selectedIndex in the items array of StrokeItems. |
newItem | Appends a StrokeItem object to the end of the items array of StrokeItems. |
newObject | Appends a graphics primitive object at the end of the items array of StrokeItems. |
newDefaultPoint | Adds a new default segment start point to the items array of StrokeItems witha positionat origo. |
newPoint | Adds a new segment start point to the items array of StrokeItems. |
insertPoint | Inserts a line or curve StrokeItem segment after the currently selected item. |
appendPoint | Appends a line or curve StrokeItem segment at the end of the items array of StrokeItems. |
deletePoint | Delete the StrokeItem at the given index. |
Selection properties | |
beginSelectionIndex | Returns the index of the first StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables. |
endSelectionIndex | Returns the index of the last StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables. |
Query methods | |
indexOfStrokePoint | Finds the index of the StrokeItem that the stroke point sprite exists on. |
indexOfControlPoint | Finds the index of the StrokeItem that the control point sprite exists on. |
indexOfCornerPoint | Finds the index of the StrokeItem that the corner point sprite exists on. |
hasGradients | Returns true if any StrokeItem objects in the Stroke uses a gradient fill, false otherwise. |
Code generation | |
generateCode | Generates script code for methods creating a stroke sprite, shape or a path. |
public var classType: String
Stroke class type, see Stroke class types
public var items: Array
Array of StrokeItem objects
public function Stroke( strokeStyles: Array, throughPoints: Array, curvePoints: Array, onSelectionChangeCallback: Function = null, isDefaultItem: Boolean = false )
Create a stroke object for a graphics shape or path.
strokeStyles | array of StrokeStyle objects |
throughPoints | array of stroke Point positions |
curvePoints | array of control Point positions |
onSelectionChangeCallback | callback invoked on selection index change |
isDefaultItem | Set to true if it is a default, see StrokeItem.isDefaultItem (default false) |
onSelectionChangeCallback | function strokeChangedSelectedStrokePoint(index:int):void |
public function setSelectionChangeCallback( onSelectionChangeCallback: Function ):void
Change the callback invoked when the selectedIndex in the stroke is changed.
onSelectionChangeCallback | callback invoked on selection index change |
onSelectionChangeCallback | function strokeChangedSelectedStrokePoint(index:int):void |
internal function restoreControlView():void
Restore the control points and indicator to their state before a call to hideControlView.
private function removePoints():void
Removes the points sprite from the display list and deletes it.
public function scale( xScale: Number, yScale: Number ):void
Scale all items in the stroke.
xScale | Horizontal scaling factor |
yScale | Vertical scaling factor |
public function render():void
Renders the stroke onto the shape display object.
private function updateIndicator():void
Change position of the indicator to the selectedIndex stroke point position.
public function updateSelectedIndex( index: int ):void
Change the selectedIndex in the items array of StrokeItems.
index | a new valid selected index |
public function newItem( item: StrokeItem ):void
Appends a StrokeItem object to the end of the items array of StrokeItems. The selectionChangeCallback is triggered.
item | a StrokeItem object |
public function newObject( type: String, sPoint: Point, ctPoint: Point, crPoint: Point = null ):void
Appends a graphics primitive object at the end of the items array of StrokeItems. The selectionChangeCallback is triggered.
type | type of graphics primitive |
sPoint | stroke point position |
ctPoint | control point position |
crPoint | corner point position (default null) |
public function newDefaultPoint():void
Adds a new default segment start point to the items array of StrokeItems witha positionat origo.
sPoint | stroke point position |
public function newPoint( sPoint: Point ):void
Adds a new segment start point to the items array of StrokeItems. The selectionChangeCallback is triggered.
sPoint | stroke point position |
public function insertPoint( sPoint: Point, cPoint: Point = null ):void
Inserts a line or curve StrokeItem segment after the currently selected item. The selectionChangeCallback is triggered.
sPoint | stroke point position |
cPoint | control point position (default null) |
private function appendPoint( sPoint: Point, cPoint: Point = null ):void
Appends a line or curve StrokeItem segment at the end of the items array of StrokeItems. The selectionChangeCallback is triggered.
sPoint | stroke point position |
cPoint | control point position (default null) |
public function deletePoint( index: int ):void
Delete the StrokeItem at the given index. The selectionChangeCallback is triggered.
index | valid item index |
public function get beginSelectionIndex():int
Returns the index of the first StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables.
public function get endSelectionIndex():int
Returns the index of the last StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables.
public function indexOfStrokePoint( sprite: Sprite ):int
Finds the index of the StrokeItem that the stroke point sprite exists on.
sprite | a stroke point sprite |
Index of the StrokeItem if found else -1
public function indexOfControlPoint( sprite: Sprite ):int
Finds the index of the StrokeItem that the control point sprite exists on.
sprite | a control point sprite |
Index of the StrokeItem if found else -1
public function indexOfCornerPoint( sprite: Sprite ):int
Finds the index of the StrokeItem that the corner point sprite exists on.
sprite | a corner point sprite |
Index of the StrokeItem if found else -1
public function hasGradients():Boolean
Returns true if any StrokeItem objects in the Stroke uses a gradient fill, false otherwise.
public function generateCode( title: String, indent: String, codeStyle: Object ):String
Generates script code for methods creating a stroke sprite, shape or a path.
title | version decorated identification of the generating application |
indent | string with spaces to indent each line of code |
codeStyle | dynamic object with properties describing the desired code style |
a script snippet
Display object name of a stroke.
public static const strokeName: String
Set to false to disable callback and render calls.
public static var enableChangeCallbacks: Boolean
Class type sprite, it is a branch node with children
public static const classSprite: String
Class type shape, it is a leat node with no children
public static const classShape: String
Class type path, it is a leaf with a motion or advanced value path
public static const classPath: String
Display object name of a stroke point sprite.
public static const pointName: String
Display object name of a control point sprite.
public static const controlName: String
Display object name of a corner point sprite.
public static const cornerName: String
Stroke class type, see Stroke class types
public var classType: String
Array of StrokeItem objects
public var items: Array
Display object used as render target to display the stroke
public var shape: Shape
Stroke bitmap filter effects
public var filter: StrokeFilter
Set to true if the stroke acts as a mask for its parent
public var isMask: Boolean
Name of the stroke’s parent in the scene graph
public var parentName: String
Offset position in parent
public var position: Point
Local reference coordinate system
public var coordinateSystem: Rectangle
Zoomed view rectangle
public var viewRectangle: Rectangle
Rotation of the stroke relative to parent
public var strokeRotation: Number
Index of currently selected point in the stroke
public var selectedIndex: int
Point selection
public var selectPoint: Boolean
Segment selection
public var selectSegment: Boolean
Shape selection
public var selectShape: Boolean
Sprite with control point children
private var points: Sprite
Selection indicator sprite
private var indicator: Shape
Set to true if the control view is hidden
private var isHidingControlView: Boolean
Stored state for view of control points when hidden
private var hiddenPointsState: Boolean
Stored state for view of selection indicator when hidden
private var hiddenIndicatorState: Boolean
Callback invoked on selection index change
private var selectionChangeCallback: Function
Create a stroke object for a graphics shape or path.
public function Stroke( strokeStyles: Array, throughPoints: Array, curvePoints: Array, onSelectionChangeCallback: Function = null, isDefaultItem: Boolean = false )
Change the callback invoked when the selectedIndex in the stroke is changed.
public function setSelectionChangeCallback( onSelectionChangeCallback: Function ):void
Dispose of all resources used or referenced in the instance.
public function dispose():void
Change the name of the stroke asset.
public function set shapeName( newName: String ):void
Change whether control points are shown (true) or not.
public function set showPoints( state: Boolean ):void
Change whether the selection indicator is shown (true) or not.
public function set showIndicator( state: Boolean ):void
Store the control view state and hide the control points and indicator.
internal function hideControlView():void
Restore the control points and indicator to their state before a call to hideControlView.
internal function restoreControlView():void
Returns a new point sprite with buttonMode set.
private function createPoints():Sprite
Removes the points sprite from the display list and deletes it.
private function removePoints():void
Scale all items in the stroke.
public function scale( xScale: Number, yScale: Number ):void
Renders the stroke onto the shape display object.
public function render():void
Renders the stroke onto the target display object.
public function renderTo( target: Shape ):void
Renders an item’s graphics action primitive on the render target.
private function renderAction( target: Shape, item: StrokeItem ):void
Change position of the indicator to the selectedIndex stroke point position.
private function updateIndicator():void
createIndicator code generated by µShape.
private function createIndicator():Shape
Change the selectedIndex in the items array of StrokeItems.
public function updateSelectedIndex( index: int ):void
Appends a StrokeItem object to the end of the items array of StrokeItems.
public function newItem( item: StrokeItem ):void
Appends a graphics primitive object at the end of the items array of StrokeItems.
public function newObject( type: String, sPoint: Point, ctPoint: Point, crPoint: Point = null ):void
Adds a new default segment start point to the items array of StrokeItems witha positionat origo.
public function newDefaultPoint():void
Adds a new segment start point to the items array of StrokeItems.
public function newPoint( sPoint: Point ):void
Inserts a line or curve StrokeItem segment after the currently selected item.
public function insertPoint( sPoint: Point, cPoint: Point = null ):void
Appends a line or curve StrokeItem segment at the end of the items array of StrokeItems.
private function appendPoint( sPoint: Point, cPoint: Point = null ):void
Delete the StrokeItem at the given index.
public function deletePoint( index: int ):void
Returns the index of the first StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables.
public function get beginSelectionIndex():int
Returns the index of the last StrokeItem in the selection range determined by the current selectedIndex and the state of the selectPoint, selectSegment and selectShape variables.
public function get endSelectionIndex():int
Finds the index of the StrokeItem that the stroke point sprite exists on.
public function indexOfStrokePoint( sprite: Sprite ):int
Finds the index of the StrokeItem that the control point sprite exists on.
public function indexOfControlPoint( sprite: Sprite ):int
Finds the index of the StrokeItem that the corner point sprite exists on.
public function indexOfCornerPoint( sprite: Sprite ):int
Returns true if any StrokeItem objects in the Stroke uses a gradient fill, false otherwise.
public function hasGradients():Boolean
Generates script code for methods creating a stroke sprite, shape or a path.
public function generateCode( title: String, indent: String, codeStyle: Object ):String
State set to true when a default segment start item is created.
public var isDefaultItem: Boolean