Events are sent to listeners. Functions or objects can be event listeners. When an event occurs, the listener is called by a table representing the event. All events will have a property name that identifies the kind of event.
Display objects and global Runtime objects can be event listeners. You can add and remove listeners for events using the following object methods:
object:addEventListener( )
: It adds a listener to the object's list of listeners. When the named event occurs, the listener will be invoked and be supplied with a table representing the event.object:removeEventListener( )
: It removes the specified listener from the object's list of listeners so that it no longer is notified of events corresponding to the specified event.
In the following example, an image display object registers to receive a touch event. Touch events are not broadcast globally. Display objects that register for the event and lie underneath it will be candidates...