Drag n Drop Objects in Flash vs. Rev

Scott Rossi scott at tactilemedia.com
Thu Dec 4 10:54:07 EST 2003


On 12/4/03 1:52 AM, "Graham Samuel" <livfoss at blueyonder.co.uk> wrote:

> on mouseDown
>    put true into tDragging
> end mouseDown
> 
> on mouseMove mouseX,mouseY
>    if tDragging then
> -- Do bounds checking here --
>        set the loc of me to (mouseX,mouseY)
>    end if
> end mouseMove
> 
> on mouseUp
>    stopDragging
> end mouseUp
> 
> on mouseRelease
>    stopDragging
> end mouseRelease
> 
> on stopDragging
>    put false into tDragging
> end stopDragging
> 
> IMHO, the **only** reason to use a scheme like this is in order to
> constrain the dragged object completely, i.e. so that the user can't
> move the object out of some chosen bounds (say a particular
> rectangle) even while dragging. If Monte is content to allow the user
> to drag an object anywhere in a window and then apply the constraints
> when the user lets go of the mouse (giving a kind of rubber-band
> effect, which can look quite attractive in some circumstances), then
> it seems to me that there is only one elegant solution, which is to
> use 'grab me' - it's built in and it's very concise. In the
> 'rubber-band' case, I can't see any need for any other solution.

The above handler set is not only appropriate for constraining mouse
movement, but can also be adapted to monitor the positions of dragged
objects and allow responses from target objects *while the dragging is
taking place* -- this can't be done using the grab command.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list