Const
The File Load Complete Event.
This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
It uses a special dynamic event name constructed from the key and type of the file.
For example, if you have loaded an image with a key of monster, you can listen for it using the following:
image
monster
this.load.on('filecomplete-image-monster', function (key, type, data) { // Your handler code}); Copy
this.load.on('filecomplete-image-monster', function (key, type, data) { // Your handler code});
Or, if you have loaded a texture atlas with a key of Level1:
atlas
Level1
this.load.on('filecomplete-atlasjson-Level1', function (key, type, data) { // Your handler code}); Copy
this.load.on('filecomplete-atlasjson-Level1', function (key, type, data) { // Your handler code});
Or, if you have loaded a sprite sheet with a key of Explosion and a prefix of GAMEOVER:
Explosion
GAMEOVER
this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { // Your handler code}); Copy
this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { // Your handler code});
Make sure you remove your listeners when you have finished, or they will continue to fire if the Scene reloads.
You can also listen for the generic completion of files. See the [FILE_COMPLETE]Phaser.Loader.Events#event:FILE_COMPLETE event.
The File Load Complete Event.
This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
It uses a special dynamic event name constructed from the key and type of the file.
For example, if you have loaded an
imagewith a key ofmonster, you can listen for it using the following:Or, if you have loaded a texture
atlaswith a key ofLevel1:Or, if you have loaded a sprite sheet with a key of
Explosionand a prefix ofGAMEOVER:Make sure you remove your listeners when you have finished, or they will continue to fire if the Scene reloads.
You can also listen for the generic completion of files. See the [FILE_COMPLETE]Phaser.Loader.Events#event:FILE_COMPLETE event.