mouseChildren property

bool mouseChildren

Determines whether or not the children of the object are mouse, or user input device, enabled.

If an object is enabled, a user can interact with it by using a mouse or user input device. The default is true.

This property is useful when you create a button with an instance of the Sprite class (instead of using the SimpleButton class). When you use a Sprite instance to create a button, you can choose to decorate the button by using the addChild method to add additional Sprite instances. This process can cause unexpected behavior with mouse events because the Sprite instances you add as children can become the target object of a mouse event when you expect the parent instance to be the target object. To ensure that the parent instance serves as the target objects for mouse events, you can set the mouseChildren property of the parent instance to false.

No event is dispatched by setting this property. You must use the on...() event methods to create interactive functionality.

Implementation

bool get mouseChildren => _mouseChildren;
void mouseChildren= (bool value)

Implementation

set mouseChildren(bool value) {
  _mouseChildren = value;
}