Packageaway3d.library
Classpublic class AssetLibraryBundle
InheritanceAssetLibraryBundle Inheritance flash.events.EventDispatcher

AssetLibraryBundle enforces a multiton pattern and is not intended to be instanced directly. Its purpose is to create a container for 3D data management, both before and after parsing. If you are interested in creating multiple library bundles, please use the getInstance() method.



Public Properties
 PropertyDefined By
  conflictPrecedence : String
Defines which asset should have precedence when resolving a naming conflict between two assets of which one has just been renamed by the user or by a parser.
AssetLibraryBundle
  conflictStrategy : ConflictStrategyBase
Defines which strategy should be used for resolving naming conflicts, when two library assets are given the same name.
AssetLibraryBundle
Public Methods
 MethodDefined By
  
AssetLibraryBundle(me:AssetLibraryBundleSingletonEnforcer)
Creates a new AssetLibraryBundle object.
AssetLibraryBundle
  
addAsset(asset:IAsset):void
Adds an asset to the asset library, first making sure that it's name is unique using the method defined by the conflictStrategy and conflictPrecedence properties.
AssetLibraryBundle
  
createIterator(assetTypeFilter:String = null, namespaceFilter:String = null, filterFunc:Function = null):AssetLibraryIterator
Create an AssetLibraryIterator instance that can be used to iterate over the assets in this asset library instance.
AssetLibraryBundle
  
enableParser(parserClass:Class):void
AssetLibraryBundle
  
enableParsers(parserClasses:Vector.<Class>):void
AssetLibraryBundle
  
getAsset(name:String, ns:String = null):IAsset
AssetLibraryBundle
  
getInstance(key:String = default):AssetLibraryBundle
[static] Returns an AssetLibraryBundle instance.
AssetLibraryBundle
  
