-
Notifications
You must be signed in to change notification settings - Fork 0
Docs Module Key
Carlonn Rivers edited this page Oct 21, 2020
·
6 revisions
| Property | Description | Key Code | Shortcut Identifier |
|---|---|---|---|
| type | The flobtive's description type. | readonly |
|
| A - Z | The key code properties for the alphabet keys |
65 - 90
|
"a" - "z"
|
| ZERO - NINE | The key code properties for the digit keys |
48 - 57
|
"zero" - "nine"
|
| ALT | The key code property for the Alt key | 18 |
"alt" |
| BACKSPACE | The key code property for the Backspace key | 8 |
"backspace" |
| CAPSLOCK | The key code property for the Caps Lock key | 20 |
"capslock" |
| CONTROL | The key code property for the Control key | 17 |
"control" |
| DELETE | The key code property for the Delete key | 46 |
"delete" |
| DOWN | The key code property for the Down Arrow key | 40 |
"down" |
| END | The key code property for the End key | 35 |
"end" |
| ENTER | The key code property for the Enter key | 13 |
"enter" |
| ESCAPE | The key code property for the Escape key | 27 |
"escape" |
| HOME | The key code property for the Home key | 36 |
"home" |
| INSERT | The key code property for the Insert key | 45 |
"insert" |
| LEFT | The key code property for the Left Arrow key | 37 |
"left" |
| PGDN | The key code property for the Page Down key | 34 |
"pgdn" |
| PGUP | The key code property for the Page Up key | 33 |
"pgup" |
| RIGHT | The key code property for the Right Arrow key | 39 |
"right" |
| SHIFT | The key code property for the Shift key | 16 |
"shift" |
| SPACE | The key code property for the Spacebar | 32 |
"space" |
| TAB | The key code property for the Tab key | 9 |
"tab" |
| UP | The key code property for the Up Arrow key | 38 |
"up" |
| Method | Description |
|---|---|
| isDown() | Checks if the key specified is down or not. |
| isPressed() | Checks if the key specified is pressed or not. |
| isReleased() | Checks if the key specified is released or not. |
| isUp() | Checks if the key specified is up or not. |
Checks if the key specified is down or not.
- code
- Types:
number|string-
number: The key code value assigned to a specific key or aKeymodule property associated with a specific key. -
string: TheKeymodule property's shortcut identifier associated with a specific key.
-
- Types:
- Type:
boolean-
trueif the key specified is down;falseotherwise.
-
- A FlevaR application can only monitor keyboard events that occur within its focus. A FlevaR application cannot detect keyboard events in another application.
Assuming const Key = flevar.Key;
Using the key code:
/* Within a script or function added to a prefab */
// check if the left arrow key is down
if(Key.isDown(37)) {
// move the prefab to the left
prefab._x -= 8;
}Using a Key module property:
/* Within a script or function added to a prefab */
// check if the left arrow key is down
if(Key.isDown(Key.LEFT)) {
// move the prefab to the left
prefab._x -= 8;
}Using a Key module property's shortcut identifier:
/* Within a script or function added to a prefab */
// check if the left arrow key is down
if(Key.isDown("left")) {
// move the prefab to the left
prefab._x -= 8;
}Checks if the key specified is pressed or not.
- code
- Types:
number|string-
number: The key code value assigned to a specific key or aKeymodule property associated with a specific key. -
string: TheKeymodule property's shortcut identifier associated with a specific key.
-
- Types:
- Type:
boolean-
trueif the key specified is pressed;falseotherwise.
-
- A FlevaR application can only monitor keyboard events that occur within its focus. A FlevaR application cannot detect keyboard events in another application.
- When a key is pressed and captured in the script, the key must be released before
isPressedis true again.
Assuming const Key = flevar.Key;
Using the key code:
/* Within a script or function */
// check if enter is pressed
if(Key.isPressed(13)) {
flevar.trace(`"Enter" key is pressed!`);
}Using a Key module property:
/* Within a script or function */
// check if enter is pressed
if(Key.isPressed(Key.ENTER)) {
flevar.trace(`"Enter" key is pressed!`);
}Using a Key module property's shortcut identifier:
/* Within a script or function */
// check if enter is pressed
if(Key.isPressed("enter")) {
flevar.trace(`"Enter" key is pressed!`);
}Checks if the key specified is released or not.
- code
- Types:
number|string-
number: The key code value assigned to a specific key or aKeymodule property associated with a specific key. -
string: TheKeymodule property's shortcut identifier associated with a specific key.
-
- Types:
- Type:
boolean-
trueif the key specified is released;falseotherwise.
-
- A FlevaR application can only monitor keyboard events that occur within its focus. A FlevaR application cannot detect keyboard events in another application.
- When a key is released and captured in the script, the key must be pressed before
isReleasedis true again.
Assuming const Key = flevar.Key;
Using the key code:
/* Within a script or function */
// check if spacebar is released
if(Key.isReleased(32)) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Using a Key module property:
/* Within a script or function */
// check if spacebar is released
if(Key.isReleased(Key.SPACE)) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Using a Key module property's shortcut identifier:
/* Within a script or function */
// check if spacebar is released
if(Key.isReleased("space")) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Checks if the key specified is up or not.
- code
- Types:
number|string-
number: The key code value assigned to a specific key or aKeymodule property associated with a specific key. -
string: TheKeymodule property's shortcut identifier associated with a specific key.
-
- Types:
- Type:
boolean-
trueif the key specified is up;falseotherwise.
-
- A FlevaR application can only monitor keyboard events that occur within its focus. A FlevaR application cannot detect keyboard events in another application.
Assuming const Key = flevar.Key;
Using the key code:
/* Within a script or function */
// check if z key is up
if(Key.isUp(90)) {
flevar.trace(`Not holding "Z"`);
}Using a Key module property:
/* Within a script or function */
// check if z key is up
if(Key.isUp(Key.Z)) {
flevar.trace(`Not holding "Z"`);
}Using a Key module property's shortcut identifier:
/* Within a script or function */
// check if z key is up
if(Key.isUp("z")) {
flevar.trace(`Not holding "Z"`);
}