new b5.Bitmap(name, location, preload, onload){b5.Bitmap}
A Bitmap object represents a bit-mapped image that can be displayed by b5.Actor's. Generally a Bitmap should be added to either a b5.Scene or the global b5.App's resources so that it can be managed by them.
Example showing how to create a bitmap and add it to the scenes resource manager
var bitmap = new b5.Bitmap("background", "images/background.jpg", true);
scene.addResource(bitmap, "bitmap"); // Add to scenes resource manager so it can be reused
For a complete overview of Resources see Booty5 Resources Overview
Name | Type | Description |
---|---|---|
name |
string |
Name of bitmap resource |
location |
string |
Location of the bitmap resource |
preload |
boolean |
If true then the bitmap will be loaded as soon as it is created |
onload |
function |
Callback function that should be called when the bitmap has finished loading or null |
Properties:
Name | Type | Description |
---|---|---|
image |
Image | The HTML5 Image that contains the bitmap (internal) |
name |
string | Name of this bitmap resource |
location |
string | Location of the bitmap resource |
onload |
function | Callback function that should be called when the bitmap has finished loading or null |
preload |
boolean | If set to true then the bitmap will be loaded as soon as it is created |
loaded |
boolean | If true then this resource has finished loading |
Returns:
Type | Description |
---|---|
b5.Bitmap | The created bitmap |
Methods
-
destroy()
resource/bitmap.js, line 86 -
Removes this resource from its resource manager and destroys it
-
load()
resource/bitmap.js, line 67 -
Loads the bitmap, only required if not preloaded