Optional
onload: Functionfunction to be called when the asset is loaded
Optional
onerror: Functionfunction to be called in case of error
the amount of corresponding resource to be preloaded
loader
// load an image asset
me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, () => this.onload(), () => this.onerror());
// load a base64 image asset
me.loader.load({name: "avatar", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."};
// load a base64 video asset
me.loader.load({
name: "avatar",
type:"video",
src: "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZ.."
};
// start loading music
me.loader.load({
name : "bgmusic",
type : "audio",
src : "data/audio/"
}, function () {
me.audio.play("bgmusic");
});
Load a single asset (to be used if you need to load additional asset(s) during the game)