Packageaway3d.loaders
Classpublic class AssetLoader
InheritanceAssetLoader Inheritance flash.events.EventDispatcher

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 AssetLibrary to load and manage assets.

See also

away3d.loading.Loader3D
away3d.loading.AssetLibrary


Public Properties
 PropertyDefined By
  baseDependency : ResourceDependency
[read-only] Returns the base dependency of the loader
AssetLoader
Public Methods
 MethodDefined By
  
Create a new ResourceLoadSession object.
AssetLoader
  
enableParser(parserClass:Class):void
[static] Enables a specific parser.
AssetLoader
  
enableParsers(parserClasses:Vector.<Class>):void
[static] Enables a list of parsers.
AssetLoader
  
load(req:URLRequest, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken
Loads a file and (optionally) all of its dependencies.
AssetLoader
  
loadData(data:*, id:String, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken
Loads a resource from already loaded data.
AssetLoader
  
stop():void
AssetLoader
Events
 Event Summary Defined By
  Dispatched when an animation node has been constructed from a resource.AssetLoader
  Dispatched when an animation set has been constructed from a group of animation state resources.AssetLoader
  Dispatched when an animation state has been constructed from a group of animation node resources.AssetLoader
  Dispatched when a animator asset has been constructed from a resource.AssetLoader
  Dispatched when any asset finishes parsing.AssetLoader
  Dispatched when a camera3d asset has been costructed from a ressource.AssetLoader
  Dispatched when a container asset has been constructed from a resource.AssetLoader
  Dispatched when a single dependency (which may be the main file of a resource) finishes loading.AssetLoader
  Dispatched when an effect method asset has been constructed from a resources.AssetLoader
  Dispatched when a geometry asset has been constructed from a resource.AssetLoader
  Dispatched when an light asset has been constructed from a resources.AssetLoader
  Dispatched when an light picker asset has been constructed from a resources.AssetLoader
  Dispatched when an error occurs during loading.AssetLoader
  Dispatched when a material asset has been constructed from a resource.AssetLoader
  Dispatched when a mesh asset has been costructed from a ressource.AssetLoader
  Dispatched when an error occurs during parsing.AssetLoader
  Dispatched when a full resource (including dependencies) finishes loading.AssetLoader
  Dispatched when an shadow map method asset has been constructed from a resources.AssetLoader
  Dispatched when a skeleton asset has been constructed from a resource.AssetLoader
  Dispatched when a skeleton pose asset has been constructed from a resource.AssetLoader
  Dispatched when a skybox asset has been costructed from a ressource.AssetLoader
  Dispatched when an animation state transition has been constructed from a group of animation node resources.AssetLoader
  Dispatched when a texture asset has been constructed from a resource.AssetLoader
  Dispatched when a texture projector asset has been constructed from a resource.AssetLoader
  Dispatched when an image asset dimensions are not a power of 2AssetLoader
Property Detail
baseDependencyproperty
baseDependency:ResourceDependency  [read-only]

Returns the base dependency of the loader


Implementation
    public function get baseDependency():ResourceDependency
Constructor Detail
AssetLoader()Constructor
public function AssetLoader()

Create a new ResourceLoadSession object.

Method Detail
addErrorHandler()method
arcane function addErrorHandler(handler:Function):void

Parameters

handler:Function

enableParser()method 
public static function enableParser(parserClass:Class):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:Class — The parser class to enable.

See also

enableParsers()method 
public static function enableParsers(parserClasses:Vector.<Class>):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:Vector.<Class> — A Vector of parser classes to enable.

See also

load()method 
public function load(req:URLRequest, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken

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

Parameters

req:URLRequest — The URLRequest object containing the URL of the file to be loaded.
 
context:AssetLoaderContext (default = null) — An optional context object providing additional parameters for loading
 
ns:String (default = null) — An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets
 
parser:ParserBase (default = null) — 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.

Returns
AssetLoaderToken
loadData()method 
public function loadData(data:*, id:String, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken

Loads a resource from already loaded data.

Parameters

data:* — The data object containing all resource information.
 
id:String — An optional context object providing additional parameters for loading
 
context:AssetLoaderContext (default = null) — An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets
 
ns:String (default = null) — 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.
 
parser:ParserBase (default = null)

Returns
AssetLoaderToken
stop()method 
public function stop():void

Event Detail
animationNodeComplete Event
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an animation node has been constructed from a resource.

animationSetComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an animation set has been constructed from a group of animation state resources.

animationStateComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an animation state has been constructed from a group of animation node resources.

animatorComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a animator asset has been constructed from a resource.

assetComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when any asset finishes parsing. Also see specific events for each individual asset type (meshes, materials et c.)

cameraComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a camera3d asset has been costructed from a ressource.

containerComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a container asset has been constructed from a resource.

dependencyComplete Event  
Event Object Type: away3d.events.LoaderEvent
LoaderEvent.type property = away3d.events.LoaderEvent

Dispatched when a single dependency (which may be the main file of a resource) finishes loading.

effectMethodComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an effect method asset has been constructed from a resources.

geometryComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a geometry asset has been constructed from a resource.

lightComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an light asset has been constructed from a resources.

lightPickerComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an light picker asset has been constructed from a resources.

loadError Event  
Event Object Type: away3d.events.LoaderEvent
LoaderEvent.type property = away3d.events.LoaderEvent

Dispatched when an error occurs during loading. I

materialComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a material asset has been constructed from a resource.

meshComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a mesh asset has been costructed from a ressource.

parseError Event  
Event Object Type: away3d.events.ParserEvent
ParserEvent.type property = away3d.events.ParserEvent

Dispatched when an error occurs during parsing.

resourceComplete Event  
Event Object Type: away3d.events.LoaderEvent
LoaderEvent.type property = away3d.events.LoaderEvent

Dispatched when a full resource (including dependencies) finishes loading.

shadowMapMethodComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an shadow map method asset has been constructed from a resources.

skeletonComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a skeleton asset has been constructed from a resource.

skeletonPoseComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a skeleton pose asset has been constructed from a resource.

skyboxComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a skybox asset has been costructed from a ressource.

stateTransitionComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an animation state transition has been constructed from a group of animation node resources.

textureComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a texture asset has been constructed from a resource.

textureProjectorComplete Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when a texture projector asset has been constructed from a resource.

textureSizeError Event  
Event Object Type: away3d.events.AssetEvent
AssetEvent.type property = away3d.events.AssetEvent

Dispatched when an image asset dimensions are not a power of 2