Checking if an unnamed object exists

I have a name for the object, but it doesn’t seem to work.

Anyone know why this doesn’t work?


		if (sprite) {
			removeChild(sprite);
		} else {
			// there is no sprite.			
		}
		
		sprite = new Sprite();
		sprite.addChild(redRect);
		//sprite.x = numPositionToPlace;
		sprite.x = 106;    //106 actual
		sprite.y = 546;   //546 actual
		sprite.alpha = .5;
		addChild(sprite);

I can tell it’s not working because the box duplicates and the Alpha increases to mask above .5.

Or, how would I trace all objects that are in the container? Nothing is working like AS2… :shifty: