Phaser API Documentation

  Version: 
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Event: FILE_KEY_COMPLETE
Phaser.Loader.Events.FILE_KEY_COMPLETE
FILE_KEY_COMPLETE

Description:

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:

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:

this.load.on('filecomplete-atlas-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:

this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) {
    // Your handler code
});

You can also listen for the generic completion of files. See the FILE_COMPLETE event.

Parameters:

name type description
key string

The key of the file that just loaded and finished processing.

type string

The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. image.

data any

The raw data the file contained.

Since: 3.0.0