PDA

View Full Version : loading sound files dynamically


dizzyllama
11-20-2002, 09:11 PM
i've been driving myself crazy trying to use loadSound ... if someone knows where I'm going wrong, please point me in the right direction:

attachSound works, but thats only useful if the sound is available as a library resource -- this script works fine:

testlibrary = new Sound();
testlibrary.attachSound("hello.mp3");
testlibrary.start();


BUT for some reason using loadSound with that mp3 file does nothing. When the following script is tested, no audio is played:

testhello = new Sound();
testhello.onLoad = function() {
trace("starting sound");
testhello.start();
trace("sound started");
}

trace("loading sound");
testhello.loadSound("hello.mp3",false);
trace("sound loaded");

the flash Output window displays:

loading sound
starting sound
sound started
sound loaded


any ideas why this fails?

Billy T
11-21-2002, 12:15 AM
try

testhello = new Sound();
testhello.loadSound("hello.mp3",true);
testhello.start();

also try a few different mp3s...some are not compatible...

dizzyllama
11-21-2002, 03:27 AM
thanks! I tried downloading a few other mp3 files, and they worked, so I guess the ones I've been working with are incompatible ... do you know what makes an mp3 compatible, or whether .wav files can be used?

Billy T
11-21-2002, 06:10 AM
no I don't think you can use wav

can't remember what makes some files incompatible sorry...maybe the ID3 tags?

simontheak
11-27-2002, 08:14 AM
I had a similar problem to this a while ago.

I had a bunch of MP3's that would play fine when using them normally on the desktop. However, when I played them through Flash they played at what must have been 5 times their original speed, producing a squeeky noise that sounded as though the song was being sung on helium

Does anybody know why this might be? Somebody suggested that this might have something to do with the rate at which the original MP3 was recorded. Is this likely to be true? And if not does anyone have any other ideas??

Thanks very much

golabi
11-29-2002, 11:07 AM
how can i loop mp3 ???

Billy T
11-29-2002, 11:23 PM
testhello = new Sound();
testhello.loadSound("hello.mp3",false);
testhello.start(0,999);

rlee
11-30-2002, 05:22 AM
hi, just wanna to know

_root.onEnterFrame = function(){
if (_root.MC1.hitTest(_root.MC2)){
testlibrary = new Sound();
testlibrary.attachSound("hello.mp3");
testlibrary.start();
}
}

the sound start and start and start again while MC1 hit MC2, however, I just want the music play once. Any suggestions????

thx.

Billy T
11-30-2002, 05:33 AM
started=false;
_root.onEnterFrame = function(){
if (_root.MC1.hitTest(_root.MC2)&&started==false){
testlibrary = new Sound();
testlibrary.attachSound("hello.mp3");
testlibrary.start();
started=true;
}
}

rlee
12-02-2002, 02:23 AM
many thanks.