This code:
function widgets.newPopUp(contents)
local popUp = display.newGroup( );
local bg = display.newRect(popUp, 0, 0, display.contentWidth-display.screenOriginX\*2-20, display.contentHeight-display.screenOriginY\*2-20 );
local contentsArea = display.newGroup(popUp);
local contentsAreaClickArea = display.newRect(contentsArea, 0, 0, bg.width-20, bg.height-120 );
contentsAreaClickArea:setFillColor( 0, 0, 255 );
bg:setFillColor( 0, 255, 0, 170 );
contentsArea:insert( contents, true );
contentsArea.x = 50;
bg:toFront();
contentsArea:toFront();
contents:toFront();
popUp:setReferencePoint( display.CenterReferencePoint );
popUp.x = display.contentCenterX;
popUp.y = display.contentCenterY;
return popUp;
end
local popUpContents = display.newGroup();
local betaText = display.newText(popUpContents, T("BetaText"), 0, 0, 400, 0, native.systemFont, 20 );
betaText:setTextColor( 255, 255, 255 );
kidoteca.widgets.newPopUp(popUpContents);
Results in this:
http://snag.gy/lFjha.jpg
I was expecting the green rect to be 20 pixels from the left, and the blue rect to be 20 pixels from the left of green rect (thus 70 pixels from left of screen).
But I am getting blue rect 50 pixels from the left and green rect 20 pixels from blue rect…
Thus: Why? [import]uid: 142895 topic_id: 30809 reply_id: 330809[/import]