Class R.resources.loaders.MultiResourceLoader
Extends
R.resources.loaders.AbstractResourceLoader.
A resource loader which can load files of varying types from the
server.
Defined in: multiresourceloader.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Loads files from multiple resource loaders based on a type specifier.
|
Method Attributes | Method Name and Description |
---|---|
addLoader(loaderType)
Add a loader type which the multiresource loader will user.
|
|
addLoaders(loaderArray)
Add multiple resource loaders at one time by their loader names.
|
|
constructor(name)
private
|
|
get(resource, name)
Get the cached object from the specified loader, by name.
|
|
Get the class name of this object.
|
|
getLoader(resource)
Gets the loader object by its given type, allowing you to call its methods
directly.
|
|
getLoaderForName(name)
Get the type of loader for the given resource name
|
|
The name of the resource this loader will get.
|
|
isReady(resource, name)
Checks all of the resource loaders to see if the specified resource is ready.
|
|
load(url)
Load a resource with the registered loader type.
|
|
registerLoader(type, className, extension)
Register a new loader type, or override an existing one.
|
|
removeLoader(loaderType)
Remove a loader type which the multiresource loader uses.
|
|
unload(name, loaderType)
Unload a resource, by its name, from the resource loader type specified, or from all
loaders where the name might be in use.
|
- Methods borrowed from class R.resources.loaders.AbstractResourceLoader:
- clear, destroy, exportAll, getCachedObjects, getResourceObject, getResources, release, set, setReady
- 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.MultiResourceLoader(name)
Loads files from multiple resource loaders based on a type specifier. Each type of
loader is registered with the multiresource loader.
- Parameters:
- name
- {String=RemoteLoader} The name of the resource loader
Method Detail
addLoader(loaderType)
Add a loader type which the multiresource loader will user. Calling this method will
dynamically load the resource loader's class file and prepare it for loading objects.
Supported default loaders are:
- bitmapfont
- image
- level
- object
- text
- sound
- sprite
- xml
- Parameters:
- loaderType
- {String} The resource loader type to add
addLoaders(loaderArray)
Add multiple resource loaders at one time by their loader names.
- Parameters:
- loaderArray
- {Array} An array of loader types
constructor(name)
private
- Parameters:
- name
{Object}
get(resource, name)
Get the cached object from the specified loader, by name.
- Parameters:
- resource
- {String} The resource to get the object from
- name
- {String} The name of the object to get from the cache
- Returns:
- {Object}
{String}
getClassName()
Get the class name of this object.
- Returns:
- {String} The string "R.resources.loaders.MultiResourceLoader"
{ResourceLoader}
getLoader(resource)
Gets the loader object by its given type, allowing you to call its methods
directly.
- Parameters:
- resource
- {String} The resource which will determine the loader
- Returns:
- {ResourceLoader}
getLoaderForName(name)
Get the type of loader for the given resource name
- Parameters:
- name
- {String} The resource name
{String}
getResourceType()
The name of the resource this loader will get.
- Returns:
- {String} The string "multi"
isReady(resource, name)
Checks all of the resource loaders to see if the specified resource is ready. If the name
is used by multiple loaders, you can optionally specify the loader type the resource should
be checked against. If no arguments are passed, all resource loaders are checked to see if
all resources are loaded.
- Parameters:
- resource
- {String} The name of the resource to check
- name Optional
- {String} The optional name within the resource
{String}
load(url)
Load a resource with the registered loader type. Resource loaders are
determined by the extension of the URL being loaded. If the loader
class isn't loaded yet, the request will be deferred until the class is available.
- Parameters:
- url
- {String} The url to load
- args... Optional
- {Object} The arguments for the loader
- Returns:
- {String} The name given to the resource
registerLoader(type, className, extension)
Register a new loader type, or override an existing one.
- Parameters:
- type
- {String} The resource loader type identifier. This is used when adding a loader or loading a resource with the multiresource loader.
- className
- {String} The class name of the of the resource loader
- extension
- {String} A comma separated list of possible extensions which can be used to automatically determine the type of loader to use.
removeLoader(loaderType)
Remove a loader type which the multiresource loader uses.
- Parameters:
- loaderType
- {String} The loader type to remove
unload(name, loaderType)
Unload a resource, by its name, from the resource loader type specified, or from all
loaders where the name might be in use.
- Parameters:
- name
- {String} The resource name to unload
- loaderType Optional
- {String} Optionally, the name of the resource loader