Attach a sound MP3 to a button?

I want to build an app that allows users to hear the sound of a given word by pressing the button that has it on. I have seen entries from several years ago on how to do this, written for full coders; is there an easy way that a non-coder can use, or is there a complete (idiot non-coder's) instruction on how to add an MP3 to a button in the current version of mendix?
3 answers

I recommend the JavaScript Button. It is possible to store urls of sounds you would like to play in an audio

  • <audio id="testAudio" src=""></audio>

and then use the JacaScript button to find the audio by id

  • var myAudio = document.getElementById('testAudio') ;

and play

  • myAudio .play();

You will just have to host your audio files somewhere to access them.

I have not tried if it is possible to put mp3 files in a resource folder in your project and access them there.


If you are interested to learn more about the basics and functions of Mendix, you can have a look for the learning paths on the Academy section on that page. 


Many thanks for your reply. As a newbie, I am not sure where to put the Javascript button so that the system knows where to find it, or where I find a resource folder in my project to try the MP3s. Can you point me in the right direction? 

Also, do you recommend that I learn the basics of javascript to use with mendix? I know just enough about programming to be seriously incompetent at this stage, although I have built great functional programs in excel for many purposes, and used a small amount of VBA in the process. If using the button, all I have to do is copy and paste the snippets above into the button and substitute the filename in each case, no problem, but I have never written a line of javascript before.