| Package | away3d.loaders.parsers |
| Class | public class ParserBase |
| Inheritance | ParserBase flash.events.EventDispatcher |
| Subclasses | AC3DParser, AWD1Parser, AWD2Parser, AWDParser, DAEParser, ImageParser, Max3DSParser, MD2Parser, MD5AnimParser, MD5MeshParser, OBJParser |
ParserBase provides an abstract base class for objects that convert blocks of data to data structures
supported by Away3D.
If used by AssetLoader to automatically determine the parser type, two static public methods should
be implemented, with the following signatures:
public static function supportsType(extension : String) : Boolean
Indicates whether or not a given file extension is supported by the parser.
public static function supportsData(data : : Boolean
Tests whether a data block can be parsed by the parser.
Furthermore, for any concrete subtype, the method initHandle should be overridden to immediately
create the object that will contain the parsed data. This allows ResourceManager to return an object
handle regardless of whether the object was loaded or not.
See also
| Property | Defined By | ||
|---|---|---|---|
| dataFormat : String [read-only]
The data format of the file data to be parsed. | ParserBase | ||
| dependencies : Vector.<ResourceDependency> [read-only]
A list of dependencies that need to be loaded and resolved for the object being parsed. | ParserBase | ||
| parsingComplete : Boolean [read-only] | ParserBase | ||
| parsingFailure : Boolean | ParserBase | ||
| parsingPaused : Boolean [read-only] | ParserBase | ||
| Property | Defined By | ||
|---|---|---|---|
| _data : * | ParserBase | ||
| _dataFormat : String | ParserBase | ||
| _frameLimit : Number | ParserBase | ||
| _lastFrameTime : Number | ParserBase | ||
| Method | Defined By | ||
|---|---|---|---|
ParserBase(format:String)
Creates a new ParserBase object
| ParserBase | ||
isBitmapDataValid(bitmapData:BitmapData):Boolean
Validates a bitmapData loaded before assigning to a default BitmapMaterial
| ParserBase | ||
parseAsync(data:*, frameLimit:Number = 30):void
Parse data (possibly containing bytearry, plain text or BitmapAsset) asynchronously, meaning that
the parser will periodically stop parsing so that the AVM may proceed to the
next frame. | ParserBase | ||
| Method | Defined By | ||
|---|---|---|---|
addDependency(id:String, req:URLRequest, retrieveAsRawData:Boolean = false, data:* = null, suppressErrorEvents:Boolean = false):void | ParserBase | ||
constructSubGeometries(verts:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number>, normals:Vector.<Number>, tangents:Vector.<Number>, weights:Vector.<Number>, jointIndices:Vector.<Number>):Vector.<SubGeometry>
Build a list of sub-geometries from raw data vectors, splitting them up in
such a way that they won't exceed buffer length limits. | ParserBase | ||
constructSubGeometry(verts:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number>, normals:Vector.<Number>, tangents:Vector.<Number>, weights:Vector.<Number>, jointIndices:Vector.<Number>):SubGeometry
Build a sub-geometry from data vectors. | ParserBase | ||
dieWithError(message:String = Unknown parsing error):void | ParserBase | ||
finalizeAsset(asset:IAsset, name:String = null):void | ParserBase | ||
finishParsing():void
Finish parsing the data. | ParserBase | ||
getByteData():ByteArray | ParserBase | ||
getTextData():String | ParserBase | ||
hasTime():Boolean
Tests whether or not there is still time left for parsing within the maximum allowed time frame per session. | ParserBase | ||
onInterval(event:TimerEvent = null):void
Called when the parsing pause interval has passed and parsing can proceed. | ParserBase | ||
pauseAndRetrieveDependencies():void | ParserBase | ||
proceedParsing():Boolean
Parse the next block of data. | ParserBase | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when an animation node has been constructed from a resource. | ParserBase | |||
| Dispatched when an animation set has been constructed from a group of animation state resources. | ParserBase | |||
| Dispatched when an animation state has been constructed from a group of animation node resources. | ParserBase | |||
| Dispatched when a animator asset has been constructed from a resource. | ParserBase | |||
| Dispatched when any asset finishes parsing. | ParserBase | |||
| Dispatched when a container asset has been constructed from a resource. | ParserBase | |||
| Dispatched when a geometry asset has been constructed from a resource. | ParserBase | |||
| Dispatched when a material asset has been constructed from a resource. | ParserBase | |||
| Dispatched when the parsing finishes. | ParserBase | |||
| Dispatched if an error was caught during parsing. | ParserBase | |||
| Dispatched when parser pauses to wait for dependencies, used internally to trigger loading of dependencies which are then returned to the parser through it's interface in the arcane namespace. | ParserBase | |||
| Dispatched when a skeleton asset has been constructed from a resource. | ParserBase | |||
| Dispatched when a skeleton pose asset has been constructed from a resource. | ParserBase | |||
| Dispatched when an animation state transition has been constructed from a group of animation node resources. | ParserBase | |||
| Dispatched when a texture asset has been constructed from a resource. | ParserBase | |||
| Constant | Defined By | ||
|---|---|---|---|
| MORE_TO_PARSE : Boolean = false [static]
Returned by proceedParsing to indicate more parsing is needed, allowing asynchronous parsing. | ParserBase | ||
| PARSING_DONE : Boolean = true [static]
Returned by proceedParsing to indicate no more parsing is needed. | ParserBase | ||
| _data | property |
protected var _data:*| _dataFormat | property |
protected var _dataFormat:String| _fileName | property |
arcane var _fileName:String| _frameLimit | property |
protected var _frameLimit:Number| _lastFrameTime | property |
protected var _lastFrameTime:Number| dataFormat | property |
dataFormat:String [read-only]
The data format of the file data to be parsed. Can be either ParserDataFormat.BINARY or ParserDataFormat.PLAIN_TEXT.
public function get dataFormat():String| dependencies | property |
dependencies:Vector.<ResourceDependency> [read-only] A list of dependencies that need to be loaded and resolved for the object being parsed.
public function get dependencies():Vector.<ResourceDependency>| parsingComplete | property |
parsingComplete:Boolean [read-only] public function get parsingComplete():Boolean| parsingFailure | property |
parsingFailure:Boolean public function get parsingFailure():Boolean public function set parsingFailure(value:Boolean):void| parsingPaused | property |
parsingPaused:Boolean [read-only] public function get parsingPaused():Boolean| ParserBase | () | Constructor |
public function ParserBase(format:String)Creates a new ParserBase object
Parametersformat:String — The data format of the file data to be parsed. Can be either ParserDataFormat.BINARY or ParserDataFormat.PLAIN_TEXT, and should be provided by the concrete subtype.
|
See also
| addDependency | () | method |
protected function addDependency(id:String, req:URLRequest, retrieveAsRawData:Boolean = false, data:* = null, suppressErrorEvents:Boolean = false):voidParameters
id:String | |
req:URLRequest | |
retrieveAsRawData:Boolean (default = false) | |
data:* (default = null) | |
suppressErrorEvents:Boolean (default = false) |
| constructSubGeometries | () | method |
protected function constructSubGeometries(verts:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number>, normals:Vector.<Number>, tangents:Vector.<Number>, weights:Vector.<Number>, jointIndices:Vector.<Number>):Vector.<SubGeometry>Build a list of sub-geometries from raw data vectors, splitting them up in such a way that they won't exceed buffer length limits.
Parameters
verts:Vector.<Number> | |
indices:Vector.<uint> | |
uvs:Vector.<Number> | |
normals:Vector.<Number> | |
tangents:Vector.<Number> | |
weights:Vector.<Number> | |
jointIndices:Vector.<Number> |
Vector.<SubGeometry> |
| constructSubGeometry | () | method |
protected function constructSubGeometry(verts:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number>, normals:Vector.<Number>, tangents:Vector.<Number>, weights:Vector.<Number>, jointIndices:Vector.<Number>):SubGeometryBuild a sub-geometry from data vectors.
Parameters
verts:Vector.<Number> | |
indices:Vector.<uint> | |
uvs:Vector.<Number> | |
normals:Vector.<Number> | |
tangents:Vector.<Number> | |
weights:Vector.<Number> | |
jointIndices:Vector.<Number> |
SubGeometry |
| dieWithError | () | method |
protected function dieWithError(message:String = Unknown parsing error):voidParameters
message:String (default = Unknown parsing error) |
| finalizeAsset | () | method |
protected function finalizeAsset(asset:IAsset, name:String = null):voidParameters
asset:IAsset | |
name:String (default = null) |
| finishParsing | () | method |
protected function finishParsing():voidFinish parsing the data.
| getByteData | () | method |
protected function getByteData():ByteArrayReturnsByteArray |
| getTextData | () | method |
protected function getTextData():StringReturnsString |
| hasTime | () | method |
protected function hasTime():BooleanTests whether or not there is still time left for parsing within the maximum allowed time frame per session.
ReturnsBoolean — True if there is still time left, false if the maximum allotted time was exceeded and parsing should be interrupted.
|
| isBitmapDataValid | () | method |
public function isBitmapDataValid(bitmapData:BitmapData):BooleanValidates a bitmapData loaded before assigning to a default BitmapMaterial
Parameters
bitmapData:BitmapData |
Boolean |
| onInterval | () | method |
protected function onInterval(event:TimerEvent = null):voidCalled when the parsing pause interval has passed and parsing can proceed.
Parameters
event:TimerEvent (default = null) |
| parseAsync | () | method |
public function parseAsync(data:*, frameLimit:Number = 30):voidParse data (possibly containing bytearry, plain text or BitmapAsset) asynchronously, meaning that the parser will periodically stop parsing so that the AVM may proceed to the next frame.
Parameters
data:* — The untyped data object in which the loaded data resides.
| |
frameLimit:Number (default = 30) — number of milliseconds of parsing allowed per frame. The
actual time spent on a frame can exceed this number since time-checks can
only be performed between logical sections of the parsing procedure.
|
| pauseAndRetrieveDependencies | () | method |
protected function pauseAndRetrieveDependencies():void| proceedParsing | () | method |
protected function proceedParsing():BooleanParse the next block of data.
ReturnsBoolean — Whether or not more data needs to be parsed. Can be ParserBase.PARSING_DONE or
ParserBase.MORE_TO_PARSE.
|
| resolveDependency | () | method |
arcane function resolveDependency(resourceDependency:ResourceDependency):voidResolve a dependency when it's loaded. For example, a dependency containing an ImageResource would be assigned to a Mesh instance as a BitmapMaterial, a scene graph object would be added to its intended parent. The dependency should be a member of the dependencies property.
Parameters
resourceDependency:ResourceDependency — The dependency to be resolved.
|
| resolveDependencyFailure | () | method |
arcane function resolveDependencyFailure(resourceDependency:ResourceDependency):voidResolve a dependency loading failure. Used by parser to eventually provide a default map
Parameters
resourceDependency:ResourceDependency — The dependency to be resolved.
|
| resumeParsingAfterDependencies | () | method |
arcane function resumeParsingAfterDependencies():void| animationNodeComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when an animation node has been constructed from a resource.
| animationSetComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when an animation set has been constructed from a group of animation state resources.
| animationStateComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when an animation state has been constructed from a group of animation node resources.
| animatorComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a animator asset has been constructed from a resource.
| assetComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when any asset finishes parsing. Also see specific events for each individual asset type (meshes, materials et c.)
| containerComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a container asset has been constructed from a resource.
| geometryComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a geometry asset has been constructed from a resource.
| materialComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a material asset has been constructed from a resource.
| parseComplete | Event |
away3d.events.ParserEventaway3d.events.ParserEventDispatched when the parsing finishes.
| parseError | Event |
away3d.events.ParserEventaway3d.events.ParserEventDispatched if an error was caught during parsing.
| readyForDependencies | Event |
away3d.events.ParserEventaway3d.events.ParserEventDispatched when parser pauses to wait for dependencies, used internally to trigger loading of dependencies which are then returned to the parser through it's interface in the arcane namespace.
| skeletonComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a skeleton asset has been constructed from a resource.
| skeletonPoseComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a skeleton pose asset has been constructed from a resource.
| stateTransitionComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when an animation state transition has been constructed from a group of animation node resources.
| textureComplete | Event |
away3d.events.AssetEventaway3d.events.AssetEventDispatched when a texture asset has been constructed from a resource.
| MORE_TO_PARSE | Constant |
protected static const MORE_TO_PARSE:Boolean = false
Returned by proceedParsing to indicate more parsing is needed, allowing asynchronous parsing.
| PARSING_DONE | Constant |
protected static const PARSING_DONE:Boolean = true
Returned by proceedParsing to indicate no more parsing is needed.