PDA

View Full Version : [AS3] delete instance from movie


rapidbushnell
02-16-2009, 03:52 PM
in my game i addChild(enemy) and when you click the enemy it kills it. eventually these children will pile up in my movie. removeChild(enemy) removes them from view. How do i delete these from the movie so they dont pile up?

dimpiax
02-16-2009, 03:58 PM
super.removeChild(_enemy); // remove from display list
_enemy.removeEventListener(...); // u must remove all enemy's listeners
_enemy = null; // remove from memory