load(req:URLRequest, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken
Loads a file and (optionally) all of its dependencies.
AssetLibraryBundle
  
loadData(data:*, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken
Loads a resource from existing data in memory.
AssetLibraryBundle
  
removeAllAssets(dispose:Boolean = true):void
Removes all assets from the asset library, optionally disposing them as they are removed.
AssetLibraryBundle
  
removeAsset(asset:IAsset, dispose:Boolean = true):void
Removes an asset from the library, and optionally disposes that asset by calling it's disposeAsset() method (which for most assets is implemented as a default version of that type's dispose() method.
AssetLibraryBundle
  
removeAssetByName(name:String, ns:String = null, dispose:Boolean = true):IAsset
Removes an asset which is specified using name and namespace.
AssetLibraryBundle
  
removeNamespaceAssets(ns:String = null, dispose:Boolean = true):void
Removes all assets belonging to a particular namespace (null for default) from the asset library, and optionall disposes them by calling their disposeAsset() method.
AssetLibraryBundle
Events
 Event Summary Defined By
  Dispatched when an animation node has been constructed from a resource.AssetLibraryBundle
  Dispatched when an animation set has been constructed from a group of animation state resources.AssetLibraryBundle
  Dispatched when an animation state has been constructed from a group of animation node resources.AssetLibraryBundle
  Dispatched when a animator asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when any asset finishes parsing.AssetLibraryBundle
  Dispatched when a container asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when a single dependency (which may be the main file of a resource) finishes loading.AssetLibraryBundle
  Dispatched when a geometry asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when an error occurs during loading.AssetLibraryBundle
  Dispatched when a material asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when a full resource (including dependencies) finishes loading.AssetLibraryBundle
  Dispatched when a skeleton asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when a skeleton pose asset has been constructed from a resource.AssetLibraryBundle
  Dispatched when an animation state transition has been constructed from a group of animation node resources.AssetLibraryBundle
  Dispatched when a texture asset has been constructed from a resource.AssetLibraryBundle
Property Detail
conflictPrecedenceproperty
conflictPrecedence:String

Defines which asset should have precedence when resolving a naming conflict between two assets of which one has just been renamed by the user or by a parser. By default ConflictPrecedence.FAVOR_NEW is used, meaning that the newly renamed asset will keep it's new name while the older asset gets renamed to not conflict. This property is ignored for conflict strategies that do not actually rename an asset automatically, such as ConflictStrategy.IGNORE and ConflictStrategy.THROW_ERROR.


Implementation
    public function get conflictPrecedence():String
    public function set conflictPrecedence(value:String):void

See also

conflictStrategyproperty 
conflictStrategy:ConflictStrategyBase

Defines which strategy should be used for resolving naming conflicts, when two library assets are given the same name. By default, ConflictStrategy.APPEND_NUM_SUFFIX is used which means that a numeric suffix is appended to one of the assets. The conflictPrecedence property defines which of the two conflicting assets will be renamed.


Implementation
    public function get conflictStrategy():ConflictStrategyBase
    public function set conflictStrategy(value:ConflictStrategyBase):void

See also

away3d.library.naming.ConflictStrategy
away3d.library.AssetLibrary.conflictPrecedence
Constructor Detail
AssetLibraryBundle()Constructor
public function AssetLibraryBundle(me:AssetLibraryBundleSingletonEnforcer)

Creates a new AssetLibraryBundle object.

Parameters
me:AssetLibraryBundleSingletonEnforcer — A multiton enforcer for the AssetLibraryBundle ensuring it cannnot be instanced.
Method Detail
addAsset()method
public function addAsset(asset:IAsset):void

Adds an asset to the asset library, first making sure that it's name is unique using the method defined by the conflictStrategy and conflictPrecedence properties.

Parameters

asset:IAsset

createIterator()method 
public function createIterator(assetTypeFilter:String = null, namespaceFilter:String = null, filterFunc:Function = null):AssetLibraryIterator

Create an AssetLibraryIterator instance that can be used to iterate over the assets in this asset library instance. The iterator can filter assets on asset type and/or namespace. A "null" filter value means no filter of that type is used.

Parameters

assetTypeFilter:String (default = null) — Asset type to filter on (from the AssetType enum class.) Use null to not filter on asset type.
 
namespaceFilter:String (default = null) — Namespace to filter on. Use null to not filter on namespace.
 
filterFunc:Function (default = null) — Callback function to use when deciding whether an asset should be included in the iteration or not. This needs to be a function that takes a single parameter of type IAsset and returns a boolean where true means it should be included.

Returns
AssetLibraryIterator

See also

enableParser()method 
public function enableParser(parserClass:Class):void

Parameters

parserClass:Class

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

Parameters

parserClasses:Vector.<Class>

getAsset()method 
public function getAsset(name:String, ns:String = null):IAsset

Parameters

name:String
 
ns:String (default = null)

Returns
IAsset
getInstance()method 
public static function getInstance(key:String = default):AssetLibraryBundle

Returns an AssetLibraryBundle instance. If no key is given, returns the default bundle instance (which is similar to using the AssetLibraryBundle as a singleton.) To keep several separated library bundles, pass a string key to this method to define which bundle should be returned. This is referred to as using the AssetLibrary as a multiton.

Parameters

key:String (default = default) — Defines which multiton instance should be returned.

Returns
AssetLibraryBundle — An instance of the asset library
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:*, context:AssetLoaderContext = null, ns:String = null, parser:ParserBase = null):AssetLoaderToken

Loads a resource from existing data in memory.

Parameters

data:* — The data object containing all resource information.
 
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
removeAllAssets()method 
public function removeAllAssets(dispose:Boolean = true):void

Removes all assets from the asset library, optionally disposing them as they are removed.

Parameters

dispose:Boolean (default = true) — Defines whether the assets should also be disposed.

removeAsset()method 
public function removeAsset(asset:IAsset, dispose:Boolean = true):void

Removes an asset from the library, and optionally disposes that asset by calling it's disposeAsset() method (which for most assets is implemented as a default version of that type's dispose() method.

Parameters

asset:IAsset — The asset which should be removed from this library.
 
dispose:Boolean (default = true) — Defines whether the assets should also be disposed.

removeAssetByName()method 
public function removeAssetByName(name:String, ns:String = null, dispose:Boolean = true):IAsset

Removes an asset which is specified using name and namespace.

Parameters

name:String — The name of the asset to be removed.
 
ns:String (default = null) — The namespace to which the desired asset belongs.
 
dispose:Boolean (default = true) — Defines whether the assets should also be disposed.

Returns
IAsset

See also

away3d.library.AssetLibrary.removeAsset()
removeNamespaceAssets()method 
public function removeNamespaceAssets(ns:String = null, dispose:Boolean = true):void

Removes all assets belonging to a particular namespace (null for default) from the asset library, and optionall disposes them by calling their disposeAsset() method.

Parameters

ns:String (default = null) — The namespace from which all assets should be removed.
 
dispose:Boolean (default = true) — Defines whether the assets should also be disposed.

See also

away3d.library.AssetLibrary.removeAsset()
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 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.