0
votes

I'm using flash.display.Loader to load an external SWF.

When I'm done with the SWF, is it enough to manually remove all references to the loader and the SWF's content in order to free it for garbage collection? or must I also call Loader/unload()?

1

1 Answers

0
votes

As it can be seen from the ASDocs of Loader

When you call the unload() method, the Loader object's contentLoaderInfo property is set to null. Any visual assets that were loaded with the SWF are unloaded and removed from memory. ActionScript class definitions in the loaded SWF remain in memory, and code in the same application domain as the loaded SWF can access instances of those classes and create new instances.

I think the best and safest way to remove it from the memory is remove all event listeners, unload and set the loader to null.