I want to be able to consistently access the scrollview object from within it’s own listener.
I am aware of event.target however there are different results depending on the phase of the event.
Specifically I want to access a custom property I’ve attached to the scrollview when ‘limitReached’ is true. I can access this on the ended phase but not when event.limitReached.
The point is, a different table seems to be returned by event.target at this point compared with any other point of the event.
Any idea what’s going on here?
If you test this scrollListener with a scrollview object and look at the print log, you’ll see what I mean.
local function scrollListener( event ) if event.phase == 'began' then print( 'self on began : ' .. tostring(event.target) ) elseif event.phase == 'moved' then print( 'self on moved : ' .. tostring(event.target) ) elseif event.phase == 'ended' then print( 'self on ended : ' .. tostring(event.target) ) end if event.limitReached then if event.direction == 'up' then print( 'self on limitReached-up : ' .. tostring(event.target) ) elseif event.direction == 'down' then print( 'self on limitReached-down : ' .. tostring(event.target) ) end end end