Write the redButton button's onEvent first, then the offButton button's. Each one sets the background color of the lamp element and says what happened in the statusLabel label.
After a click on the redButton button, the lamp element is red, and the statusLabel label says "The lamp is red."
9 strips: B1 to B9
setProperty("lamp", "background-color", "red"); B1}); B2}); B3setProperty("lamp", "background-color", "black"); B4setText("statusLabel", "The lamp is red."); B5setProperty("lamp", "text-color", "red"); B6onEvent("redButton", "click", function() { B7onEvent("offButton", "click", function() { B8setText("statusLabel", "The lamp is off."); B9Order: B7, B1, B5, B2, B8, B4, B9, B3. Extra: B6
Lines with the same mark can go in either order.
onEvent("redButton", "click", function() {
setProperty("lamp", "background-color", "red");
setText("statusLabel", "The lamp is red.");
});
onEvent("offButton", "click", function() {
setProperty("lamp", "background-color", "black");
setText("statusLabel", "The lamp is off.");
}); Extra strip: setProperty("lamp", "text-color", "red");. "text-color" changes the color of the text on the lamp, not its background. The lamp itself stays the same color.