More Fun with mouseMove
Scott Rossi
scott at tactilemedia.com
Wed Mar 20 16:07:01 EST 2002
In the quest for ever more easy/efficient scripts, the following seems
to work very well for a custom stack drag routine. Just place this
script in a button and you should be off and dragging.
on mouseDown
set the uAllowDrag of me to true
end mouseDown
on mouseMove x,y
if not the uAllowDrag of me then exit mouseMove
put globalLoc(x & "," & y) into tLoc
set topLeft of this stack to \
item 1 of tLoc - item 1 of the clickLoc,\
item 2 of tLoc - item 2 of the clickLoc
end mouseMove
on mouseUp
set the uAllowDrag of me to empty
end mouseUp
on mouseRelease
mouseUp
end mouseRelease
Note: I can't recall if MC Corp wants to eliminate the screenMouseLoc
function; if not, then the mouseMove handler could be written with one
less line:
on mouseMove
if not the uAllowDrag of me then exit mouseMove
set topLeft of this stack to \
item 1 of the screenMouseLoc - item 1 of the clickLoc,\
item 2 of the screenMouseLoc - item 2 of the clickLoc
end mouseMove
Regards,
Scott Rossi
Creative Director, Tactile Media
scott at tactilemedia.com
http://www.tactilemedia.com
More information about the use-livecode
mailing list