Skip to main content
Inspiring
October 23, 2007
Question

Dynamically unloading libraries

  • October 23, 2007
  • 1 reply
  • 182 views
Version: Flash CS3, AS3

Hi,
I've written a program that essentially loads a swf file in order to use its runtime-exportable library items (see below for the relevant code).

However, when I use the same function to load another swf file for the same purpose, the previously imported library remains in effect and is neither deleted nor overwritten. ie. if previously loaded swfA contains library item class Star and I load swfB with a library item also of class Star, the old class Star (swfA) is the one that gets used when I refer to class Star, when in fact I want class Star (swfB) and no longer need Star (swfA).

So is there a way to delete any memory of the previously imported library? (ie. remove knowledge of swfA?)

Thanks,
Rick

function RuntimeAssetLoader(filename:String) {
var path:URLRequest = new URLRequest(filename);
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,runtimeAssetsLoadComplete);
loader.load(path,context);
}
This topic has been closed for replies.

1 reply

Inspiring
October 26, 2007
Umm... anybody got an answer...?