Flex Spark PNG Image with Transparency acting as button

时间:2015-07-31 19:29:07

标签: actionscript-3 flex flash-builder flex4.5

I have a PNG image that has some transparency it is a 20px x 20px png image of an X. Given the shape of the X the hit state is odd since it gets interpreted as transparent. How do you make the whole area 20px x 20px clickable?

<s:Image id="closeOut" y="10" source="@Embed('/assets/png/X.png')" click="this.visible=false"/>

If you hover over where ever there isn't the X, left and right mostly it isn't clickable. Thoughts?

1 个答案:

答案 0 :(得分:1)

Add the image in a group of 20x20px and add the mouse event on the group and not on the image.

<s:Group y="10" width="20" height="20" click="this.visible=false">
      //Your image here
</s:Group>

Hope this helps.