AS1 OOP: Custom Classes with MovieClips
by senocular
MovieClip Deconstructors
Movieclips, too, can have deconstructors defined for them.
The difference with movieclips is that they aren't deleted
by conventional means with the delete keyword. To
dynamically delete movieclips, the removeMovieClip method
must be used.
One the positive side of things, since the movieclip
itself is the object, if you removed a movieclip without
using a deconstructor, you probably won’t run into many
problems. Though a reference to the movieclip may still
exist in a listener list, because the movieclip itself is no
longer present on the timeline, it can no longer contain its
properties and methods etc. So, unlike other objects, event
methods for removed movieclips will not continue to be
called. However, the reference still exists and would be an
unwanted and unneeded artifact in any listeners list.
Therefore, it should be taken care of and removed.
Example:
[ deconstructor used in removing marching soldiers ]
The removeMovieClip method over-rides that which would
have been otherwise inherited from MovieClip. The MovieClip
removeMovieClip is still used via super so that the
movieclip can still be successfully removed.
There is an alternate way of creating this relation for
movieclips, and that is through altering a movieclip
instance's __proto__ property.