# AS3 Target of target?

**URL:** https://forum.kirupa.com/t/as3-target-of-target/325836
**Category:** flash
**Created:** [November 7, 2011, 6:25pm UTC](https://forum.kirupa.com/t/as3-target-of-target/325836 "2011-11-07T18:25:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tompa](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@Tompa](https://forum.kirupa.com/u/Tompa)
#### Post date: [November 7, 2011, 6:25pm UTC](https://forum.kirupa.com/t/as3-target-of-target/325836/1 "2011-11-07T18:25:04Z")

</div>

**Hello there!**  
I’ve made a loop that is creating 9x movieClips that is loading external images  
and I have also added eventListeners to those movieClips to make it possible  
to change the movieclips image.  
My problem is that i can’t access the target of the "_first eventListener"_

Here is the code to browse for the new image, i want to access the movieclip of  
this function in a later eventListener, like this: **event.CurrentTarget**

```auto

file.addEventListener(Event.SELECT, onFileSelected);
function mUp(event:MouseEvent):void{                        
     file.browse(new Array(new FileFilter( "Bild (JPG och JPEG)", "*.jpg;*.jpeg;")));
}

```

The second eventListener. This function is called when the new image is selected

```auto
function onFileSelected(event:Event):void{
     file.addEventListener(Event.COMPLETE, loadCompleteHandler); 
     file.load();    
}

```

The third and last function, this function is called when the image is loaded  
and is ready to be used.

```auto
function loadCompleteHandler(event:Event):void{
     file.removeEventListener(Event.COMPLETE, loadCompleteHandler);
     var loader:Loader = new Loader();
     loader.loadBytes(event.target.data);

** // Here is the problem!
     event.target.addChild(loader)**
}

```

If if put this code, it will target the second function’s event.

```auto
event.target.addChild(loader);

```

I am searching for a code looking like this to replace the  
old image with the new one

```auto
event.target.target.addChild(loader);

```

I hope you understand where the problem is and what i’m searching,  
_Thanks in advance  
Tompa_
