TouchEvent

Availability

BlackBerry 7.0 or later

Extends

UIEvent

The TouchEvent object extends the UIEvent object and represents an event generated when the user touches the surface of a touch-sensitive screen.

To create an instance of a UIEvent, you must invoke Document.createEvent() with an input parameter of ”TouchEvent”.

By default, touch events from the user are consumed by the BlackBerry Browser or BlackBerry device UI. The browser uses these events in order to provide improvements in usability. For example, the user must use their finger to scroll through the content, and can double-tap to zoom in to a content block. To prevent these events from being consumed by the UI, you can use the touch-event-mode meta tag.

With this meta tag, you can disable these UI features for a web page, so that the browser passes the entire array of events and gestures to the web page unprocessed. With access to raw touch events, you can, for example, track both the direction and distance of a swipe event, and respond differently based on the swipe direction or distance.

The touch-event-mode meta tag is added to the <head> section of a page as part of a <meta> element. For more information see touch-event-mode.

Properties

Property name

Type

Description

Status

Support level

Availability

changedTouches

TouchList

Specifies a TouchList containing a list of Touch objects that represent every point of contact that contributed to the touch event.

read only

Touch Events

7.0+

targetTouches

TouchList

Specifies a TouchList containing a list of Touch objects that represent every point of contact currently touching the screen surface that started on the same target.

read only

Touch Events

7.0+

touches

TouchList

Specifies a TouchList containing a list of Touch objects that represent every point of contact currently touching the screen surface.

read only

Touch Events

7.0+

Event types

Event type

Bubbles

Cancelable

Description

touchstart

yes

yes

Occurs when the user places a touch point on a touch-sensitive screen.

touchend

yes

yes

Occurs when the user removes a touch point from a touch-sensitive screen.

touchmove

yes

yes

Occurs when the user moves a touch point along the surface of a touch-sensitive screen, or if there is a change in one or more of Touch.radiusX , Touch.radiusY , Touch.rotation , or Touch.force .

touchenter

no

yes

Occurs when the user moves a touch point onto an interactive area defined by a DOM element.

touchleave

no

yes

Occurs when the user moves a touch point off of an interactive area defined by a DOM element.

touchcancel

yes

yes

Occurs when the user performs some action that disrupts the sequence of touch points.

Methods

Method name

Description

Support level

Availability

initTouchEvent()

Initializes the value of a TouchEvent.

Touch Events

7.0+

Last modified: 2014-03-10



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus