Codementor Events

Squeak/Smalltalk: Create Flasher object and openInWorld

Published Nov 26, 2022
Squeak/Smalltalk: Create Flasher object and openInWorld

Squeak Smalltalk comes with many built-in objects and one of the most simple and straight forward is Flasher. It’s based on EllipseMorph and it flashes every 500 milliseconds. The default flashing color is red, but it can be changed. This object can be seen in the objects window.
flasher-objects.PNG

Here is how to create an instance of Flasher using objects window.
flasher2.gif

You can also find this object in the System Browser here in case you want to see in depth details.
flasher-squeak.PNG

And finally, here is my code examples that show how to create 2 new instances of Flasher class and show them in the world.

Code Example

flasher := Flasher new.
flasher openInWorld.
 
greenflasher := Flasher new.
greenflasher onColor: Color green.
greenflasher openInWorld.

Demo

flasher.gif

I hope it was helpful and makes you think differently about programming. Watch this space for more Smalltalk related articles and tutorials.

💡 Note: Please see my older article if you want to know how to get started with Squeak/Smalltalk.

Discover and read more posts from Humayun Shabbir
get started
post commentsBe the first to share your opinion
Show more replies