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.
away3d.loading.parsers.AssetLoader
away3d.loading.ResourceManager
protected var _dataFormat:Stringarcane var _fileName:Stringprotected var _frameLimit:Numberprotected var _lastFrameTime:NumberdataFormat:String [read-only]
The data format of the file data to be parsed. Can be either ParserDataFormat.BINARY or ParserDataFormat.PLAIN_TEXT.
Implementation public function get dataFormat():Stringdependencies:Vector.<ResourceDependency> [read-only]
A list of dependencies that need to be loaded and resolved for the object being parsed.
Implementation public function get dependencies():Vector.<ResourceDependency>parsingComplete:Boolean [read-only]
Implementation public function get parsingComplete():BooleanparsingFailure:Boolean Implementation public function get parsingFailure():Boolean public function set parsingFailure(value:Boolean):voidparsingPaused:Boolean [read-only]
Implementation public function get parsingPaused():Booleanpublic function ParserBase(format:String)
Creates a new ParserBase object
Parameters | format: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
away3d.loading.parsers.ParserDataFormat
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) |
protected function dieWithError(message:String = Unknown parsing error):void Parameters
| message:String (default = Unknown parsing error) |
protected function finalizeAsset(asset:IAsset, name:String = null):void Parameters
| asset:IAsset |
| |
| name:String (default = null) |
protected function finishParsing():void
Finish parsing the data.
protected function getByteData():ByteArrayReturns protected function getTextData():StringReturns protected function hasTime():Boolean
Tests whether or not there is still time left for parsing within the maximum allowed time frame per session.
Returns | Boolean — True if there is still time left, false if the maximum allotted time was exceeded and parsing should be interrupted.
|
public function isBitmapDataValid(bitmapData:BitmapData):Boolean
Validates a bitmapData loaded before assigning to a default BitmapMaterial
Parameters
Returns protected function onInterval(event:TimerEvent = null):void
Called when the parsing pause interval has passed and parsing can proceed.
Parameters
| event:TimerEvent (default = null) |
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.
|
protected function pauseAndRetrieveDependencies():void protected function proceedParsing():Boolean
Parse the next block of data.
Returns | Boolean — Whether or not more data needs to be parsed. Can be ParserBase.PARSING_DONE or
ParserBase.MORE_TO_PARSE.
|
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
arcane function resolveDependencyFailure(resourceDependency:ResourceDependency):void
Resolve a dependency loading failure. Used by parser to eventually provide a default map
Parameters
arcane function resolveDependencyName(resourceDependency:ResourceDependency, asset:IAsset):String
Resolve a dependency name
Parameters
Returns arcane function resumeParsingAfterDependencies():voidEvent Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when an animation node has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when an animation set has been constructed from a group of animation state resources.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when an animation state has been constructed from a group of animation node resources.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a animator asset has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when any asset finishes parsing. Also see specific events for each
individual asset type (meshes, materials et c.)
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a container asset has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a geometry asset has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a material asset has been constructed from a resource.
Event Object Type: away3d.events.ParserEventParserEvent.type property = away3d.events.ParserEvent
Dispatched when the parsing finishes.
Event Object Type: away3d.events.ParserEventParserEvent.type property = away3d.events.ParserEvent
Dispatched if an error was caught during parsing.
Event Object Type: away3d.events.ParserEventParserEvent.type property = 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.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a skeleton asset has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a skeleton pose asset has been constructed from a resource.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when an animation state transition has been constructed from a group of animation node resources.
Event Object Type: away3d.events.AssetEventAssetEvent.type property = away3d.events.AssetEvent
Dispatched when a texture asset has been constructed from a resource.
protected static const MORE_TO_PARSE:Boolean = false
Returned by proceedParsing to indicate more parsing is needed, allowing asynchronous parsing.
protected static const PARSING_DONE:Boolean = true
Returned by proceedParsing to indicate no more parsing is needed.
Tue May 7 2013, 10:42 PM +01:00