function Scene() { this.activeObjects = []; this.addObject = function(obj) { this.activeObjects.push(obj); } this.destroy = function() { for(var i = 0; i < this.activeObjects.length; i++) { this.activeObjects[i].destroy(); } } }