Link in Zwischenablage kopieren
Kopiert
Good evening, i'm new to the flash/animate universe and i have some questions about it.
I'm trying to create an html5 canvas document where there is a button who has to play and stop a sound.
Following a tutorial instruction i have been able to animate the button and make it sound after the is clicked, but i need to use it also to stop the sound.
How can i do that?
thanks for answers
Link in Zwischenablage kopieren
Kopiert
Recently discussed here:
SoundJS with Flash HTML5 Canvas - pausing sound & updating the lib?
Link in Zwischenablage kopieren
Kopiert
thanks but i'm trying to do it not with code, or i'd used a library but using the animate button states and code snippets. the problem is that when i add an audio file to the button i just can play it as an event, i don't know how to use the stop event because the software does not make me select it
Link in Zwischenablage kopieren
Kopiert
You can't do this without code (and code snippets are, of course, code).
How, exactly, are you currently making the audio file play?
Link in Zwischenablage kopieren
Kopiert
hi man, sorry if i had not thank you before for the answer but i was on mobile, i'll do now for both answers D.
It's my first time with easejs so i still don't know functions and code snippets. I have a button. I imported into the library a sound that i want to play when it is pressed. I double clicked on the button and i created a keyframe for the down state of the button and i used it to play the audio.
I don't know why if i go on another frame why i can't select the "stop" event and give it to a button state
Link in Zwischenablage kopieren
Kopiert
I'm going to assume that by "used it to play the audio", you mean you placed the audio directly on the timeline. In that case, the only way to stop it prematurely is with this:
createjs.Sound.stop();
This will kill ALL currently playing audio.
Link in Zwischenablage kopieren
Kopiert
No i imported it into the library. I would make a screenshot of it, but unfortunately the app is in italian so i think that it would be quite useless. Thanks for your advices
Link in Zwischenablage kopieren
Kopiert
Importing audio into the library doesn't make it play.
Link in Zwischenablage kopieren
Kopiert
as you can see there is the down (the yellow one) state of the button with a keyframe and on the right the mp3 selected in the library.
Doing that i imported the audio file in the timeliine?
Link in Zwischenablage kopieren
Kopiert
So yes, you did place the audio on the timeline, just like I said. That Name/Nome dropdown isn't the library. The Library/Libreria tab is the library.
If you want to start and stop the sound by clicking on the same button, that's not going to work. You're going to need some code to track the button state and determine whether it should be starting or stopping the sound.
Link in Zwischenablage kopieren
Kopiert
yeah i have been able to do it with the animation of the button but not with the button. is there a code reference to see what functions i have to use to do what you said?
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen