Stepped scroll

Does anyone know how to make the scrollView scroll to interval positions, like the picker wheel does? This would be useful for making a horizontal scroller for selecting levels, like the Angry Birds selector does.

Hi Matt,

In truth, the ScrollView wasn’t really designed for “level select screens”. You’re certainly free to tinker with the Slider/Flicker Carousel code I added to the Code Exchange awhile back. The foundation is quite solid (I use it myself, in a side project), but it could use a little care and attention by somebody who wants to make it better. :slight_smile:

http://developer.coronalabs.com/code/enhanced-springboard-slidephoto-viewer

Brent

You could calculate the center point for each “screen” that you want and then the scrollView:getContentPosition() to find out where you are then do scrollView:scrollToPosition({x = whereYouWantToGo * -1 , time=500 }).  That will create a snap like effect.

Not the most optimal way.  I’m actually doing this in an app now.

Hi Matt,

In truth, the ScrollView wasn’t really designed for “level select screens”. You’re certainly free to tinker with the Slider/Flicker Carousel code I added to the Code Exchange awhile back. The foundation is quite solid (I use it myself, in a side project), but it could use a little care and attention by somebody who wants to make it better. :slight_smile:

http://developer.coronalabs.com/code/enhanced-springboard-slidephoto-viewer

Brent

You could calculate the center point for each “screen” that you want and then the scrollView:getContentPosition() to find out where you are then do scrollView:scrollToPosition({x = whereYouWantToGo * -1 , time=500 }).  That will create a snap like effect.

Not the most optimal way.  I’m actually doing this in an app now.