How to make a sketch editable in red color only after pressing a button?

I would like to give my students an opportunity to see the answer and then correct their work if necessary, and I want to be able to see their work before and after the correct answer is shown.
So I made 5 colors (blue, black, orange, purple, green) available when the “Check Answer” button presscount=0, and only 1 color (red) available when the “Check Answer” button presscount>0. It works if students stay with color blue, which is the initial color. However, if students change to a different color, for example, orange, orange will remain available even after the button is pressed.
Here is what I have so far.

Any suggestions, please?

Maybe make a second sketch set to initial and available color red, with it’s background set to the first sketch. Then, hide the original sketch when the button is pressed (i.e. hidden: button.pressCount>0) and reveal the second (i.e. hidden: button.pressCount=0).

I thought about making two sketches. However, students’ work done using Text or Math tool cannot be included as the background in the 2nd sketch.

I think you can accomplish what you want by restricting the available colours depending on stroke count and use that to force available colors to just one at a time. What the following does is:

  • Start with the (only available) color to orange

  • After they’ve sketched something, force change the (only available) color to blue

  • After they’ve clicked the button, force change the (only available) color to red

when this.sketch.strokeCount=0 colors.list(
when this.sketch.strokeCount=1 colors.list(
when b.pressCount>0 colors.list(
otherwise colors.list(

You can see this in action here

1 Like