I recently posted a code exchange entry which allows for a thumbnail of an image to be viewed through two nested display groups with masks applied to each. This gives the effect that when tapped on the view can grow smoothly by shifting the masks.
The problem is that the tap has to be detected by an invisible object placed over the top of the top masked group. This is because the display objects within the nested, masked groups do not receive touch events.
This seems to be a problem and I am wondering if this is (a) by design and (b) has a work around/solution?
My asset files are here: https://dl.dropbox.com/u/10254959/MaskTestAssets.zip
And this is the main.lua:
[lua]-- mask test
– set default screen values
display.setStatusBar(display.HiddenStatusBar)
display.setDefault( “background”, 50, 50, 50 )
stage = display.getCurrentStage()
img = display.newImage( “5UgTS.jpg” )
– load the mask to be used
mask = graphics.newMask(“mask.png”)
maskbr = graphics.newMask(“maskbr.png”)
img:setMask( maskdt )
local top, bottom = display.newGroup(), display.newGroup()
top:insert( bottom )
bottom:insert( img )
top:setMask(maskbr)
top.maskX, top.maskY = (display.contentWidth/4)*3, (display.contentHeight/4)*3
bottom:setMask(mask)
bottom.maskX, bottom.maskY = display.contentWidth/4, display.contentHeight/4
rect = display.newRect( bottom, 250, 500, 250, 200 )
function img:tap(e)
print(‘tap’)
end
img:addEventListener(“tap”,img)
rect:addEventListener(“tap”,img)[/lua] [import]uid: 8271 topic_id: 34158 reply_id: 334158[/import]
Is the “window” that you can see Indiana Jones through supposed to slowly resize/scale? Or only move around, like the user is dragging that window around? Does the aspect ratio change (as in, must the “window” grow taller or wider depending on certain factors)?