How to add sound effect for button for CryEngine UI

#1
I have tried add add sound into button in Flash Asset (https://youtu.be/JiFFVzUxARE?t=2m16s - I add sound with Adobe Flash's GUI, haven't tried ActionScript yet)
But when I apply the UI to the game, the sound, which I added in Flash, is not working. So how can I properly add sound effect for button for CryEngine UI?
(I think the most painful way is: catching the event of the button (fscommand()) and play sound with C++ when the event is triggered, I hope there is a better way)
Small tips
How to add an image to a forum post
[C++] How to smoothly turn your character

Re: How to add sound effect for button for CryEngine UI

#3
To elaborate on what asfor kindly suggested;

If you use ActionScript you can expose your ActionScript functions to the Sandbox Editor as a FlowGraph node. This way you can create an event you can handle via FlowGraph like a button click. You can then use FlowGraph to trigger a sound file to play.

An example would be:
http://docs.cryengine.com/display/SDKDO ... ashDevelop
Note: The important stuff here is t he ActionScript and XML file.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: How to add sound effect for button for CryEngine UI

#4
To elaborate on what asfor kindly suggested;

If you use ActionScript you can expose your ActionScript functions to the Sandbox Editor as a FlowGraph node. This way you can create an event you can handle via FlowGraph like a button click. You can then use FlowGraph to trigger a sound file to play.

An example would be:
http://docs.cryengine.com/display/SDKDO ... ashDevelop
Note: The important stuff here is t he ActionScript and XML file.
Do you mean like this?
In ActionScript2, I have function PlayClickSound(), PlayHoverSound() which are just empty functions. I call these functions when the button is hovered / Clicked in ActionScript2.
In CryEngine's flow-graph, I connect OnCall event of function PlayClickSound() or PlayHoverSound() to the node that play sound.

Mm... I think this is less painful for me if I understand it correctly.
Small tips
How to add an image to a forum post
[C++] How to smoothly turn your character

Re: How to add sound effect for button for CryEngine UI

#5
Essentially the correct idea but you need to define the events a little differently.
Check the bottom of the page I linked in my previous post. You need to setup your events so Flowgraph can tell it is a node that will be called from the UI rather than from the engine.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: How to add sound effect for button for CryEngine UI

#6
On second thought, play sound for UI with C++ is not so bad. The events from the UI always trigger the function OnUIEvent() in C++ anyway (because I have registered the event of this UI screen with IUIElement::AddEventListener()). So all I need to do is add a switch case for UI sound. In the Adobe Flash, I just call the fscommand("btnSound_Hover") in the event onRollOver of all the buttons. for example:

Code: Select all

btnExit.onRollOver = function() { fscommand("btnSound_Hover"); } btnPlay.onRollOver = function() { fscommand("btnSound_Hover"); } ....
But what I'm afraid is that I may miss it for some buttons, If only there is way that I write one fscommand("btnSound_Hover") that apply to all the buttons in the menu.
Small tips
How to add an image to a forum post
[C++] How to smoothly turn your character

Who is online

Users browsing this forum: No registered users and 1 guest

cron