# Streaming mp3 files?

**URL:** <https://forum.kirupa.com/t/streaming-mp3-files/15897>\
**Category:** Uncategorized\
**Created:** [March 19, 2003, 3:33am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897 "2003-03-19T03:33:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exedus](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@Exedus](https://forum.kirupa.com/u/Exedus)\
**Post date:** [March 19, 2003, 3:33am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/1 "2003-03-19T03:33:31Z")

</div>

I can’t believe I had to register again?? What gives? I couldn’t log in.

Oh well, here’s my question. I’m working on a fully flash website. I want to stream a few mp3’s from the server instead of having them in my main swf.

I haven’t been able to find a decent tutorial on this. My new book on flash doesn’t even go into enough detail. I want to know how to stream the files ( there are 3 of them). Let the user choose between the files via buttons. And stop and play buttons for the files as well.

Can someone please help me?

---

<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:** [March 19, 2003, 3:49am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/2 "2003-03-19T03:49:18Z")

</div>

I use a similar technique as this on one of my sites. It’s pretty  
much what you need to get started, I’m sure.

[http://www.flashkit.com/tutorials/Audio/Create\_c-Shaun\_St-881/index.php](http://www.flashkit.com/tutorials/Audio/Create_c-Shaun_St-881/index.php)

---

<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:** [March 19, 2003, 4:05am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/3 "2003-03-19T04:05:28Z")

</div>

I’m a little confused with the tutorial you refered me to.

so here’s the code he says to use in the main timeline  
I don’t have a domain name yet. What do I put in the field where the URL is?? I would like to be able to test this to make sure it works before I post the site.

Also when creating the external swf with all the music files, does it matter what I name the swf? This also isn’t mentioned in the tutorial. ☹

stop();  
unloadMovieNum(66);  
loadMovieNum(“[http://www.yoursite.com/swf/song1.swf](http://www.yoursite.com/swf/song1.swf)”, 66);

---

<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:** [March 19, 2003, 4:19am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/4 "2003-03-19T04:19:10Z")

</div>

ok…

the path to the file can be wherever it’s located. In most cases,  
you’re going to want to just keep it in the same directory as your  
main movie, or in another folder named music or something. You  
don’t necessarily need to list out the entire URL.

So, could look like this:

```auto
stop();
unloadMovieNum(66);
loadMovieNum("music/song1.swf", 66);

```

or even simpler, this:

```auto
stop();
unloadMovieNum(66);
loadMovieNum("song1.swf", 66);

```

If you use the 2nd method, just make sure the music movie is in  
the same directory as your main movie.

As for the naming, it does not matter at all what you name them.  
Just so long as they are the same. So if the file is named  
hotmusic1.swf, then make sure the code reflects that.

---

<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:** [March 19, 2003, 4:46am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/5 "2003-03-19T04:46:48Z")

</div>

thanks for the help. You website is awesome by the way!!

---

<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:** [March 19, 2003, 4:49am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/6 "2003-03-19T04:49:36Z")

</div>

np - and thx 🙂

---

<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:** [March 19, 2003, 11:04am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/7 "2003-03-19T11:04:27Z")

</div>

im a little confused is this how to stream a song meaning it plays as you download it, or is this how you load it like on electron geeks site, i would prefer that version if somone could point me to 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:** [March 19, 2003, 11:13am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/8 "2003-03-19T11:13:50Z")

</div>

On your music swf file just add a preloader actionscript on it’s .fla file. 🙂

---

<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:** [March 19, 2003, 5:02pm UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/9 "2003-03-19T17:02:36Z")

</div>

it’s the same thing as electrongeek’s site. It’s actually playing as  
it’s loading. Just set your audio export settings to stream, and  
away you go!

If you want them to have to download the entire song first, then  
you would want to add a preloader like lairusi suggests.

🙂

---

<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:** [March 20, 2003, 12:48am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/10 "2003-03-20T00:48:43Z")

</div>

but how do you get the loader to go in a certain spot… and hwo to you get the bars to start popping once the sound comes up 😕

---

<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:** [March 20, 2003, 12:56am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/11 "2003-03-20T00:56:51Z")

</div>

getting the loader to go is just following the basic preloader rules.

the lines are just a mc he made to designate that the sound is  
playing. Simply load the lines mc on the first frame of the sound,  
beyond the preloader.

---

<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:** [March 20, 2003, 3:01am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/12 "2003-03-20T03:01:40Z")

</div>

OK. I followed the tutorial and then ran the movie. The first song did start playing like it should. The stop button worked as well. But the play button didn’t work after I stopped it. I also got these errors. Please help.

Scene=Scene 1, Layer=buttons, Frame=80: Line 3: String literal was not properly terminated  
loadMovieNum("song1.swf, 66);

Scene=Scene 1, Layer=buttons, Frame=80: Line 4: ‘)’ or ‘,’ expected  
}

Scene=Scene 1, Layer=buttons, Frame=80: Line 1: Statement block must be terminated by ‘}’  
on (release) {

Scene=Scene 1, Layer=buttons, Frame=80: Line 5: Syntax error.

Scene=Scene 1, Layer=buttons, Frame=80: Line 3: String literal was not properly terminated  
loadMovieNum("song2.swf, 66);

Scene=Scene 1, Layer=buttons, Frame=80: Line 4: ‘)’ or ‘,’ expected  
}

Scene=Scene 1, Layer=buttons, Frame=80: Line 1: Statement block must be terminated by ‘}’  
on (release) {

Scene=Scene 1, Layer=buttons, Frame=80: Line 5: Syntax error.

Scene=Scene 1, Layer=buttons, Frame=80: Line 3: String literal was not properly terminated  
loadMovieNum("song3.swf, 66);

Scene=Scene 1, Layer=buttons, Frame=80: Line 4: ‘)’ or ‘,’ expected  
}

Scene=Scene 1, Layer=buttons, Frame=80: Line 1: Statement block must be terminated by ‘}’  
on (release) {

Scene=Scene 1, Layer=buttons, Frame=80: Line 5: Syntax error.

---

<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:** [March 20, 2003, 3:03am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/13 "2003-03-20T03:03:35Z")

</div>

LOL never mind!! I went over the code again. I was missing end quotes. Bah!!

---

<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:** [March 20, 2003, 5:48am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/14 "2003-03-20T05:48:56Z")

</div>

glad you caught it, cuz I was just about to tell you! hehe

glad it worked for you, and nice job finding it yourself. not many  
keep trying once they post here.

=)

