[Newbies] Re: Timer in Morph

Andreas Raab andreas.raab at gmx.de
Thu Feb 4 21:37:38 UTC 2010


Garret Raziel wrote:
> hi, can anyone help me with some code? I want to have a Morph object 
> that change his color by values that squeak gets from SerialPort. I have 
> wroted code of getting values and changing color but I dunno how to do 
> that the morph change its color forever. If i call method "AMorph 
> changeColor" in some to:do: it stucks and shows only last color. I want 
> to use some kind of timer, that will call this method every second and 
> updates this Morph. what must I use?

Use stepping, i.e.,

MyMorph>>wantsSteps
	"Yes, please"
	^true

MyMorph>>stepTime
	"1/sec please"
	^1000 "msecs"

MyMorph>>step
	self changeColor.

Cheers,
   - Andreas


More information about the Beginners mailing list