How to move scrollview left and rigth by certain distance ?

Hi Team,

I have scrollview with picture inside it that represent levels for user to select from. I am not able to make buttons around to allow user to scroll left and write… i tried scrollTo function but the issue it scroll to x position not by distance… 

i am looking for something to scroll left and right by for example x distance. 

is it possible  ?

http://postimg.org/image/7w991inx9/

If you want to scroll by distance when a tap on a button happens you will need to get the current scroll position and add the scroll distance to it, then call scrollTo with that value.

This is very possible, so maybe just take another look at the documentation.

Hi horacebury,

scrollTo does not allow to add values… it just postions : “top”, “bottom”, “left”, or “right”.

http://docs.coronalabs.com/api/type/ScrollViewWidget/scrollTo.html#TOC

did I miss anything ?  

also i am not able to find the current postions for this scroll ? how can i do that., 

thanks

Use this: http://docs.coronalabs.com/api/type/ScrollViewWidget/scrollToPosition.html

no luck yet

scrollToPosition scrolls your view to the position that you specify in pixels. What value are you providing? Can you post code?

<horcebury> is giving you good advice. scrollToPosition() is what you need, perhaps coupled with getContentPosition(), and then +/- by a constant representing the width of your each panel in your scrollView. All these are in the API specs.

my issue is to find current x … so i can add and subtract using scrollToPosition … I will try again and see if i can achieve that… 

If you want to scroll by distance when a tap on a button happens you will need to get the current scroll position and add the scroll distance to it, then call scrollTo with that value.

This is very possible, so maybe just take another look at the documentation.

Hi horacebury,

scrollTo does not allow to add values… it just postions : “top”, “bottom”, “left”, or “right”.

http://docs.coronalabs.com/api/type/ScrollViewWidget/scrollTo.html#TOC

did I miss anything ?  

also i am not able to find the current postions for this scroll ? how can i do that., 

thanks

Use this: http://docs.coronalabs.com/api/type/ScrollViewWidget/scrollToPosition.html

no luck yet

scrollToPosition scrolls your view to the position that you specify in pixels. What value are you providing? Can you post code?

<horcebury> is giving you good advice. scrollToPosition() is what you need, perhaps coupled with getContentPosition(), and then +/- by a constant representing the width of your each panel in your scrollView. All these are in the API specs.

my issue is to find current x … so i can add and subtract using scrollToPosition … I will try again and see if i can achieve that…