Class R.resources.loaders.ImageLoader
Extends
R.resources.loaders.RemoteLoader.
Loads images and stores the reference to those images. Images
are stored on the client-side in a simple cache for faster re-use.
When loading images, you assign a name to the image. This would allow
you to re-use the image without having to load it again for another
purpose.
this.imageLoader = R.resourceloaders.ImageLoader.create(); // Load an image this.imageLoader.load("keys", this.getFilePath("resources/fingerboard.png"), 220, 171);In the example above, this refers to a R.engine.Game object which implements the {@link R.engine.Game#getFilePath getFilePath()} method which is used to get a path relative to where the game is located on the server.
Defined in: imageloader.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
The ratio by which to scale image load times when loading on the Wii
|
- Fields borrowed from class R.resources.loaders.RemoteLoader:
- STATUS_CACHED, STATUS_NOT_FOUND, STATUS_OK, STATUS_SERVER_ERROR
Method Attributes | Method Name and Description |
---|---|
get(name)
Get the image from the resource stored with the specified name, or null
if no such image exists.
|
|
Get the class name of this object
|
|
getDimensions(name)
Get the dimensions of an image from the resource stored with
the specified name, or null if no such image exists.
|
|
getImage(name)
Get an R.resources.types.Image object from the resource which represents the image, or null
if no such image exists.
|
|
getResourceObject(name)
Get the specific image resource by name.
|
|
The name of the resource this loader will get.
|
|
load(name, url, width, height)
Load an image resource from a URL.
|
|
loadImageResource(name, url, width, height)
Lazy loads an image resource when the information for it becomes available.
|
- Methods borrowed from class R.resources.loaders.RemoteLoader:
- exists, getPathUrl, setPathUrl
- Methods borrowed from class R.resources.loaders.AbstractResourceLoader:
- clear, destroy, exportAll, getCachedObjects, getResources, isReady, release, set, setReady, unload
- 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.ImageLoader(name)
- Parameters:
- name
- {String=ImageLoader} The name of the resource loader
Field Detail
loadAdjust
The ratio by which to scale image load times when loading on the Wii
Method Detail
{HTMLImage}
get(name)
Get the image from the resource stored with the specified name, or null
if no such image exists.
- Parameters:
- name
- {String} The name of the image resource
- Returns:
- {HTMLImage} The image
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} The string "R.resources.loaders.ImageLoader"
{R.math.Point2D}
getDimensions(name)
Get the dimensions of an image from the resource stored with
the specified name, or null if no such image exists.
- Parameters:
- name
- {String} The name of the image resource
- Returns:
- {R.math.Point2D} A point which represents the width and height of the image
{R.resources.types.Image}
getImage(name)
Get an R.resources.types.Image object from the resource which represents the image, or null
if no such image exists.
- Parameters:
- name
- {String} The name of the image resource
- Returns:
- {R.resources.types.Image}
{R.resources.types.Image}
getResourceObject(name)
Get the specific image resource by name.
- Parameters:
- name
- {String} The name of the resource
- Returns:
- {R.resources.types.Image}
{String}
getResourceType()
The name of the resource this loader will get.
- Returns:
- {String} The string "image"
load(name, url, width, height)
Load an image resource from a URL. Images are cached within the page
in an invisible object for fast retrieval.
- Parameters:
- name
- {String} The name of the resource
- url
- {String} The URL where the resource is located
- width
- {Number} The width of this resource, in pixels
- height
- {Number} The height of this resource, in pixels
{HTMLImage}
loadImageResource(name, url, width, height)
Lazy loads an image resource when the information for it becomes available. It
is best to specify the width and height of the resource, but it isn't necessary
to load the image.
- Parameters:
- name
- {String} The name of the resource
- url
- {String} The URL where the resource is located
- width
- {Number} The width of this resource, in pixels, or null
- height
- {Number} The height of this resource, in pixels, or null
- Returns:
- {HTMLImage} The image loaded