How to select and move an image using 1 mouse click?
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Thu Jul 5 08:52:01 EDT 2007
Hi Ian,
Could this code snippet help you:
It's made to move a whole stack but you'll adapt it for an object.
local allowDrag -- variable declared outside any handler
---------------------------------
on mouseDown
put the mouseH & comma & the mouseV into allowDrag
end mouseDown
---------------------------------
on mouseMove x,y
if allowDrag is empty then exit mouseMove
set topLeft of this stack to globalLoc(x - item 1 of allowDrag &
comma & y - item 2 of allowDrag)
end mouseMove
---------------------------------
on mouseUp
put empty into allowDrag
end mouseUp
---------------------------------
on mouseRelease
put empty into allowDrag
end mouseRelease
---------------------------------
on mouseLeave
put empty into allowDrag
end mouseLeave
Le 5 juil. 07 à 14:31, Ian Wood a écrit :
> Eric, on mousedown the new image doesn't exist yet...
>
> I managed this in the past, but can't remember exactly how I did
> it. :-(
>
> Something like: make the new image, set a custom prop to true to
> show that it's draggable, and have a mousemove handler in the new
> image that triggers if the custom prop is true. Then have a mouseup
> handler in the new image that resets the custom prop to false.
>
> Other Ian
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list