Sticking an image to the cursor

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Oct 11 16:45:05 EDT 2008


Bonsoir Sue,

Le 11 oct. 08 à 19:37, Sue Smith a écrit :

> I did, but it only works with mouseDown. I need it to work on the  
> mouseEnter handler. I am developing (freeware) for children with  
> disabilities - so many are unable to click the mouse button, let  
> alone keep it held down.

Just to get you started without being too complicated:
In any piece of your jigsaw puzzle *

on mouseMove
   if the loc of me is within the rect of btn "Right place" then
     set the loc of me to the loc of btn "Right place" -- where piece  
must sticked
   else
     set the loc of me to the mouseloc -- just move piece
   end if
end mouseMove

*Of course such a handler should not be repeated in all jigsaw pieces  
but handled using specific conditions at a higher level:

on mouseMove -- in every piece
   PlacePiece --
end mouseMove
--------------------------------------
on PlacePiece -- in card's script
   local tRightHiddenPlace
   -----
   if "jigsaw" is not in the short name of the target then exit  
PlacePiece
   -- we just take into account objects the name of which contains  
"jigsaw"
   -- jigsaw1, jigsaw2, etc.
   put the short name of the target & "RightPlace" into  
tRightHiddenPlace
   -- refers to jigsaw1RightPlace, jigsaw2RightPlace, etc.
   -- these are hidden objects just set to get the right place for  
any piece
   if the loc of the target is within the rect of btn  
tRightHiddenPlace then
     set the loc of the target to the loc of btn tRightHiddenPlace --  
where piece must sticked
   else
     set the loc of the target to the mouseloc -- just move piece
   end if
end PlacePiece

Hope this helps :-)

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