I have scrollview widget with one child (myrect)
I want to detect the touch ended event for “myrect” however currently it only detects the “began” phase !!
here is the complete code
--main.lua
local widget = require "widget"
local myscrollview = widget.newScrollView{}
local myrect = display.newRect(0, 0, display.contentWidth, 68)
myrect:setFillColor(255,100,100,255)
myscrollview:insert(myrect)
local function ontouch(event)
if event.phase == "ended" then
print("event ended")
end
end
myrect:addEventListener( "touch", ontouch )
what I need is a basic functionality it is strange that corona does not support that or maybe I am missing something
Many thanks
Thank you SatheeshJM your code for some how give me wrong result so when I click anywhere outside the rect the “touch ended event ” will be fired
but finally I have the solution Just in case if anyone is interested
here is the enhanced version of the solution
Thanks to Danny http://developer.anscamobile.com/forum/2012/05/15/scrollview-problem
and Jonathan Beebe for this helpful workaround https://gist.github.com/1590908