Book Image

Flash iOS Apps Cookbook

By : Christopher Caleb
Book Image

Flash iOS Apps Cookbook

By: Christopher Caleb

Overview of this book

The latest version of Flash Professional can directly target iOS, allowing Flash developers to write applications that will run natively on Apple's iPhone, iPad, and iPod touch. What's more, with Apple loosening its restrictions on third-party technologies, apps written in Flash can now be sold and distributed within the App Store.Flash iOS Apps Cookbook provides the recipes required to build native iOS apps using your existing knowledge of the Flash platform. Whether you want to create something new or simply convert an existing Flash project, the relevant steps and techniques will be covered, helping you achieve your goal.Learn how to configure and use Flash Professional for iOS development by writing and deploying a simple app to a device. Implement many iOS-specific features such a multi-touch, the virtual keyboard, camera support, screen orientation and the Retina display. Overcome the limitations of mobile development by mastering hardware acceleration and optimization. Whether you're an enthusiast or professional developer, the Flash iOS Apps Cookbook is your toolkit to creating high-quality content for iPhone, iPad and iPod touch.
Table of Contents (21 chapters)
Flash iOS Apps Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Detecting multiple touch points


The term multi-touch refers to the ability to simultaneously detect and track two or more distinct points of contact on a touch-screen. Touch events are similar to the mouse events provided by Flash, except you can listen for and respond to multiple touch events all at once.

Let us revisit the Bubbles app from Chapter 3 and add multi-touch interaction to it. We will add functionality to let the user trap multiple bubbles by holding a finger on top of each.

Getting ready

A version of the Bubbles FLA has been provided for you to work from.

From Flash Professional, open chapter5\recipe2\recipe.fla from the book's accompanying code bundle.

How to do it...

We will be making changes to both the FLA's document class and Bubble.as.

Updating the Bubble class

Let us start by adding some code to Bubble.as that prevents any of the bubble instances from moving if being held:

  1. Open the Bubble.as class.

  2. Add the following member variable:

    private var _held:Boolean = false;
  3. Now write...