Reverse engineering parser for generated AS3 class code.
ClassParser | Reverse engineering parser for generated AS3 class code. |
Parsed class properties | |
assetName | Name of the graphical asset class. |
backgroundColor | Scene background color. |
frameRate | Animation frame rate. |
loopState | Animation loop state. |
xMin | Minumum X in the scene coordinate system |
yMin | Minumum Y in the scene coordinate system |
xMax | Maximum X in the scene coordinate system |
yMax | Maximum Y in the scene coordinate system |
sceneGraph | Array of parent/child relationships |
maskNames | Array of mask name strings |
strokeList | Array of MethodParsers with stroke shapes and paths |
animation | A MethodParser with timeline tweens |
Public methods | |
parse | Parse a class script. |
dispose | Dispose of references and reset variables. |
Scene parsing methods | |
splitScript | Splits a class script into parts. |
parseMethods | Parses an array of class methods to separate the methods into types. |
parseSceneMethod | Parses a method that defines the parent/child relationships on the scene graph. |
parseMaskObjects | Parses a method that defines stroke assets as masks. |
parseAnimateMethod | Parses a timeline animation method for defined tweens. |
parseStrokeMethods | Parses all script methods as stroke methods except those found to define scene relations and animation. |
String conversion | |
toString | Transforms basic parsed properties into a form suitable for debugging. |
Property parsing methods | |
parseAssetName | Scans the script for an class asset name, updates assetName. |
parseDimensions | Scans for scene coordinate system dimensions, updates xMin, yMin, xMax, yMax if found. |
parseFrameRate | Scans for movie animation framerate, updates frameRate if found. |
public var strokeList: Array
Array of MethodParsers with stroke shapes and paths
public var animation: MethodParser
A MethodParser with timeline tweens
private function parseMethods( scriptArray: Array ):void
Parses an array of class methods to separate the methods into types. Updates sceneGraph, maskNames, animation and strokeList.
Looks for a method that defines the parent/child relationships on the scene graph and mask definitions and parses those if found. Looks for any timeline animation definition method and parses it if found. The remaining methods are parsed as methods defining stroke shapes and paths.
scriptArray | an array of class method scripts |
private function parseSceneMethod( script: String ):Array
Parses a method that defines the parent/child relationships on the scene graph.
The parsing is performed by identifying addChild method calls. Each relationship is placed in an object with a parentName and childName attribute.
script | a method script defining scene relations and masks |
Array of relationship objects
private function parseMaskObjects( script: String ):Array
Parses a method that defines stroke assets as masks.
The parsing is performed by identifying addChild method calls that are assigned as masks.
script | a method script defining scene relations and masks |
Array of mask names
private function parseAnimateMethod( script: String ):MethodParser
Parses a timeline animation method for defined tweens.
script | animation method script |
A MethodParser object
private function parseStrokeMethods( scriptArray: Array, sceneMethodIndex: int, animateMethodIndex: int ):Array
Parses all script methods as stroke methods except those found to define scene relations and animation.
Each method is parsed by a MethodParser in sequence.
scriptArray | an array of class method scripts |
sceneMethodIndex | index of the scene relation method, -1 if no such method exists |
animateMethodIndex | index of the timeline animation method, -1 if no such method exists |
Array of MethodParser objects.
private function parseAssetName( script: String ):void
Scans the script for an class asset name, updates assetName.
The class name is extracted from ... ‘class’ AssetName ‘extends’ ...
script | text of a script for a graphical asset class |
private function parseDimensions( script: String ):void
Scans for scene coordinate system dimensions, updates xMin, yMin, xMax, yMax if found.
Looks for an SWF attribute with width and height defined. The coordinate system is not essential to recover the definition of a class.
script | text of a script for a graphical asset class |
private function parseFrameRate( script: String ):void
Scans for movie animation framerate, updates frameRate if found.
Looks for an SWF attribute with frameRate defined.
script | text of a script for a graphical asset class |
Name of the graphical asset class.
public var assetName: String
Scene background color.
public var backgroundColor: String
Animation frame rate.
public var frameRate: Number
Animation loop state.
public var loopState: Boolean
Minumum X in the scene coordinate system
public var xMin: Number
Minumum Y in the scene coordinate system
public var yMin: Number
Maximum X in the scene coordinate system
public var xMax: Number
Maximum Y in the scene coordinate system
public var yMax: Number
Array of parent/child relationships
public var sceneGraph: Array
Array of mask name strings
public var maskNames: Array
Array of MethodParsers with stroke shapes and paths
public var strokeList: Array
A MethodParser with timeline tweens
public var animation: MethodParser
Parse a class script.
public function parse( scriptText: String ):void
Dispose of references and reset variables.
public function dispose():void
Splits a class script into parts.
private function splitScript( script: String ):Array
Parses an array of class methods to separate the methods into types.
private function parseMethods( scriptArray: Array ):void
Parses a method that defines the parent/child relationships on the scene graph.
private function parseSceneMethod( script: String ):Array
Parses a method that defines stroke assets as masks.
private function parseMaskObjects( script: String ):Array
Parses a timeline animation method for defined tweens.
private function parseAnimateMethod( script: String ):MethodParser
Parses all script methods as stroke methods except those found to define scene relations and animation.
private function parseStrokeMethods( scriptArray: Array, sceneMethodIndex: int, animateMethodIndex: int ):Array
Transforms basic parsed properties into a form suitable for debugging.
public function toString():String
Scans the script for an class asset name, updates assetName.
private function parseAssetName( script: String ):void
Scans for scene coordinate system dimensions, updates xMin, yMin, xMax, yMax if found.
private function parseDimensions( script: String ):void
Scans for movie animation framerate, updates frameRate if found.
private function parseFrameRate( script: String ):void