Packagecom.zavoo.svg.nodes
Classpublic class SVGNode
InheritanceSVGNode Inheritance flash.display.Sprite
SubclassesSVGAnimateNode, SVGCircleNode, SVGClipPathNode, SVGEllipseNode, SVGFilterNode, SVGGroupNode, SVGImageNode, SVGLineNode, SVGMask, SVGMaskNode, SVGPathNode, SVGPolygonNode, SVGPolylineNode, SVGRectNode, SVGRoot, SVGSymbolNode, SVGTextNode, SVGTitleNode, SVGUseNode

Base node extended by all other SVG Nodes



Public Properties
 PropertyDefined by
  svgRoot : SVGRoot
[read-only] Recursively searches for the root node
SVGNode
  xml : XML
SVG XML
SVGNode
Protected Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
  
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
Protected Methods
 MethodDefined by
  
Remove all child nodes
SVGNode
  
draw():void
Clear current graphics and call runGraphicsCommands to render SVG element
SVGNode
  
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
  
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
  
Execute graphics commands contained in var _graphicsCommands
SVGNode
  
Load attributes/styling from the XML.
SVGNode
  
setupFilters():void
Add any assigned filters to node
SVGNode
  
Perform transformations defined by the transform attribute
SVGNode
Public Constants
 ConstantDefined by
  attributeList : Array
[static]
SVGNode
Property detail
_graphicsCommandsproperty
protected var _graphicsCommands:Array

List of graphics commands to draw node. Generated by generateGraphicsCommands()

_invalidDisplayproperty 
protected var _invalidDisplay:Boolean = false

If true, redraw sprite graphics Set to true on any change to xml

_styleproperty 
protected var _style:Object

Used for caching node attribute style values. font, font-size, stroke, etc... Set by setAttributes() Used by getStyle()

svgRootproperty 
svgRoot:SVGRoot  [read-only]

Recursively searches for the root node

Implementation
    public function get svgRoot():SVGRoot
_xmlproperty 
protected var _xml:XML

SVG XML for this node

xmlproperty 
xml:XML  [read-write]

SVG XML

Implementation
    public function get xml():XML
    public function set xml(value:XML):void
Constructor detail
SVGNode()constructor
public function SVGNode(xml:XML = null)

Constructor

Parameters
xml:XML (default = null) — XML object containing the SVG document.
Method detail
clearChildren()method
protected function clearChildren():void

Remove all child nodes

draw()method 
protected function draw():void

Clear current graphics and call runGraphicsCommands to render SVG element

generateGraphicsCommands()method 
protected function generateGraphicsCommands():void

Called 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
* — Returns the value of defaultValue
getStyle()method 
public function 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.

Parameters
name:String — Name of style to retreive

Returns
String — Value of style or null if it is not found
invalidateDisplay()method 
public function invalidateDisplay():void

Force a redraw of a node and its children

loadAttribute()method 
protected function loadAttribute(name:String, field:String = null):void

Load an XML attribute into the current node

Parameters
name: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):void

Load an SVG style into the current node

Parameters
name: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():void

Called at the start of drawing an SVG element. Sets fill and stroke styles

nodeEndFill()method 
protected function nodeEndFill():void

Called at the end of drawing an SVG element

parse()method 
protected function parse():void

Parse the SVG XML. This handles creation of child nodes.

redrawNode()method 
protected function redrawNode(event:Event):void

Triggers on ENTER_FRAME event Redraws node graphics if _invalidDisplay == true

Parameters
event:Event
registerId()method 
protected function registerId(event:Event):void

If node has an "id" attribute, register it with the root node

Parameters
event:Event
runGraphicsCommands()method 
protected function runGraphicsCommands():void

Execute graphics commands contained in var _graphicsCommands

setAttributes()method 
protected function setAttributes():void

Load 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):void

Set node style to new value Updates SVG XML and then calls refreshGraphis()

Parameters
name:String — Name of style
 
value:String — New value for style
setupFilters()method 
protected function setupFilters():void

Add any assigned filters to node

transformNode()method 
protected function transformNode():void

Perform transformations defined by the transform attribute

Constant detail
attributeListconstant
public static const attributeList:Array