Difference between revisions of "Event.KEY UP"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Value</translate>:''' keyUp<br/>
+
'''Value:''' keyUp<br/>
'''<translate>Defined by</translate>:''' [[Special:MyLanguage/Controller|Controller]]<br/>
+
'''Defined by:''' [[Sprite]]<br/>
=== <translate>Descriptio</translate>n ===
+
 
<translate>Button on controller was released up</translate>
+
=== Description ===
=== <translate>Parameters</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:
'''playerId''': (number) <translate>id of controller/player that released the button</translate><br/>
+
*[[KeyCode.MODIFIER_NONE]]
'''keyCode''': (number) <translate>button key code that was released</translate><br/>
+
*[[KeyCode.MODIFIER_SHIFT]]
__NOTOC__
+
*[[KeyCode.MODIFIER_CTRL]]
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
*[[KeyCode.MODIFIER_ALT]]
'''<translate>Value</translate>:''' keyUp<br/>
+
*[[KeyCode.MODIFIER_META]]
'''<translate>Defined by</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
 
=== <translate>Descriptio</translate>n ===
+
=== Parameters ===
<translate>This event is dispatched when a supported key is released. For the list of supported keys, check `KeyCode` class.</translate>
+
'''keyCode''': (number) code of the key pressed<br/>
=== <translate>Parameters</translate> ===
+
'''realCode''': (number) real keyCode underneath<br/>
'''keyCode''': (number) <translate>code of the key pressed.</translate><br/>
+
'''modifiers''': (number) modifiers present, or nil if not supported<br/>
'''realCode''': (number) <translate>real keyCode underneath</translate><br/>
+
 
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
function onKeyUp(e)
 +
print(e.keyCode, e.realCode)
 +
end
 +
 
 +
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).