Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Button function after a certain time

Guest
Nov 21, 2018 Nov 21, 2018

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.

564
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 21, 2018 Nov 21, 2018

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"); 

}

Translate
Community Expert ,
Nov 21, 2018 Nov 21, 2018

you can add your rollover listener to the frame where the clouds stop or where the timeline reaches 10 seconds.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2018 Nov 21, 2018

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2018 Nov 21, 2018

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2018 Nov 21, 2018

No, at first I did it manually. I klicked the button and pasted the audio file on the "over" state at the timeline (screenshot).

Greenshot 2018-11-21 17.34.55.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2018 Nov 21, 2018

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"); 

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2018 Nov 21, 2018

thank you so much, you helped me a lot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2018 Nov 21, 2018
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines