Phaser API Documentation

  Version: 
removeCapture(keycode)

Description:

Removes an existing key capture.

Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove the capture of a key, then it will remove it for any Scene in your game, not just the calling one.

You can pass in a single key code value, or an array of key codes, or a string:

this.input.keyboard.removeCapture(62);

An array of key codes:

this.input.keyboard.removeCapture([ 62, 63, 64 ]);

Or a string:

this.input.keyboard.removeCapture('W,S,A,D');

To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'.

You can also provide an array mixing both strings and key code integers.

If there are no captures left after calling this method, the preventDefault property is set to false.

Parameters:

name type description
keycode string | number | Array.<number> | Array.<any>

The Key Codes to disable capture for, allowing them reaching the browser again.

Since: 3.16.0