Continue touch after the event coordinates are out of object bounds

I am having an issue, I have added an event listener to an object. When I touch the object I want it to change the coordinates of the line to where the even.x is. However I want this to also continue even if I move my finger past the objects bounds.

local box = display.newRect(0,0, 100, 100) local line = display.newLine(0,-50 0,50) local function listener( event ) if ( event.phase == "began" ) then line.isFocus = true line.x = event.x elseif ( event.phase == "moved" ) then line.x = event.x elseif ( event.phase == "ended" ) then line.isFocus = false end end box:addEventListener( "touch", listener )

Have a look here:

https://docs.coronalabs.com/api/type/StageObject/setFocus.html

So after reading that little update, I was able to solve the problem. I have posted my updated code below. 

local box = display.newRect(0,0, 100, 100) local line = display.newLine(0,-50 0,50) local function listener( event ) if ( event.phase == "began" ) then display.getCurrentStage():setFocus( event.target ) line.x = event.x elseif ( event.phase == "moved" ) then line.x = event.x elseif ( event.phase == "ended" or event.phase == "cancelled" )then display.getCurrentStage():setFocus(nil) end end box:addEventListener( "touch", listener )

Have a look here:

https://docs.coronalabs.com/api/type/StageObject/setFocus.html

So after reading that little update, I was able to solve the problem. I have posted my updated code below. 

local box = display.newRect(0,0, 100, 100) local line = display.newLine(0,-50 0,50) local function listener( event ) if ( event.phase == "began" ) then display.getCurrentStage():setFocus( event.target ) line.x = event.x elseif ( event.phase == "moved" ) then line.x = event.x elseif ( event.phase == "ended" or event.phase == "cancelled" )then display.getCurrentStage():setFocus(nil) end end box:addEventListener( "touch", listener )