Chapter 26. Creating an MP3 Jukebox

One of the exciting features introduced in Flash MX was the ability to load MP3s at runtime using the Sound class. In this chapter, we create an MP3 jukebox application that enables users to load MP3 files from various locations. The user can create a playlist of songs and play them back. To make things extra saucy, we also add a five-second cross-fade between songs. Refer to Chapter 13 for basic recipes regarding sound playback. Refer to Chapter 14 for information on recording and publishing audio with FlashCom.

Creating an Application Overview

The MP3 player that you create in this chapter is composed of several parts, so the first step is to determine what these pieces are and how they work together to create an entire application. The final files are available for download from http://www.person13.com/ascb. Here is a brief synopsis of each part of this application:

Local MP3 selector

Combines HTML, JavaScript, and a Flash movie using a local connection to select MP3 files from the hard drive of the client computer so that they can be played in the jukebox.

Server MP3 selector

Allows users to select an MP3 from the server from which the jukebox is being served so that it can be played. This feature uses Flash Remoting.

Jukebox controller component

A custom component used to control the playback of the songs in the jukebox playlist. The jukebox controller is composed of two instances of the Sound Controller component from Recipe 13.16.

Main jukebox ...

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