| Package | com.zavoo.svg.nodes |
| Class | public class SVGNode |
| Inheritance | SVGNode flash.display.Sprite |
| Subclasses | SVGAnimateNode, SVGCircleNode, SVGClipPathNode, SVGEllipseNode, SVGFilterNode, SVGGroupNode, SVGImageNode, SVGLineNode, SVGMask, SVGMaskNode, SVGPathNode, SVGPolygonNode, SVGPolylineNode, SVGRectNode, SVGRoot, SVGSymbolNode, SVGTextNode, SVGTitleNode, SVGUseNode |
| Property | Defined by | ||
|---|---|---|---|
| svgRoot : SVGRoot
[read-only]
Recursively searches for the root node
| SVGNode | ||
| xml : XML
SVG XML
| SVGNode | ||
| Property | Defined by | ||
|---|---|---|---|
| _firstRendering : Boolean = true | SVGNode | ||
| _graphicsCommands : Array
List of graphics commands to draw node.
| SVGNode | ||
| _invalidDisplay : Boolean = false
If true, redraw sprite graphics
Set to true on any change to xml
| SVGNode | ||
| _style : Object
Used for caching node attribute style values.
| SVGNode | ||
| _xml : XML
SVG XML for this node
| SVGNode | ||
| Method | Defined by | ||
|---|---|---|---|
|
SVGNode(xml:XML = null)
Constructor
| SVGNode | ||
|
addChild(child:DisplayObject):DisplayObject
Track nodes as they are added so we know when to send the RENDER_DONE event
| SVGNode | ||
|
getAttribute(attribute:*, defaultValue:* = null):*
| SVGNode | ||
|
getHeight():Number
Get height calculated from _minY and _maxY
| SVGNode | ||
|
getStyle(name:String):String
Get a node style (ex: fill, stroke, etc..)
Also checks parent nodes for the value if it is not set in the current node.
| SVGNode | ||
|
getWidth():Number
Get width calculated from _minX and _maxX
| SVGNode | ||
|
invalidateDisplay():void
Force a redraw of a node and its children
| SVGNode | ||
|
setStyle(name:String, value:String):void
Set node style to new value
Updates SVG XML and then calls refreshGraphis()
| SVGNode | ||
| Method | Defined by | ||
|---|---|---|---|
|
checkX(value:Number):void
Check value of x against _minX and _maxX,
Update values when appropriate
| SVGNode | ||
|
checkY(value:Number):void
Check value of y against _minY and _maxY,
Update values when appropriate
| SVGNode | ||
|
clearChildren():void
Remove all child nodes
| SVGNode | ||
|
draw():void
Clear current graphics and call runGraphicsCommands to render SVG element
| SVGNode | ||
|
generateGraphicsCommands():void
Called to generate AS3 graphics commands from the SVG instructions
| SVGNode | ||
|
loadAttribute(name:String, field:String = null):void
Load an XML attribute into the current node
| SVGNode | ||
|
loadStyle(name:String, field:String = null):void
Load an SVG style into the current node
| SVGNode | ||
|
nodeBeginFill():void
Called at the start of drawing an SVG element.
| SVGNode | ||
|
nodeEndFill():void
Called at the end of drawing an SVG element
| SVGNode | ||
|
onMouseClick(event:MouseEvent):void
| SVGNode | ||
|
onMouseDown(event:MouseEvent):void
| SVGNode | ||
|
onMouseMove(event:MouseEvent):void
| SVGNode | ||
|
onMouseOut(event:MouseEvent):void
| SVGNode | ||
|
onMouseOver(event:MouseEvent):void
| SVGNode | ||
|
onMouseUp(event:MouseEvent):void
| SVGNode | ||
|
onNodeAdded(event:Event):void
If node has an "id" attribute, register it with the root node
| SVGNode | ||
|
onNodeRemoved(event:Event):void
| SVGNode | ||
|
parse():void
Parse the SVG XML.
| SVGNode | ||
|
redrawNode(event:Event):void
Triggers on ENTER_FRAME event
Redraws node graphics if _invalidDisplay == true
| SVGNode | ||
|
runGraphicsCommands():void
Execute graphics commands contained in var _graphicsCommands
| SVGNode | ||
|
setAttributes():void
Load attributes/styling from the XML.
| SVGNode | ||
|
setupEvents():void
| SVGNode | ||
|
setupFilters():void
Add any assigned filters to node
| SVGNode | ||
|
transformNode():void
Perform transformations defined by the transform attribute
| SVGNode | ||
| Constant | Defined by | ||
|---|---|---|---|
| attributeList : Array [static]
| SVGNode | ||
| _firstRendering | property |
protected var _firstRendering:Boolean = true
| _graphicsCommands | property |
protected var _graphicsCommands:ArrayList of graphics commands to draw node. Generated by generateGraphicsCommands()
| _invalidDisplay | property |
protected var _invalidDisplay:Boolean = falseIf true, redraw sprite graphics Set to true on any change to xml
| _style | property |
protected var _style:ObjectUsed for caching node attribute style values. font, font-size, stroke, etc... Set by setAttributes() Used by getStyle()
| svgRoot | property |
svgRoot:SVGRoot [read-only]Recursively searches for the root node
Implementation public function get svgRoot():SVGRoot
| _xml | property |
protected var _xml:XMLSVG XML for this node
| xml | property |
xml:XML [read-write]SVG XML
Implementation public function get xml():XML
public function set xml(value:XML):void
| SVGNode | () | constructor |
public function SVGNode(xml:XML = null)Constructor
Parametersxml:XML (default = null) — XML object containing the SVG document. |
| addChild | () | method |
public override function addChild(child:DisplayObject):DisplayObjectTrack nodes as they are added so we know when to send the RENDER_DONE event
Parameterschild:DisplayObject |
DisplayObject |
| checkX | () | method |
protected function checkX(value:Number):voidCheck value of x against _minX and _maxX, Update values when appropriate
Parametersvalue:Number |
| checkY | () | method |
protected function checkY(value:Number):voidCheck value of y against _minY and _maxY, Update values when appropriate
Parametersvalue:Number |
| clearChildren | () | method |
protected function clearChildren():voidRemove all child nodes
| draw | () | method |
protected function draw():voidClear current graphics and call runGraphicsCommands to render SVG element
| generateGraphicsCommands | () | method |
protected function generateGraphicsCommands():voidCalled to generate AS3 graphics commands from the SVG instructions
| getAttribute | () | method |
public function getAttribute(attribute:*, defaultValue:* = null):*Parameters
attribute:* — Attribute to retrieve from SVG XML
|
|
defaultValue:* (default = null) — to return if attribute is not found
|
* — Returns the value of defaultValue
|
| getHeight | () | method |
public function getHeight():NumberGet height calculated from _minY and _maxY
ReturnsNumber |
| getStyle | () | method |
public function getStyle(name:String):StringGet a node style (ex: fill, stroke, etc..) Also checks parent nodes for the value if it is not set in the current node.
Parametersname:String — Name of style to retreive
|
String — Value of style or null if it is not found
|
| getWidth | () | method |
public function getWidth():NumberGet width calculated from _minX and _maxX
ReturnsNumber |
| invalidateDisplay | () | method |
public function invalidateDisplay():voidForce a redraw of a node and its children
| loadAttribute | () | method |
protected function loadAttribute(name:String, field:String = null):voidLoad an XML attribute into the current node
Parametersname:String — Name of the XML attribute to load
|
|
field:String (default = null) — Name of the node field to set. If null, the name attribute will be used as the field attribute.
|
| loadStyle | () | method |
protected function loadStyle(name:String, field:String = null):voidLoad an SVG style into the current node
Parametersname:String — Name of the SVG style to load
|
|
field:String (default = null) — Name of the node field to set. If null, the value of name will be used as the field attribute.
|
| nodeBeginFill | () | method |
protected function nodeBeginFill():voidCalled at the start of drawing an SVG element. Sets fill and stroke styles
| nodeEndFill | () | method |
protected function nodeEndFill():voidCalled at the end of drawing an SVG element
| onMouseClick | () | method |
protected function onMouseClick(event:MouseEvent):voidParameters
event:MouseEvent |
| onMouseDown | () | method |
protected function onMouseDown(event:MouseEvent):voidParameters
event:MouseEvent |
| onMouseMove | () | method |
protected function onMouseMove(event:MouseEvent):voidParameters
event:MouseEvent |
| onMouseOut | () | method |
protected function onMouseOut(event:MouseEvent):voidParameters
event:MouseEvent |
| onMouseOver | () | method |
protected function onMouseOver(event:MouseEvent):voidParameters
event:MouseEvent |
| onMouseUp | () | method |
protected function onMouseUp(event:MouseEvent):voidParameters
event:MouseEvent |
| onNodeAdded | () | method |
protected function onNodeAdded(event:Event):voidIf node has an "id" attribute, register it with the root node
Parametersevent:Event |
| onNodeRemoved | () | method |
protected function onNodeRemoved(event:Event):voidParameters
event:Event |
| parse | () | method |
protected function parse():voidParse the SVG XML. This handles creation of child nodes.
| redrawNode | () | method |
protected function redrawNode(event:Event):voidTriggers on ENTER_FRAME event Redraws node graphics if _invalidDisplay == true
Parametersevent:Event |
| runGraphicsCommands | () | method |
protected function runGraphicsCommands():voidExecute graphics commands contained in var _graphicsCommands
| setAttributes | () | method |
protected function setAttributes():voidLoad attributes/styling from the XML. Attributes are applied in functions called later. Creates a sprite mask if a clip-path is given.
| setStyle | () | method |
public function setStyle(name:String, value:String):voidSet node style to new value Updates SVG XML and then calls refreshGraphis()
Parametersname:String — Name of style
|
|
value:String — New value for style
|
| setupEvents | () | method |
protected function setupEvents():void
| setupFilters | () | method |
protected function setupFilters():voidAdd any assigned filters to node
| transformNode | () | method |
protected function transformNode():voidPerform transformations defined by the transform attribute
| attributeList | constant |
public static const attributeList:Array