One of the most common concerns to any ActionScript3 developer is to make their applications  memory efficient, by using memory efficient resources, writing optimized code and also always cleaning up unused objects after their roles have been fulfilled. Naturally, Flash garbage collector (GC) will make sure allocated memory chunks to objects that are no longer in use will be recollected, however it takes some skill to write proper code that facilitate the GC to do its job. An excellent account on garbage collection, indispensable for any AS3 learner, is an article by Gran Skinner. Based on his article, I will write example code that exhibit the GC's behaviors and mechanisms, thereby helping novice programmers fully understand GC in practice and be able to write better code.

Below is the example flash file that'll be used

Source code can be downloaded in the attachments. Please go ahead, download the source code and open GCExample.fla. As you can see, I create different buttons ( and placed them in frame 1) to test different scenarios, some scenarios can be run inside Flash IDE, others should be run on browsers, but we'll get to that difference shortly.