There are four types of mouse interaction. Each event fires the routine assigned to it.
Each type of mouse event can apply to the canvas or to individual sprites.
Use "set mouseup=MouseUpHandler" inside a routine to set the handler routine for the whole canvas.
Use "mouseup=MouseUpHandler" inside the "where" clause of a sprite to apply the handler routine to the sprite only.
Of course MouseUpHandler can be named anything as long as it is a routine.
Check out the reference for full details.