Answered
Canvass: How to listen for the end of a sound event
Hi. I finally got the first part of this working.
I am trying to check for end of a sound.
However, all the examples I see don't seem to work.
The console says I can't use .on
this.btn_play.addEventListener("click", buttonClicked.bind(this));
function buttonClicked () {
var instance = createjs.Sound.play("itemName");
//instance.on("complete", this.handleComplete, this);
if (itemName=="monkey") {
monkeyClickSound.play("monkeySound");
completeMonkeySound = monkeyClickSound.play("monkeySound");
completeMonkeySound.on("complete", this.handleComplete, this);
}
if (itemName=="froggy") {
froggyClickSound.play("froggySound");
}
this.genie.visible=true;
this.genie_static.visible=false;
//monkeyClickSound.on("complete", handleComplete, null, true);
}
function handleComplete() {
console.log("sound complete works");
this.genie.visible=false;
this.genie_static.visible=true;
}
