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 public static methods should be implemented, with the following signatures:

public static function supportsType(extension : String) : Bool Indicates whether or not a given file extension is supported by the parser.public static function supportsData(data : *) : Bool 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:

  • away3d.loading.parsers.AssetLoader

  • away3d.loading.ResourceManager

Static variables

@:value(false)staticinlineread onlyMORE_TO_PARSE:Bool = false

Returned by proceedParsing to indicate more parsing is needed, allowing asynchronous parsing.

@:value(true)staticinlineread onlyPARSING_DONE:Bool = true

Returned by proceedParsing to indicate no more parsing is needed.

Constructor

new(format:String)

Creates a new ParserBase object

Parameters:

format

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

Variables

read onlydataFormat:String

The data format of the file data to be parsed. Can be either ParserDataFormat.BINARY or ParserDataFormat.PLAIN_TEXT.

read onlydependencies:Vector<ResourceDependency>

A list of dependencies that need to be loaded and resolved for the object being parsed.

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

read onlyparsingComplete:Bool

read onlyparsingPaused:Bool

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)

Methods

isBitmapDataValid(bitmapData:BitmapData):Bool

Validates a bitmapData loaded before assigning to a default BitmapMaterial

@:value({ frameLimit : 30 })parseAsync(data:Dynamic, frameLimit:UInt = 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 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.