send <messageName> [<parameter1> [, <parameter2>[, ...]]] to <target> [in <ticks>]

send mouseUp to button "OK"
send doSpecialThing "Sioux Atkinson","Dan Winkler","Rebecca Bettencourt" to project "Home" in 240 ticks


Use the send command to invoke a command handler in another object. Like just writing a message and its parameters on a line, the send command lets you send a message. However, with send, you can control which object a message is sent to, or delay a message and have it sent after a small delay.

Delayed messages as timers

If you want to periodically run a script, e.g. to show an animation by flipping through icons on a button, you can repeatedly use send ... in ..., like:

on mouseUp
	define the firstIconID of me
	define the lastIconID of me
	set the firstIconID of me to 12001
	set the lastIconID of me to 12024
	send animate to me in 2 ticks
end mouseUp

on animate
	put icon of me into theIcon
	add 1 to theIcon
	if theIcon > lastIconID of me then
		set icon of me to firstIconID of me
		set icon of me to theIcon
	end if
	send animate to me in 2 ticks -- endlessly call this to call itself to animate to the next frame
end animate

See Also