hitTestPoint method

bool hitTestPoint (num x, num y, [ 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.

Implementation

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

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