4.13 Drop Down Help

Dropdowns are bit more complicated than buttons because we need to add a conditional inside the event to check which option was selected. Because this is beyond the scope of programming, students may have to move to the full App Lab to get access to these commands. Assuming a dropdown with id “menu”, your code might look like:

onEvent("menu", "change", function(event) {
  var choice = getProperty("menu", "value");
  if (choice == "Red") {
    setScreen("red");
  } else if (choice == "Green") {
    setScreen("green");
  } else if (choice == "Blue") {
    setScreen("blue");
  }
});
1 Like