'From Squeak3.3alpha of 18 January 2002 [latest update: #4827] on 18 April 2002 at 2:34:48 pm'! "Change Set: simplerFlasher-sw Date: 18 April 2002 Author: Scott Wallace A simpler and cleaner flasher"! EllipseMorph subclass: #Flasher instanceVariableNames: 'onColor ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Demo' module: #(Squeak Morphic Demo)! !Flasher commentStamp: 'sw 4/18/2002 23:51' prior: 0! A simple example - a circle that flashes. The "onColor" instance variable indicates the color to use when "on", A darker color is used to represent "off". The #step method, called every 500ms. by default, alternatively makes the flasher show its "on" and its "off" color.! !Flasher methodsFor: 'initialization' stamp: 'sw 4/18/2002 13:45'! initializeToStandAlone "Initialize the flasher." super initializeToStandAlone. self setInitialState! ! !Flasher methodsFor: 'initialization' stamp: 'sw 4/18/2002 13:56'! setInitialState "Initialize the flasher's appearance and onColor" color _ onColor _ Color red. self borderWidth: 2. self extent: 25@25! ! !Flasher methodsFor: 'stepping' stamp: 'sw 4/18/2002 14:01'! step "Perform my standard periodic action" super step. onColor ifNil: ["this instance was probably created by 'Flasher new openInWorld', and hence is not yet set up to function propertly, so..." self setInitialState]. color = onColor ifTrue: [self color: onColor muchDarker] ifFalse: [self color: onColor]! ! !Flasher methodsFor: 'stepping' stamp: 'sw 4/17/2002 12:05'! stepTime "Answer the desired time between steps, in milliseconds." ^ 500! ! !Flasher class methodsFor: 'parts bin' stamp: 'sw 4/17/2002 11:37'! descriptionForPartsBin "Answer a description of the receiver for use in a parts bin" ^ self partName: 'Flasher' categories: #('Demo') documentation: 'A circle that flashes'! ! Smalltalk removeClassNamed: #FlasherMorph.!