Tag Archives: button toggle

How to make a toggle button

February 27, 2010

6 Comments

To make a button that stops or starts a music loop (variable name: “music”) depending on whether the music is playing already, create a true/false variable (in this case, “musicplaying”) and change it with the button: on (release) { if (musicplaying == true) { music.stop(); musicplaying = false; } else { music.stop(); // guard against [...]

Continue reading...