all groups > macromedia flash sitedesign > november 2005 >
You're in the

macromedia flash sitedesign

group:

Streaming Audio on Flash MX - Help


Streaming Audio on Flash MX - Help Ravenssagw
11/6/2005 8:57:32 PM
macromedia flash sitedesign:
I have a flash website @ www.ravens-place.com. I am looking to stream audio
samples on the music page, but to protect rights, I do not want it available
for download. How do I stream audio? Any step by step programming advice will
be greatly appreciated. Thank you for your time and patience.
Re: Streaming Audio on Flash MX - Help anonymusflasher
11/6/2005 9:48:07 PM
You can do this using the loadSound method

mySound = new Sound();
mySound.loadSound("http://whatever.mp3", true);
mySound.play();...

The first parameter specifies where the sound file is located. The second
parameter specifies whether the sound should be streamed or not. (true =
streams).

or if you are programmactically challenged, you can create streaming sounds
inside the flash timeline at author time by:

1. Import your sound sample into the library (File -> Import)
2. Create a new layer in your timeline and call it whatever you like (this
will hold the sound)
3. Go to the first keyframe in that layer and look at the Properties
Inspector.
4. Click on the "Sound" combo-box and click on the sound file you imported.
5. Clikc on the "Sync" combo-box right below it and select "Stream"
6. Test Movie

It will play your sound sample. Because you specified the sound as streaming,
it will play the sound almost immediately after the flash loads onto the page.
But in my opinion i like to do it by code because it gives you more control.
But you do whatever you want.

I hope this answers your question.
Re: Streaming Audio on Flash MX - Help Ravenssagw
11/7/2005 12:00:00 AM
Re: Streaming Audio on Flash MX - Help anonymusflasher
11/10/2005 12:00:00 AM
Sure! However, i don't recommend that you import all your song samples into the
Flash Library because it will most likely make the filesize a lot bigger (which
might take forever for some users).

You can do this:

mySound = new Sound();

playTrack1btn.onPress = function() {
mySound.stop();
mySound.loadSound("track1.mp3", true);
mySound.play();
}

playTrack2btn.onPress = function() {
mySound.stop();
mySound.loadSound("track2.mp3", true);
mySound.play();
}

playTrack3btn.onPress = function() {
mySound.stop();
mySound.loadSound("track3.mp3", true);
mySound.play();
}
...

Get it? Everytime one presses a certain button it stops the sound if it it's
playing and load another sound to the mySound Object. (It will automatically
unload any previously loaded songs) then plays them.

I just found out you can omit the "http://" in the URL if you place the music
samples in the same folder as your swf.

Hope this answers your other question.

AddThis Social Bookmark Button