PDA

View Full Version : loadSound();


joeri
08-15-2002, 08:07 PM
Hi,

I tried to load a sound and manage it with some buttons but it didn't really work......???
I did the following :


sound_object = new Sound();
sound_object.loadSound("music/mymusic.mp3",false);


On the buttons(on a other layer) that should control the sound I placed the following script :


//button1
on(release){sound_object.start();}

//button2
on(release){sound_object.stop();}

I used false in the load statement because the file eventually is stored onto a cd-rom, so a streaming sound is out of the question.
Perhaps I should use the attachSound() method??
And is the sound palyed automatically when you load it?Should I therfore use a stop action directly when I load it?

Thanx, Joeri

Jesse
08-16-2002, 04:16 AM
attachSound willr equire you to include the sounds in your FLA and SWF. I would encourage you to stick with loadSound(). That code should work fine...
A basic example of code is:
mySound = new Sound();
mySound.loadSound("aa.mp3", false);
mySound.onLoad = function(success) {
// Some actions
};
mySound.start();
Make sure your paths are to correct (on your buttons, make sure you're targets are correct).