Oh, its fine - not choppy at all. I've even been toying with the idea of
doing something more acceleration based instead, but probably won't bother.

I scroll to a position where some text is newly selected. I just needed to
be careful that I only made the selection after the scrolling finished.
Otherwise, I think it jumps straight there when you make the selection...

Also, if the number of lines to be scrolled is below a certain minimum, I
base the duration on the number of lines (so it doesnt scroll too slow).
Above that minimum, I use a fixed duration.

private function verticalScrollToPosition(newPosition:int,
nextFunc:Function, durationInMillis:Number = SCROLL_DURATION_IN_MILLIS):void
{
        var scrollEffect:AnimateProperty = new AnimateProperty(this)
        scrollEffect.addEventListener(EffectEvent.EFFECT_END,
function(evt:EffectEvent):void {
                if (nextFunc != null) {
                        nextFunc();
                }
        });
        scrollEffect.property = "verticalScrollPosition";
        scrollEffect.toValue = newPosition;
        // maybe possible to use scrollEffect.fromValue instead of
this.verticalScrollPosition?
        var linesToScroll:int = Math.abs(newPosition -
this.verticalScrollPosition);
        // don't go too slow
        scrollEffect.duration = Math.min(durationInMillis, (1000 * 
linesToScroll) /
MIN_SCROLL_SPEED);
        scrollEffect.play();
}

I'd never heard of easing functions before. I'll check them out...

-- 
View this message in context: 
http://www.nabble.com/Smooth-scrolling-when-setting-verticalScrollPosition-on-TextArea-tp19930681p19966745.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to