Hi.
When i create widget.newButton with png image (a circle) the button reacts in the alpha area. Is it normal behavior? How can i get rounded button which should not be touchable at the edges?
I think what you’re saying is the transparent part of the button is still touchable?
I don’t think the widget.* button makers support restricting touches to translucent and opaque sections of an image only.
Terms definition (to be 100% clear; people often confuse these terms)
- Opaque: alpha == 1.0
- Transparent: alpha == 0.0
- Translucent: == 0.0 < alpha < 1.0
I think, if you need this feature, you’ll need to make your own button builder.
One way to achieve your goal (touches to transparent parts of image ignored) is via hit masking:
https://docs.coronalabs.com/api/type/DisplayObject/isHitTestMasked.html
I made an example of this for someone who wanted to make orthogonal terrain maps where the transparent edges would not select the tile.
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/08/hitmasking.zip
This same technique would apply to your requirement.