Jump to content
GreenSock

donJao

onOverwrite possible?

Recommended Posts

Hello.

 

Trying to call a function when overwrite occurs, is it possible?

 

Thanks.

Link to comment
Share on other sites

Nope, sorry. Help me understand how/why/when this would be useful. I've never run into a real-world situation yet where it would, so I'm hesitant to add the extra conditional logic to the class which would negatively impact file size and performance. Maybe I'm missing something obvious, though.

Link to comment
Share on other sites

Well. Nothing obvious I suppose. I'll just tell you what I'm trying to achieve.

 

I'm working on a class, that will dynamically change the framerate of the stage. For such reason I made a static variable, that holds total amount of currently active tweens inside SWF. All of my transitions have onStart and onComplete methods. onStart adds 1 to total amount of tweens, onComplete - substracts 1. Setter for that static variable checks the end value, if it's 0 - that means there is not active tweens and we're ok to set up Stage's frameRate to say 5. If it's more than 0 - setter sets frameRate to high value. There's one problem though - tweens are likely to be overwritten, and onComplete does not substract that tween.

 

So that's why I asked if it's possible to fire onOverwrite, so I could also decrease 1 tween.

 

Maybe I'm missing something, but i'm using TweenLite for - couple of days only.

Link to comment
Share on other sites

Well, if you're just trying to sense whether there are tweens in the queue or not, you could do a for...in loop on the TweenLite.masterList Dictionary (in the current version at least). This isn't something I'd generally advise because I don't want to guarantee that the masterList will always be a part of the API, but it has been for quite a while and I don't have specific changes in mind. It should allow you to accomplish what you're after currently, though.

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.
×