Hi,
Newbie to corona here. For my first exercise, I am building an (endlessly) vertical scrolling wall of images like Pinterest. You can flick to scroll up and down but when you touch an image it zooms in on that image.
Although I could create individual listeners for every image I put in the newScrollView, that seems pretty inefficient and I’m worried it could perform poorly on the device and eat memory.
If I know the bounds of every image in the scrolling wall, I could watch for touches on the newScrollView and see if the coordinates are within an image and didn’t move.
However, I can’t seem to get event.x from the touch event I get from newScrollView.
Specifically, I have code like this:
local function printTouch2( event, where )
print ("x=" .. event.x)
end
local function onTouch3(event)
if event.type == "beganScroll" then
printTouch2(event,"beganScroll")
elseif event.type == "endedScroll" then
printTouch2(event,"endScroll")
end
end
-- Setup a scrollable content group
local scroller = widget.newScrollView { width=display.contentWidth, height=display.contentHeight, listener = onTouch3 }
Can anybody tell me how to find where the touch in a scrollview happened (both up and down so I can tell if it moved)?
Thank you very much.
[import]uid: 155483 topic_id: 27900 reply_id: 327900[/import]