Making an image draggable
Douglas Gilliland
douggilliland at gmail.com
Sat Jul 9 11:52:42 EDT 2005
Thanks to all - it's great to have this as a resource for learning transcript.
The following script works great.
on mouseDown
grab me
end mouseDown
I will also try the others just to learn more about Revolution.
Thanks again.
Doug Gilliland
Sarasota, Fl
dodging the bullet with hurricane Dennis :>)
On 7/9/05, Derek Bump <webmaster at dreamscapesoftware.com> wrote:
> 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