# How to reference the object listening for event?

**URL:** https://forum.kirupa.com/t/how-to-reference-the-object-listening-for-event/257411
**Category:** flash
**Created:** [April 14, 2008, 2:33am UTC](https://forum.kirupa.com/t/how-to-reference-the-object-listening-for-event/257411 "2008-04-14T02:33:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![johnlouis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/johnlouis/32/568_2.png) [@johnlouis](https://forum.kirupa.com/u/johnlouis)
#### Post date: [April 14, 2008, 2:33am UTC](https://forum.kirupa.com/t/how-to-reference-the-object-listening-for-event/257411/1 "2008-04-14T02:33:58Z")

</div>

i want to make a preloading function that could be used by any Loader object I have regardless of name. I’ll explain in code

```auto

loader1.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

function loadProgress(e:Event):void{
  //how do i get a reference of the object that is calling this function?
  trace(targetObject.bytesLoaded); //i want to reference the contentLoaderInfo of the Loader currently using this method
}

function loadComplete(e:Event):void{
  addChild(targetObject.parent); //not sure if that's logical
}

```

I hope i’m making sense. :book:
