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 Methods
 MethodDefined By
  
Create a new ResourceLoadSession object.
AssetLoader
  
enableParser(parserClass:Class):void
[static]
AssetLoader
  
enableParsers(parserClasses:Vector.<Class>):void
[static]
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
Events
 Event Summary Defined By
  Dispatched when an animation set has been constructed from a group of animation state resources.AssetLoader
  Dispatched when an animation node has been constructed from a resource.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 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 a geometry asset has been constructed from a resource.AssetLoader
  Dispatched when an error occurs during loading.AssetLoader
  Dispatched when a material asset has been constructed from a resource.AssetLoader
  Dispatched when a full resource (including dependencies) finishes loading.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 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
Constructor Detail
AssetLoader()Constructor
public function AssetLoader()

Create a new ResourceLoadSession object.

Method Detail
enableParser()method
public static function enableParser(parserClass:Class):void

Parameters

parserClass:Class

enableParsers()method 
public static function enableParsers(parserClasses:Vector.<Class>):void

Parameters

parserClasses:Vector.<Class>

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
Event Detail
animationNodeComplete 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.

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

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

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.)

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.

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.

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

Dispatched when an error occurs during loading.

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.

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

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

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.

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.