Can mask objects be inserted into display groups?

Hi,

It seems mask objects can’t be inserted into display groups. No error message when doing so, but the masked object disappears from the screen. This is true either when the image is inserted into a group before the mask is being applied or after.

Can someone confirm this, please?

Thanks.
Ch. [import]uid: 4958 topic_id: 8562 reply_id: 308562[/import]

Hi charlyp,

I’ve been able to set a mask on a group without issue. If you’re having other mask issues, you might want to follow this thread.

http://developer.anscamobile.com/forum/2011/02/07/mask-trouble#comment-30718

I’ve posted a sample on my site you can play with. [import]uid: 27183 topic_id: 8562 reply_id: 30734[/import]

Hi Don,

I’ve read the thread you refer to --I always search the forum before posting, anyway-- but the problem I encountered isn’t mentioned, there. And since I use a 100 x 100 mask, I don’t have the main issue the thread is about --I’ve seen it when I first explored the mask functionality, tho =)

I’ve downloaded you test project but you don’t use display groups in it. Can you elaborate?

Thanks.
Ch. [import]uid: 4958 topic_id: 8562 reply_id: 30735[/import]

Hey Ch,

Using the sample project assets you can try this out:

[code]
local container = display.newGroup()
local image = display.newImage(container, ‘nodame.jpg’)
container:setMask(graphics.newMask(‘arrow_gradient_mask.png’)) – mask must be x-aligned on 4 pixels

local function touchHandler(_e)
if _e.phase == ‘moved’ then
container.maskX = _e.x
container.maskY = _e.y
end
end

Runtime:addEventListener(‘touch’, touchHandler)
[/code] [import]uid: 27183 topic_id: 8562 reply_id: 30738[/import]

Hey Don,

Turns out the problem was due to a faulty refresh in the Corona simulator --I didn’t try on a real device, then --when putting the masked object in the localGroup used by the infamous Director class =)

It’s now fixed and and it works perfectly fine.

Thanks a lot for your help.
Ch. [import]uid: 4958 topic_id: 8562 reply_id: 30877[/import]