Play sound via a text object


Attached Files

The following files have been attached to this tutorial:



Download now 373.06 KB


1,173 visits, 1,514 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.



Like you, I like to minimize code to the fewest lines as possible.

So here is a little trick I just discovered when I was given a game example by korbaach.

I hope this helps you too.

For this capx example, I use families,


if you wanted to use a sprite strip and name each animation frame separately,

that would work too.

To try the game in a new tab,

right click on the link

just below this line

Click Here to run sample game

Here is what the layout looks like (below),

just CLICK on an image after running.



here is the code (below)

thats all the code you need.

Its a bit confusing, but

you are accessing the audio via the text file ( in this case named item.text)




You will need to change the name of the animation frame

on each of the images to the corresponding sound file.

These names need to be the same or this will not work.






Smile if you think this tutorial will be useful in your projects

because smiles are free,

and so is clicking on favourite. :-) (hehe)



Download now 373.06 KB

  • Order by
Want to leave a comment? Login or Register an account!