# Target Drop Area

Up till now, I've always created a target drop area by using 4 coordinates. For example:

`If (mouse.x is <= -32 && mouse.x >= 32 && mouse.y <= -32 && mouse.y >= 32)`

I thought there might be a way to dynamically create the same above but with a circle (surrounding an MC) with a set radius.  The sole purpose of this circle is (like above) to test if the cursor is inside it to trigger an event. That way I only have to set a radius rather than 4 numbers like the above code. Plus I wouldn't have to keep track of whether a number is negative or positive. Just how wide from the center (radius) I want the circle to be.

So how would I be able to do the above in AS2 or AS3?

• ###### 1. Re: Target Drop Area

you can check the distance between any two points, including the distance between the mouse and the registration point of a movieclip.  you would use something like:

if(distF(mc)){

// do whatever

}

function distF(mc):Number{

return (mc._x-_xmouse)*(mc._x-_xmouse)+(mc._y-_ymouse)*(mc._y-_ymouse);  // apply Math.sqrt if that's important

}