1 Reply Latest reply on Oct 26, 2007 3:08 AM by Rrrrrrrrrk

    Dynamically unloading libraries

      Version: Flash CS3, AS3

      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?)


      function RuntimeAssetLoader(filename:String) {
      var path:URLRequest = new URLRequest(filename);
      var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
      var loader:Loader = new Loader();