Need some help simplifying code

Hey all,

I’ve given up on trying to do comboboxes in xml, so I’m just making them the boring old movieclip way. (insert shameful hanging of head here)

Works a treat until I get to one in particular, which has a list of 87 different planes, vehicles and a few other treats). I’ve created an array (my first one) with the entire list in it, and also 87 invisible buttons that change the combobox label and close it when clicked.

I’ve written a function for those invisible buttons. The second bit calls the function and specifies which name to display in the label.

function i_dd(select:String):Void {
_parent.dd_selected = (select);
_parent.gotoAndStop(1);
}

i1.onRelease = function() {
i_dd(myArray[0]);
}

Each invisible button is named i1, i2, i3 etc up to i87, and each one requires the two (or three, if you count the curly bracket) lines of code at the end there. That’s a lot of code. (with extra spaces for each group of ten it comes up as 279 lines)

I’m wondering if that’s considered an acceptable manner to do things, or is there a better way using maths that automatically registers which one’s hit and assigns the variable accordingly?

Thanks heaps!