Page 1 of 1

Native Scroller for images - no horizontal scrolling

Posted: Fri Aug 14, 2015 5:43 pm
by dmeier
Hi

I tried to code a native scroller for images. I followed the instruction on http://lessons.runrev.com/s/lessons/m/4 ... ll-a-field
but my scroller is only scrolling vertically not horizontally.

What I did

a) put 3 pics on a card
b) locked their size and position
c) grouped the pics
d) created a scroller with the rect of the group
e) resized the group and locked the size and position

I dont get it working :?
I attached my stack which is configured to run with iOS.

Thanks for help
David

Re: Native Scroller for images - no horizontal scrolling

Posted: Sun Aug 16, 2015 1:05 am
by Simon
Hi David,
Not to be an ass or anything but I think if you just look at this code you can figure it out?

Code: Select all

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
What do you think hOffset is?

Simon

Re: Native Scroller for images - no horizontal scrolling

Posted: Sun Aug 16, 2015 7:53 am
by dmeier
Hi Simon

I just didn't see the wood for the trees. I was so sure I made an error with the ContentRect that I oversaw the missing line for "hScroll" in the "scrollerDidScroll" handler.

Thank you very much for your help

Regards David

For clearness that's what I have now:

To scroll vertically and horizontally I use now the following code, which works perfectly

on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "scrollArea" to vOffset
set the hScroll of group "scrollArea" to hOffset
end scrollerDidScroll

Re: Native Scroller for images - no horizontal scrolling

Posted: Sun Aug 16, 2015 8:30 am
by Simon
Hi David,
Glad you got it!

Simon