# Accessing MC after attachMovie

**URL:** <https://forum.kirupa.com/t/accessing-mc-after-attachmovie/257310>\
**Category:** flash\
**Created:** [April 12, 2008, 2:54pm UTC](https://forum.kirupa.com/t/accessing-mc-after-attachmovie/257310 "2008-04-12T14:54:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![duckhill101](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@duckhill101](https://forum.kirupa.com/u/duckhill101)\
**Post date:** [April 12, 2008, 2:54pm UTC](https://forum.kirupa.com/t/accessing-mc-after-attachmovie/257310/1 "2008-04-12T14:54:48Z")

</div>

Accessing MC after attachMovie

Hi all,

This is a simplified version of the script I’m using.

```auto

var aNames:Array = ["Bob", "Carl", "Christopher", "Wayne", "Peter"];
for (var i = 0; i<aNames.length; i++) {
	nameBtn = mholder.attachMovie("mbtn", "mbtn"+i, mholder.getNextHighestDepth());
	nameBtn.tTxt.text = aNames*;
	nameBtn.tTxt.autoSize = "left"
	nameBtn._y = 0;
	//
	//
	if (i != 0) {
		var nameBtnPrev = nameBtn["mbtn"+(i-1)];//trying to get to previous mc
		trace(nameBtnPrev);
		nameBtn._x = nameBtnPrev._x+nameBtnPrev._width+20;
	}

}

```

I’m trying to make a simple horizontal navigation and the buttons which are MCs need to be spaced evenly with the same space inbetween. I’m trying to do it using the previous clips \_x and width and then spacing the next clip after that.

The problem is I’ve forgot (or can’t) access the previous clip. I was trying to it this way.

```auto

var nameBtnPrev = nameBtn["mbtn"+(i-1)];

```
