Hi guys,
I am trying to have a box (with touch) in front of a scroll view. The problem is that, either the scrollView will move, or the box’s touch listener is active.
I can’t get both the scrollView and box to have the listener at the same time. I tried playing around with different ‘return false/true’ scenarios, but still can’t get it to work.
Thanks
-- ScrollView listener local function scrollListener( event ) local phase = event.phase print( "Scroll view phase : " , event.phase ) return true end -- Create the widget local scrollView = widget.newScrollView { top = 100, left = 10, width = 300, height = 400, scrollWidth = 600, scrollHeight = 800, listener = scrollListener } local scrollViewBackground = display.newRoundedRect( 0, 0, 768, 200, 12 ) scrollViewBackground.strokeWidth = 3 scrollViewBackground:setStrokeColor( 1, 0, 0 ) scrollViewBackground:setFillColor( 0,0,1, 50/255 ) scrollView:insert( scrollViewBackground ) local foreground = display.newRoundedRect( 0, display.contentCenterY, display.actualContentWidth, 500, 12 ) foreground.strokeWidth = 3 foreground:setStrokeColor( 1, 0, 1 ) foreground:setFillColor( 1,0,0, 50/255 ) local function foregroundTouch(event) print( "foregroundTouch" , event.phase ) if event.phase == "began" then return false --true else return false end end foreground:addEventListener( "touch", foregroundTouch )