# My listener is... deaf

**URL:** https://forum.kirupa.com/t/my-listener-is-deaf/263885
**Category:** Uncategorized
**Created:** [June 20, 2008, 2:06am UTC](https://forum.kirupa.com/t/my-listener-is-deaf/263885 "2008-06-20T02:06:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![BlueD](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blued/32/2074_2.png) [@BlueD](https://forum.kirupa.com/u/BlueD)
#### Post date: [June 20, 2008, 2:06am UTC](https://forum.kirupa.com/t/my-listener-is-deaf/263885/1 "2008-06-20T02:06:41Z")

</div>

I’m trying to trigger the completeHandler function when the loader is done loading IMG1.jpg. I know the rest of the code is sound, because if I move the code from the function to the main it works.

So, what am I doing wrong?

```auto

import flash.display.Sprite;
import flash.events.Event;

var logo:Sprite = new Sprite();
var loader = new Loader();

loader.load(new URLRequest("IMG1.jpg"));
loader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void {
	
logo.addChild(loader);
addChild(logo);

}

```

Thank you in advance guys!

---

<div class="post-metadata">

### Author: ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)
#### Post date: [June 20, 2008, 2:11am UTC](https://forum.kirupa.com/t/my-listener-is-deaf/263885/2 "2008-06-20T02:11:44Z")

</div>

```auto
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);

```

It kind of makes sense that you need to use a different object to keep track of the loading process, since the Loader may need to dispatch events of its own.

---

<div class="post-metadata">

### Author: ![BlueD](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blued/32/2074_2.png) [@BlueD](https://forum.kirupa.com/u/BlueD)
#### Post date: [June 20, 2008, 2:28am UTC](https://forum.kirupa.com/t/my-listener-is-deaf/263885/3 "2008-06-20T02:28:56Z")

</div>

thank you, it worked…
