Hello i have a problem with my program on androids 4.0.4+ .
The problem is on menu scene.
On menu scene i have a scrollview widget with some image objects inside that. These image objects are links on other scenes. When i touch these objects on android 4.0.3 the program works great, But when i tested on androids 4.0.4+ there is a problem with touch event. Although i touch the objects it does nothing. I THINK THE PROBLEM IS ON ’ scrollView:takeFocus(event) ’ .
PLEASE TAKE A LOOK AT THIS BUG…
[lua] Group1 = display.newGroup();
Group2 = display.newGroup();
Group3 = display.newGroup();
Group4 = display.newGroup();
local scrollView = widget.newScrollView{
top = 0,
width = 320,
height = 480,
scrollWidth = 910,
scrollHeight = 480,
hideBackground=true,
frinction=1.2,
maskFile=“mask.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: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);
elseif 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” then
print( “ended phase” )
display.getCurrentStage():setFocus(event.target,nil);
storyboard.gotoScene(“hotel”);
end
return true
end
Group1:addEventListener( “touch”, Group1 )
scrollView:insert(Group1)
local rooms = display.newImageRect(“images/menu/room.png”, 90, 180)
Group2:insert(rooms);
Group2:setReferencePoint(display.CenterReferencePoint)
Group2.x=Group1.x+hotel.width +10
Group2.y=350
function Group2:touch(event)
if event.phase == “began” then
print( “begin phase” )
Group2:remove(rooms);
rooms = display.newImageRect(“images/menu/room_hover.png”,90,180);
Group2:insert(rooms);
display.getCurrentStage():setFocus( self )
self.isFocus = true
elseif self.isFocus then
if event.phase == “moved” then
print( “moved phase” )
scrollView:takeFocus( event )
Group2:remove(rooms);
rooms = display.newImageRect(“images/menu/room.png”,90,180);
Group2:insert(rooms);
elseif event.phase == “ended” or event.phase == “cancelled” then
print( “ended phase” )
display.getCurrentStage():setFocus( nil )
self.isFocus = false
storyboard.gotoScene(“rooms”);
end
end
return true
end
Group2:addEventListener( “touch”, Group2 )
scrollView:insert(Group2)
local news = display.newImageRect(“images/menu/news.png”, 90, 180)
Group3:insert(news);
Group3:setReferencePoint(display.CenterReferencePoint)
Group3.x=Group2.x+hotel.width +10
Group3.y=350
function Group3:touch(event)
if event.phase == “began” then
print( “begin phase” )
Group3:remove(news);
news = display.newImageRect(“images/menu/news_hover.png”,90,180);
Group3:insert(news);
display.getCurrentStage():setFocus( self )
self.isFocus = true
elseif self.isFocus then
if event.phase == “moved” then
print( “moved phase” )
scrollView:takeFocus( event )
Group3:remove(news);
news = display.newImageRect(“images/menu/news.png”,90,180);
Group3:insert(news);
elseif event.phase == “ended” or event.phase == “cancelled” then
print( “ended phase” )
display.getCurrentStage():setFocus( nil )
self.isFocus = false
storyboard.gotoScene(“nea”);
end
end
return true
end
Group3:addEventListener( “touch”, Group3 )
scrollView:insert(Group3)
local price = display.newImageRect(“images/menu/price.png”, 90, 180)
Group4:insert(price);
Group4:setReferencePoint(display.CenterReferencePoint)
Group4.x=Group3.x+hotel.width +10
Group4.y=350
function Group4:touch(event)
if event.phase == “began” then
print( “begin phase” )
Group4:remove(price);
price = display.newImageRect(“images/menu/price_hover.png”,90,180);
Group4:insert(price);
display.getCurrentStage():setFocus( self )
self.isFocus = true
elseif self.isFocus then
if event.phase == “moved” then
print( “moved phase” )
scrollView:takeFocus( event )
Group4:remove(price);
price = display.newImageRect(“images/menu/price.png”,90,180);
Group4:insert(price);
elseif event.phase == “ended” or event.phase == “cancelled” then
print( “ended phase” )
display.getCurrentStage():setFocus( nil )
self.isFocus = false
storyboard.gotoScene(“times”);
end
end
return true
end
Group4:addEventListener( “touch”, Group4 )
scrollView:insert(Group4)
group:insert(scrollView); [import]uid: 185094 topic_id: 33412 reply_id: 333412[/import]