Search code examples
actionscript-3apache-flexflash-builderflex4.5

Flex Spark PNG Image with Transparency acting as button


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?


Solution

  • 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.