MovieObjectGenerator

Updates a movie scene object’s graph and timeline with properties obtained by a class parser.

Summary
MovieObjectGeneratorUpdates a movie scene object’s graph and timeline with properties obtained by a class parser.
Public properties
movieMovie scene object that is updated by a call to updateFromParser.
Public methods
updateFromParserUpdates the movie scene object with properties collected by a ClassParser.
Private movie scene methods
setupMoviePropertiesSets movie scene properties for name, background color, timeline framerate, loop state and scene coordinate system according to the values present in the parser.
setupSceneMethodsSets the movie scene graph reestablishing parent/child relationships of shapes, masks and paths.
lookupParentIndexFind the index of a parent stroke for a named child stroke.
Private timeline methods
setupTimelineSets timeline properties from a method parser object.
setupTimelineTweensSets timeline tweens from a method parser object.
setTweenParamsSets tween parameters for a new tween added to the movie timeline.
setPathTweenParamsSets tween parameters for a new motion path tween added to the movie timeline.
setAdvancedTweenParamsSets tween parameters for a new advanced tween added to the movie timeline.
reverseTransitionTypeTranslates a Transitions symbolic enumeration string into its runtime pseudo-enumeration string representation.
Private helper methods
stripQuotesRemoves double quotes from a string
stripMethodPrefixRemoves the method name prefix to obtain the name of the asset created by the method.

Public properties

movie

public var movie: MovieScene

Movie scene object that is updated by a call to updateFromParser.

Public methods

updateFromParser

public function updateFromParser(parser: ClassParser):String

Updates the movie scene object with properties collected by a ClassParser.  This may be a partial update depending on the parser properties.  Scene dependencies and an optional timeline with tweens is handled directly, stroke shape and path methods are handled by calls to a StrokeObjectGenerator.

Parameters

parserinitialized class parser object

Returns

An empty string if successful or a string with an error message

Private movie scene methods

setupMovieProperties

private function setupMovieProperties(parser: ClassParser):String

Sets movie scene properties for name, background color, timeline framerate, loop state and scene coordinate system according to the values present in the parser.

A scene coordinate system is not currently implemented.

Parameters

parserinitialized class parser object

setupSceneMethods

private function setupSceneMethods(sceneRelations: Array,
maskNames: Array,
sceneMethods: Array):String

Sets the movie scene graph reestablishing parent/child relationships of shapes, masks and paths.  The scene methods are converted into stroke objects by calls to a StrokeObjectGenerator object.

Parameters

sceneRelationsarray of objects with parentName/childName properties
maskNamesarray of names of the strokes that are masks
sceneMethodsarray of MethodParser objects

Returns

An empty string if successful or a string with an error message

lookupParentIndex

private function lookupParentIndex(sceneRelations: Array,
childName: String):int

Find the index of a parent stroke for a named child stroke.  The parent must exist on the movie scene graph for its index to be returned.  Handles the case where the stroke has no parent because it is root by returning -1.

Parameters

sceneRelationsarray of objects with parentName/childName properties
childNamename of a stroke

Returns

Found parent index or 0 for root if not found.  If the stroke is root then -1 is returned.

Private timeline methods

setupTimeline

private function setupTimeline(parser: MethodParser):String

Sets timeline properties from a method parser object.

Parameters

parsermethod parser object with timeline tween properties

Returns

An empty string if successful or a string with an error message

setupTimelineTweens

private function setupTimelineTweens(actions: Array):String

Sets timeline tweens from a method parser object.  Handled tween types are Tween, TweenEx, PathTween and AdvancedTween.

Parameters

actionsarray of tweens obtained from parsing

Returns

An empty string if successful or a string with an error message

setTweenParams

private function setTweenParams(params: Array):String

Sets tween parameters for a new tween added to the movie timeline.  Ensures that the stroke exists and if it is an extended property such as a filter or a color/matrix transform that a filter or transform object of the required type is added to it if not already present.

Parameters

paramsarray of tween parameters obtained from parsing

Returns

An empty string if successful or a string with an error message

setPathTweenParams

private function setPathTweenParams(params: Array):String

Sets tween parameters for a new motion path tween added to the movie timeline.  Ensures that the stroke and the motion path exists.

Parameters

paramsarray of tween parameters obtained from parsing

Returns

An empty string if successful or a string with an error message

setAdvancedTweenParams

private function setAdvancedTweenParams(params: Array):String

Sets tween parameters for a new advanced tween added to the movie timeline.  Ensures that the stroke and the value path exists and if it is a tween of an extended property such as a filter or a color/matrix transform that a filter or transform object of the required type is added to it if not already present.

Parameters

paramsarray of tween parameters obtained from parsing

Returns

An empty string if successful or a string with an error message

reverseTransitionType

private function reverseTransitionType(transition: String):String

Translates a Transitions symbolic enumeration string into its runtime pseudo-enumeration string representation.  For example “Transitions.LINEAR” is translated to “linear”.

Parameters

transitionSymbolic transitions enumeration

Returns

String representing the symbolic enumeration

Private helper methods

stripQuotes

private function stripQuotes(quotedString: String):String

Removes double quotes from a string

Parameters

quotedStringa string with double quotes

Returns

A string witout double quotes

stripMethodPrefix

private function stripMethodPrefix(methodName: String):String

Removes the method name prefix to obtain the name of the asset created by the method.

Parameters

methodNamename of a method for creating an asset

Returns

Asset name

public var movie: MovieScene
Movie scene object that is updated by a call to updateFromParser.
public function updateFromParser(parser: ClassParser):String
Updates the movie scene object with properties collected by a ClassParser.
Reverse engineering parser for generated AS3 class code.
private function setupMovieProperties(parser: ClassParser):String
Sets movie scene properties for name, background color, timeline framerate, loop state and scene coordinate system according to the values present in the parser.
private function setupSceneMethods(sceneRelations: Array,
maskNames: Array,
sceneMethods: Array):String
Sets the movie scene graph reestablishing parent/child relationships of shapes, masks and paths.
private function lookupParentIndex(sceneRelations: Array,
childName: String):int
Find the index of a parent stroke for a named child stroke.
private function setupTimeline(parser: MethodParser):String
Sets timeline properties from a method parser object.
private function setupTimelineTweens(actions: Array):String
Sets timeline tweens from a method parser object.
private function setTweenParams(params: Array):String
Sets tween parameters for a new tween added to the movie timeline.
private function setPathTweenParams(params: Array):String
Sets tween parameters for a new motion path tween added to the movie timeline.
private function setAdvancedTweenParams(params: Array):String
Sets tween parameters for a new advanced tween added to the movie timeline.
private function reverseTransitionType(transition: String):String
Translates a Transitions symbolic enumeration string into its runtime pseudo-enumeration string representation.
The ‘Transitions’ class contains time-based easing equations.
private function stripQuotes(quotedString: String):String
Removes double quotes from a string
private function stripMethodPrefix(methodName: String):String
Removes the method name prefix to obtain the name of the asset created by the method.
Updates a stroke shape or path object with properties obtained by a method parser.
Reverse engineering parser for generated AS3 script methods
The ‘Tween’ class tweens any property of any object.
Extends the Tween class with dispose and extended properties on objects.
The ‘PathTween’ class tweens a display object along a path.
The ‘AdvancedTween’ class tweens the property of an object using a path as a graph.
Close