I’ve put this scipting at the beginning of of my flash file, but now I want to add a music on/off button. One button. What scripting do I use for the button?
mySound.stop();
mySound = new Sound();
mySound.loadSound("sound_1.mp3", false);
mySound.setVolume(40);
mySound.start(0, 100000);
ok… my bad… sorry but haven’t tested that code.
The fact is that even if you stop the sound, sound.position remains the number of miliseconds the sound has been playing, and does not revert to 0 (as i supposed it would :p)
I put a variable that checks if the sound is playing… try this code
on (release) {
if (mySound.isPlaying != false)
{
mySound.stop();
mySound.isPlaying = false;
}
else
{
mySound.start(0, 100000);
mySound.isPlaying=true;
}
}
and where you start the sound you should also define the variable