Chapter 26. Working with Sound


In this chapter

  • Working with sounds in AS3—an overview of the system, classes, and events

  • Loading sounds from URLs or embedding them in your program

  • Creating a simple sound player

  • Using ID3 data to display song information

  • Displaying a visualization of the sound spectrum

In this section, you look at ways to integrate sound into your program. A little bit of sound goes a long way in adding depth and character to your Flash program. Although sound has been a part of every previous version of Flash, developers now have more control over sound than ever before. The ability to work with MP3 files locally or over the network and to access metadata makes Flash an ideal platform for cross‐platform custom audio interfaces. As with many other areas of the API, the sound classes work with the AS3 event framework. Perhaps most important, the ability to compute an analysis of the sound spectrum will allow you to provide visual feedback controlled by the playing sound.

How Sound Works in AS3

The sound system works a little bit differently than previous versions of Flash. Here's an overview of how everything fits together.

Learning the AS3 sound classes

There are five major sound‐related classes in ActionScript 3.0. Together, they work to make up the Flash Player 9 sound system. The Sound class, along with SoundLoaderContext, handles the loading of the sound file. Playing that Sound object creates a new SoundChannel, which can be used to control the playback of ...

Get ActionScript™ 3.0 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.