So this is the code I have:
mainView = display.newGroup()
local background = display.newRect(screenX, screenY, display.viewableContentWidth, display.viewableContentHeight)
background:setFillColor(111, 111, 255)
mainView:insert(background)
myButton = widget.newButton{
id = "grabURL",
label = "Grab URL",
onEvent = grabURL,
emboss = true,
font=native.systemFont,
width=200
}
myButton.y = display.contentHeight \* 0.5
myButton.x = (display.viewableContentWidth \* 0.5) - (myButton.width \* 0.5)
mainView:insert(myButton.view)
and then in my orientation change event I have:
myButton.x =(display.viewableContentWidth/2) - math.floor(myButton.contentWidth/2)
I’ve tried tweaking everything in the world, and I can’t get it to align center when you rotate from portrait to landscape. I know I’m missing something, but I can’t figure out what.
Also, I have the button width set to 200, but when you go to landscape it upscales it to 300. Is there a way to prevent this upscaling on an object by object basis?
Thanks,
Scott.
[import]uid: 19193 topic_id: 13565 reply_id: 313565[/import]