Skip to main content
June 11, 2009
Question

TweenLite - only able to handle one function at a time?

  • June 11, 2009
  • 6 replies
  • 2610 views

I'm having this trouble with Tweenlite.  I downloaded it and started to use it since it was quite easier to do the tint morph, and that part works great!  However, one thing I've noticed is that for some reason, If i activate more then one thing that has a function at a time, it will freeze up most of the time.

For example.  When you click on one of the links in the Nav Bar, it uses Tween Lite to scroll to the page you selected, with out trouble.  So after I had done that, i wanted to make it so that Upon rollover, the Links in the Navbar would change color.  Now they both still do what they are told yet 90% of the time one of them freezes, whether its the page that scrolls halfway and stops, or the color on the link halfway to its final destination color.  Is there a known fix for this or is this the tradeoff?

Thanks!

Michael

This topic has been closed for replies.

6 replies

Participating Frequently
June 19, 2009

what i see from ur code from first look -u use timers to control tween time, thats not cmart, tweenlite contains delay property which u can use to start ur tweens after some time

example:

Tweenlite.to(logo,1,{alpha:1});

Tweenlite.to(logo,1,{delay:1,x:"100"});

logo will fade and after will start moving 100px right

June 19, 2009

@ armen, thanks for the input!  It isn't smart to use timer you say?  I think I have to use them for what my site does, the delay would work fine if it needed to wait before doing the tween, but thats not the case.  The only thing I use timers for are the intro, that is, to time when the B A N and X fall in, and how the buttons and text fade in (You cant see it in the SWF cause in order for it to work, i have to put everything's alpha at 0, and i am waiting till the rest of the site is done first so I can still see everything hehe)

Inspiring
June 17, 2009

Yep, Rob is right. tweenGroup is awesome. You should def use that.. Props to Grant Skinner for implementing so many features into it. It's definately the best Tween package out there.

June 17, 2009

Just curious if anyone has a solution to this issue

Thanks!

robdillon
Participating Frequently
June 17, 2009

Yes, TweenLite and TweenMax each have a bunch of ways to deal with this. You can use TweenGroup to set up relationships with a set of tween events and get them to fire sequentially, or together. You can also use the onComplete event in any tween to call another function. You can also add listeners to any tween to cause another action. Another option is to put more than one tweenable property into any given tween. Look at the documentation for TweenLite for more info.

June 18, 2009

Hey Rob, thanks for the response.

As for putting more then one tween in each function, I can't do that because the tweens are all fired from different actions.  For instance, I wanted my buttons to scroll a block of text Onclick and change color OnRollOVER, which i can't do in the same function (i think? lol).  And after I added the onRollOVER whenever id put my mouse over the button and try to click, each tween would keep canceling each other out and it was a big mess.

About this group thing.. Should I only group tweens that have relevance to each other?  http://mrbanx.com/index2.html.  There is my site so you can get an idea of what I am talking about.  If i wanted to fix the issue, should i tween group the scrolling text and the buttons?  And leave the B  A N X in another group? Or should every single tween in my project be in the same group?

(Btw, if you click one of the buttons to scroll the text, then put your mouse over one of the letters in the logo (B A N X) you will see how the color tween on the logo stops the totally unrelated tween on the scrolling text).

Thanks again!

June 11, 2009

Well the thing is, the tweens arent affecting the same item, they are just triggered by the same item.  The Clicking of the link only scrolls the bdy of text, where as the rollover only tweens the color of the button.  Or is that what you mean, anything thats doing more then one thing will abort the other?  Is tween max any different?

To give you an idea of what I'm talking about, I've uploaded the FLA file.  When you play the movie, try clicking on the Links button.  (I say this since its the farthest and will take the longest for the animation to complete).  As its scrolling, run your mouse quickly over to one of the letters on the side (B A N X).  I have a totally unrelated tween on there that changes their color, when you touch it, it will stop the other animation mid-tween.

Thanks so much for the help guys!!

(The uploader wasnt working for me?)

http://www.sendspace.com/file/tcl1pi

kglad
Community Expert
Community Expert
June 11, 2009

tweenlite can tween multiple properties of one object, but they must be in one tweenlite method call.  you can use a delay parameter to stagger tweens.

but if you call a tweenlite method in two different statements passing the same object, the first tween will abort.

robdillon
Participating Frequently
June 11, 2009

I've never used the lite version, but I use TweenMax all the time. I've never seen a problem like you describe. Can you show the code that you are using that's giving this problem?