I wrote the code below and let me know how to simulate the pressure of bottone1? Sorry for my horrible English.
local function onKeyEvent( event )
if (event.keyName == “menu”) and (event.phase == “down”) then
How to simulate the button 1 is pressed?
end
local button1Press = function( event )
print (“Press button1”)
end
button3 = widget.newButton
{
defaultFile = “res/buttonRed.png”,
overFile = “res/buttonRedOver.png”,
labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
label = “RESET”,
emboss = true,
onPress = button1Press,
}
button1.x = display.contentWidth / 2; button1.y = 180
Runtime:addEventListener( “key”, onKeyEvent)