Positioning dynamically created MC's w/ variable height along y axis

My code works fine as long as all the dynamically created MC’s have the same height.

The following pulls in data from an array structured as such:

elements1= [
    {file:"image1.jpg", sequence:0,  header: "", description:"Text One", VRname: "Sample1" }, 
    {file:"image2.jpg", sequence:1,  header: "I'm a subheading", description:"Text Two", VRname: "Sample2" }, 
    {file:"image3.jpg", sequence:2,  header: "", description:"Text Three", VRname: "Sample3" }, 
    {file:"image4.jpg", sequence:3,  header: "", description:"Text four", VRname: "Sample4" }

arraySet = elements1

… to populate dyamically created text fields through this function:

function pickArray(arraySet) {
    for (i = 0; i < arraySet.length; i++) {
    listholder.createEmptyMovieClip(["MC"+i], i*2 );
    listholder["MC"+i].vrname.embedFonts = true
    listholder["MC"+i].vrname.text = arraySet*["VRname"] 
    listholder["MC"+i].vrname.autoSize = "right";
    listholder["MC"+i].vrname.selectable = false;
    listholder["MC"+i]._y =  (i * listholder["MC"+i]._height)


This works fine if all dynamically created MC’s have the same height. However, the code breaks as soon as I append information from the header category of my array with the following line:

listholder["MC"+i].vrname.text = arraySet*["VRname"] + "
" + arraySet*["header"]

Only one record in the array has information contained in the header category, so the height of the MC containing those two lines of text is greater than the others.

I tried numerous combinations to add each MC’s­­ height to the equation, but noting I attempt seems to work.


listholder["MC"+i]._y =  (i * listholder["MC"+i]._height) + listholder["MC"+i]._height

and this:

listholder["MC"+i]._y =  (i * listholder["MC"+i]._height) + 44

only add values to the top of the list, pushing everything down from its initial y=0 position.

Searching the archives found an old posting from 2004 with the same issue, but seems to have gone unanswered:

I may be going about this all wrong. I coded my app without realizing that some of my text links would require a main heading with sub links. So I’m not even sure this scenario will work. But I’ll deal with that issue later. Right now, this problem has bitten into me and I’m obsessed with finding a solution.

Hope anyone can help.