I would like to play a sound when I click on an image. But when I quickly click on it again, it doesn't play it again because the other is not finished. How can I adjust this?
My code:
var click;
click = new Audio("sound/ping.mp3")
click.volume = .75;
circle.on("click", handleMouseEventClick);
function handleMouseEventClick(evt){
click.play();
punten += 1;
score.text = "Score: " + punten;
stage.removeChild(this);
stage.update();
}
Thanks!
Try this:
function handleMouseEventClick(evt){
if(!click.paused){
click.pause();
click.currentTime = 0;
click.play();
}
else click.play();
}