Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Before start writing a bunch of code to create our MP3 player, let's take a look at our project plan. If you're following along in the Exercise Files folder, find the Chapter 09 folder and then find the 02 folder, and open up 02_Flow.swf. I'm going to expand this file to take up the full screen. Now let's talk a little bit about the structure of our classes. So we have our Main FLA at the top and that's going to be used to create an instance of a class called the Mp3 player class.
And all the classes we'll use will be custom classes that we create. The Mp3 player class will act as the master class for our Mp3 player. Through the MP3 player class, we'll create an instance of a class called the SoundLoader class. The SoundLoader class will control loading and playing of all of our songs. The Mp3 player class will also hold properties that are instances of the PlayPauseButton class, the SkipButtons class, VolumeControl class, and the ProgressSlider class.
These instances will be created through the SoundLoader class. The classes on the right will control the interactivity elements. So first we have the PlayPauseButton class. This class will control the playing and pausing of the sounds. It will do that by communicating through the Mp3Player class to the SoundLoader class to control the sound. The SkipButtons class will control the next and the previous buttons for the Mp3 player. Like to PlayPauseButton class, the SkipButtons class will communicate to the SoundLoader through the Mp3Player class to control skipping tracks in the sound.
The VolumeControl class will work in the same way. It will communicate through the Mp3Player class to the SoundLoader class to control the volume of the songs. The ProgressSlider class will also work in the same way. It will communicate through the Mp3Player class to the SoundLoader class to display and set the progress of the songs that are playing. So we're going to be creating a lot of classes and they're all going to be working with each other.
We're going to be writing a lot of code throughout this chapter, and if any of the code sounds unfamiliar or classes even sound unfamiliar, I definitely recommend viewing the ActionScript 3.0 in Flash CS3 Essential Training title. That will give you a lot of practice in working with sound and practice working with classes. Throughout this chapter if you ever get confused about the structure of our project or how objects are communicating to each other, you can always come back to this file and take a look in a how the structure our classes is setup.
So now that we have a good idea of how our application's going to be set up, let's start making it.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.