Autochrome Photography Wordpress theme for just $25. Get Yours

Cleansing your ActionScript codes

— By

We all know that Flash uses only reference counting to do garbage collection. So, we have come to the decision that it is a wise idea to take special care to dispose circular references as these tend to hang around a lot. In ActionScript, take care that you are cleaning up external references before destroying or unloading movieclips. Our internal team usually have a dispose method in most of the objects that nulls external references before hand.

// for movieclip subclasses
public function dispose ():Void
{
 externalRef = null;
 this.removeMovieClip ();
};
//
// for other class instances use something like
myObject.dispose (); 
myObject = null;

Brajeshwar

Brajeshwar believes in simplicity; pushes the envelop and envisions the betterment of usable and practical solutions.

More by Brajeshwar

  • Kevin

    Do you have any AS examples that generate garbage waiting to be collected in flash player?

    Thanks,

    Kevin

  • Kevin

    Do you have any AS examples that generate garbage waiting to be collected in flash player?

    Thanks,

    Kevin

Teknopoint Multimedia - Adobe Training, Design and Development, RIA Consulting. Teknopoint Multimedia - Adobe Training, Design and Development, RIA Consulting.

Themes