scrollview blocks touches on objects inside that

I have a scrollview with some images inside. when i touch a image scrollview blocks
the “end” phase of the event… it listens only the “moved” phase… i dont know what to do… please help!

[lua] local scrollView = widget.newScrollView{
top = 0,
width = 320,
height = 459,
scrollWidth = 810,
scrollHeight = 459,
hideBackground=true,
frinction=1.2,
maskFile=“mask2.png”

}
scrollView.content.verticalScrollDisabled = true
scrollView.content.horizontalScrollDisabled= false
scrollView.isHitTestMasked = true;

local hotel = display.newImageRect(“images/menu/hotel.png”, 90, 180)
Group1:insert(hotel);
Group1.isHitTestMasked = true;

Group1:setReferencePoint(display.CenterReferencePoint)
Group1.x=hotel.width/2 +10
Group1.y=350

function Group1:touch(event)
if event.phase == “began” then
print( “begin phase” )
Group1:remove(hotel);
hotel = display.newImageRect(“images/menu/hotel_hover.png”,90,180);
Group1:insert(hotel);
display.getCurrentStage():setFocus(event.target,event.id);
event.target.isFocus = true
elseif event.target.isFocus then
if event.phase == “moved” then
print( “moved phase” )
scrollView:takeFocus(event)
Group1:remove(hotel);
hotel = display.newImageRect(“images/menu/hotel.png”,90,180);
Group1:insert(hotel);
elseif event.phase == “ended” or event.phase == “cancelled” then
print( “ended phase” )
display.getCurrentStage():setFocus(event.target,nil);
event.target.isFocus = false
storyboard.gotoScene(“hotel”);
end
end
return true
end
Group1:addEventListener( “touch”, Group1 )
scrollView:insert(Group1) [import]uid: 185094 topic_id: 33856 reply_id: 333856[/import]

scrollView does not use the same sort of event.phase system as other objects - it needs something different to support scrolling.

You can make touch events work inside it by adding return true to the object. That just ensures it won’t look below your object at the scrollView.

It seems you already have return true here, but what’s not clear is what Group1 is or where it is. You’re attaching the listener to the group and not the image so it really depends on where the group is in the scene. [import]uid: 41884 topic_id: 33856 reply_id: 135755[/import]

thanks for answering to me!!

well… the group1 is a way to make a touch effect something like rollover ! first goup1 is a object with a white image inside it, when the user touches this group the white image is gone and its place take’s a black one! I think the only way to do this type of rollover effect is by using a group object… am i right? This effect works perfect when it is not put inside in other objects( like scrollview or tableview ). In my case now… I want to have that group1 in a scrollview , because i dont have only one group1! i have another object called group2, group3, group4 …etc…! All these groups are making a scrolling menu!! This menu works perfect on samsung devices… But not working on google nexus or nokias… I have tested that on these 3 brand of mobile devices… The exact problem on some devices is that they dont recognize the touch event on group objects of my scrolling menu. I had the exactly same problem using simple widget.newButton objects!

I hope my english are not too bad, and you will understand something!! :))

thanks anyway!! [import]uid: 185094 topic_id: 33856 reply_id: 136024[/import]

Rollovers can be done in two ways:

  1. make two images and set one of to .isVisible = false, if pressed
  2. use an imageSheet and then just change the frame (requires both images be in the same file)

Does it work fine for you on simulator (on your PC)? That could mean a Corona bug or some sort of configuration bug. [import]uid: 41884 topic_id: 33856 reply_id: 136027[/import]

scrollView does not use the same sort of event.phase system as other objects - it needs something different to support scrolling.

You can make touch events work inside it by adding return true to the object. That just ensures it won’t look below your object at the scrollView.

It seems you already have return true here, but what’s not clear is what Group1 is or where it is. You’re attaching the listener to the group and not the image so it really depends on where the group is in the scene. [import]uid: 41884 topic_id: 33856 reply_id: 135755[/import]

yes it works fine on simulator … rob miracle said that corona has issues with nested widgets and the team is working on them… :confused: i think we must wait for now… [import]uid: 185094 topic_id: 33856 reply_id: 136254[/import]

thanks for answering to me!!

well… the group1 is a way to make a touch effect something like rollover ! first goup1 is a object with a white image inside it, when the user touches this group the white image is gone and its place take’s a black one! I think the only way to do this type of rollover effect is by using a group object… am i right? This effect works perfect when it is not put inside in other objects( like scrollview or tableview ). In my case now… I want to have that group1 in a scrollview , because i dont have only one group1! i have another object called group2, group3, group4 …etc…! All these groups are making a scrolling menu!! This menu works perfect on samsung devices… But not working on google nexus or nokias… I have tested that on these 3 brand of mobile devices… The exact problem on some devices is that they dont recognize the touch event on group objects of my scrolling menu. I had the exactly same problem using simple widget.newButton objects!

I hope my english are not too bad, and you will understand something!! :))

thanks anyway!! [import]uid: 185094 topic_id: 33856 reply_id: 136024[/import]

Rollovers can be done in two ways:

  1. make two images and set one of to .isVisible = false, if pressed
  2. use an imageSheet and then just change the frame (requires both images be in the same file)

Does it work fine for you on simulator (on your PC)? That could mean a Corona bug or some sort of configuration bug. [import]uid: 41884 topic_id: 33856 reply_id: 136027[/import]

yes it works fine on simulator … rob miracle said that corona has issues with nested widgets and the team is working on them… :confused: i think we must wait for now… [import]uid: 185094 topic_id: 33856 reply_id: 136254[/import]