Code to stop a song
in
Programming Questions
•
3 years ago
Hi,
I've got an image divided in areas. Any area correspondes at a sound file that must start when the cursor pass on the relative area. This my code part it's ok. Here the problem: sometimes, when the cursor changes area, the new song start, but the precedent continuos. It happens only with some areas.
I'm using this code to play and pause:
if(mouseX> 523 && mouseX < 693)
if (mouseY> 360 && mouseY < 508) {
song1.play();
}
else{song1.pause();
}
Can you help me with code, please?
Thanks,
Zackaria
I've got an image divided in areas. Any area correspondes at a sound file that must start when the cursor pass on the relative area. This my code part it's ok. Here the problem: sometimes, when the cursor changes area, the new song start, but the precedent continuos. It happens only with some areas.
I'm using this code to play and pause:
if(mouseX> 523 && mouseX < 693)
if (mouseY> 360 && mouseY < 508) {
song1.play();
}
else{song1.pause();
}
Can you help me with code, please?
Thanks,
Zackaria
1