Skip to main content
February 9, 2009
Question

drop in correct position

  • February 9, 2009
  • 1 reply
  • 210 views
I want to make a function which makes that if you drop something (picture1) roughly at the correct place the object goes automatically to the right position.

So first I made a startDrag/stopDrag function and it worked.
then I tried to make the next function... it lookes like this:
if(picture1.x > -10,
picture1.x < 10,
picture1.y > -10,
picture1.y < 10) {
picture1.x == 0;
picture1.y == 0;

but it doesn't work... can someone help me?
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
February 9, 2009
Try the following:

if(Math.abs(picture1.x) < 10 && Math.abs(picture1.y) < 10 ){
picture1.x = 0;
picture1.y = 0;
}