AssetLoader can load any file format that Away3D supports (or for which a third-party parser has been plugged in) and it's dependencies. Events are dispatched when assets are encountered and for when the resource (or it's dependencies) have been loaded.

The AssetLoader will not make assets available in any other way than through the dispatched events. To store assets and make them available at any point from any module in an application, use the Asset3DLibrary to load and manage assets.

See also:

  • away3d.loading.Loader3D

  • away3d.loading.Asset3DLibrary

Static methods

staticenableParser(parserClass:Class<ParserBase>):Void

Enables a specific parser. When no specific parser is set for a loading/parsing opperation, loader3d can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

Parameters:

parserClass

The parser class to enable.

See also:

  • away3d.loaders.parsers.Parsers

staticenableParsers(parserClasses:Array<Dynamic>):Void

Enables a list of parsers. When no specific parser is set for a loading/parsing opperation, AssetLoader can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

Parameters:

parserClasses

A Vector of parser classes to enable.

See also:

  • away3d.loaders.parsers.Parsers

Constructor

new()

Create a new ResourceLoadSession object.

Variables

read onlybaseDependency:ResourceDependency

Returns the base dependency of the loader

Methods

@:value({ parser : null, ns : null, context : null })load(req:URLRequest, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a file and (optionally) all of its dependencies.

Parameters:

req

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

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

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

@:value({ parser : null, ns : null, context : null })loadData(data:Dynamic, id:String, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a resource from already loaded data.

Parameters:

data

The data object containing all resource information.

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

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

stop():Void