As you can see, I've named the handlers with a name that reflects the button they handle. Every one of them works exactly the same way, and in fact all I did was duplicate the first handler, dragged all the blocks out of the duplicate and put them in the next handler, changing the details as necessary and discarding the now empty duplicate. So let's look at one of them and we've seen them all.


So, the event handler that contains the active code blocks here is when Buttontrouserflapper.Click and that will only run the enclosed blocks when that button has been pressed.

With regard to that code, I've gone a bit convoluted here because I've put if not player1.IsPlaying = true when I could I just have put if player1. IsPlaying = false which would have worked just as well; it's because I'm a bit old school and tend to think in double negatives with logic arguments which sometimes pays off and sometimes just makes you look antiquated as is the case here.

So, if the button's been pressed and the player's not doing anything, we tell it firstly what to play:

set Player1.Source to TrouserFlapper.MP3

Notice how the full filename is given, and it's put in a text block dragged from the blocks window on the left and the filename is typed in. Now it knows what to play, we tell it to play it:

call Player1.Start

It's that simple. Really. As I said, all the blocks work the same way. Here's pantsripper:


And so all one has to do is the change the name of the MP3 file that is requested to be played.

A nice and simple app that can be created inside of an hour. That's what we like! Now let's look at something a bit more complicated; the electronic dice machine.