by Jon (Updated on 2015-10-14)
At times, it’s useful to display the on-screen keyboard in order to support text entry. For example, you may want the player to enter in a name when upon achieving a high score.
Use the show keyboard block under User Input > Mobile to show or hide the Keyboard. When you do this, the keyboard will immediately display.
Pressing the keys will fire keyboard events, which you can pick up on using a keyboard event (Add Event > Mobile > Keyboard). Each event will receive the complete text typed in so far, not the individual letters.
For example, you can record the currently typed in text and store that in an attribute...
So that you can then draw it on screen.
When the user’s done (hits return), you can get the final result and act accordingly.
Besides receiving events, you can perform a few operations on the keyboard.
Alerts are modal dialogs that display information to the user. When they appear, everything about the game pauses. Alerts are a blunt way of grabbing the user’s attention and should be used sparingly.
To display an Alert, use the alert block at the bottom of Game > Mobile.
Vibrations provide haptic (tactile) feedback to a user, if a device supports them. To vibrate a device, use the vibrate block at the bottom of User Input > Mobile-Only.
Notes: If a device doesn’t support vibrate (iPad, iPod Touch), nothing will happen. iOS devices may only vibrate for 2 seconds. In other words, you have no control over the duration.
Stencyl supports additional mobile features through user-created extensions. These currently include:
Extensions found in our Extensions Market and our Extensions forum.
As these extensions mature and see further uptake, we'll selectively pull them into the core engine.
If you wish to contribute an extension you have a some technical expertise, consider creating a Extension which allows you to extend the Stencyl engine with native code (Objective-C, C++, Java).