Join Todd Perkins for an in-depth discussion in this video Setting up your FLA and other files, part of Flash CS4 Professional Audio Techniques.
Before we start creating our music player, let's take a look at how to organize your FLA file and the other files that you will be working with. In the exploring-fla folder, I have a folder called start. That's where the files are that you will be working with for this exercise. I have a music file called 01 Eyes Wide.mp3. If you don't have the Exercise Files, you can use any MP3 file here. In addition to that file, I have an FLA file called player.fla, which we will explore later on.
And a folder called com. Note that it is all lowercase. Inside of the com folder is a folder called lynda, also all lowercase. Inside of the lynda folder is a folder called audio, also all lowercase. And inside of there is a lone action script file Player.as, note that it starts with a P. If you don't have the Exercise Files, now it is probably a good time to create that file. So, create Player.as and just save it in that folder. Let's take a look at player.fla in Flash.
This file is actually pretty simple, on the stage here there is only one layer and one frame. If I select the artwork on that layer, you will see that it's a single movie clip. I will expand the Properties panel and we will take a look. Note that it is called player_mc. And if I double-click that movie clip, I can enter its Timeline. Inside its Timeline, you will see three layers. There is the pause layer, the play button layer, and the background layer. The pause layer contains a movie clip called pause_mc.
The movie clip is actually just a simple Bitmap graphic of a pause button. I will zoom in a little bit so you can see it. It is right there. It looks kind of funky because the play button is right behind it. But it is just a Bitmap graphic, and you don't have to use a Bitmap graphic. You can just make your own little quick vector graphic if you would like. So, back to the player, I will hide the pause button, and then double-click the play button to enter its Timeline. The play button is also a simple Bitmap graphic.
Back to the player movie clip, note that the play button has an instance name of play_mc. The background is actually just a rectangle with a Bitmap fill. In other words, I imported a Bitmap image I created in Photoshop, I drew a rectangle and using the Fill Color menu I selected the Bitmap that I imported there. And that's really all there is to this FLA file. So, once you have your FLA file setup, you are ready to start writing the code for our application.
- Playing and pausing audio in a created player class
- Controlling audio progress and showing it in a text field
- Loading XML playlist data into the final player
- Animating a volume slider and using effects to add depth
- Making Flash applications sharable
- Viewing the finished player and taking it for a spin
Skill Level Intermediate
Q: I am having trouble getting the exercise files to work for this title. For example, when I drag the progress bar of a song to another location on the slider, the movieclip always jumps back to the beginning and the song starts over. What could be causing this error?
A: An update to Flash since the time of recording broke this functionality. The problem appears to happen when Flash compiles the SWF in Flash Player 10. If you change your publish settings to Flash Player 9 instead, you won't see any problems.