Responding to events and gestures
Most of the events that your application handles are generated by BlackBerry device users. For example, when a user touches the screen or tilts the device, your application receives a notification of the event. Other events are generated by the BlackBerry 10 OS. For example, if the battery power level is low, the BlackBerry 10 OS tries to notify all applications, passing the event information to your application by using the Adobe Flash event model.
In the Flash event model, the BlackBerry 10 OS tries to notify an object about an event. If the event is not processed, the next object in the object hierarchy is notified until the event is processed.
To respond to events that are generated by a user, the BlackBerry 10 OS or the Adobe AIR runtime, you can add an event handler to any object by invoking addEventListener(). For example, when you create a button you can add an event handler:
When an event occurs that is specified by the event parameter, the BlackBerry 10 OS invokes the method specified by the method parameter.
The following table describes the APIs you can use to listen for and manage events created by the user or the BlackBerry 10 OS.
|qnx.events||This package contains the event classes that you can use to listen for events that are generated by the BlackBerry 10 OS (for example, low battery power level, and requests to release the media service connection).|
|qnx.fuse.ui.events||This package contains the event classes that you can use to capture events related to BlackBerry 10 OS UI components (for example, ListEvent or ScrollEvent).|
This package contains the event classes that you can use to capture events that are generated by the Adobe AIR runtime, events related to the application state (for example, foreground, background), geolocation, and the accelerometer.
For more information on flash.events, see the ActionScript 3.0 Reference