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 ...

Get Flash iOS Apps Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.