# Image slideshow cant remove previous image

**URL:** <https://forum.kirupa.com/t/image-slideshow-cant-remove-previous-image/259180>\
**Category:** Uncategorized\
**Created:** [May 1, 2008, 7:23pm UTC](https://forum.kirupa.com/t/image-slideshow-cant-remove-previous-image/259180 "2008-05-01T19:23:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobcooper](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@bobcooper](https://forum.kirupa.com/u/bobcooper)\
**Post date:** [May 1, 2008, 7:23pm UTC](https://forum.kirupa.com/t/image-slideshow-cant-remove-previous-image/259180/1 "2008-05-01T19:23:08Z")

</div>

Hi there I have a basic image slide show loading external images that fades out after each image and then I want to load the next image. However I can’t figure out how to remove the old image, at the moment when the image fades out you can see all the previous images fading out too.

Here is the code I am using:

```auto
var imageNo:Number = 1;

ImageLoad("images/home/" + imageNo + ".jpg",imageHolderMC);

// image preloader
function ImageLoad(u:String,target){
    var targetClip = target;
    var _loader:Loader = new Loader();
    var request:URLRequest = new URLRequest(u);
    _loader.load(request);
    targetClip.addChild(_loader);
    _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
    _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    
    
}

function loadProgress(event:ProgressEvent):void {
    var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
    percentLoaded = Math.round(percentLoaded * 100);
}

function completeHandler(event):void {
    imageHolderMC.alpha = 1;
    imageHolderMC.addEventListener(Event.ENTER_FRAME, fadeOut);
    function fadeOut(evt:Event):void {
        if(imageHolderMC.alpha > 0){
            imageHolderMC.alpha -= .02;
        } else {
            imageHolderMC.removeEventListener(Event.ENTER_FRAME, fadeOut);
            imageNo++;
            ImageLoad("images/home/" + imageNo + ".jpg",imageHolderMC);
        }
    }
}

```

I think it is something to do with removeChild() but I can’t figure out where to put it.

Any help would be really er… helpful!

Cheers,

Bob
