Hi,
I have an interesting issue.
I have to show a automatic scroll screen. The problem is as soon as the scroll reaches to the last element, it comes back to the first showing a quick transition backwards. I want it to be smooth. Eg
the observed behaviour
1->2->3->4->5 ->4321->2->3->4->5
desired behaviour
1->2->3->4->5->1->2->3->4->5
where ->means 2 seconds delay
I hope i made my question clear.
Below is the code i have written.
var startedScrollView = Titanium.UI.createScrollableView({ showPagingControl : true, backgroundImage : 'ui/common/images/background.png', scrollingEnabled : false, exitOnClose : true }); var infoViewArray = [];Then, i add 5 views to the array. I add a timer as follows. I have a sleep function that sleeps for the given millisecs.
var intervalTimer = setInterval(startScrolling, 2000);Then i write my startScrolling function as follows
function startScrolling() { sleep(2000); Ti.API.info('Scrolling To Index: ' + viewIndex); startedScrollView.scrollToView(viewIndex); viewIndex++; viewIndex=viewIndex%infoViewArray.length }Thanks in advance.
1 Answer
Hi Shashank
Unfortunately for the moment there is no parameter to restart without the visual effect you are seeing.
However, you could create the effect yourself by using the same views and zindex.
1 Place your primary (first view) in the location you want on the screen.
2 Place the remaining views off screen to the right by setting the required left parameters.
3 In your loop, slide the next view using a simple animation over the top of the on screen view.
4 Take the previous card and position it off screen with the others.
5 No need for animation on this as you should not be able to see it.
6 Make sure you change each of the views zindex property during each loop interval.
7 Repeat 3 - 6.
Will work a charm, and very little code required.
Your Answer
Think you can help? Login to answer this question!