As lostinbeta mentioned before, You can only load MP3 sounds at runtime.
With attachSound() the sound must be in the library of the FLA & properly linked for export when the movie is published, you wont be loading anything at runtime with attachSound(). Instead you will be creating thoose sound objects during authoring & using soundObj.start() to play them at runtime.
I'll go ahead & walk through an example of both attachSound & loadSound.
First, attachSound() (I noticed it being used earlier)
For example sake drag an instance of the button component to the stage & give it the instanceName "boomBox" Leave the clickHandeler blank.
Now with the button still selected open the actions panel (should say "Actions - Movie Clip")
Apply theese actions,
on(press){
(played == undefined) ? played=0 : null;
_root.sOA[played].stop();
(played >= _root.totalSounds) ? played=1 : played++;
_root.sOA[played].start();
}
- on(press){
- (played == undefined) ? played=0 : null;
- _root.sOA[played].stop();
- (played >= _root.totalSounds) ? played=1 : played++;
- _root.sOA[played].start();
- }
Now you may be wondering WTH is _root.sOA[played] ?? Well we'll get into that shortly, for now lets focus on what is happening here.
First there is
(played == undefined) ? played=0 : null; This says "if the counter we are going to use to keep track is undefined, then make it"
Next there's
_root.sOA[played].stop(); This tells all sounds that are playing to stop, It will effect other sounds playing in the movie but for example sake it serves out purpose.

Now we have
(played >= _root.totalSounds) ? played=1 : played++; This looks at the total sounds variable that we will setup later, if played is greater than or equil to total sounds it resets the counter, otherwise it increments it by 1.
Finally for the button we have
_root.sOA[played].start(); This tells the soundObject with the same array index as "played" to start playing.
Ok done with button actions, on to what goes in the root.
Click the dropdown menu right below where it says "Actions - Movie Clip" (what your looking for should say "Actions for boomBox (pushbutton)") & select what should be the other only option there ("Actions for Frame 1 of Layer Name Layer 1") Look at that no more clicking timelines or objects to switch actions panels

Ok now apply theese actions,
totalSounds = 4;
sOA = ["soundArray"];
for(i=1; i<=totalSounds; i++){
sOA[i] = new Sound(boomBox);
}
// attach sounds from library to the objects
sOA[1].attachSound("sound1");
sOA[2].attachSound("sound2");
sOA[3].attachSound("sound3");
sOA[4].attachSound("sound4");
- totalSounds = 4;
- sOA = ["soundArray"];
- for(i=1; i<=totalSounds; i++){
- sOA[i] = new Sound(boomBox);
- }
- // attach sounds from library to the objects
- sOA[1].attachSound("sound1");
- sOA[2].attachSound("sound2");
- sOA[3].attachSound("sound3");
- sOA[4].attachSound("sound4");
For the play by play we start with "totalSounds = 4;" , This is the sounds variable we talked about before.
Next we have
sOA = ["soundArray"]; this is declaring an array to hold our sound objects. ("soundArray" is a personal naming scheeme

)
Now for setting up out array of soundObjects we have this loop,
for(i=1; i<=totalSounds; i++){
sOA[i] = new Sound(boomBox);
}
- for(i=1; i<=totalSounds; i++){
- sOA[i] = new Sound(boomBox);
- }
All this loop does is fill our sOA with blank soundObjects that are attached to our boomBox button.
Ok on to assigning sounds to our sound objects in our sound object array.
we have
sOA[1].attachSound("sound1");
sOA[2].attachSound("sound2");
sOA[3].attachSound("sound3");
sOA[4].attachSound("sound4");
- sOA[1].attachSound("sound1");
- sOA[2].attachSound("sound2");
- sOA[3].attachSound("sound3");
- sOA[4].attachSound("sound4");
This attaches sounds from the library to each soundObject in out array, Now you may be saying "I dont see any .wav or .mp3" well that's becouse you dont really need it, now before you try excluding the extension from every sound and wondering why it's not working let me explain linking sounds in the library.
First we go to "File" then "Import to Library" and pick what sounds we want to add (hold CTRL to import multiple

)
Now If it's not visible allready press F11 to bring up the library window.
You should see your sounds in there ready to be linked.
Here's how you link them,
Right click a sound & select "linkage", this will bring up a dialog with 3 checkboxes you can pick, check the one that says "Export for Actionscript" this will enable the "Identifier" box (where you put "sound1", "sound2", ect...I like to think of it as giving sounds in the library instanceNames) It will also enable a checkbox saying "Export in first frame" Leave it checked.
Provided you linked the sounds in the library correctly you should now be able to test the movie and get a new sound for each button press.
Now on to loading MP3 sounds.
This is going to be easier than you think, For the only big thing we have to change is the lines that fill our soundObject array
Where
sOA[1].attachSound("sound1"); now becomes
sOA[1].loadSound("url_to_MP3", false); where "false" tells the sound not to start unless actionscript tells it to. "url_to_mp3" should explain itself.
Keep in mind that theese sounds will not play if they are not fully downloaded, you may want to setup a preloader that enables the button only after all sounds have finished loading.
Well that should be enough to get some people started

Strong with this one, the sudo is.