Sticking an image to the cursor

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Oct 11 13:21:26 EDT 2008


Bonsoir Sue,

Le 11 oct. 08 à 17:00, Sue Smith a écrit :

> Is is possible for an image to smoothly "stick" onto the cursor? I  
> am working on a jigsaw puzzle for children. I know that I can set  
> the image to the mouse location, but it is very choppy and and the  
> image will drop if the user accelerates mouse speed and it can't  
> leep up.

If you use Rev 2.9 or later, probably you could use drag and drop 2.9  
implementation.
Or if you don't want to 'move' a 'blendleveled' image, you should  
have a look at two things:

1. The 'grab' command.
2. A code snippet that has been posted many times in this list and  
you can call from every piece of your jigsaw puzzle:

local sAllowDrag
---------------------------------
on mouseDown
   put the mouseH & comma & the mouseV into sAllowDrag
end mouseDown
---------------------------------
on mouseMove pX,pY
   if sAllowDrag is empty then exit mouseMove
   set topLeft of this stack to globalLoc(pX - item 1 of sAllowDrag &  
comma & pY - item 2 of sAllowDrag)
end mouseMove
---------------------------------
on mouseUp
   put empty into sAllowDrag
end mouseUp
---------------------------------
on mouseRelease
   mouseUp
end mouseRelease

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