Jump to content
GreenSock

JoeC

onComplete not triggering?

Recommended Posts

Hello. One of my functions doesn't appear to be triggering when I call onComplete. I've looked over the syntax loads, and I've tried a few different things, but 'removeFromStage' just isn't being called no matter what. I've also tried downloading in the latest swc, am I missing something completely obvious?

 

private function bombExplode():void{

TweenLite.to(bomb_MC, 1, {y:100, onComplete:removeFromStage});

}

 

private function removeFromStage():void{

trace("function triggered")

}
Link to comment
Share on other sites

Okay, figured this one out. Turns out you can't remove the EventListener for EnterFrame, it effectively removes the functionality of greensock, hope this helps someone else!

Link to comment
Share on other sites

You can certainly remove your own ENTER_FRAME event listeners - that has no effect on GreenSock stuff. I think you were running into a scope issue, that's all. In your previous code (which apparently you edited), you had this.removeEventListener(...) inside your onComplete function, but "this" probably didn't refer to what you THOUGHT it referred to. Feel free to trace() to see for yourself. You can set the scope inside the onComplete function using onCompleteScope. Like:

TweenLite.to(bomb_MC, 1, {y:100, onComplete:removeFromStage, onCompleteScope:this});
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.
×