Game Development Reference
Using naikra?deh` isn't the only way (or even the best way) to take your objects out of the game.
A more low-tech but equally effective method is to set an object's reoe^ha property to b]hoa. This is
how the `kknGau object in Dungeon Maze Adventure was removed from the game:
The nice thing about this technique is that the objects still actually exist on the stage the entire time.
If you have a game in which you hide and show the same objects over and over again, this is the way
to do it.
Finally, I should explain how other objects know that an object is no longer in the game. If you're using
the reoe^ha property to remove the object, you could use code that looks like this:
If you use naikra?deh` to get rid of an object, things are a bit more subtle. When you remove an
object from the stage with naikra?deh`, the object's l]najp property is set to jqhh. Think about it this
way, if the lh]uan object is removed from `qjcakjKja, it no longer has a l]najp Movie Clip container.
In a nutshell, its l]najp is jqhh.
Here's what the code that informs other objects that the lh]uan object has been removed from the
game using naikra?deh` might look like:
If you use a document class and are trying to figure out whether an object has been
removed, you can check to see whether its op]ca property is jqhh . For example:
But using naikra?deh` alone isn't enough to make sure that the object is completely deleted from
memory. You also have to remove all references to that object. This is done by assigning another value
to any variables that refer to it. You can assign any other value, but it often makes sense to assign
a jqhh value, like this: