How to remove all definitions from a loaded swf?
I use Loader.unloadAndStop()
func开发者_StackOverflow社区tion on loader which was used to load an SWF
, but I can still reach classes using getDefinitionByName
. How to remove them from the memory?
There is no easy way to do this. In actionscript 3 objects and classes stay in memory until they are cleaned up by the garbage collector. But the Garbage collector only runs when it wants. So you cannot know when or if it has run. Also - if there are references to the objects in memory - such as event listeners - that refer to the classes, and those listeners are not removed, the object will persist indefinitely. This is a pretty good article on Garbage Collection in AS3 http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html
If you can make it through, you'll have a good idea how to deal with your problem, and when not to worry as well.
精彩评论