I have bought a few loops off Shockwave sound with the intention of playing them in Flash in random order ( they are designed to be combined).
It's not user controlled, this is just a background music. However I found out that external MP3 files do not loop properly, there is always a split second pause at the end of each clip and it apparently can not be avoided. So far I think my options are
a) to mix them in the audio editing program, load the big MP3 in Flash and forget about random mixing.
b) import .wav files in Flash and randomly mix them with scripting, then load this as .swf into the main file.
I am curious of what is generally done and the good practices on doing something like that? Thanks a lot.
Natalia.
.wav would be the best bet in my estimation.
Flash is still going to output the audio at the required MP3 compression. The only advantage to bringing in an MP3 is that you probably let a sound editing program compress slightly better than Flash's compression. So, because of the looping problem (I think it stems from the file or IDs data at the beginning) go with .wav and export at whatever compression you need.
I've done this (sound linkage names from the library are 1, 2 and 3). This script is placed in one-frame movie. I want to play the sound 1 once and then for the three clips to play in random order.
soundPlay = new Sound();
rndClip = Math.floor(Math.random()*3)+1
soundPlay.attachSound(1);
soundPlay.start(0,1);
soundPlay.onSoundComplete = function()
{
soundPlay.attachSound(rndClip);
soundPlay.start (0,1);
}
trace(rndClip);
However, I have a hard time testing it. Does this look right? The loops are similar and it's hard for me to figure out where one ends and the other begins
. I know I am getting sound 1 to play and a random sound after that to play also, however, I think that random sound gets stuck and no other random selection is made.
I got it. I just split the above script over three frames. The first frame plays the first sound
soundPlay = new Sound(this); soundPlay.attachSound(1); soundPlay.start(0,1);
the second frame has the randomizing function and onSoundComplete
rndClip = Math.floor(Math.random()*3)+1
soundPlay.onSoundComplete = function()
{
soundPlay.attachSound(rndClip);
soundPlay.start (0,1);
trace(rndClip);
}
and the third frame is
gotoAndPlay(2);
fine, DON'T give us a chance to help! 
Glad you got it working for you.
Hey, Storm, I got another question. How would I get this script working in one frame, so it does not depend on looping timeline, but instead uses Actionscript looping?
put this: rndClip = Math.floor(Math.random()*3)+1 right in the onComplete function. You need to generate a new number each time.