# Child Index

**URL:** <https://forum.kirupa.com/t/child-index/292472>\
**Category:** flash\
**Created:** [July 14, 2009, 4:14pm UTC](https://forum.kirupa.com/t/child-index/292472 "2009-07-14T16:14:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky55](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@Ricky55](https://forum.kirupa.com/u/Ricky55)\
**Post date:** [July 14, 2009, 4:14pm UTC](https://forum.kirupa.com/t/child-index/292472/1 "2009-07-14T16:14:25Z")

</div>

Hi

I have this swf file  
[http://www.qwerty-design.co.uk/bensons/forum.html](http://www.qwerty-design.co.uk/bensons/forum.html)

This will eventually be loads of these pins. I’m using the Pin head as a hit area to start the simple rollover animation.

I just want the the grey box that appears to allows be on top of all the pins. I’ve managed to get it to do this but then once I have it on top the other pins event handler doesn’t work.

Is there a way of storing the current index in a variable so I can return the movieclip to this on the rollout function?

Or is there a better way altogether? whilst keeping things simple?

My code so far

```auto

//Roll over and out button actions
var buttonArray:Array =
[
pin1_mc.hitMov_mc,
pin2_mc.hitMov_mc
];

function initSite():void
{
	for (var i:Number = 0; i < buttonArray.length; i++)
	{
		MovieClip(buttonArray*).buttonMode=true;
		MovieClip(buttonArray*).addEventListener(MouseEvent.ROLL_OVER, onOver, false, 0, true);
		MovieClip(buttonArray*).addEventListener(MouseEvent.ROLL_OUT, onOut, false, 0, true);
	}
}
initSite();

function onOver (event:MouseEvent):void
{
	event.currentTarget.parent.gotoAndPlay(2);
	this.setChildIndex(this.getChildByName(event.currentTarget.parent.name), this.numChildren-1);
}

function onOut (event:MouseEvent):void
{
	event.currentTarget.parent.gotoAndPlay(7);
}

```
