I was wondering if anyone had had any code snippets or anything for this before I started trying to make my own? [import]uid: 143007 topic_id: 27985 reply_id: 327985[/import]
I haven’t seen anything like this around unfortunately, sorry
[import]uid: 52491 topic_id: 27985 reply_id: 113332[/import]
Well, for anyone discovering this thread, here is a code snippet that should help. You just need to add a listener to the scrollview, in my case, the function below, dragUpdate, is that scrollView listener.
local updating = false;
local function dragUpdate(event)
local s = event.target -- reference to scrollView object
if(event.type == 'contentTouch')then
local dragX, dragY = s:getContentPosition();
if(dragY \> display.contentHeight \* .1)then
if(updating == false)then
updating = true;
print("Dragged down, when release, should upate");
end
else
if(updating == true)then
updating = false;
print("Dragged back up, when released, should --NOT-- update");
end
end
elseif(event.type == 'endedScroll')then
if(updating == true)then
print('finger was released, and we should be updating');
end
end
end
So, in this case, if the menu is dragged down more than 10% of the screen’s height, it will trigger the print.
Cheers everyone! [import]uid: 143007 topic_id: 27985 reply_id: 113364[/import]
Terrific! Thanks for sharing this - may also be worth putting in the code exchange if you felt like it
[import]uid: 52491 topic_id: 27985 reply_id: 113455[/import]
So where is this contentTouch and endedScroll documented?
Also, is this for the ‘widget’ scrollview? or for the scrollView.lua? [import]uid: 5942 topic_id: 27985 reply_id: 119638[/import]
So where is this contentTouch and endedScroll documented?
Also, is this for the ‘widget’ scrollview? or for the scrollView.lua? [import]uid: 5942 topic_id: 27985 reply_id: 119638[/import]