widget.newScrollView swipeLeft + swipeRight

Hello everyone,

There is a swipeLeft and swipeRight (event.phase) function in newTableView but not in newScrollView and that gives me a hard time right now.

I’m using my newScrollView for vertical scroll only.

I have a storyboard with many different scenes. I need to switch between these scenes by doing a swipe, it works fine but doesn’t when a scrollview comes in.

at the same time I don’t get any event.x or event.xStart parameters by the event-listener in newscrollview widget so I hope you understand my frustration…

any suggestions?
any help appreciated,
roman [import]uid: 140000 topic_id: 31816 reply_id: 331816[/import]

okay I found a solution. I put a fullscreen-rectangle inside the scrollview, set it’s alpha to 0 and attached this listener to it(the rectangle):

 local function ontouch(event)  
 if event.phase == "began" then  
  
 elseif event.phase == "moved" then  
 local dx = math.abs( event.x - event.xStart )  
 local dy = math.abs( event.y - event.yStart )  
  
 if dx \< 10 and dy \> 5 then  
 scrollView:takeFocus( event )  
  
 elseif dx \> 20 and dy \< 5 then  
  
 if event.xStart \< event.x then  
 previouspage() -- some function  
 elseif event.xStart \> event.x then  
 nextpage() -- some function  
 end  
  
 end  
  
 elseif event.phase == "ended" then  
 display.getCurrentStage():setFocus(nil)  
 end  
  
 return true  
 end  

it would still be nice to have the event.x and event.xStart parameters in the future to make things a bit easier and avoid possible performance-issues. [import]uid: 140000 topic_id: 31816 reply_id: 127387[/import]

okay I found a solution. I put a fullscreen-rectangle inside the scrollview, set it’s alpha to 0 and attached this listener to it(the rectangle):

 local function ontouch(event)  
 if event.phase == "began" then  
  
 elseif event.phase == "moved" then  
 local dx = math.abs( event.x - event.xStart )  
 local dy = math.abs( event.y - event.yStart )  
  
 if dx \< 10 and dy \> 5 then  
 scrollView:takeFocus( event )  
  
 elseif dx \> 20 and dy \< 5 then  
  
 if event.xStart \< event.x then  
 previouspage() -- some function  
 elseif event.xStart \> event.x then  
 nextpage() -- some function  
 end  
  
 end  
  
 elseif event.phase == "ended" then  
 display.getCurrentStage():setFocus(nil)  
 end  
  
 return true  
 end  

it would still be nice to have the event.x and event.xStart parameters in the future to make things a bit easier and avoid possible performance-issues. [import]uid: 140000 topic_id: 31816 reply_id: 127387[/import]