# Check to see if a loader already contains an image

**URL:** <https://forum.kirupa.com/t/check-to-see-if-a-loader-already-contains-an-image/285967>\
**Category:** Uncategorized\
**Created:** [April 8, 2009, 10:26am UTC](https://forum.kirupa.com/t/check-to-see-if-a-loader-already-contains-an-image/285967 "2009-04-08T10:26:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oblivion2010](https://avatars.discourse-cdn.com/v4/letter/o/bbe5ce/32.png) [@oblivion2010](https://forum.kirupa.com/u/oblivion2010)\
**Post date:** [April 8, 2009, 10:26am UTC](https://forum.kirupa.com/t/check-to-see-if-a-loader-already-contains-an-image/285967/1 "2009-04-08T10:26:17Z")

</div>

Hi, I hope you can help me on a problem that has left me stuck for a couple of days.

I have created a photo gallery, following this tutorial:  
[http://www.republicofcode.com/tutorials/flash/as3gridgallery/index.php](http://www.republicofcode.com/tutorials/flash/as3gridgallery/index.php)

However I want the user to be able to click a thumbnail, which triggers a function to unload the previous image, and then reload the selected image.

```auto
function callFull(e:MouseEvent):void{    
var full_loader:Loader = new Loader();
var full_url = my_images[e.target.name].@FULL;
full_loader.load(new URLRequest(full_url));
full_loader.contentLoaderInfo.addEventListener(Event.INIT, fullLoaded);
}

function fullLoaded(e:Event):void{    
var my_loader:Loader = Loader(e.target.loader);
addChild(my_loader);
my_loader.x = 300;
my_loader.y = 80;        
my_loader.addEventListener(MouseEvent.CLICK,removeFull); // Removes image when large pic is clicked
}

```

I’ve been told to use

```auto
if ( hasChild( my_loader )) return; 

```

, however this gave me an error as hasChild isn’t recognised in AS.

Any solutions to my problem? Thanks.
