The SingleFileLoader is used to load a single file, as part of a resource.

While SingleFileLoader can be used directly, e.g. to create a third-party asset management system, it's recommended to use any of the classes Loader3D, AssetLoader and Asset3DLibrary instead in most cases.

See also:

  • away3d.loading.Loader3D

  • away3d.loading.AssetLoader

  • away3d.loading.Asset3DLibrary

Static methods

staticenableParser(parser:Class<ParserBase>):Void

staticenableParsers(parsers:Array<Dynamic>):Void

Constructor

@:value({ materialMode : 0 })new(materialMode:UInt = 0)

Creates a new SingleFileLoader object.

Variables

read onlydata:Dynamic

read onlydependencies:Vector<ResourceDependency>

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

read onlyloadAsRawData:Bool

read onlyparser:ParserBase

A reference to the parser that will translate the loaded data into a usable resource.

read onlyurl:String

Methods

@:value({ loadAsRawData : false, parser : null })load(urlRequest:URLRequest, ?parser:ParserBase, loadAsRawData:Bool = false):Void

Load a resource from a file.

Parameters:

urlRequest

The URLRequest object containing the URL of the object to be loaded.

parser

An optional parser object that will translate the loaded data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.

@:value({ req : null, parser : null })parseData(data:Dynamic, ?parser:ParserBase, ?req:URLRequest):Void

Loads a resource from already loaded data.

Parameters:

data

The data to be parsed. Depending on the parser type, this can be a ByteArray, String or XML.

uri

The identifier (url or id) of the object to be loaded, mainly used for resource management.

parser

An optional parser object that will translate the data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.