all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

loadSound method problem


Re: loadSound method problem tralfaz
4/25/2004 2:43:38 PM
flash actionscript: [quoted text, click to view]

The start command won't work until the song is finished loading so you need
a preloader. Also, don't put a hard drive reference like
"C:\SONGS\song.mp3", just put "song.mp3" and make sure that the song.mp3 is
in the same directory as the flash file. Then it works for hard drive or
web the same way.
If the mp3 plays at the wrong speed then it is recorded at the wrong sample
rate for Flash. You need to make sure the mp3 sample rate is 11khz, 22khz
or 44khz. Other sample rates are not supported by Flash and they may run at
the wrong speed and sound like chipmunks.

Here is some code that you can use to preload and start a sound file with
(non- streaming)
tralfaz

mySong = new Sound();
mySong.loadSound("song.mp3", false);
id = setInterval(preloader, 100);

function preloader(){
if((mySong.getBytesLoaded() == mySong.getBytesTotal()) && mySong.duration
[quoted text, click to view]
{
mySong.start();
clearInterval (id);
}
}

loadSound method problem Graff|ti
4/25/2004 5:35:13 PM
I use these lines in a movie:
s=new Sound();
s.loadSound("some url (This adress is from my hard drive, and it's
correct)",FALSE);
How can I make the Sound play? It doesn't start automatically.
I know it loads, I checked with getBytesLoaded and the value matched.
If I put TRUE instead of FALSE, It plays, but very rapidely, not at normal
rate, but at load rate.
s.start(0,1) won't make it play.
I can't s.attachSound, cause the parameter must be a linkage name, and the
sound has just loaded, it doesn't have any linkage name.
There is probably a simple solution, but if so, it's done a great job eluding
me.
AddThis Social Bookmark Button