Making an image draggable
Derek Bump
webmaster at dreamscapesoftware.com
Sat Jul 9 10:43:40 EDT 2005
Douglas Gilliland wrote:
> I know it must be easy but I cannot figure out the script to make an
> image of a metric ruler draggable so my students can drag it around
> the screen to measure items in a quiz stack I am writing.
You could try the following...
1. Create a separate stack.
2. Place the "ruler.jpg" image on the stack.
3. Resize the stack so it is the same dimensions as the image.
4. Set the windowDecorations to empty
5. Add the following to the stack's script...
local sgDragging
local sgOffset
on mouseDown
put true into sgDragging
put the mouseLoc into sgOffset
end mouseDown
on mouseMove
if sgDragging then
set the topLeft of this stack to \
item 1 of the screenMouseLoc - item 1 of sgOffset, \
item 2 of the screenMouseLoc - item 2 of sgOffset
end if
end mouseMove
on mouseUp
put false into sgDragging
end mouseUp
on mouseRelease
put false into sgDragging
end mouseRelease
Derek Bump
Dreamscape Software
_______________________________________________
Compress Photos for the Web with JPEGCompress
http://www.dreamscapesoftware.com/
More information about the use-livecode
mailing list