Event.phase == "ended" does NOT fire inside of scroll view

So all I am trying to do is have some buttons/images/etc inside of a scroll view and detect event.phase == “ended” if they are touched.  But from my observations the only thing that ever happens is the “began” phase.  

Is this intentional behavior?

As a side note, “tap” seems to work fine.  But as soon as I change it to “touch” the “ended” phase never happens.

I have attached some very simple code as an example of what I am trying to do.  Would really appreciate some help as I have spent many hours trying to solve this.  

local composer = require "composer" local widget = require "widget" local scene = composer.newScene() local function scrollListener( event ) ---[[local phase = event.phase if ( phase == "began" ) then print( "Scroll view was touched" ) elseif ( phase == "moved" ) then print( "Scroll view was moved" ) elseif ( phase == "ended" ) then print( "Scroll view was released" ) end -- In the event a scroll limit is reached... if ( event.limitReached ) then if ( event.direction == "up" ) then print( "Reached bottom limit" ) elseif ( event.direction == "down" ) then print( "Reached top limit" ) elseif ( event.direction == "left" ) then print( "Reached right limit" ) elseif ( event.direction == "right" ) then print( "Reached left limit" ) end end --]] return true end local scrollView = widget.newScrollView( { top = 0, left = 0, width = contentWidth, height = contentHeight, scrollWidth = 1000, scrollHeight = 1000, leftPadding = 0, topPadding = 0, listener = scrollListener } ) function scene:create( event ) local sceneGroup = self.view sceneGroup:insert(scrollView) local function onTouch(event) print("event.phase is: " .. event.phase) if(event.phase == "began") then event.target:takeFocus(event) print("TOUCHED") end if(event.phase == "ended") then print("ENDED") end end local apple = display.newImageRect("apple.png", 100,100) apple.x, apple.y = 110, 110 scrollView:insert(apple) apple:addEventListener("touch", onTouch) scrollView:setScrollHeight(1000) scrollView:setScrollWidth(1000) end -- show() function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene

Your problem is that your  onTouch function doesn’t have “return true” at the end. Having that before the function ends would stop the touch event from propagating. In other words, if you now press that  apple , then the event will begin, but the touch will also trigger the scrollListener below it, which takes the focus and which is why the onTouch function never reaches any other event state.

The reason why it works with tap is because tap and touch events use different listeners.

If you want that the player cannot scroll by holding the buttons, then all you need to do is add “return true” at the end of the onTouch function. If you want the player to be able to scroll by pressing and holding the buttons as well, then have a look at this tutorial: https://coronalabs.com/blog/2014/08/19/tutorial-building-a-sliding-menu/.

Wow.  Can’t believe it was such a simple fix.  That’s exactly what I needed.  Much appreciated!