I wanted to know how to create an image a button and when clicked it changes scenes for my app.
And Also I wanted to know how to make a tab menu like facebook. And i am a noob at promgramming.
I wanted to know how to create an image a button and when clicked it changes scenes for my app.
And Also I wanted to know how to make a tab menu like facebook. And i am a noob at promgramming.
First look how to create a simple image,
local image = display.newImageRect(“image.png”, 50,50)
image.x = display.contentWidth/2
image.y = display.contentHeight/2
Creating a button
local widget = require( “widget” )
– Function to handle button events
local function handleButtonEvent( event )
if ( “ended” == event.phase ) then
composer.gotoScene(“menu”)
print( “Button was pressed and released” )
end
end
– Create the widget
local button1 = widget.newButton
{
left = 100,
top = 200,
id = “button1”,
label = “Default”,
onEvent = handleButtonEvent
}
to know about composer http://docs.coronalabs.com/api/library/composer/index.html
First look how to create a simple image,
local image = display.newImageRect(“image.png”, 50,50)
image.x = display.contentWidth/2
image.y = display.contentHeight/2
Creating a button
local widget = require( “widget” )
– Function to handle button events
local function handleButtonEvent( event )
if ( “ended” == event.phase ) then
composer.gotoScene(“menu”)
print( “Button was pressed and released” )
end
end
– Create the widget
local button1 = widget.newButton
{
left = 100,
top = 200,
id = “button1”,
label = “Default”,
onEvent = handleButtonEvent
}
to know about composer http://docs.coronalabs.com/api/library/composer/index.html