FoxyFish
FoxyFish

Reputation: 892

AS2 onPress only non-transparent area in PNG movieclip?

Is this possible? I have an irregular shape png with transparency contained in a movieclip, but when i use onPress on the movieclip it presses the whole bounding box.

pngMC.onPress = function() {

Is there any way to make it only fire when it presses the non-transparent area of the PNG?

thanks.

Upvotes: 0

Views: 294

Answers (1)

mitim
mitim

Reputation: 3201

I may be wrong, but I don't think AS2 has this capability... since it would see the entire clip as the bitmap/png itself...it wouldn't make a difference if it was transparent, translucent, or opaque.

A few different workarounds off the top of my head:

  • Convert the png to vector and actually delete those empty areas (vector shapes will support irregular button shapes). How well this will work depends on the png contents.

  • Create a mask and actually hide the invisible areas of the png within the movieclip. This one may be the easiest, you'll just have to remember in the future why you were masking off already empty areas.

  • Move to AS3, where you can specify a separate button hit area that can be any shape and size independent of the button visuals (just thought I'd throw this out there, even though it may be too much work).

Upvotes: 1

Related Questions