Moving objects with mouse (SOLVED)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Moving objects with mouse (SOLVED)

Post by MaxV »

Hi all,
I feel clumsy because I want to move an image with the mouse, draging it, but my code seems to me too complicated. I wrote in image code:

Code: Select all

global mytest

on mousedown
   put true into mytest
end mousedown

on mouseUp
   put false into mytest
end mouseUp

on mousemove
   if mytest then
      set the loc of me to the mouseloc
   end if   
end mousemove
Is there a best and more concise way to do it? :?:
Last edited by MaxV on Thu May 08, 2014 4:44 pm, edited 1 time in total.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Moving objects with mouse (SOLVED)

Post by MaxV »

Founded the solution:

Code: Select all

on mousedown
   grab me
end mousedown
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Post Reply