[RESOLVED] event touch stops

So I am having some problems with touch on objects and how it works. Cant remember it being the this way in the past. The issue is that it seems the touch stops working once the event has moved passed some kind of boundary compared to where the object is.

Code to test it:

display.setStatusBar( display.HiddenStatusBar ) function changeValue(event) local t = event.target local phase = event.phase if "began" == phase then t.isFocus = true t.x1 = event.x t.y1 = event.y elseif t.isFocus then if "moved" == phase then t.x2 = event.x t.y2 = event.y if math.abs( t.y2 - t.y1 ) \> 2 then if event.y \< t.y1 then t.y = t.y - 4 else t.y = t.y + 4 end t.x1 = event.x t.y1 = event.y end elseif "ended" == phase or "cancelled" == phase then display.getCurrentStage():setFocus( nil ) t.isFocus = false end end return true end testBox = display.newRect( 0, 0, 100, 100 ) testBox.x = display.contentCenterX testBox.y = display.contentCenterY testBox:addEventListener( "touch", changeValue )

the box will move up or down if you touch it and move. If you move the box slowly it is ok and more or less follows your touch, but if you move fast you will get out of some boundary and things stops to work. This would also be ok if some feedback or a release of the touch would happen, but I cant seem to find a way to detect this. If you continue to touch and move back to the box it will start to work again. But if you release outside the box nothing happens.

I would like the box to move in the same pace regardless of where the user moves his finger or how fast, as long as the initial touch was on the box, or at least have some feedback if the touch has moved passed some boundary that stops it from working. Is this not possible? And should it be like this?

ok, so after some more researching and testing I found that I totally forgot to set the focus in the “began” phase:

display.getCurrentStage():setFocus( t )

so now everything works as I want it to :slight_smile:

ok, so after some more researching and testing I found that I totally forgot to set the focus in the “began” phase:

display.getCurrentStage():setFocus( t )

so now everything works as I want it to :slight_smile: