Share Posted May 4, 2012 Howdy! Have a problem and was wondering if there was a quick solution... Is there a way to remove all 'onComplete' events? Here is my scenario: - I create and start tweens on movieClips with onComplete events. TweenLite.to(waveMc, 5, {alpha:0, ease:Sine.easeInOut, delay:2, overwrite:false, onComplete:showNextWave} ); function showNextWave() { trace("Still gets called?"); } - Then user initated cancel (halfway through the animation)... need to remove all movieClips - I'm using teh following to remove the movieClip: while (this.numChildren != 0) { this.removeChildAt(0); } It seems that the onComplete event still gets triggered. Is there a way to make sure the tweens and events also get destroyed? Link to comment Share on other sites More sharing options...
Share Posted May 4, 2012 Yes, removing an object from the display list has no effect on tweens that are using that object. there are a number of methods in TweenLite/TweenMax for killing tweens http://www.greensock...k/TweenMax.html you can use kill() on a particluar tween you can use killTweensOf() to kill tweens of a particular object or you can use killAll() to kill every tween. in your case, since you seem to be looping through children of a particular DisplayObject you may be best off with: killChildTweensOf() Kills all tweens of the children of a particular DisplayObjectContainer, optionally forcing them to completion first. please consult the documentation. if you have any trouble implementing these methods just let us know. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now