Yup, that’s right.
I’m pretty excited about this … I searched a little … I think I’m the only one to post about how to get this done, so I claim the right to name this comet if that’s the case. 
– note I’m using the crawlspacelib in all my code, so screenWidth/screenHeight and centerX/centerY are based on the device, per the awesome library from Adam. 
Anyway, here you go:
-- let's make a "mask" group for our vector...
local dynamicMask = display.newGroup();
-- paint a screen sized background white and put it in the group.
local thisRect = display.newRect (0,0,screenWidth, screenHeight)
dynamicMask:insert(thisRect);
-- create the vector rectangle that i want for my mask and put it in the group
local thisRect = display.newRect (0,0,screenWidth-40, screenHeight-100)
dynamicMask:insert(thisRect);
-- paint the mask black - i want this area to SHOW THROUGH the mask.
thisRect:setFillColor(0,0,0);
-- position it. i want a scroll view in the center of the screen -- so i need
-- to position this rectangle in the middle of the screen, leaving some extra
-- room up top for a title that doesn't scroll.
thisRect.x =centerX;
thisRect.y = centerY +20
-- you could add addition vector objects here to create a complex mask.
-- now the magic:
display.save (dynamicMask, "tmp.jpg", system.TemporaryDirectory)
-- we don't need no stickin' badges -- get rid of the group.
dynamicMask:removeSelf();
-- but we do need our dynamically created, vector mask! ;-)
local mask = graphics.newMask( "tmp.jpg", system.TemporaryDirectory )
-- ta da!
objectToMask:setMask(mask)
Hope this helps. 
… and am I the first to figure this little tidbit out???
… I think there was maybe some hold up with the official corona UI elements because of issues with putting scrolling area “anywhere”. This definitely solves the problem for me pretty cleanly. I don’t know how well it will translate to other cases, but I’d imagine pretty well?
Here’s how I put the floating scrollView in the middle of the screen with the above mask generation:
-- take a pic of the screen...
local screenCap = display.captureScreen( false )
screenCap:setMask(mask)
-- depending on your setup, insert this masked screencap to the group
-- display group for neatness.
(Though I only care about iOS and came up with the dynamic mask because I didn’t want to worry about iPad vs iPhone 3Gs vs iPhone 4/5… etc – no clue how well this ports to Android as I saw the screencap stuff may not work there?)
Best,
~~Kenn
[import]uid: 13859 topic_id: 11527 reply_id: 311527[/import]
