I’m a newbie and learning how to use sound component. I made a simple app that has 2 buttons showing a cat and a dog, and a sound component. I want to make it play a cat mp3 file when the cat button is clicked, play a dog mp3 file when the dog button is clicked.
But when the app is started, no sound is played during the first click. Then when I clicked the cat button the 2nd time, cat mp3 file was played as expected. But then when I clicked the dog button, the cat mp3 file was played again. If I clicked dog button again, the dog mp3 file will play this time.
I think I might use the sound component wrongly. Somebody please help!
The code is as follows: