File Complete Event
Learn how to use the 'filecomplete' event on an individual file loader to execute a callback as soon as a specific asset has finished loading.
800 × 600
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
// this.load.on('filecomplete', function (key, file) {
// this.add.image(400, 300, key);
// }, this);
this.load.image('taikodrummaster', 'assets/pics/taikodrummaster.jpg').on('filecomplete', this.addImage, this);
this.load.image('sukasuka-chtholly', 'assets/pics/sukasuka-chtholly.png');
}
addImage (key, file)
{
this.add.image(400, 300, key);
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'game-container',
pixelArt: true,
scene: Example
};
const game = new Phaser.Game(config);