Difference between revisions of "KeyCode"
From GiderosMobile
| Line 5: | Line 5: | ||
<br /> | <br /> | ||
KeyCode table holds the key code constants. These map directly to a physical key on the keyboard.<br /> | KeyCode table holds the key code constants. These map directly to a physical key on the keyboard.<br /> | ||
| + | === Examples === | ||
| + | '''Listening for back button'''<br/> | ||
| + | <source lang="lua">stage:addEventListener(Event.KEY_DOWN, function(event) | ||
| + | if event.keyCode == KeyCode.BACK then | ||
| + | application:exit() | ||
| + | end | ||
| + | end)</source> | ||
{|- | {|- | ||
| style="width: 50%;"| | | style="width: 50%;"| | ||
Revision as of 10:44, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
Description
KeyCode table holds the key code constants. These map directly to a physical key on the keyboard.
Examples
Listening for back button
stage:addEventListener(Event.KEY_DOWN, function(event)
if event.keyCode == KeyCode.BACK then
application:exit()
end
end)