Packageaway3d.loaders.misc
Classpublic class SingleFileLoader
InheritanceSingleFileLoader Inheritance flash.events.EventDispatcher

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 AssetLibrary instead in most cases.

See also

away3d.loading.Loader3D
away3d.loading.AssetLoader
away3d.loading.AssetLibrary


Public Properties
 PropertyDefined By
  data : *
[read-only]
SingleFileLoader
  dependencies : Vector.<ResourceDependency>
[read-only] A list of dependencies that need to be loaded and resolved for the loaded object.
SingleFileLoader
  loadAsRawData : Boolean
[read-only]
SingleFileLoader
  parser : ParserBase
[read-only] A reference to the parser that will translate the loaded data into a usable resource.
SingleFileLoader
  url : String
[read-only]
SingleFileLoader
Public Methods
 MethodDefined By
  
Creates a new SingleFileLoader object.
SingleFileLoader
  
enableParser(parser:Class):void
[static]
SingleFileLoader
  
enableParsers(parsers:Vector.<Class>):void
[static]
SingleFileLoader
  
load(urlRequest:URLRequest, parser:ParserBase = null, loadAsRawData:Boolean = false):void
Load a resource from a file.
SingleFileLoader
  
parseData(data:*, parser:ParserBase = null, req:URLRequest = null):void
Loads a resource from already loaded data.
SingleFileLoader
Events
 Event Summary Defined By
  Dispatched when an animation node has been constructed from a resource.SingleFileLoader
  Dispatched when an animation set has been constructed from a group of animation state resources.SingleFileLoader
  Dispatched when an animation state has been constructed from a group of animation node resources.SingleFileLoader
  Dispatched when a animator asset has been constructed from a resource.SingleFileLoader
  Dispatched when any asset finishes parsing.SingleFileLoader
  Dispatched when a container asset has been constructed from a resource.SingleFileLoader
  Dispatched when the dependency that this single-file loader was loading complets.SingleFileLoader
  Dispatched when a geometry asset has been constructed from a resource.SingleFileLoader
  Dispatched when an error occurs during loading.SingleFileLoader
  Dispatched when a material asset has been constructed from a resource.SingleFileLoader
  Dispatched when a skeleton asset has been constructed from a resource.SingleFileLoader
  Dispatched when a skeleton pose asset has been constructed from a resource.SingleFileLoader
  Dispatched when an animation state transition has been constructed from a group of animation node resources.SingleFileLoader
  Dispatched when a texture asset has been constructed from a resource.SingleFileLoader
Property Detail
dataproperty
data:*  [read-only]


Implementation
    public function get data():*
dependenciesproperty 
dependencies:Vector.<ResourceDependency>  [read-only]

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


Implementation
    public function get dependencies():Vector.<ResourceDependency>
loadAsRawDataproperty 
loadAsRawData:Boolean  [read-only]


Implementation
    public function get loadAsRawData():Boolean
parserproperty 
parser:ParserBase  [read-only]

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


Implementation
    public function get parser():ParserBase
urlproperty 
url:String  [read-only]


Implementation
    public function get url():String
Constructor Detail
SingleFileLoader()Constructor
public function SingleFileLoader()

Creates a new SingleFileLoader object.

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

Parameters

parser:Class

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

Parameters

parsers:Vector.<Class>

load()method 
public function load(urlRequest:URLRequest, parser:ParserBase = null, loadAsRawData:Boolean = false):void

Load a resource from a file.

Parameters

urlRequest:URLRequest — The URLRequest object containing the URL of the object to be loaded.
 
parser:ParserBase (default = null) — 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.
 
loadAsRawData:Boolean (default = false)

parseData()method 
public function parseData(data:*, parser:ParserBase = null, req:URLRequest = null):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.
 
parser:ParserBase (default = null) — The identifier (url or id) of the object to be loaded, mainly used for resource management.
 
req:URLRequest (default = null) — 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.

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

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 the dependency that this single-file loader was loading complets.

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.

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.