Also, don’t forget anchors.
If you want some object aligned to a corner (say upper right) you can do this:
local myText = display.newTest( "Hi This will align to upper right on all screens", display.contentCenterX + display.actualContentWidth/2, display.contentCenterY - display.actualContentHeight/2, native.systemFont, 10 ) myText.anchorX = 1 mytext.anchorY = 0
or using the shorthand code sonic mentioned:
local unusedWidth = display.actualContentWidth - display.contentWidth local unusedHeight = display.actualContentHeight - display.contentHeight local left = 0 - unusedWidth/2 local top = 0 - unusedHeight/2 local right = display.contentWidth + unusedWidth/2 local bottom = display.contentHeight + unusedHeight/2 local myText = display.newTest( "Hi This will align to upper right on all screens", right, top, native.systemFont, 10 ) myText.anchorX = 1 mytext.anchorY = 0