I want when i click a button on my Home screen, that a new screen shows up, how do I do this?
Tried several of times now and still fail at it, a help would be great!
I want when i click a button on my Home screen, that a new screen shows up, how do I do this?
Tried several of times now and still fail at it, a help would be great!
Have you been through the tutorials for using the storyboard API? It’s our scene manager.
Also your question is rather broad and really doesn’t give us a starting point. Are you using Storyboard or Director? Are you making your own scene controls? How are you setting up your button? Where is the new screen? We need quite a bit more details to give you can kind of useful answer.
I’m using storyboard, I have put a button and the code is
local button = widget.newButton{
label = “The button”,
font = “HelveticaNeue-Bold”,
fontSize = 16,
yOffset = -2,
labelColor = { default={ 10 }, over={ 10 } },
emboss = true
}
button.x = display.contentCenterX
But I want that a new scene shows up so where, and which code should I add?
I’m a newbie in Corona…
widget.newButton had a parameter:
onEvent = onButtonEvent
The “onButtonEvent” is the name of the function to execute when the button is tapped. You will need this function. Here is an example:
local onButtonEvent = function (event )
if event.phase == “release” then
print( “You pressed and released a button!” )
storyboard.gotoScene(“yourscene”)
end
end
See the documentation at:
http://docs.coronalabs.com/api/library/widget/newButton.html
Have you been through the tutorials for using the storyboard API? It’s our scene manager.
Also your question is rather broad and really doesn’t give us a starting point. Are you using Storyboard or Director? Are you making your own scene controls? How are you setting up your button? Where is the new screen? We need quite a bit more details to give you can kind of useful answer.
I’m using storyboard, I have put a button and the code is
local button = widget.newButton{
label = “The button”,
font = “HelveticaNeue-Bold”,
fontSize = 16,
yOffset = -2,
labelColor = { default={ 10 }, over={ 10 } },
emboss = true
}
button.x = display.contentCenterX
But I want that a new scene shows up so where, and which code should I add?
I’m a newbie in Corona…
widget.newButton had a parameter:
onEvent = onButtonEvent
The “onButtonEvent” is the name of the function to execute when the button is tapped. You will need this function. Here is an example:
local onButtonEvent = function (event )
if event.phase == “release” then
print( “You pressed and released a button!” )
storyboard.gotoScene(“yourscene”)
end
end
See the documentation at:
http://docs.coronalabs.com/api/library/widget/newButton.html