Page 1 of 1

Draggin a group

Posted: Mon Dec 26, 2011 4:27 am
by maxs
How do I drag a group in IOS?

on mousestilldown
set the loc of grp "Dragball1" of grp "3Balls" to the mouseloc


The release note mentions a touchMove id, x, y, but does not show examples, or explain how to send messages with it.

Re: Draggin a group

Posted: Mon Dec 26, 2011 7:42 am
by Jellicle
Try the "grab me" command in a mousedown handler n the group's script.

Gerry

Re: Draggin a group

Posted: Mon Dec 26, 2011 11:55 am
by jmburnod
Hi Maxs

I have a script to drag an object. No tested for a group

Code: Select all

local sX,sY,canMove

-- For IOS
on touchstart
   put true into canMove
   put (the mouseH - item 1 of the loc of me) into sX
   put (the mousev - item 2 of the loc of me) into sY
end touchstart

on touchMove pTouchId,pX,pY
   if canMove then
      set loc of me to pX-sX,pY-sY
   end if
   put pX,pY
end touchMove

on touchend
 put false into canMove
end touchend

-- For desktop
--on mousedown
--   put true into canMove
--   put (the mouseH - item 1 of the loc of me) into sX
--   put (the mousev - item 2 of the loc of me) into sY
--end mousedown

--on mouseMove pX,pY
--   if canMove then
--      set loc of me to pX-sX,pY-sY
--   end if
--   put pX,pY
--end mouseMove
I hope this help

Best regards

Jean-Marc

Re: Draggin a group

Posted: Mon Dec 26, 2011 8:24 pm
by maxs
Thanks Jean-Marc,

THis will help. Sometimes the mousestilldown option seems to work in ios. Other times the objects dont move.

Thanks, Max