I\'m making a 2D, top-down Zelda style web rpg single player in JavaScript.
When the player (purple shirt) walks near a cat, it will \"rescue\" it... which basically rem
Beware that EaselJS elements aren't DOM elements.
Supposing you want to remove an element by its id, I'd suggest this :
function removeElementById(container, id) {
for (var i=container.getNumChildren(); i-->0;) {
if (container.getChildAt(i).id===id) {
container.removeChildAt(i);
return true;
}
}
return false;
}
But using the id might not be the best architectural solution. In my EaselJS program I keep a reference to the objects themselves so that I don't have to search them.