If you're going to constantly be creating enemies, you might want to simple do a check of existing enemies and if an enemy is dead, delete it when you create one.
The important thing to note is that an enemy cannot call the destroyEnemy() method of its manager because then it's still the same thread (the method is being called from the object you're trying to delete). It has to happen independantly outside the object. If you want the enemies to manage themselves, it is best to just give them a boolean property called dead (for instance) and then check independantly for dead enemies somewhere else. enemies = {}; function createEnemy() { for (var a in enemies) { if (enemies[a].dead) { for (var b in enemies[a]) { delete enemies[a][b]; } delete enemies[a]; } } // code to create an enemy // enemies[enemyID] = new Baddie(); } enemies[enemyID].dead = true; Or baddie.onKilled = function() { this.dead = true; } Notice that I've gone through and deleted level one props/methods inside the enemy object. If you apply methods to an enemy object after you instantiate it, you should delete those methods before you delete the object or they get orphaned and memory waste can occur. Hence, my delete loop through the enemy object before deleting it. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders