| 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 | ||
|---|---|---|---|
| _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 | ||
|
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 | ||
|
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 | ||
|---|---|---|---|
|
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 | ||
|
getAttribute(attribute:*, defaultValue:* = null):*
| 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 | ||
|
parse():void
Parse the SVG XML.
| SVGNode | ||
|
redrawNode(event:Event):void
Triggers on ENTER_FRAME event
Redraws node graphics if _invalidDisplay == true
| SVGNode | ||
|
registerId(event:Event):void
If node has an "id" attribute, register it with the root node
| SVGNode | ||
|
runGraphicsCommands():void
Execute graphics commands contained in var _graphicsCommands
| SVGNode | ||
|
setAttributes():void
Load attributes/styling from the XML.
| 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 | ||
| _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. |
| 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 |
protected 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
|
| 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
|
| 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
| 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 |
| registerId | () | method |
protected function registerId(event:Event):voidIf node has an "id" attribute, register it with the root node
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
|
| 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