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

Determining your speed and heading


The availability of an on-board GPS unit makes it possible to determine your speed and heading. In this recipe, we will write a simple app that uses the Geolocation class to obtain and use this information. In addition, we will add compass functionality by utilizing the user's current heading.

Getting ready

You will need a GPS-enabled iOS device. The iPhone has featured an on-board GPS unit since the release of the 3G. GPS hardware can also be found in all cellular network-enabled iPads.

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

Sitting on the stage are three dynamic text fields. The first two (speed1Field and speed2Field) will be used to display the current speed in meters per second and miles per hour respectively. We will write the device's current heading into the third—headingField.

Also, a movie clip named compass has been positioned near the bottom of the stage and represents a compass with north...