Package | away3d.loaders.parsers |
Class | public class ParserBase |
Inheritance | ParserBase flash.events.EventDispatcher |
Subclasses | AC3DParser, AWD1Parser, AWD2Parser, AWDParser, DAEParser, DXFParser, 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 | ||
materialMode : uint
MaterialMode defines, if the Parser should create SinglePass or MultiPass Materials
Options:
0 (Default / undefined) - All Parsers will create SinglePassMaterials, but the AWD2.1parser will create Materials as they are defined in the file
1 (Force SinglePass) - All Parsers create SinglePassMaterials
2 (Force MultiPass) - All Parsers will create MultiPassMaterials
| ParserBase | ||
parsingComplete : Boolean [read-only] | ParserBase | ||
parsingFailure : Boolean | ParserBase | ||
parsingPaused : Boolean [read-only]
parsingPaused will be true, if the parser is paused
(e.g. | 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 | ||
dieWithError(message:String = Unknown parsing error):void
Stops the parsing and dispatches a ParserEvent.PARSE_ERROR
| ParserBase | ||
finalizeAsset(asset:IAsset, name:String = null):void
Finalize a constructed asset. | 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
Pauses the parser, and dispatches a ParserEvent.READY_FOR_DEPENDENCIES
| 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 camera3d asset has been costructed from a ressource. | ParserBase | |||
Dispatched when a container asset has been constructed from a resource. | ParserBase | |||
Dispatched when an effect method asset has been constructed from a resources. | ParserBase | |||
Dispatched when a geometry asset has been constructed from a resource. | ParserBase | |||
Dispatched when an light asset has been constructed from a resources. | ParserBase | |||
Dispatched when an light picker asset has been constructed from a resources. | ParserBase | |||
Dispatched when a material asset has been constructed from a resource. | ParserBase | |||
Dispatched when a mesh asset has been costructed from a ressource. | 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 an shadow map method asset has been constructed from a resources. | 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 a skybox asset has been costructed from a ressource. | 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 | |||
Dispatched when a texture projector 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>
materialMode | property |
materialMode:uint
MaterialMode defines, if the Parser should create SinglePass or MultiPass Materials Options: 0 (Default / undefined) - All Parsers will create SinglePassMaterials, but the AWD2.1parser will create Materials as they are defined in the file 1 (Force SinglePass) - All Parsers create SinglePassMaterials 2 (Force MultiPass) - All Parsers will create MultiPassMaterials
public function get materialMode():uint
public function set materialMode(value:uint):void
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] parsingPaused will be true, if the parser is paused (e.g. it is waiting for dependencys to be loadet and parsed before it will continue)
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):void
Parameters
id:String | |
req:URLRequest | |
retrieveAsRawData:Boolean (default = false )
| |
data:* (default = null )
| |
suppressErrorEvents:Boolean (default = false )
|
dieWithError | () | method |
protected function dieWithError(message:String = Unknown parsing error):void
Stops the parsing and dispatches a ParserEvent.PARSE_ERROR
Parameters
message:String (default = Unknown parsing error ) — The message to apply to the ParserEvent.PARSE_ERROR
|
finalizeAsset | () | method |
protected function finalizeAsset(asset:IAsset, name:String = null):void
Finalize a constructed asset. This function is executed for every asset that has been successfully constructed.
It will dispatch a AssetEvent.ASSET_COMPLETE
and another AssetEvent, that depents on the type of asset.
Parameters
asset:IAsset — The asset to finalize
| |
name:String (default = null ) — The name of the asset. The name will be applied to the asset
|
finishParsing | () | method |
protected function finishParsing():void
Finish parsing the data.
getByteData | () | method |
protected function getByteData():ByteArray
ReturnsByteArray |
getTextData | () | method |
protected function getTextData():String
ReturnsString |
hasTime | () | method |
protected function hasTime():Boolean
Tests 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):Boolean
Validates a bitmapData loaded before assigning to a default BitmapMaterial
Parameters
bitmapData:BitmapData |
Boolean |
onInterval | () | method |
protected function onInterval(event:TimerEvent = null):void
Called 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):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.
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
Pauses the parser, and dispatches a ParserEvent.READY_FOR_DEPENDENCIES
proceedParsing | () | method |
protected function proceedParsing():Boolean
Parse 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):void
Resolve 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):void
Resolve a dependency loading failure. Used by parser to eventually provide a default map
Parameters
resourceDependency:ResourceDependency — The dependency to be resolved.
|
resolveDependencyName | () | method |
arcane function resolveDependencyName(resourceDependency:ResourceDependency, asset:IAsset):String
Resolve a dependency name
Parameters
resourceDependency:ResourceDependency — The dependency to be resolved.
| |
asset:IAsset |
String |
resumeParsingAfterDependencies | () | method |
arcane function resumeParsingAfterDependencies():void
After Dependencys has been loaded and parsed, continue to parse
animationNodeComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an animation node has been constructed from a resource.
animationSetComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an animation set has been constructed from a group of animation state resources.
animationStateComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an animation state has been constructed from a group of animation node resources.
animatorComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a animator asset has been constructed from a resource.
assetComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when any asset finishes parsing. Also see specific events for each individual asset type (meshes, materials et c.)
cameraComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a camera3d asset has been costructed from a ressource.
containerComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a container asset has been constructed from a resource.
effectMethodComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an effect method asset has been constructed from a resources.
geometryComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a geometry asset has been constructed from a resource.
lightComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an light asset has been constructed from a resources.
lightPickerComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an light picker asset has been constructed from a resources.
materialComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a material asset has been constructed from a resource.
meshComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a mesh asset has been costructed from a ressource.
parseComplete | Event |
away3d.events.ParserEvent
away3d.events.ParserEvent
Dispatched when the parsing finishes.
parseError | Event |
away3d.events.ParserEvent
away3d.events.ParserEvent
Dispatched if an error was caught during parsing.
readyForDependencies | Event |
away3d.events.ParserEvent
away3d.events.ParserEvent
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.
shadowMapMethodComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an shadow map method asset has been constructed from a resources.
skeletonComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a skeleton asset has been constructed from a resource.
skeletonPoseComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a skeleton pose asset has been constructed from a resource.
skyboxComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a skybox asset has been costructed from a ressource.
stateTransitionComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when an animation state transition has been constructed from a group of animation node resources.
textureComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a texture asset has been constructed from a resource.
textureProjectorComplete | Event |
away3d.events.AssetEvent
away3d.events.AssetEvent
Dispatched when a texture projector 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.