Copy link to clipboard
Copied
I'm making an interactive media using html5 in adobe animate
I want to create a button that can play an audio for textspeech, so when pressed it will play the audio.
But I also want that when pressed once again the audio will be turned off
for the button to start it is already running, but for the button to turn it off in addition to the textspeech audio stopped my interactive media music backsound also stopped.
How do I stop the audio speech without turning off the audio backsound?
or are there any suggestions on how to make a textspeech or button that can be used to play the textspeech audio?
Here my code
I'm using a movieclip with 2 button, here code when clicking and play the text speech
and here the button to turn off the audio, but the backsound also stopped
because have a separate button to disable the music backsound.
Hi.
Createjs.Sound.play returns an AbstractSoundInstance that you can control.
So one approach is to store these returned instances in variables or objects so that you can have multiple sounds playing.
For example:
var sfx = createjs.Sound.play("coin");
var bgm = createjs.Sound.play("level1");
// ...
yourSfxButton.on("click", function(){ sfx.stop(); });
// ...
yourBgmButton.on("click", function(){ bgm.volume = 0.5; });
This link should help as a reference:
https://github.com/joao-cesar/adobe/tree/master/animate%20cc/html5_canvas/narrated_story
Copy link to clipboard
Copied
Hi.
Createjs.Sound.play returns an AbstractSoundInstance that you can control.
So one approach is to store these returned instances in variables or objects so that you can have multiple sounds playing.
For example:
var sfx = createjs.Sound.play("coin");
var bgm = createjs.Sound.play("level1");
// ...
yourSfxButton.on("click", function(){ sfx.stop(); });
// ...
yourBgmButton.on("click", function(){ bgm.volume = 0.5; });
This link should help as a reference:
https://github.com/joao-cesar/adobe/tree/master/animate%20cc/html5_canvas/narrated_story
Regards,
JC
Copy link to clipboard
Copied
@JoãoCésar Thank you for the reply!
from the references you gave
Copy link to clipboard
Copied
You're welcome!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now