

function onPress() { //scroll immediately scrollDown(); //setup pause _scrollID = setInterval(this,"initDownScroll",350); } function initDownScroll() { clearInterval(_scrollID); //scroll immediately again scrollDown(); //setup continuous scrolling _scrollID = setInterval(this,"scrollDown",50); } function scrollDown() { //handle scrolling here }Thankfully there is a easy fix that lets you only have to use one function for both intervals:
function onPress() { //scroll immediately scrollDown(); //setup pause _scrollID = setInterval(this,"scrollDOwn",350,true); } function scrollDown(first:Boolean) { if(first) { clearInterval(_scrollID); //setup continuous scrolling _scrollID = setInterval(this,"scrollDown",50); } //handle scrolling here }So just by passing an extra parameter to the first interval, the scrollDown function can detect that the pause is over and setup the next interval.
This site is licensed under a
Creative Commons License