Dragging an object

Peter Bogdanoff bogdanoff at me.com
Thu Jul 10 20:24:16 EDT 2014


Hi,

I want to drag an object around (a group), restricting its Y coordinate (set to be a property, “yLocation"). I’m using this script inside the object:

on mouseMove
   if the mouse is down then
      set the loc of me to (item 1 of the mouseLoc,the yLocation of me)
   end if
end mouseMove

However, after moving it sideways, when I click on it again to move it, every time it jumps back so that its X coordinate is zero relative to the mouseLoc.

This behavior would be fine for a button, but I’m dragging a 3000-pixel-wide group.

How can I drag it by clicking on one side of this group?

I tried using the grab command, but I couldn’t seem to be able to restrict the Y coordinate with that.

Peter
UCLA




More information about the use-livecode mailing list