# Please how do I unload and hide an external image?

**URL:** https://forum.kirupa.com/t/please-how-do-i-unload-and-hide-an-external-image/287656
**Category:** flash
**Created:** [May 4, 2009, 8:04pm UTC](https://forum.kirupa.com/t/please-how-do-i-unload-and-hide-an-external-image/287656 "2009-05-04T20:04:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![carface100](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carface100](https://forum.kirupa.com/u/carface100)
#### Post date: [May 4, 2009, 8:04pm UTC](https://forum.kirupa.com/t/please-how-do-i-unload-and-hide-an-external-image/287656/1 "2009-05-04T20:04:04Z")

</div>

I have been trying for a few hours now just to unload an image but I get an error when I try it which sais ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display: ![](http://forum.kirupa.com/uploads/kirupa/1495/f1fea26928e562b8.gif)isplayObjectContainer/removeChild()  
at tester\_fla::MainTimeline/ontester2ButtonClick()

I have 2 buttons on the stage the first one adds the image and is called tester\_btn, the second (attempts) to unload and hide the image and is called tester2\_btn

My code is as follows:

tester\_btn.addEventListener(MouseEvent.CLICK,ontes terButtonClick);  
function ontesterButtonClick(event:MouseEvent):void {

var myrequest:URLRequest=new URLRequest (“HomeLogo.png”);  
var myloader:Loader = new Loader();  
myloader.load(myrequest);  
myloader.contentLoaderInfo.addEventListener(Event. COMPLETE, imgLoaded);  
function imgLoaded(event:Event):void{  
addChild(myloader);  
}  
}

tester2\_btn.addEventListener(MouseEvent.CLICK,onte ster2ButtonClick);  
function ontester2ButtonClick(event:MouseEvent):void {  
var myrequest:URLRequest=new URLRequest (“HomeLogo.png”);  
var myloader:Loader = new Loader();  
myloader.unload();  
stage.removeChild(myloader);

}

Any help will be much appreciated!