---

<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:** [March 21, 2003, 7:54am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/15 "2003-03-21T07:54:03Z")

</div>

k i followed the tutorial… ig ot it to wokr… [http://tek-labs.com/songtext.swf](http://tek-labs.com/songtext.swf) it all works fine… and i udnerstnad putting the little music bars after the preloader, but i dont get how they come up in an exact spot on the songtext.swf… please help

---

<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:** [March 22, 2003, 1:25am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/16 "2003-03-22T01:25:14Z")

</div>

anyone?

---

<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:** [March 22, 2003, 3:27am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/17 "2003-03-22T03:27:21Z")

</div>

there’s a couple ways to go about this, but here’s the easiest IMO…

Make your bars it’s own movie, not movie clip - it’s own movie.  
Make it the same size as songtext.swf, and place your animations  
in the appropriate spot in relation to songtext.swf.

Then, after your preloader, put this code:

```auto
loadMovie("bars.swf", "10");

```

the “10” represents a level, so you can use whatever level  
necessary to fit your project. “bars.swf” obviosuly is the name of  
whatever your bars movie is.

Give that a try…

---

<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:** [March 22, 2003, 3:48am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/18 "2003-03-22T03:48:39Z")

</div>

i THINK i understand… so i have to make a seperate movie clip for the song and a sepereate one for the bars… what if i want there to be a loading bar, like on electrons site and i want the bar to show up inside the box, then i want the bars to start playing after the song is loaded… any thoughts? and thanks

---

<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:** [March 22, 2003, 4:12am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/19 "2003-03-22T04:12:12Z")

</div>

not movie clips, MOVIES. totally seperate new movie for the bars.

The loading shows up in your preloader for the sound, then load  
the bars.swf movie after it’s complete. understand?

---

<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:** [March 22, 2003, 4:15am UTC](https://forum.kirupa.com/t/streaming-mp3-files/15897/20 "2003-03-22T04:15:23Z")

</div>

so basically im loading 2 seperate movies at once… and i think i understand how to get the sound bars to appear, but theere are 2 problesm

how do i get the music loader to show up in the box

how do i get the black bars to appear AFTER the loader, and right when the music plays

[Next page](https://forum.kirupa.com/t/streaming-mp3-files/15897.md?page=2)
