# \[AS3\]Questions

**URL:** <https://forum.kirupa.com/t/as3-questions/209769>\
**Category:** programming\
**Created:** [December 12, 2006, 9:07am UTC](https://forum.kirupa.com/t/as3-questions/209769 "2006-12-12T09:07:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dazzer](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@Dazzer](https://forum.kirupa.com/u/Dazzer)\
**Post date:** [December 12, 2006, 9:07am UTC](https://forum.kirupa.com/t/as3-questions/209769/1 "2006-12-12T09:07:37Z")

</div>

I’m creating a class that will load external clips, hold them in a dictionary array by name. These clips are basically sprites, but contain 2-4 different “rotations”. This sprite loader will receive requests for sprites, and it will return BitmapData.

Now the questions

```auto

 package dazzer.engine
 {
   import flash.utils.Dictionary
   import flash.display.Loader
   import flash.net.*

    public class spriteLoader
    {
         private var myClips:Dictionary();
          public function spriteLoader():void
         {
               myClips = new Dictionary();
         }
         function loadPath(name:String, path:String):void
         {
               //This part is truncated to save time
               temp:Loader = new Loader()
               temp.load(new URLRequest(path));
               myClips[name] = temp.content
         }
    }
 }
 

```

1. Does my class need to extend anything? Or can i just create it like that? Since it doesn’t have to be in the displaylist.

2. I know the code above won’t work. But its just the general idea.  
What steps should i take for Garbage Collection? If , say, I wish to clear all the memory on the sprites, should i just put

```auto
myClips = new Dictionary();

```

what if i wanted to remove just 1 sprite from memory? I don’t have a reference to the Loader anymore? Would

```auto
myClips["whatever"] = null

```

qualify that Loader it was referencing for collection?

Thank you anyone for their reply
