I have three buttons that each play a different sound when they have focus. Problem is, I want to stop the sound when I go from a button to another, yet the sound of previous button overlaps with the new focused button. How can I fix it?
Are you stopping the sound on mouse out?
I am not using mouse, I only use keyboards, up and down.
Ok, can you stop the sound on âfocus lostâ then?
I do not know how to stop the sound. Iâve read that there should be a node called like âStopâ or âStop Audioâ but I didnât manage to find it.
Thanks for your reply. I didnât realise I needed to get a variable to call âStopâ.
I made this mess, and I see nothing wrong with it. Yet, it doesnât solve the problem. Sounds from previous button focus, overlap with new button focus sound. Any idea?
edit: I saw something wrong with it.
I think code can not go past âSet Timer By Eventâ since it technically loops forever. So I moved âStopâ nodes âSoundEffectOnFocusâ custom event. Now it works perfectly. Still, I get errors after ending the simulation since sometimes I am trying to close a sound effect that was not spawned to begin with. Would that be a problem or am I okay?
Itâs best to get rid of none errors, if you can
Do you have any idea? I am not quite sure on how to use âOn Focus Lostâ and âOn Focus Receivedâ events. I tried to use them but I do not know how to assign them to a widget. If I could use those events everything would be much simpler. I am kind of having writerâs block right now.
edit: nvm got it. I used âis validâ function to check if a sound is playing.
You click the âon focusâ plus signs ( near the bottom of the page in the button details in layout ), to write code for when that happens.
The just play your sound when the button gets focus, and stop it when it loses focus
I do not have an option for that. Only âClickedâ, âPressedâ, âHoveredâ, âUnhoveredâ, âReleasedâ
Use hovered and unhovered then?
Nope. Only works for mouse
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.