I’ve looked everywhere, but I haven’t been able to find a way to position buttons onto the main.lua file. every time i try to position the buttons other than the default upper left corner I keep getting a syntax error. here is the code:
–
– main.lua
–
local storyboard = require “storyboard”
local bg = display.newImage( “bg.png” )
bg.x = 160; bg.y = 195
local widget = require( “widget” )
– Function to handle button events
local function handleButtonEvent( event )
if ( “ended” == event.phase ) then
print( “You have signed in” )
end
end
local button1 = widget.newButton
{
width = 240,
height = 120,
defaultFile = “button.png”,
overFile = “button.png”,
label = “button”,
onEvent = handleButtonEvent
}
– Change the button’s label text
button1:setLabel( “Login” )
the button itself works fine. i just want to position it on the center of the screen.