User Input > Mobile-Only


Note: These blocks only work on iOS and Android. They have no effect on other platforms (or return 0/-1/useless values).


Accelerometer

Accelerometer Value

x of accelerometer

Returns the current values for the accelerometer.

Portrait Orientation

Name Description
X (Positive) Right
X (Negative) Left
Y (Positive) Up
Y (Negative) Down

Landscape Orientation

Name Description
X (Positive) Up
X (Negative) Down
Y (Positive) Left
Y (Negative) Right
Input.accelX
Input.accelY
Input.accelZ

Gestures

Swiped

swiped up

Returns true if the user has swiped [up/down/left/right]. A swipe is defined as touching the screen, sliding the finger and then releasing.

Input.swipedUp
Input.swipedDown
Input.swipedLeft
Input.swipedRight

Alernate Approach: Events

swipe-event

We recommend using a swipe event instead of a swipe block. It's easier to work with.


Other

Show / Hide Keyboard

hide keyboard

Immediately shows or hides the virtual keyboard. Use mobile keyboard events to track what's been typed.

example

hideKeyboard();
showKeyboard();

Set Keyboard Text

set keyboard text to text

Imagine that the keyboard is inputting into an invisible text field. This sets the text that's in that text field.

setKeyboardText([TEXT]);

Clear Keyboard Text

clear keyboard text

Imagine that the keyboard is inputting into an invisible text field. This clears out the text that's in that text field.

setKeyboardText("");

Vibrate

vibrate for number secs

Vibrates the device for the given number of seconds. On some devices, vibration duration cannot be controlled.

vibrate([NUMBER]);