Reuse loaded object

Hi All,

I’ve come across a problem. I’m developing a gallery and I’ve just relised I’ve been creating a new set of thumbnails each time I click on the image category.

There are four Categories and everytime I click on a category a new set of thumbnails gets created.
How would I go about reusing the loaded thumbnails.

I’m assuming I would need to create a separate Array to store the loaded thumbnail from each category.
I am able to create the Array but how do I tell flash that the Loaded objects are in the array so don’t create a new Loader and a new thumbHolder.

        private function loadThumbnail():void {
          
            //trace(xmlLoader.xmlData.children()[index].children().attribute("thumb").length())
            for (var i:int = 0; i<xmlLoader.xmlData.children()[index].children().attribute("thumb").length(); i++) {
                //Create a new thumbnail holder
                thumbHolder = new Sprite();
                //Create a new loader for the thumbnails
                thumbLoader = new Loader();
                //Load the thumbnails
                thumbLoader.load(new URLRequest("xml file where the thumbs are store");
                //x and y of thumbnail holder
                thumbHolder.x = i* 50;
                thumbHolder.y = 200;
                //Add thumbHolder to the stage
                addChild(thumbHolder);
                //add thumbLoader to the stage
                thumbHolder.addChild(thumbLoader);
                //Mouse children off
                thumbHolder.mouseChildren = false;
                //Button mode on
                thumbHolder.buttonMode = true;
                //Name of the thumbnails
                thumbHolder.name = "xml file where the thumbs are store");
                //Call loadImage when the thumbnail is clcked
                thumbHolder.addEventListener(MouseEvent.CLICK, loadImage);
                
            }//end loop


        }//loadThumbnail()