Jump to content
Search Community

Disable TweenMax

rahuljungle test
Moderator Tag

Recommended Posts

Is there a way to disable (not remove) TweenMax completely from your game?

 

I've used it in at least 100 locations but how can I simply disable it all together, without having to change my code completely? I am trying this because on a few very slow machines the performance is poor, so I want a way to disable it when not required.

 

Much Thanks :)

Link to comment
Share on other sites

So are you saying you want to have hundreds of tweens in your code and then at runtime you want to make none of them work? Or are you saying you want to extract TweenMax from your entire project at compile-time so that TweenMax never gets included to begin with? 

 

I suppose if you want your tweens to act almost immediately (as if their duration was almost 0), you could set the TweenMax.globalTimeScale to a crazy high number. If you want to literally remove TweenMax from the swf entirely, you'd need to edit your code or swap in a dummy TweenMax.as file that's basically a stub (no functional code) before compiling. 

Link to comment
Share on other sites

So are you saying you want to have hundreds of tweens in your code and then at runtime you want to make none of them work? Or are you saying you want to extract TweenMax from your entire project at compile-time so that TweenMax never gets included to begin with? 

 

I suppose if you want your tweens to act almost immediately (as if their duration was almost 0), you could set the TweenMax.globalTimeScale to a crazy high number. If you want to literally remove TweenMax from the swf entirely, you'd need to edit your code or swap in a dummy TweenMax.as file that's basically a stub (no functional code) before compiling. 

 

Thanks for the reply!

I already have a 100 tweens in my code, I do not want to remove it from my code, nor I want them to execute immediately, just the ability to disable it when not required (in case the performance is bad on slower machines). something like: TweeMax.DisableAllTweens() -> this should just disable all the tweenmax instances that are already initialised and all the new ones too.

Thanks again :)

Link to comment
Share on other sites

I'm having a tough time understanding how your app is going to function if you prevent all tweens from running or even being created. 

 

It seems like you would need all your tweens to be forced to completion as soon as they are created, which is what a very high globalTimelineScale would accomplish. SImply stripping out all functionality of TweenMax seems like it would be disastrous unless you have coded your app in a way that animation is completely unnecessary. 

 

Even if you had very simple simple code like this:

nav_mc.alpha = 0;
TweenMax.to(nav_mc, 1, {alpha:1})

If TweenMax is disabled how will the nav_mc ever become visible?

 

Setting the globalTimeScale very high will solve that problem and relieve slower machines from rendering multiple updates on multiple objects at the same time.

TweenMax.globalTimeScale(200);

I'd suggest giving it  try in your app and seeing how it works.

Link to comment
Share on other sites

Thanks for the reply!

 

Indeed i've structured my tweens in such a way that they are harmless if disabled.

 

Giving you an example, I have used MotionBlur in a few places in my code, If i do not activate the motion blur plugin, the effect is not rendered but it does not affect my game in anyway.

 

Similarly all my tweens are completely independent of other objects. I am not forcing my object alpha to be 0 and then tweening, rather, I prefer using from method in such cases.

Link to comment
Share on other sites

Thanks for the clarification. It helps us understand your scenario.

 

Currently there isn't anything in the API to disable all existing tweens and prevent future tweens from being created. 

 

If we can justify adding a feature to accomodate something like this we'll be sure to post back here. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...