O'Reilly logo

Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications by Richard Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required