Hello
I’m trying to add touch event handler to one object in my app. The object is pretty small - only 30*30 pixels. In simulator when I’m using mouse everything works ok. But on the real device (HTC with Android) the reaction is veeery poor - when I press on the object and slide my finger it works only 1 time from 5 - seems like most of the time the touch event is not posted. I’m using Corona SDK for Win. So the question is: is it a problem in the size of the object? How can I improve this touch handling?
The code itself looks like this:
[code]
function onCueTouch( event )
if event.phase == “began” then
display.getCurrentStage():setFocus( event.target )
event.target.isFocus = true
targetLine = nil
elseif event.target.isFocus then
if event.phase == “moved” then
if targetLine ~= nil then
targetLine.parent:remove( targetLine ) – erasing old line
end
targetLine = display.newLine( event.target.x, event.target.y, event.x, event.y )
targetLine:setColor( 255, 200, 200, 100 )
targetLine.width = 6
end
if event.phase == “ended” then
display.getCurrentStage():setFocus( nil )
event.target.isFocus = false
if targetLine ~= nil then
targetLine.parent:remove( targetLine ) – erasing old line
end
decShotsCount()
print( “touch listener removed” )
event.target.isTouchListen = false
event.target:removeEventListener( “touch”, onCueTouch )
gameScreen.cuePoint.isVisible = false
event.target:applyForce( (event.target.x - event.x), (event.target.y - event.y), event.target.x, event.target.y )
end
end
return true
end
[/code] [import]uid: 31161 topic_id: 7298 reply_id: 307298[/import]