Constraining 'grab'

Ken Norris (dialup) pixelbird at interisland.net
Tue Mar 5 13:15:01 EST 2002


on 3/4/02 6:26 PM, Geoff Canyon at gcanyon at inspiredlogic.com wrote:
 
> local tDragging
> 
> on mouseDown
> put true into tDragging
> end mouseDown
> 
> on mouseMove mouseX,mouseY
> if tDragging then
> -- Do bounds checking here --
> set the loc of me to (mouseX,mouseY)
> end if
> end mouseMove
> 
> on mouseUp
> stopDragging
> end mouseUp
> 
> on mouseRelease
> stopDragging
> end mouseRelease
> 
> on stopDragging
> put false into tDragging
> end stopDragging
> 
> Note that you will likely want to get the offset of the mouse from the loc of
> the object in the mouseDown in order to maintain that offset while dragging.
> Otherwise the object will snap to the mouseLoc at mouseDown.
----------
Thanks Geoff,

This is a lot like what I was looking for. However, I don't understand why
you use both 'on mouseUp' and on 'mouseRelease'. Aren't they the same thing?

Can you clarify the difference, if any, and why they _both_ need to be used?

Thanks,
Ken N. 




More information about the use-livecode mailing list