# setChildIndex() and e.target

**URL:** <https://forum.kirupa.com/t/setchildindex-and-e-target/303911>\
**Category:** flash\
**Created:** [January 28, 2010, 10:07pm UTC](https://forum.kirupa.com/t/setchildindex-and-e-target/303911 "2010-01-28T22:07:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geki](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Geki](https://forum.kirupa.com/u/Geki)\
**Post date:** [January 28, 2010, 10:07pm UTC](https://forum.kirupa.com/t/setchildindex-and-e-target/303911/1 "2010-01-28T22:07:28Z")

</div>

Hello,

I have a movieclip with the instance name of \*\*container \*\*and in that other movieclips that are partly on each other.  
What I’m trying to do, is that if the mouse goes on a movieclip inside the container it comes front (depth goes to 0).

My code:

> container.addEventListener(MouseEvent.MOUSE\_OVER, mouseOn);

function mouseOn(e:MouseEvent):void{  
this.setChildIndex(e.target, this.numChildren-1);  
}

when I trace the e.target it gets me the correct instance names of these objects but when I run it I get an error.

> 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.

Could anyone help me please?
