# (MX)Dynamically loading mp3's

**URL:** <https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669>\
**Category:** flash\
**Created:** [October 13, 2002, 10:09pm UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669 "2002-10-13T22:09:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnyVagabond](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@JohnyVagabond](https://forum.kirupa.com/u/JohnyVagabond)\
**Post date:** [October 13, 2002, 10:09pm UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/1 "2002-10-13T22:09:39Z")

</div>

Hi,

Dynamically loading mp3’s

I am currently tearing my hair out trying to get this thing to work.

I have 10 buttons, 1 stop and the others track 01 - 09, these are all in one .swf file.

The buttons are all on one layer, on another i have defined all my sounds like so :

firstSound = new Sound();  
firstSound.loadSound(“track 01.mp3”);

through to

ninthSound = new Sound();  
ninthSound.loadSound(“track 09.mp3”);

Then i have the actions for my buttons

on (press) {  
//Track 01 Button  
stopAllSounds();  
firstSound.loadsound(“track 01.mp3”);  
firstSound.start(0,999);  
}

through to

on (press) {  
//Track 09 Button  
stopAllSounds();  
ninthSound.loadsound(“track 09.mp3”);  
ninthSound.start(0,999);  
}

I have uploaded the 9 mp3’s, the swf & html file to same folder and this is what happens :

[http://www.nrgdesigns.net/bgsounds/buttonstest.html](http://www.nrgdesigns.net/bgsounds/buttonstest.html)

When any of the 9 track buttons are pressed 7 of the nine mp3’s download all at the same time from pressing 1 single button:q: (no track 3 or 9 which play fine normally and have definitely been uploaded) and none of the sounds work. But, when i refresh the page the 7 mp3’s that were downloaded now work :q: . The stop all sounds still work on buttons 3 & 9. On my friends comp he dl’s the same 7 tracks but they don’t even play at all for him  
:q:

Can anyone help me Plzzzzzzzzzzzzzzzzzzzzzzzzzz

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 6:45am UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/2 "2002-10-14T06:45:36Z")

</div>

> \*\*When any of the 9 track buttons are pressed 7 of the nine mp3’s download all at the same time from pressing 1 single button:q: (no track 3 or 9 which play fine normally and have definitely been uploaded) and none of the sounds work. Can anyone help me Plzzzzzzzzzzzzzzzzzzzzzzzzzz \*\*

First of all…

WHAT?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 7:20am UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/3 "2002-10-14T07:20:58Z")

</div>

> \*Originally posted by eron19 \*  
> \*\*

First of all…

WHAT? \*\*  
Yes, I’m not sure I understand what’s happening either :P. But there’s a really good tute on sounds here: [Flash Kit Community Forums](http://www.flashkit.com/tutorials/Audio/Flash_MX-Kenny_Be-824/)

It should contain everything you need an more. If there’s something you don’t understand, just post…

pom :cowboy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 10:06am UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/4 "2002-10-14T10:06:33Z")

</div>

OK,

I am trying to do this from that tutorial from flash kit, but it doesn’t cover much of dynamically loading mp3’s.

[http://www.nrgdesigns.net/bgsounds/buttonstest.html](http://www.nrgdesigns.net/bgsounds/buttonstest.html)

When the page first loads up ^^^^^^^^^

This is what happens

I press the track 01 button ONCE only.

Then i’m watching my traffic and i know that 7 of the tracks all download from this single click on track 01 button.(no track 03 or track 09)

This is definitely happening because i’m watching my temp internet files and each time i delete them and try again the same thing happens.

After the 7 mp3’s files have downloaded the buttons still do not work, until, i refresh my page. Then those 7 buttons work.

Is that any clearer ?

I can upload the .fla if that will help at all, let me know.

Do you know of a better way to do this, that works ? I would be very grateful if anyone could show me.

The end result i am after is to have 9 play buttons(track 01 - 09) and a stop button. The stop button obviously has to stop any of the tracks from playing. The 9 play buttons should check to see(on press) if any other sounds are playing first and if so stop them, then start playing the track associated with it.

If any more explanations are needed please ask me,

Thanx again for your time

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 9:43pm UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/5 "2002-10-14T21:43:51Z")

</div>

Latest update

I was wrong about the 1 button loading all the mp3’s.

As soon as you enter the page

[http://www.nrgdesigns.net/bgsounds/test.html](http://www.nrgdesigns.net/bgsounds/test.html)

all the mp3’s start downloading without pressing a single button!

☹

Once they r downloaded the buttons work for me, but they only seem to work for me and no-one else  
Does this help anymore ?:q:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 9:59pm UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/6 "2002-10-14T21:59:16Z")

</div>

im guessing maybe its because they havent downloaded all the way. you should check if they have loaded fully. thats what im thinking. because if they work for you, then it works. just because it doesnt work for them doesnt mean there’s something wrong. just check if theyve downloaded fully. i believe you can use getBytesLoaded() for that. sound.getBytesLoaded(). im not sure you, you will have to look into it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2002, 1:10am UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/7 "2002-10-21T01:10:33Z")

</div>

There’s A Tutorial On This Site, for  
Dynamically Loading Sound. Check it out sometime.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 23, 2002, 12:51am UTC](https://forum.kirupa.com/t/mx-dynamically-loading-mp3s/6669/8 "2002-10-23T00:51:20Z")

</div>

testing
