Skip to content

Instantly share code, notes, and snippets.

@ferminhg
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save ferminhg/a035e94045c056a26d5c to your computer and use it in GitHub Desktop.

Select an option

Save ferminhg/a035e94045c056a26d5c to your computer and use it in GitHub Desktop.
Corona SDK - Creating Button
local widget = require("widget")
--Function to handle button events
local function handleButtonEvent( event )
local phase = event.phase
if "ended" == phase then
print( "You pressed and released a button!")
end
end
--Create the buttond
local myButton = widget.newButton
{
left = 150,
top = 200,
width = 350,
height = 150,
defaultFile = "cerdito.png",
label = "Wopwop",
onEvent = handleButtonEvent,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment