Class Index | File Index

Classes


Class R.resources.loaders.AbstractResourceLoader


Extends R.engine.BaseObject.
A resource loader is a generalized interface used by all resource loaders. It is designed to provide a common set of routines for loading resources (fonts, images, game data, etc...) from some location. Additionally, objects are cached by this base class, although some classes make use of other methods to enhance the caching, such as the R.resources.loaders.ImageLoader class.
Defined in: abstractresourceloader.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create a resource loader
Method Summary
Method Attributes Method Name and Description
 
Clear the objects contained in the cache.
 
Destroy the resource loader and all cached resources.
 
exportAll(resourceNames)
Export all of the resources in this loader, as a JavaScript object, with the resource name as the key and the corresponding object as the value.
 
get(name)
Get the object with the specified name from the cache.
 
Returns the cache.
 
Get the class name of this object
 
Get the specific resource supported by the resource loader.
 
Get the names of all the resources available in this resource loader.
 
The name of the resource this loader will get.
 
isReady(name)
Check to see if a named resource is, or all resources are, "ready for use".
 
load(name, data, isReady)
Load an object via this resource loader, and add it to the cache.
 
Releases the resource loader back into the pool
 
set(name, data)
Set the data associated with the name.
 
setReady(name, isReady)
Set the "ready" state of the resource.
 
unload(name)
Unload an object from this resource loader.
Methods borrowed from class R.engine.BaseObject:
addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
Methods borrowed from class R.engine.PooledObject:
clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.resources.loaders.AbstractResourceLoader(name)
Create a resource loader
Parameters:
name Optional, Default: ResourceLoader
{String} The name of the resource loader.
Method Detail
clear()
Clear the objects contained in the cache.

destroy()
Destroy the resource loader and all cached resources.

exportAll(resourceNames)
Export all of the resources in this loader, as a JavaScript object, with the resource name as the key and the corresponding object as the value.
Parameters:
resourceNames Optional
{Array} An optional array of resources to export, by name, or null to export all resources

{Object} get(name)
Get the object with the specified name from the cache.
Parameters:
name
{String} The name of the object to retrieve
Returns:
{Object} The object stored within the cache

{Object} getCachedObjects()
Returns the cache. You should not manipulate the cache directly. instead, call methods to update the cache.
Returns:
{Object} The cache

{String} getClassName()
Get the class name of this object
Returns:
{String} "R.resources.loaders.AbstractResourceLoader"

{Object} getResourceObject(name)
Get the specific resource supported by the resource loader.
Parameters:
name
{String} The name of the resource
Returns:
{Object}

{Array} getResources()
Get the names of all the resources available in this resource loader.
Returns:
{Array} An array of resource names

{String} getResourceType()
The name of the resource this loader will get.
Returns:
{String} The string "default"

{Boolean} isReady(name)
Check to see if a named resource is, or all resources are, "ready for use".
Parameters:
name
{String} The name of the resource to check ready status for, or null for all resources in loader.
Returns:
{Boolean} true if the resource is loaded and ready to use

load(name, data, isReady)
Load an object via this resource loader, and add it to the cache. When all resources being loaded by this resource loader are ready, fires the isready event.
Parameters:
name
{String} The name to refer to the loaded object
data
{Object} The data to store in the cache
isReady
{Boolean} A flag that states whether or not a resource is ready to use.

release()
Releases the resource loader back into the pool

set(name, data)
Set the data associated with the name. The ready state is set to false, so it will be up to the developer to call #setReady on the object if the object is truly ready for use.
Parameters:
name
{String} The name of the cache record
data
{Object} Data to store

setReady(name, isReady)
Set the "ready" state of the resource. When a resource has been completely loaded, set the resource "ready" state to true to allow objects waiting for those resources to utilize them. Fires the resourceready event, with the name of the resource, when the resource is ready to use.
Parameters:
name
{String} The name of the resource
isReady
{Boolean} true to set the resource to "ready for use"

unload(name)
Unload an object from this resource loader. Removes the object from the cache.
Parameters:
name
{String} The name of the object to remove

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:20 GMT-0400 (EDT)