Why the program runs through the playButton onEvent twice (on the initial version) after clicking the downButton then upButton again (even though the button has only been clicked once)?
I’m having a difficult time coming up with a concise explanation.
If you are referring to the Music Player app, the problem is that all subsequent onEvents after the upButton are nested inside the onEvent for the upButton.
Besides fixing the nested onEvents, I feel there is another problem. If the play button is pressed once, and then pressed a second time without pressing the stop button in between, there will be a “canon” effect. That is to say, a new melody plays, but the old melody is still playing, so you have two overlapping melodies. The more times you press the play button, the more overlapping melodies you get. I feel, that this is not the intended outcome
To fix this issue, I added one more line of code in the playButton onEvent. It’s a stopSound command. Here you can see a screenshot of the fix.