# Getting the event target depth

**URL:** <https://forum.kirupa.com/t/getting-the-event-target-depth/321038>\
**Category:** flash\
**Created:** [April 8, 2011, 12:53pm UTC](https://forum.kirupa.com/t/getting-the-event-target-depth/321038 "2011-04-08T12:53:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeeto](https://avatars.discourse-cdn.com/v4/letter/z/e274bd/32.png) [@zeeto](https://forum.kirupa.com/u/zeeto)\
**Post date:** [April 8, 2011, 12:53pm UTC](https://forum.kirupa.com/t/getting-the-event-target-depth/321038/1 "2011-04-08T12:53:10Z")

</div>

Hi guys, I can’t figure out how to get the depth of event target Object…

My code looks like this:

```auto
 
  private function createFooterItem(footerItem:XML):void {
[COLOR=gray] var button:Sprite = new Sprite();[/COLOR]
[COLOR=gray] button.graphics.beginFill(0xFF0000, 0);[/COLOR]
[COLOR=gray] button.graphics.drawRect(0, 0, 100, 50);[/COLOR]
[COLOR=gray] button.graphics.endFill();[/COLOR]
[COLOR=gray] button.buttonMode = true;[/COLOR]
    button.addEventListener(MouseEvent.CLICK, clicked);
    addChild(button);
  }
 
  private function clicked(e:MouseEvent):void {
   trace(getChildIndex(e.currentTarget));
  }

```

On the other hand… is it possible to assign a value to a sprite to pass it to other functions?  
something like:

```auto
 
button.someValue = 100;

```

and then:

```auto
 
  private function clicked(e:MouseEvent):void {
   trace(button.someValue);
  }

```
