What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
The `parent` property of an object is a reference to the instance of `DisplayObjectContainer` which added the `DisplayObject` in question to the display list.
// instance of World
The `parent` of that instance of Mountain would be the instance of World.
`removeChild` tells it to remove it from the display list.
Every DisplayObject has a .parent property. The parent is the ~~DisplayObject~~ DisplayObjectContainer that added it as its own child.
For instance, say you have a Sprite mysprite and you put a Bitmap mybitmap on it as so:
Now mybitmap is mysprite’s child and mysprite is mybitmap’s parent. If you call mybitmap.parent it returns the reference to mysprite. Clear so far?
OK, so the line of code you wrote up in the OP simply calls the removeChild() function on the current object’s parent, using the current object as the argument. In plain English, the current object is to be removed from the display list.
Note that the object won’t actually be collected as garbage unless there is no other reference to it anywhere else, so usually you’re better off handling the removal and subsequent cleanup at the parent level.
Edit: Senekis is right, the parent is a DisplayObjectContainer, not just a DisplayObject. Also, ninja’d.