# Finding the depth of clicked movie clip

**URL:** https://forum.kirupa.com/t/finding-the-depth-of-clicked-movie-clip/250306
**Category:** flash
**Created:** [January 28, 2008, 11:01am UTC](https://forum.kirupa.com/t/finding-the-depth-of-clicked-movie-clip/250306 "2008-01-28T11:01:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shaji](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@shaji](https://forum.kirupa.com/u/shaji)
#### Post date: [January 28, 2008, 11:01am UTC](https://forum.kirupa.com/t/finding-the-depth-of-clicked-movie-clip/250306/1 "2008-01-28T11:01:30Z")

</div>

Hi All  
I need help to find depth of one of the movie clips on the stage.

Movie clip exists in flash library and its associated with a class using linkage properties.Its instantiated as below

```auto

var atomSmall1:AtomSmall=new AtomSmall();

```

Mulitple duplicates are created on the screen. I need to find the depth of the movie clip when I click on it. Code given below is the handler for the movie clip.  
Below is the code snippet I have used.

```auto

private function removeAtoms1(evt:Event):void {
 var targetName:String=String(evt.target.name);
 trace("Target Name is "+evt.target.name); ///instance120 or keeps changing
 var target1:DisplayObject = getChildByName(targetName); 
 trace(target1) ////Prints NULL
 trace("Depth of the atom "+ getChildIndex(target1)); 
}

```

Below is the output of trace and error message

```auto

Target Name is instance208
TypeError: Error #2007: Parameter child must be non-null.
 at flash.display::DisplayObjectContainer/getChildIndex()
 at ChemistryActivity1View/::removeAtoms1()

```
