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

Playing embedded audio


ActionScript can be used to play back sound files embedded within an FLA's library. The sound must have a unique class name associated with it.

In this recipe, we will cover how to play such embedded sounds.

Getting ready

From the book's code bundle, open chapter12\recipe5\recipe.fla into Flash Professional and use it as a starting point.

The embedded sound from the Embedding audio recipe can be found in the FLA's library and has a class name of SoundEffect linked to it.

Also, sitting on the stage is a button named playBtn. We will play the embedded sound whenever this button is pressed.

How to do it...

Perform the following steps to play the sound associated with the SoundEffect class:

  1. Create a document class and name it Main.

  2. Import the MouseEvent class and listen for playBtn being pressed:

    package {
    
      import flash.display.MovieClip;
      import flash.events.MouseEvent;
    
      public class Main extends MovieClip {
    
        public function Main() {
          playBtn.addEventListener(MouseEvent...