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
  _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
Public Methods
 MethodDefined 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
  
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
  
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
  
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
  
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
  
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
  
Execute graphics commands contained in var _graphicsCommands
SVGNode
  
Load attributes/styling from the XML.
SVGNode
  
setupEvents():void
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
_firstRenderingproperty
protected var _firstRendering:Boolean = true
_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
addChild()method
public override function addChild(child:DisplayObject):DisplayObject

Track nodes as they are added so we know when to send the RENDER_DONE event

Parameters
child:DisplayObject

Returns
DisplayObject
checkX()method 
protected function checkX(value:Number):void

Check value of x against _minX and _maxX, Update values when appropriate

Parameters
value:Number
checkY()method 
protected function checkY(value:Number):void

Check value of y against _minY and _maxY, Update values when appropriate

Parameters
value:Number
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 
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
* — Returns the value of defaultValue
getHeight()method 
public function getHeight():Number

Get height calculated from _minY and _maxY

Returns
Number
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
getWidth()method 
public function getWidth():Number

Get width calculated from _minX and _maxX

Returns
Number
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

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

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

Parameters
event:Event
onNodeRemoved()method 
protected function onNodeRemoved(event:Event):voidParameters
event:Event
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
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
setupEvents()method 
protected function setupEvents():void
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