Adding music in flash


I’m building a website in Flash and I want to add long mp3 tracks in it. But the loadingtimes are horrible! How can I add music in a flash-file without those very long loading times?

Grtz, DNNS

if you make the sync setting “stream”, the movie will start playing even if the sound has not finished downloading.

this can be problematic though. if the song doesn’t download fast enough, the movie will stop, wait for more data, play, stop, wait for more data, play, etc. you’ll want to put in some kind of buffering feature for low bandwidth viewers.

if you put your music in another swf altogether, it becomes a little more flexible. for instance people who don’t want to hear it won’t have to download it.

make a swf with just the music, with sync set to stream - that’s a setting in the sound panel.

have some way of loading it from your main movie (via a button, frame action, whatever):


the ‘2’ means level 2. you can see how the download is going by using:


that will return how much of _level2 has downloaded. if you pair that with:


you can make a kick ass progress meter.

this has worked well for me in the past.

good luck!

in line with this, what is the best program for resampling audio files? i have some nice wav music but when i try to convert it to mp3 using Yamp only the best quality ones get converted (128 kbps/ 44 khz). i hear some guys manage to go as low as 40 kbps/11 khz without significant loss in quality. any suggestion?

I recomd using the stream option and also exporting your music as a seperate SWf then using the loadmovie script to load your music.

but exporting the music as a separate swf would mean you’ll lose control over the synchorinzation aspect right?
for example you want a certain word to appear right after a particular number of (bass) drum beats.

well, i’m not sure … experiment and find out!

if you are losing synch you can still work out ways around it, for instance, in your music movie (which won’t lose synch with itself!), use frame actions to control the main timeline.


you’d have to set texttoappear._visible=0; somewhere. if i want a movie to be invisible right off the bat, i put it in an onClipEvent(load) event.

select your movie and put this in the actionscript:


it won’t appear until you give it a _visible=1;