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

Streaming audio


When working with large sound files, you may want to keep them outside your application's binary in order to minimize its load time and memory consumption. The Sound class can stream an MP3 file from the web or locally from the device's file system, removing the need to embed the audio directly within your FLA.

In this recipe, we will bundle an MP3 file with an app and progressively play it back.

Getting ready

An .mp3 file has been provided for this recipe. Using either Windows Explorer or Finder, copy chapter12\resources\music.mp3 from the book's accompanying code bundle to chapter12\recipe6\.

Open chapter12\recipe6\recipe.fla within Flash Professional. Sitting in the center of the stage is a button named playBtn. We will write some ActionScript to stream music.mp3 whenever this button is pressed.

How to do it...

This recipe will be split into two parts. First we will bundle an MP3 with the app, then we will write the ActionScript required to play it.

Bundling the MP3 file

Follow...