Copy link to clipboard
Copied
Hi!
I wrote this code below but my pause button won't work. The play and stop are ok. Could anyone tell me why? I openned dev mode in my browser and no errors have been pointed out.
Hi.
Sorry for not having answered on the other topic.
First you store the current sound in a variable and then you access its paused property and stop method.
With that being sad, your code should be like this:
var root = this;
var sound;
root.stop();
root.btnPlay.addEventListener("click", playSong1);
root.btnPause.addEventListener("click", pauseSong1);
root.btnStop.addEventListener("click", stopSong1);
function playSong1()
{
sound = createjs.Sound.play("SongToPlay1");
}
function pa
...
Copy link to clipboard
Copied
Hi.
Sorry for not having answered on the other topic.
First you store the current sound in a variable and then you access its paused property and stop method.
With that being sad, your code should be like this:
var root = this;
var sound;
root.stop();
root.btnPlay.addEventListener("click", playSong1);
root.btnPause.addEventListener("click", pauseSong1);
root.btnStop.addEventListener("click", stopSong1);
function playSong1()
{
sound = createjs.Sound.play("SongToPlay1");
}
function pauseSong1()
{
sound.paused = true;
}
function stopSong1()
{
sound.stop();
}
I hope it helps.
Regards,
JC