Event: Difference between revisions
---- |
|||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | |||
''' | '''Available since:''' Gideros 2011.6<br/> | ||
''' | '''Inherits from:''' [[Object]]<br/> | ||
''' | |||
=== | === Description === | ||
The objects of [[Event]] class contain information about an event that has occurred. [[Event]] objects are passed to event listeners when an event occurs. | |||
The objects of [[ | |||
are passed to event listeners when an event occurs. | Usually, event objects contain specific additional information about the event that has occured. For example, when an [[Event.MOUSE_DOWN]] event occurs, ''x'' and ''y'' fields contain the coordinates. | ||
Usually event objects | Users can create their own events and dispatch them through the event mechanism. | ||
when an [[ | |||
Users can create their own events and dispatch through the event mechanism. | === Examples === | ||
=== | |||
'''Mouse down event example'''<br/> | '''Mouse down event example'''<br/> | ||
<source lang="lua">function onMouseDown(event) | <source lang="lua"> | ||
function onMouseDown(event) | |||
print(event.x, event.y) | print(event.x, event.y) | ||
end | end | ||
mysprite:addEventListener(Event.MOUSE_DOWN, onMouseDown) | |||
</source> | |||
<br/> | |||
'''User created event'''<br/> | '''User created event'''<br/> | ||
<source lang="lua">local event = Event.new("myevent") | <source lang="lua"> | ||
local event = Event.new("myevent") | |||
event.data1 = "12345" | event.data1 = "12345" | ||
event.data2 = "abcde" | event.data2 = "abcde" | ||
mydispatcher:dispatchEvent(event)</source> | mydispatcher:dispatchEvent(event) | ||
</source> | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== | === Methods === | ||
[[ | [[Event.new]] ''creates a new Event object''<br/> | ||
[[ | [[Event:getTarget]] ''returns the element on which the event listener was registered''<br/> | ||
[[ | [[Event:getType]] ''returns the type of Event''<br/> | ||
[[ | [[Event:stopPropagation]] ''stops the propagation of the current event in the scene tree hierarchy''<br/> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== | |||
=== | === Events === | ||
=== Constants === | |||
|} | |} | ||
---- | |||
{{Special:PrefixIndex/Event}} | |||
<br/> | |||
Revision as of 16:27, 2 December 2019
Supported platforms: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2011.6
Inherits from: Object
Description
The objects of Event class contain information about an event that has occurred. Event objects are passed to event listeners when an event occurs.
Usually, event objects contain specific additional information about the event that has occured. For example, when an Event.MOUSE_DOWN event occurs, x and y fields contain the coordinates.
Users can create their own events and dispatch them through the event mechanism.
Examples
Mouse down event example
function onMouseDown(event)
print(event.x, event.y)
end
mysprite:addEventListener(Event.MOUSE_DOWN, onMouseDown)
User created event
local event = Event.new("myevent")
event.data1 = "12345"
event.data2 = "abcde"
mydispatcher:dispatchEvent(event)
MethodsEvent.new creates a new Event object |
EventsConstants |
- Event
- Event.ADDED TO STAGE
- Event.ADS READY
- Event.AD ACTION BEGIN
- Event.AD ACTION END
- Event.AD CONSENT
- Event.AD DISMISSED
- Event.AD DISPLAYED
- Event.AD ERROR
- Event.AD FAILED
- Event.AD RECEIVED
- Event.AD REWARDED
- Event.ANIMATION COMPLETE
- Event.ANIMATION END
- Event.ANIMATION START
- Event.APPLICATION BACKGROUND
- Event.APPLICATION EXIT
- Event.APPLICATION FOREGROUND
- Event.APPLICATION PERMISSION
- Event.APPLICATION RESIZE
- Event.APPLICATION RESUME
- Event.APPLICATION START
- Event.APPLICATION SUSPEND
- Event.BEGIN CONTACT
- Event.BEGIN CONTACT PARTICLE
- Event.COMPLETE
- Event.CONNECTED
- Event.CONNECTED TO ROOM
- Event.DATA AVAILABLE
- Event.DATA RECEIVED
- Event.DISCONNECTED
- Event.DISCONNECTED FROM ROOM
- Event.END CONTACT
- Event.ENTER FRAME
- Event.ERROR
- Event.GAME STARTED
- Event.HEADING UPDATE
- Event.INVITATION RECEIVED
- Event.JOINED ROOM
- Event.KEY CHAR
- Event.KEY DOWN
- Event.KEY UP
- Event.LAYOUT RESIZED
- Event.LEFT JOYSTICK
- Event.LEFT ROOM
- Event.LEFT TRIGGER
- Event.LOAD ACHIEVEMENTS COMPLETE
- Event.LOAD ACHIEVEMENTS ERROR
- Event.LOAD SCORES COMPLETE
- Event.LOAD SCORES ERROR
- Event.LOCATION UPDATE
- Event.MEDIA CANCEL
- Event.MEDIA RECEIVE
- Event.MEMORY WARNING
- Event.MOUSE DOWN
- Event.MOUSE ENTER
- Event.MOUSE HOVER
- Event.MOUSE LEAVE
- Event.MOUSE MOVE
- Event.MOUSE UP
- Event.MOUSE WHEEL
- Event.OPEN URL
- Event.PEER CONNECTED
- Event.PEER DECLINED
- Event.PEER DISCONNECTED
- Event.PEER INVITED
- Event.PEER JOINED
- Event.PEER LEFT
- Event.PLAYER INFORMATION COMPLETE
- Event.PLAYER INFORMATION ERROR
- Event.PLAYER SCORE COMPLETE
- Event.PLAYER SCORE ERROR
- Event.POST SOLVE
- Event.PRE SOLVE
- Event.PROGRESS
- Event.REMOVED FROM STAGE
- Event.REPORT ACHIEVEMENT COMPLETE
- Event.REPORT ACHIEVEMENT ERROR
- Event.REPORT SCORE COMPLETE
- Event.REPORT SCORE ERROR
- Event.RIGHT JOYSTICK
- Event.RIGHT TRIGGER
- Event.ROOM AUTO MATCHING
- Event.ROOM CONNECTED
- Event.ROOM CONNECTING
- Event.ROOM CREATED
- Event.STATE CONFLICT
- Event.STATE DELETED
- Event.STATE ERROR
- Event.STATE LOADED
- Event.TIMER
- Event.TIMER COMPLETE
- Event.TOUCHES BEGIN
- Event.TOUCHES CANCEL
- Event.TOUCHES END
- Event.TOUCHES MOVE
- Event.VIDEO COMPLETE
- Event.new
- Event:getTarget
- Event:getType
- Event:stopPropagation
- EventDispatcher
- EventDispatcher.new
- EventDispatcher:addEventListener
- EventDispatcher:dispatchEvent
- EventDispatcher:hasEventListener
- EventDispatcher:removeAllListeners
- EventDispatcher:removeEventListener
- Event system