ImageCache
Properties | Methods | Events
Package | qnx.fuse.ui.utils |
Class | public class ImageCache |
Inheritance | ImageCache ![]() |
The
ImageCache
class provides image caching functionality for your application.
The class can be used in conjuction with the Image
component class.
Class information: |
---|
PlayBook Tablet OS Version: 1.0.6 |
See also
Public Properties
Property | Defined By | ||
---|---|---|---|
cacheSize : int
Gets or sets the cache size for your image cache given an integer representing the number of images to cache. | ImageCache |
Public Methods
Method | Defined By | ||
---|---|---|---|
Creates a new ImageCache instance. | ImageCache | ||
addImageData(url:String, data:BitmapData):void
Updates the bitmap image data for an element in the cache given a URL to the image and new bitmap data. | ImageCache | ||
clear(force:Boolean = false):void
Clear the image cache and disposes the BitmapData. | ImageCache | ||
getImage(url:String, load:Boolean):BitmapData
Returns an image from the cache, given the URL of the image and a Boolean that determines whether or not
to load the image from the URL provided. | ImageCache | ||
reloadImage(url:String):void
Reloads an image from the cache given the URL to the image. | ImageCache | ||
unlock(url:String):void
Unlocks an image in the cache, given a URL to the image. | ImageCache |
Events
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when an image has loaded. | ImageCache | |||
Dispatched when an image has failed to load. | ImageCache |
Property Detail
cacheSize
cacheSize:int |
Gets or sets the cache size for your image cache given an integer representing the number of images to cache.
The default value is
.Number.POSITIVE_INFINITY
Implementation
public function get cacheSize():int |
public function set cacheSize(value:int):void |
Constructor Detail
ImageCache()
public function ImageCache() |
Creates a new ImageCache
instance.
Method Detail
addImageData()
public function addImageData(url:String, data:BitmapData):void |
Updates the bitmap image data for an element in the cache given a URL to the image and new bitmap data.
This method will dispatch an ImageCacheEvent.IMAGE_LOADED
event, so listeners can update automatically.
Parameters
url:String — The URL to the image.
|
data:BitmapData — The new bitmap data for the image.
|
clear()
public function clear(force:Boolean = false):void |
Clear the image cache and disposes the BitmapData.
Parameters
force:Boolean (default = false ) — If true ALL images will be disposed, including one whch may be on the stage, if false only unlocked images will be disposed
|
getImage()
public function getImage(url:String, load:Boolean):BitmapData |
Returns an image from the cache, given the URL of the image and a Boolean that determines whether or not to load the image from the URL provided.
If the image is in the cache it is locked before it is returned. It must be unlocked when no longer in use.
Parameters
url:String — The URL to the image.
|
load:Boolean — A Boolean indicating whether or not to load the image.
|
Returns
BitmapData — The Image as BitmapData.
|
reloadImage()
public function reloadImage(url:String):void |
Reloads an image from the cache given the URL to the image.
If the image is not in the cache nothing is done.
Parameters
url:String — The URL to the image.
|
unlock()
public function unlock(url:String):void |
Unlocks an image in the cache, given a URL to the image.
An unlocked image can be flushed from cache if space is required.
Parameters
url:String — The URL to the image.
|
Event Detail
imageLoaded
qnx.fuse.ui.events.ImageCacheEvent
ImageCacheEvent.type property =
qnx.events.ImageCacheEvent.IMAGE_LOADED
Dispatched when an image has loaded.
See also
imageLoadError
qnx.fuse.ui.events.ImageCacheEvent
ImageCacheEvent.type property =
qnx.events.ImageCacheEvent.IMAGE_LOAD_ERROR
Dispatched when an image has failed to load.
See also