Copy link to clipboard
Copied
Hi, I'm a new user of Adobe Animate and I have a problem.
I'm creating an interactive Image with HTML5 canvas. The project begins with two clouds flying in and then staying at a certain place. When they stop they should make a sound if you hover over them, but only if they stop not when they are flying in. I don't know how to do this. Is there a way to add a function to a button on a certain time in the timeline (for example after 10 seconds, when the clouds stop)?
I've been trying to do this a difficult way with to different objects. At first the clouds with the sounds are hidden, then the other ones without the sound fly in and then hide, then they stop and the other ones show. But although the ones with the sound are hidden at first, it plays the sound when i hover over the place where they will be (although there ist nothing to be seen). But maybe this way is too complicated anyway. I don't really know how to manage this. I'm sorry if this is a stupid question. I hope someone can help me and that this was understandable. Sorry for my bad English.
stage.enableMouseOver(10); // 10 updates per second
createjs.Sound.registerSound("./sounds/Som1.mp3", "soundID");
this.mc.addEventListener('rollover',f.bind(this));
function f(e){
createjs.Sound.play("soundID");
}
Copy link to clipboard
Copied
you can add your rollover listener to the frame where the clouds stop or where the timeline reaches 10 seconds.
Copy link to clipboard
Copied
thank you very much for your answer! I've actually never heard of "rollover listener", is that an ActionScript term? Is that the same as mouseover in JavaScript? And when I created the Event Listener how do I tell it to play the audio file?
Copy link to clipboard
Copied
dianam12406399 wrote
And when I created the Event Listener how do I tell it to play the audio file?
Err... haven't you already done this? How are you playing the sound on rollover now?
Copy link to clipboard
Copied
No, at first I did it manually. I klicked the button and pasted the audio file on the "over" state at the timeline (screenshot).
Copy link to clipboard
Copied
stage.enableMouseOver(10); // 10 updates per second
createjs.Sound.registerSound("./sounds/Som1.mp3", "soundID");
this.mc.addEventListener('rollover',f.bind(this));
function f(e){
createjs.Sound.play("soundID");
}
Copy link to clipboard
Copied
thank you so much, you helped me a lot!
Copy link to clipboard
Copied
you're welcome.