Hi guys, I’m having a really newbie question. I’ve read in tons of places that to avoid this behaviour I just have to return true in the functions that are called by the events, but it’s not working… of course because I’m doing something wrong, but I can’t tell what?!
I have a background like this:
local background = display.newRect( centerX, centerY, display.contentWidth, display.contentHeight ) background:setFillColor( 20/255, 21/255, 25/255 ) sceneGroup:insert( background )
I add the following listener:
function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then background:addEventListener( "tap", moveCrocodile ) Runtime:addEventListener( "collision", onCollision ) Runtime:addEventListener( "enterFrame", moveBirds ) end end
And I also have a button that is added on the scene:create like this:
local fastButton = widget.newButton { x = \_W - 149/2, y = \_H - 149/2, width = 149, height = 149, onEvent = changeHeight, defaultFile = "images/height.png", overFile = "images/heightPressed.png" } sceneGroup:insert( fastButton )
The button of course is over the background but when I touch the button the “onEvent” event that calls changeHeight and the moveCrocodile is called as well. I don’t know what else to try. Both of my changeHeight and moveCrocodile are returning true at the end. What can be wrong?!
changeHeight = function ( event ) if event.phase == "began" then elseif event.phase == "ended" then end print("changeSpeed is called") return true end
moveCrocodile = function ( event ) print("moveCrocodile called") return true end
THANKS!!!