Stopping a running Tween class

I have a tween class defined in a function like below, which runs when the user clicks a left or right arrow to scroll some thumbnails:

function scroll_thumbs() {
// code that defines scroll_to's value
var mcTween:Tween = new Tween( paintings_strip_mc, "_x", Strong.easeOut, paintings_strip_mc._x, scroll_to, 5, true );

This works perfectly, but I also want to move the same mc (paintings_strip_mc) in another way if the user hovers over the mc. This doesn't use a tween - instead it uses a timer which gently scrolls the mc along.

All good. However if the tween above is still running from the user clicking an arrow, then it fights with the timer scrolling and you get a horrible effect and it doesn't move but instead jiggles about. You have to wait for the tween to finish, and then it works.

Since I've defined the tween in a function, how can I tell it to stop if the user hovers over the strip?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

firstly don't define the tween in a function.
import mx.transitions.*;
var mcTween:Tween;
function scroll_thumbs() {
// code that defines scroll_to's value
 mcTween = new Tween( paintings_strip_mc, "_x", Strong.easeOut, paintings_strip_mc._x, 500, 5, true );

then just call mcTween.stop();


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
corin_pearceAuthor Commented:
Thanks! I thought of that, but problem is I want to change mcTween each time an arrow is pressed - i.e. there will be a new scroll_to value each time.

So that's why I put it in a function, so that it could be made again and again...
corin_pearceAuthor Commented:
ahhh sorry I misread your comment, I'll have a go at that
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.