Difference between revisions of "Event.KEY UP"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(10 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Value:''' keyUp<br/>
 
'''Value:''' keyUp<br/>
 +
'''Defined by:''' [[Sprite]]<br/>
 +
 
=== Description ===
 
=== Description ===
<translate>Button on controller was released up</translate>
+
This event is dispatched when a supported key is released. For the list of supported keys, check [[KeyCode]] class. Modifiers can have values of:
 +
*[[KeyCode.MODIFIER_NONE]]
 +
*[[KeyCode.MODIFIER_SHIFT]]
 +
*[[KeyCode.MODIFIER_CTRL]]
 +
*[[KeyCode.MODIFIER_ALT]]
 +
*[[KeyCode.MODIFIER_META]]
 +
 
 
=== Parameters ===
 
=== Parameters ===
'''playerId''': (number) <translate>id of controller/player that released the button</translate><br/>
+
'''keyCode''': (number) code of the key pressed<br/>
'''keyCode''': (number) <translate>button key code that was released</translate><br/>
+
'''realCode''': (number) real keyCode underneath<br/>
__NOTOC__
+
'''modifiers''': (number) modifiers present, or nil if not supported<br/>
'''Available since:''' Gideros 2011.6<br/>
+
 
'''Value:''' keyUp<br/>
+
=== Example ===
=== Description ===
+
<syntaxhighlight lang="lua">
<translate>This event is dispatched when a supported key is released. For the list of supported keys, check [[Special:MyLanguage/KeyCode|KeyCode]] class.</translate>
+
function onKeyUp(e)
=== Parameters ===
+
print(e.keyCode, e.realCode)
'''keyCode''': (number) <translate>code of the key pressed.</translate><br/>
+
end
'''realCode''': (number) <translate>real keyCode underneath</translate><br/>
+
 
 +
stage:addEventListener(Event.KEY_UP, onKeyUp)
 +
</syntaxhighlight>
 +
'''note''': for this event to work you need to add your sprite to the stage (scene).
 +
 
 +
{{Sprite}}

Latest revision as of 14:27, 13 July 2023

Available since: Gideros 2011.6
Value: keyUp
Defined by: Sprite

Description

This event is dispatched when a supported key is released. For the list of supported keys, check KeyCode class. Modifiers can have values of:

Parameters

keyCode: (number) code of the key pressed
realCode: (number) real keyCode underneath
modifiers: (number) modifiers present, or nil if not supported

Example

function onKeyUp(e)
	print(e.keyCode, e.realCode)
end

stage:addEventListener(Event.KEY_UP, onKeyUp)

note: for this event to work you need to add your sprite to the stage (scene).