Flash MX Audio Player

An in depth look at building a reusable streaming audio preloader for Flash MX that includes media controls.

click here to get more tutorials

01 Introduction
02 What should the media player do? / How should the player be structured? / Useful reading
03 Part 1: Start with some easy audio
04 Putting the sound on the stage / Adding a sample graphic
05 Animating the waveform
06 Part 2: Planning our controls / Getting the sound to play, pause and rewind
07 Adding a load indicator
08 Adding a thumb dragger to the slider
09 Dragger states
10 Limiting the dragger / Setting the sound's playhead position
11 Making the media controls ready for sharing
12 Part 3: Using the media player
13 Anything else? / Conclusion / About the authors / Copyright

Previous << Limiting the dragger / Setting the sound's playhead position

Making the media controls ready for sharing

So far we have a good set of controls in a movie, but they're not going to be easy to reuse as they are. If you've done any of our other tutorials, you will know that our next step will be to share the resources for use in other files.

Using the "File > Save As..." command (Ctrl+Shift+S), save the test.fla file as media-controller.fla. This will be the file that we will get media controls from after we have finished this section.

You should now have two Flash MX files:

test.fla

Where we did all our initial development and testing of our media controls.

media-controller.fla

The file that we will tidy up and get ready for sharing out our completed media controls to other Flash files.

From now on we are only working on the media-controller.fla file

Go back to your main timeline: the one with the sound and waveform graphics on it. Now delete all of the layers except the controller layer. Really. Do it. And delete all additional frames on the controller layer, leaving only frame 1.

And save it. We don't need those bits any longer. They were just for development. It's difficult to build media controllers without any media to control!

And we need to dump all of that media from the Library as well. So open the Library (F11) and let's get started. I deleted the sound resource, the sample GIF and the graphic we made from the GIF. That left all this stuff:

So I tidied it up a bit:

The next bit of preparation involves exporting our resources for runtime sharing (look it up in the online help, or check out our other tutorials). Right-click on the media-controls movie clip and select "Linkage..."

The Linkage Properties dialog opens. Fill it out like this:

Do the same to all resources in the Library. You will find that once you have set up one resource for runtime sharing, when you go to do the others, all of the fields will be filled in automatically. The Identifier text box will change to the name of each resource you export.

Save the file.

Do a quick test (Ctrl+Enter). This will create the media-controller.swf file for us. Have a look at the size of the media-controller.swf file: mine came out to 2,836 bytes! Not bad! And our site visitors will only have to download this sucker once.

Next up, I will demonstrate how to use the controls.

Next >> Part 3: Using the media player

01 Introduction
02 What should the media player do? / How should the player be structured? / Useful reading
03 Part 1: Start with some easy audio
04 Putting the sound on the stage / Adding a sample graphic
05 Animating the waveform
06 Part 2: Planning our controls / Getting the sound to play, pause and rewind
07 Adding a load indicator
08 Adding a thumb dragger to the slider
09 Dragger states
10 Limiting the dragger / Setting the sound's playhead position
11 Making the media controls ready for sharing
12 Part 3: Using the media player
13 Anything else? / Conclusion / About the authors / Copyright

© 2003 Glasson Murray Group Pty Ltd (ACN 098 651 542), Western Australia. All rights reserved.