xncroft
xncroft

Reputation: 143

Is it possible to tween scroll position of ScrollPane component with TweenLite?

In actionscript3, using the ScrollPane component and the TweenLite package, would it be possible to animate to a particular scroll position? This seems like it should be possible, but I'm not sure exactly how to go about it. Thanks!

Upvotes: 0

Views: 1281

Answers (2)

habsi
habsi

Reputation: 311

Tweenlite also provides a scrollRect Plugin.

You have to scoll down to the plugin Examples and there you have to scroll again.

Their example:

import com.greensock.*; 
import com.greensock.easing.*;

TweenLite.to(mc, 1, {scrollRect:{left:0, right:288, top:0, bottom:216}});

Be careful with the parentheses after the scrollRect attribute. The first time I overlooked it.

Upvotes: 1

xncroft
xncroft

Reputation: 143

I figured it out, so I thought I should go ahead and post the solution. It is indeed possible to use TweenLite to animate to a scroll position on a ScrollPane component.

You just need to do:

TweenLite.to(yourScrollPane, 1, {verticalScrollPosition: yourScrollPane.verticalScrollPosition+amountToScroll});

Upvotes: 2

Related Questions