Hello…
I contact you because i have a problem with widget button.
In the simulator appears correctly, while in the device that is moved off screen. There’is no error during debug.
Here i post the code:
local composer = require( “composer” )
local scene = composer.newScene()
local widget = require (“widget”)
W = display.contentWidth
H = display.contentHeight
– “scene:create()”
function scene:create( event )
local sceneGroup = self.view
–
local background= display.newImage(“background.png”)
background.x = W/2
background.y = H/2
– Function to handle button events
local function handleButtonEvent( event )
local phase = event.phase
if “ended” == phase then
local options =
{
effect = “slideLeft”,
time = 4000,
}
composer.gotoScene( “scene02”, options )
end
end
local button= widget.newButton
{
left = W/2 140 ,
top = H/2 -20,
width = 280,
height = 280,
defaultFile = “play.png”,
overFile = “play1.png”,
onEvent = handleButtonEvent,
}
sceneGroup:insert(background)
sceneGroup:insert(button)
end
– “scene:destroy()”
function scene:destroy( event )
local sceneGroup = self.view
end
– Listener setup
scene:addEventListener( “create”, scene )
scene:addEventListener( “destroy”, scene )
return scene
Thanks for your help