Sounds

From IfsoGUIWiki

Jump to: navigation, search

Sounds

Gadgets are capable of playing sounds when they emit Events. Each gadget can have a sound (TSound) attached to it for each event, then when the gadget emits the event, the sound will automatically be played. Gadgets can only play sounds for Events they normally emit. Check the documentation for each gadget to see which events they emit.

To add a sound to a gadget's event, just call the AddSound function.

Example

In this partial example, a local button is created, a sound is added to the Click Event and it is added to the GUI. At that point, if the button is clicked, the sound will be played.

Local clickSound=LoadSound("Click.wav")
Local mybutton:ifsoGUI_Button = ifsoGUI_Button.Create(5,5,100,25,"btnSample", "Click Me")
mybutton.AddSound(ifsoGUI_EVENT_CLICK, clickSound)
GUI.AddGadget(mybutton)
Personal tools