Ignore alpha channel of images

Hi everyone.
I have a doubt about alpha channel of images.

I’m developing an application that has a lot of images with transparency. I want the visible part of the images works as buttons, but the problem is that the “invisible” parts of images works as buttons too.
I know i can use masks or rectangles, but there are a lot of images.
Does exist another way to do it?

Thank you. [import]uid: 105206 topic_id: 23059 reply_id: 323059[/import]

Right now it’s really just what you’re already suggested as solutions.

Is there a reason you need so much alpha? [import]uid: 52491 topic_id: 23059 reply_id: 92350[/import]

It’s easier to situate the buttons.

Thanks for the answer. [import]uid: 105206 topic_id: 23059 reply_id: 93005[/import]

Hi - I have the same problem.

I’m creating a “pie” (like out of Trivial Pursuits) made of 6 segments, each of which I want to apply an event listener to for touch events so I can drag the 6 segments around the screen. The problem is that if I use 6 rotated images for my 6 segments then the alpha part of each rectangular image overlaps the others and hit events don’t work properly.

I’ve tried drawing the shapes using display.newline but then I can’t fill them easily or apply any event listeners at all so they won’t respond to being touched.

Does anyone have any idea how I might achieve this?

Thanks,

Ian [import]uid: 123492 topic_id: 23059 reply_id: 116197[/import]

Hey Ian - you need to use isHitTestMasked; http://developer.coronalabs.com/reference/index/objectishittestmasked

As I said above doing this without masks isn’t possible right now but it *can* still be done with them.

Peach :slight_smile: [import]uid: 52491 topic_id: 23059 reply_id: 116214[/import]

Thanks Peach,

I noticed this line in the docs though:

“Currently for a bitmap mask created by graphics.newMask(), the touch sensitive area corresponds to the image bounds, i.e. it is rectangular regardless of the image contents.”

Does that not mean I’ll have the same problem as an irregular shaped object like a segment of pie like I’m creating will still have a rectangular hit area?

Thanks,

Ian [import]uid: 123492 topic_id: 23059 reply_id: 116225[/import]

Uhm, I haven’t done a whole bunch with masks but I was sure we had a mask on a rect with curved corners from the multitouch example that was working fine… I may be mistaken.

It’s obviously the weekend not but leave this with me, I’m going to ask another member of the team who has done a fair amount with masks and see what he has to say, though I may not be able to get back to you until Monday so please be patient with me :wink:

Peach :slight_smile: [import]uid: 52491 topic_id: 23059 reply_id: 116301[/import]

Thanks Peach - much appreciated.

I’ll check back next week.

Thanks,

Ian [import]uid: 123492 topic_id: 23059 reply_id: 116338[/import]

Thanks Ian - do me a favor and don’t be shy to bump this if need be. [import]uid: 52491 topic_id: 23059 reply_id: 116415[/import]