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

Using an update loop


Listening for events can be expensive. For a handler to receive an event, Flash must create an object in memory that represents that event. Repeatedly allocating memory can hurt the performance of your app, and this is especially true if you are listening for Event.ENTER_FRAME from a large number of display objects.

Let us see how to minimize the impact of handling multiple ENTER_FRAME events by making some adjustments to the architecture of your example app. We will also add some additional code to individually control the speed of each bubble, making the app a little more polished.

How to do it...

You will be required to make code changes to both Main.as and Bubble.as:

  1. First start by opening Bubble.as.

  2. Within the constructor, remove the highlighted line of code that listens for Event.ENTER_FRAME:

    public function Bubble() {
      addEventListener(Event.ENTER_FRAME, enterFrame);
    }
  3. Change the enterFrame() method's signature by renaming it to update() and removing its Event parameter...