U3L7 Level 6 - Music Player

Does anyone notice that the music is still layering and how to correct it?

// In this level the first onEvent is also holding all the other onEvents.
// This is what is causing this issue as it starts layering the sounds.
// To fix it, just end the first onEvent right after the setProperty line
// on line 11 in this answer and remove the “});” from the end.

// Show the controls when the user clicks the up button
onEvent(“upButton”, “click”, function( ) {
console.log(“Showing controls”);
setProperty(“downButton”, “hidden”, false);
setProperty(“playButton”, “hidden”, false);
setProperty(“stopButton”, “hidden”, false);
});

// Hide the controls
onEvent(“downButton”, “click”, function( ) {
setProperty(“downButton”, “hidden”, true);
setProperty(“playButton”, “hidden”, true);
setProperty(“stopButton”, “hidden”, true);
console.log(“Hiding controls”);
});

// Play the music
onEvent(“playButton”, “click”, function( ) {
playSound(“sound://category_loops/vibrant_game_musical_harping_movement_loop_1_accents.mp3”);
console.log(“Playing song”);
});

// Stop the music
onEvent(“stopButton”, “click”, function( ) {
stopSound();
console.log(“Stopping song”);
});

Try stopping the sound before playing it again when the play button is clicked.

I have not tested it in a while.

I opened a bug up for it last year. You should open another.