HitTestPoint not working as expected

I stumbled upon a little glitch or undocumented secret in the hitTestPoint function and thought I better share it to prevent others beside myself from going crazy trying to understand what’s going wrong.

On stage is a 100x100 square positioned at 0,0.
If you do a hitTestPoint with shapeFlag set to false the points that result in success ranges from (0,0) to (100,100). Makes sense since it’s supposed to do a hitTest on the bounding box.

If you set the shapeflag to true you might believe that the result should turn out the same since it’s a perfect square, or at least something like (0,0) to (99.9, 99.9). But no, the successful points ranges from (0.6, -0.5) to (100.5, 99.4).
So a point at x=0 will never return true though the square is obviously is there.

A range from (-0.5, -0.5) to (99.4, 99.4) could have been acceptable if you imagine that the pixels are centered around each point, and of course (0,0) to (100,100) would overlap (100,100) to (200,200) so 99.9 makes sence. But (0.6, -0.5) suggests that the top left pixels centerpoint is at (1,0) which doesn’t make sense, well not to me at least.

So. Conclusion:
If you do hitTestPoint with shapeflag set to true, add 0.6 to the x value and -0.5 to the y value.

:: nook