Chapter 5. Multitouch API

WHAT'S IN THIS CHAPTER?

  • Understanding the difference between touch and gesture events

  • Enabling your app to respond to touches and gestures

  • Adding a swipe to your app

  • Zooming and rotating display objects

One of the core capabilities of any mobile app is effectively handling multitouch events: a finger press, a finger swipe, a multifinger gesture. With its multitouch interface, Android and iOS devices are designed for that intimate connection with the user. As you develop Flash apps, you'll want to pay close attention to this key method of user interaction.

This chapter walks you through touch events available to you and shows you how to listen and respond to them in your apps.

UNDERSTANDING THE MULTITOUCH JARGON

Before going into the actual touch API, the next sections highlight the three types of touch-related events.

Mouse Emulation Events

Mouse emulation events (MouseEvent) are the events that you are probably quite familiar with if you worked with ActionScript 3 (AS3) events in Flash. When a user touches a single finger to the device, a MouseEvent is dispatched, which in effect, simulates a mouse clicking a display object, such as a button. You can decide whether to listen for mouse events or respond only to touch events.

Touch Events

Touch events (TouchEvent) are dispatched when one or more fingers touch the screen. You can listen for a single finger press or multiple finger touches that occur at different points on the screen at the same time. (See Table 5-1

Get Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.