hitArea property

Sprite hitArea
read / write

Designates another sprite to serve as the hit area for a sprite.

If the hitArea is null (the default), the sprite itself is used as the hit area. The value of the hitArea property can be a reference to a Sprite object.

You can change the hitArea property at any time; the modified sprite immediately uses the new hit area behavior. The sprite designated as the hit area does not need to be visible; its graphical shape, although not visible, is still detected as the hit area.

Note: You must set to false the mouseEnabled property of the sprite designated as the hit area. Otherwise, your sprite button might not work because the sprite designated as the hit area receives the user input events instead of your sprite button.

Implementation

Sprite hitArea