Accessing MC after attachMovie
Hi all,
This is a simplified version of the script I’m using.
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.
var nameBtnPrev = nameBtn["mbtn"+(i-1)];