Clear loaded pictures in xml gallery to load another set

Hi,

i’ve got an xml gallery and just don’t figure out how to remove the already loaded pictures before loading a new set, when i load a new set it place over the previously loaded images…
i know i must call 2 functions, first to unload content, second to load new :

//following 2 functions will be called by a button :

// removes previously placed objects 
function clearLoadedPictures():void {
  //code i want.....
  
  //
function LoadNewPictures();

}

// Load another ,xml to load new pictures set - this function works fine
function LoadNewPictures():void {
                //
                i_g = 0;
                //
           // xml data
                        var xml_gallery:XML                = new XML();
                        var xml_gallery_List:XMLList        = new XMLList;
                        // XML data loader...
                        var xmlUrlReq:URLRequest   = new URLRequest("xml/gallery2.xml");// gallery2.xml will replace gallery.xml already loaded
                        var xml_gallery_UrlLoader:URLLoader = new URLLoader(xmlUrlReq);
                        //
                        xml_gallery_UrlLoader.addEventListener(Event.COMPLETE, xml_gallery_Complete);
                        xml_gallery_UrlLoader.addEventListener(IOErrorEvent.IO_ERROR, xml_gallery_LoadFailed);
                
 }

and here the original gallery code :

var _mc:item;
var total:int;
var i_g:int;
var id:int;
//
var btn_Gallery_Ready:Boolean;
//

var speedX:Number;
var spaceR:Number;

var img_gallery_Loader:Loader;
//

i_g = 0;
                        //
           // xml data
                        var xml_gallery:XML                = new XML();
                        var xml_gallery_List:XMLList        = new XMLList;
                        // XML data loader...
                        var xmlUrlReq:URLRequest   = new URLRequest("xml/gallery.xml");
                        var xml_gallery_UrlLoader:URLLoader = new URLLoader(xmlUrlReq);
                        //
                        xml_gallery_UrlLoader.addEventListener(Event.COMPLETE, xml_gallery_Complete);
                        xml_gallery_UrlLoader.addEventListener(IOErrorEvent.IO_ERROR, xml_gallery_LoadFailed);
                        //
            bottom24.gallery.content_mc.addEventListener(MouseEvent.ROLL_OVER, startScroll);
            bottom24.gallery.content_mc.addEventListener(MouseEvent.ROLL_OUT, stopScroll); //

// xmlComplete function
        function xml_gallery_Complete(e:Event):void 
        {
            
            xml_gallery = XML(e.target.data); // 
            xml_gallery_List = xml_gallery.item;  // <item> in gallery.xml
            total = xml_gallery_List.length();
            spaceR = xml_gallery.attribute("space"); // specified in gallery.xml file as is : <gallery space="119" speed="0.2">
            speedX = xml_gallery.attribute("speed");
                        //
            init_gallery();

        }//;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                function xml_gallery_LoadFailed(e:IOErrorEvent):void {
                        trace("Load Failed: " + e);
                }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                function init_gallery()  // 
        {
            
                        //bottom.gallery.content_mc.itemHolder_mc.
                        
            _mc = new item(); //
            _mc.alpha = 0;
                        //_mc.imgMask_mc.scaleY = 0;  // condition pour apparition des timbres ds la gallery - OLD
                        _mc.imgMask_mc.alpha = 0; // condition pour apparition des timbres ds la gallery - NEW
            _mc.x = i_g * spaceR;
                        
                        _mc.btn.id = i_g; 
                        _mc.btn.mouseChildren = false;
                         
            bottom24.gallery.content_mc.itemHolder_mc.addChild(_mc);
                        //
            Tweener.addTween(_mc, {alpha:1, time:0.8, transition:"easeOutExpo"});
                        //

                        //
            _mc.online_mc.alpha = 0; //invisible sans roll over
                        

                        //
                        
            if (xml_gallery_List[i_g].url != "")
            {
                _mc.btn.buttonMode = true;
                _mc.online_mc.visible = true;
                                //
                btn_Gallery_Ready = true;
                                //
            }
            else 
            {
                _mc.btn.buttonMode = false;
                _mc.online_mc.visible = false;
                                //
                btn_Gallery_Ready = false;
                                //
            }
                        //
           
                        //
            
                        //
            var imgRequest:URLRequest = new URLRequest (xml_gallery_List[i_g].image); //
            img_gallery_Loader = new Loader(); // var imgLoader:Loader;
            img_gallery_Loader.load(imgRequest); //
                        //
            img_gallery_Loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imgLoading);
            img_gallery_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, img_gallery_Complete);
                        //
            i_g++;
        
        }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        function imgLoading(event:ProgressEvent):void // tiny preloader in bottom thumbs pics
        {

        _mc.preloader_mc.width = Math.round(img_gallery_Loader.contentLoaderInfo.bytesLoaded / img_gallery_Loader.contentLoaderInfo.bytesTotal * 100);
        }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        function img_gallery_Complete(event:Event):void
        {
            _mc.imgHolder_mc.addChild(img_gallery_Loader);
                        
                        Tweener.addTween(_mc.imgHolder_mc, {_saturation:0.9, time:0.6});// desaturate scrolling thumbs
                        //_mc.imgHolder_mc.alpha = 0.5; // test
                        
                        // fade in for thumbs appearence : - NEW
                        Tweener.addTween(_mc.imgMask_mc, {"alpha":1, delay:i_g / 20, time:0.4, transition:"easeOutExpo"});// test


                        
                        // preloader  :
            Tweener.addTween(_mc.preloader_mc, {"scaleX":0, delay:0, time:1, transition:"easeOutExpo"});
                        
                        //
            _mc.btn.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
            _mc.btn.addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
            _mc.btn.addEventListener(MouseEvent.CLICK, onMouseClick);
                        //
                        
            if (i_g < total)
            {
                init_gallery();
            }
           //
        }

i supose we have to set a kind of loop to delete old pctures, but how to ??

Thanks for help

dan