Jump to content
GreenSock

yaure

Difference - onComplete and onCompleteListener [SOLVED]

Recommended Posts

I've been using quite a lot of onCompletes, onStart etc

I see TweenMax have the onCompleteListeners

 

so,, what are the they?

Are there any differences?

Link to comment
Share on other sites

Event listeners are pretty standard in AS3 - like when you addEventListener(MouseEvent.ROLL_OVER, myFunction) it's the same kind of idea. Some people really like using them because they're consistent across AS3 for the most part. One of the benefits is that you can have multiple listeners on the same object. So you could have 50 things notified when a tween is done with an onCompleteListener. The down side, however, is that event dispatching is significantly slower than using simple callbacks like onComplete. It's just the nature of the beast. I'd recommend using standard callbacks unless you need multiple things notified (although you could do that with an onComplete that then calls multiple other functions). Oh, and the other benefit of event listeners is that they're passed a TweenEvent object that has a target, so you can determine the actual tween instance that called the function if you want. Not a super common requirement, but it can come in handy.

Link to comment
Share on other sites

cool, I'll stick with simple callbacks then

Thanks

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