Drag and Drop HELP
Posted: Thu Dec 30, 2010 6:47 pm
Hello
I am new to live code. I am try to develope apps based on drag and drop.
please see attached pic. User have to drag and drop part of the body label to relevant box.
if drop on correct box then label centre location equal to correct box centre location
if drop on wrong box then set location of label back to start point.
Questions
1) how to track and store start location of label
2) how to set label location to box location if answer is correct
3) how to set label location back to start location
So far my code is as following where Code in RED not working and Code in Blue is working fine.
on touchStart
--get startlocation
end touchStart
-- dragORdrop is custom property set either drag or drop
on touchmove pid,pX,pY
if the dragORdrop of the target is "drag" then
set the loc of the target to pX, pY
end if
end touchmove
Many thanks in advance.
I am new to live code. I am try to develope apps based on drag and drop.
please see attached pic. User have to drag and drop part of the body label to relevant box.
if drop on correct box then label centre location equal to correct box centre location
if drop on wrong box then set location of label back to start point.
Questions
1) how to track and store start location of label
2) how to set label location to box location if answer is correct
3) how to set label location back to start location
So far my code is as following where Code in RED not working and Code in Blue is working fine.
on touchStart
--get startlocation
end touchStart
-- dragORdrop is custom property set either drag or drop
on touchmove pid,pX,pY
if the dragORdrop of the target is "drag" then
set the loc of the target to pX, pY
end if
end touchmove
Many thanks in advance.