hitTestPoint method

bool hitTestPoint(
  1. num x,
  2. num y,
  3. [bool shapeFlag = false]

Evaluates this display object to see if it overlaps or intersects with the point specified by the x and y parameters.

The x and y parameters specify a point in the coordinate space of the Stage, not the DisplayObjectContainer that contains the display object (unless that display object container is the Stage).

If shapeFlag is set to false (the default), the check is done against the bounding box. If true, the check is done against the actual pixels of the object.

Returns true if this display object overlaps or intersects with the specified point; false otherwise.


bool hitTestPoint(num x, num y, [bool shapeFlag = false]) {
  var point = Point<num>(x, y);
  globalToLocal(point, point);

  return shapeFlag
      ? hitTestInput(point.x, point.y) != null
      : bounds.contains(point.x, point.y);