PDA

View Full Version : Dynamically playing sound files


jlmjr
06-24-2002, 09:35 PM
I have a collection of wave files that will be continually changing. I can't recreate my flash movie everyday. Is there a way to create a generic flash movie that will play whatever wave file I tell it to from a webpage?

ScratUAD
06-24-2002, 09:45 PM
somehow you may be able to load the sounds dynamically...
if you are going to do that... use a preloader.
then you should be able to insert a controll into your fla file that will select which shound you want.

check the tut's for both the preloader and the dynamic loading.

tg
06-24-2002, 11:16 PM
far as i know, ya need mx to load sounds dynamically, unless you want to wrap them all in a swf file first.

don't know how with mx, havn't been mxtified yet.

ScratUAD
06-25-2002, 12:37 AM
ya, see, I'm already using MX... got it a week after they released it.

nick_kind
09-03-2002, 02:01 PM
Hi there,

Did any of you guys manage to find out how to load sound dynamically?

I know it has to be an mp3 and it can only be done in mx.

AT the moment I am using this line of code

loadSound("French\a.mp3" ,true);

But nothing !!

ANyone got any ideas??

Cheers

ScratUAD
09-03-2002, 02:51 PM
ok...
that should work....
are you using any code to play the sound?
because that line of code... will only load it... not play it.

this is the code I used to play my sound... (but mine wasn't loaded dynamically)
you should be able to load the sound to a variable and use that variable to play it... here's my code.

mySound = new Sound();
mySound.attachSound("theme");
_root.playbutton._visible=false; //--for play button only --\\
_root.stopbutton._visible=true; //--for stop button only --\\
mySound.start(1,100);

if you don't want play stop buttons, discard the button code.
(you have to make your own play stop buttons)

try that.

nick_kind
09-03-2002, 03:01 PM
Okay so now I'm trying it this way, but still no coconuts!!

mySound = new Sound();
mySound.attachSound("English\a.mp3");
mySound.loadSound("English\a.mp3", true);
mySound.start(1, 100);

is 'mySound' actually a movie clip?

Cheers

NIck Kind

ScratUAD
09-03-2002, 03:22 PM
nah... mysound is just a variable.

ScratUAD
09-03-2002, 03:25 PM
maybe try it this way

mySound = new Sound(); //declare your variable (and type)

mySound.loadSound("English\a.mp3", true); //load the sound

mySound.attachSound("English\a.mp3"); //attach it

mySound.start(1, 100); //play it

you may not need to attach the sound since you are loading the sound straight dynamically, in my movie... the sound was part of the movie... like.... imported. not dynamically loaded.