Keyboard script interface

The IKeyboardObjectType interface derives from IObjectClass to add APIs specific to the Keyboard plugin.

Note this class derives from the object class interface, not the instance interface. Typically it is used through runtime.keyboard instead of the named object.

Examples

See the Simple keyboard movement example for a basic demonstration of using the isKeyDown() method to move a Sprite.

Events

To detect key press events, use the "keyup" and "keydown" events fired on the Runtime script interface.

Keyboard APIs

isKeyDown(keyStringOrWhich)
Return a boolean indicating if the specified keyboard key is currently being held down. The key can be specified either by its numeric code, corresponding to the KeyboardEvent.which property, or a string identifying the physical key, corresponding to the KeyboardEvent.code property (see also KeyboardEvent: code values).
Construct 3 Manual 2024-02-16