# How does setChildIndex(); work?

**URL:** <https://forum.kirupa.com/t/how-does-setchildindex-work/245345>\
**Category:** flash\
**Created:** [November 28, 2007, 7:27pm UTC](https://forum.kirupa.com/t/how-does-setchildindex-work/245345 "2007-11-28T19:27:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)\
**Post date:** [November 28, 2007, 7:27pm UTC](https://forum.kirupa.com/t/how-does-setchildindex-work/245345/1 "2007-11-28T19:27:51Z")

</div>

For the life of me, I cannot understand this method. The help files are confusing to me, and I can’t locate anything else on the web that explains how it works.

What I have is an array of 5 objects closely in a row, that tween and expand on a MOUSE\_OVER. Trouble is, I want the object to be in front of the others on the MOUSE\_OVER, but part of it is always beneath the object to its right or left. Here’s the code I have:

```auto

import fl.transitions.*; 
import fl.transitions.easing.*;

addEventListener(Event.ENTER_FRAME, setupVars);

function setupVars(e:Event):void {
    trace("Entering setupVars");
    //The following removes the Event.ENTER_FRAME listener so that it does not activate 30 times a second.
    removeEventListener(Event.ENTER_FRAME,setupVars);
    var myArray:Array = [box1_mc, box2_mc, box3_mc, box4_mc, box5_mc];  
    for(var i:Number = 0; i < myArray.length; i++) {
    myArray*.addEventListener(MouseEvent.MOUSE_OVER, boxOver);
    myArray*.addEventListener(MouseEvent.MOUSE_OUT, boxOut);
    myArray*.buttonMode = true;
   }
}
var box:Tween;
var box2: Tween;
function boxOver(ev:Event):void {
     box = new Tween(ev.target, "width", Elastic.easeIn, 100, 130, .5, true);
     box = new Tween(ev.target, "height", Elastic.easeIn, 100, 130, .5, true);
     trace("yay, it works")
}

function boxOut(ev:Event):void {
     box2 = new Tween(ev.target, "width", Elastic.easeOut, 130, 100, 1, true);
     box2 = new Tween(ev.target, "height", Elastic.easeOut, 130, 100, 1, true);
     trace("yay, this one works, too")
} 

```

Could someone be so kind as to help me with the setChildIndex method? I want any particular box to be in front of the others on the OVER.
