Difference between revisions of "KeyCode"
From GiderosMobile
Line 5: | Line 5: | ||
'''<translate>Available since</translate>:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | '''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | + | KeyCode table holds the key code constants. These map directly to a physical key on the keyboard. | |
− | KeyCode table holds the key code constants. These map directly to a physical key on the keyboard. | + | |
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
− | '''Listening for back button''' | + | '''Listening for back button''' |
− | <source lang="lua">stage:addEventListener(Event.KEY_DOWN, function(event) | + | <source lang="lua"> |
+ | stage:addEventListener(Event.KEY_DOWN, function(event) | ||
if event.keyCode == KeyCode.BACK then | if event.keyCode == KeyCode.BACK then | ||
application:exit() | application:exit() | ||
end | end | ||
− | end)</source> | + | end) |
+ | </source> | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Methods</translate> === | === <translate>Methods</translate> === | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
Line 93: | Line 98: | ||
[[Special:MyLanguage/KeyCode.Z|KeyCode.Z]]<br/><!-- GIDEROSCST:KeyCode.Z 90--> | [[Special:MyLanguage/KeyCode.Z|KeyCode.Z]]<br/><!-- GIDEROSCST:KeyCode.Z 90--> | ||
|} | |} | ||
− | |||
− |
Revision as of 23:33, 9 December 2019
Supported platforms:
Available since: Gideros 2011.6
Inherits from: Object
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)