Transparent PNGs and Flash
December 10, 2012 12:13 PM Subscribe
Flash CS5/actionscript 3 - how to click through transparent pngs?
posted by missmagenta to computers & internet (10 answers total)
I have 2 movie clips and inside each movie clip is a transparent png, the 2 movie clips overlap such that the non-transparent areas of the pngs are touching but do not overlap. Both movie clips are linked to the same actionscript class - so they have the same onclick event. In the areas where the bounding boxes overlap the top one receives the click event even if it is transparent in the area that is being clicked.
That's a simplified example of what's going on, in actuality there are 3 instances of the same movie clip, all in the same place. The movie clip has numerous transparent pngs imported from photoshop - 1 per frame and actionscript determines which frame to display at any given time. The pngs appear to be solid objects though, even if I 'break apart' the transparent areas still highlight when the object is selected and seem to be inseparable. Trace Bitmap allows only the solid area to be clickable but image quality is lost - including making straight edges curved, (some are quite complex shapes and they really do need that tiny bit of edge aliasing to look their best.
Is there a solution? I googled the problem but didn't find much help, most solutions relied on checking the alpha transparency of the pixel under the mouse and only doing x if it wasn't transparent but as far as I can tell the bottom one doesn't even receive the click event.