Changing Screens

Using the setScreen command to change screens with code

The setScreen command changes the screen to show whatever screen you want. You specify the screen by its ID.

  1. Find setScreen in the UI Elements toolbox and drag it into the code workspace.
  2. Most of the time you change the screen in response to some user-event. In this case setScreen is being added to a "click" event handler for the image with ID "smileyFace"
  3. Select the ID of the screen you want to change to. In this case, when smiley face is clicked on the screen that says "hello" we want to change to the screen that says "goodbye."
  4. Key idea: Multiple Screens - One Coding Workspace. This is the code that handles a "click" event for an image that is on a different screen - the "goodbyeScreen". You can't see that image right now, or that screen, because the screen isn't selected. However, the code for it still goes here.

Found a bug in the documentation? Let us know at