Difference between revisions of "Event"
(----) |
|||
Line 48: | Line 48: | ||
|} | |} | ||
− | + | {{Event}} | |
− | {{ | ||
− |
Revision as of 01:26, 3 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 |