I have problem with button and composer. See gif
It’s normal behavior? Why the background of button not fading ?
Here is sample code nothing fancy:
[lua]
function onButtonRelease(event)
local button = event.target;
if button.id == “playGame” then
composer.gotoScene(“game”, {
effect = “fade”,
time = 800,
})
elseif button.id == “bestScore” then
composer.gotoScene(“best”, {
effect = “fade”,
time = 800,
})
end
end
function scene:create( event )
local sceneGroup = self.view
local background = display.newRect(display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight)
background:setFillColor(0.682, 0.835, 0.505)
sceneGroup:insert(background)
local buttonsGroup = display.newGroup()
buttonsGroup.anchorChildren = true
buttonsGroup.anchorX = 0.5
buttonsGroup.anchorY = 0.5
buttonsGroup.x = display.contentCenterX
buttonsGroup.y = display.contentCenterY
sceneGroup:insert(buttonsGroup)
playButton = widget.newButton
{
id = “playGame”,
label = “Play Game”,
shape = “rect”,
height = 150,
width = 600,
x = 0,
y = 0,
fillColor = {default={0.682, 0.835, 0.505}, over={0.545, 0.764, 0.290}},
labelColor = {default={ 1, 1, 1 }, over={ 1, 1, 1} },
fontSize = 72,
onRelease = onButtonRelease
}
buttonsGroup:insert(playButton)
bestButton = widget.newButton
{
id = “bestScore”,
label = “Best Score”,
shape = “rect”,
height = 150,
width = 600,
x = 0,
y = 200,
fillColor = {default={0.682, 0.835, 0.505}, over={0.545, 0.764, 0.290, 1}},
labelColor = {default={ 1, 1, 1}, over={ 1, 1, 1 } },
fontSize = 72,
onRelease = onButtonRelease
}
sceneGroup:insert(bestButton)
buttonsGroup:insert(bestButton)
end
[/lua]
