usinf animate HTML5 Canvas, i need the very basic sctript to play sound from library
- Go to the Library and give a linkage name to your sound.
- Then use the static play method from SoundJS:
- If you want to stop the sound, you first store the AbstractSoundInstance that is returned by the play method in a variable or property and then use it as a reference later on. Like this:
this.voice0 = createjs.Sound.play("Voice0"); /* . . . */ this.voice0.stop();
I have a sample of a narrated story in my GitHub repo that demonstrates how to use this method to play voices and a background music to tell a story if you're interested.
I hope this helps.