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

Controlling audio playback


A SoundChannel object is created for each sound that is played. Using the class' API, you can control the playback of a sound.

In this recipe, we will learn how to pause and resume a sound.

Getting ready

An .mp3 file and an FLA have been provided within the book's accompanying code bundle.

Open chapter12\recipe7\recipe.fla into Flash Professional. Sitting in the center of the stage is a button named playBtn. In the layer directly below is another button named pauseBtn. During this recipe, we will write ActionScript to toggle between the two, indicating whether or not the MP3 is currently playing.

The MP3 we will be using can be found at chapter12\resources\music.mp3. Before proceeding, copy it to the FLA's root folder at chapter12\recipe7\.

How to do it...

This recipe is covered in two main steps. First we will bundle the MP3 with the app, then we will write the ActionScript required to control its playback.

Bundling the MP3 file

Let us start by bundling the .mp3 file...