Packageaway3d.loading
Classpublic class ResourceManager
InheritanceResourceManager Inheritance flash.events.EventDispatcher

ResourceManager is a singleton class providing a central access point for external resources and their disposal, such as meshes, materials, etc, while taking care of loading transparently, when needed.

Public Properties
 PropertyDefined by
  instance : ResourceManager
[static][read-only] Gets the singleton instance of the ResourceManager.
ResourceManager
Public Methods
 MethodDefined by
  
clearResource(resource:IResource):void
Clears the memory used by a resource, including all of its dependencies.
ResourceManager
  
getResource(uri:String, ignoreDependencies:Boolean = false, parser:Class = null):IResource
Retrieve the resource at the given url.
ResourceManager
  
parseData(data:*, id:String, ignoreDependencies:Boolean = true, parser:Class = null):IResource
Retrieves the resource parsed from the given data.
ResourceManager
Property detail
instanceproperty
instance:ResourceManager  [read-only]

Gets the singleton instance of the ResourceManager.

Implementation
    public static function get instance():ResourceManager
Method detail
clearResource()method
public function clearResource(resource:IResource):void

Clears the memory used by a resource, including all of its dependencies.

Parameters
resource:IResource — The resource to be cleared.
getResource()method 
public function getResource(uri:String, ignoreDependencies:Boolean = false, parser:Class = null):IResource

Retrieve the resource at the given url. Loading and parsing is only performed on the first time for the url, and if not cleared.

Parameters
uri:String — The url or id of the resource to be retrieved. If not parsed before, it should be a url.
 
ignoreDependencies:Boolean (default = false) — Indicates whether or not dependencies should be ignored or loaded.
 
parser:Class (default = null) — An optional parser object that will translate the data into a usable resource.

Returns
IResource — A handle to the retrieved resource.
parseData()method 
public function parseData(data:*, id:String, ignoreDependencies:Boolean = true, parser:Class = null):IResource

Retrieves the resource parsed from the given data.

Parameters
data:* — The data to be parsed.
 
id:String — The id that will be assigned to the resource. This can later also be used by the getResource method.
 
ignoreDependencies:Boolean (default = true) — Indicates whether or not dependencies should be ignored or loaded.
 
parser:Class (default = null) — An optional parser object that will translate the data into a usable resource.

Returns
IResource — A handle to the retrieved resource.
Wiki link
Click to go to the wiki page for 'away3d.loading.ResourceManager'

Code examples

Comments