Jump to content


TweenMax onComplete - removeChild and null

Recommended Posts

I'm having some troubles with a function that gets called on the onComplete handler of TweenMax. Here's some code


// in some method
if (_gameOverScreen) {
TweenMax.to(_gameOverScreen, 0.55, {
			   onCompleteParams:[_gameOverScreen, _gameContainer],

private function removeSprite(target:*, holder:*):void {
     target = null;


The problem is that the actual _gameOverScreen, which is passed to the parameters of the removeSprite method, doesn't get null.


Am I doing something wrong here?


Thanks in advance,



Link to comment
Share on other sites

You're setting target = null inside your function, but all that does is set the local variable "target" to null. It doesn't somehow null all other references in the application to that object. Think of "target" as just a pointer.


var original:String = "something";
var a:String = original;
var b:String = original;
a = null;
trace(a); //"null"
trace(; //"something"
trace(original); //"something"

Link to comment
Share on other sites

that's what i thought too, and i changed the logic so that it would clear the actual variable to null, instead of the reference "target"...



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.