Step 19: Coding the Clear Button

Goal:


Next let’s add the code for pushing the ClearButton.

This code will clear any doodles we’ve made on our screen using a function built into the Canvas.

Steps:

  1. Under the section labeled Blocks select ClearButton.
  2. Grab and place the block labeled “when ClearButton.Click”.
  3. Under Blocks select Canvas1.
  4. Grab and place the block labeled call Canvas1.Clear.

Code:


Click to replay