Read this: http://timotheegroleau.com/Flash/articles/scope_chain.htm
<quote> To summarize, here are the keypoints we have discussed: 1. The scope chain is a sequence of objects that Flash will inspect when it looks for a variable. 2. When a function is created, the current scope chain is attached to it. 3. Each time a function is executed, a new object, called the activation object, is created to hold all the local variables and this object is placed on top of the function's attached scope chain. 4. When nesting functions, the activation object of the outer function is placed in the scope chain of the inner function. 5. If the inner function gets attached to a persistent object as a method, or is returned from the outer function, then the inner function becomes persistent and with it the activation object of the outer function. This leads to memory waste. 6. To avoid memory waste, a simple solution is to not use nested function but create function externaly instead and attach references only. </quote> regards, Muzak ----- Original Message ----- From: "James Tu" <[EMAIL PROTECTED]> To: <flashcoders@chattyfig.figleaf.com> Sent: Thursday, June 28, 2007 6:59 PM Subject: [Flashcoders] Flash garbage collection > How will Flash's garbage collection handle the following scenario? > > > function loadAsset(url:String) { > > this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); > > this.onLoadInit = function(target_mc:MovieClip) { > trace(target_mc + "...loaded"); > } > > var mcl:MovieClipLoader = new MovieClipLoader(); > mcl.addListener(this);; > mcl.loadClip(url); > > } > > > > > loadAsset("foo.jpg"); > loadAsset("bar.swf"); > ... > > What happens to all the instances MovieClipLoader? > > > -James _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com