String to Movieclip instance name


I have a function to set focus to a movieclip. Something’s wrong, not sure what… I’m blinded by this, and need help!


First I’m creating a movieclip container and populating this with movieclips that will make up a menu. Next step is to give focus to the first “tab” initially, and then to have a selecteditem variable that changes as the focus changes…

//Creates an empty movieclip for containing the menu
menu_container = this.createEmptyMovieClip(“main_menu_mc”, this.getNextHighestDepth());
menu_container._y = 20;

//Counts through the categorynodes_array and adds buttons
//Adds the category name and description to the textfields in “tab”
for (var i = 0; i<_root.categorynodes_array.length; i++) {
var m = menu_container.attachMovie(“tab”, “tab”+i+"_mc", i);
m.categoryname_txt.text = _root.categorynames_array*;
m.categorydescription_txt.text = _root.categorydescriptions_array*;
m._x = 30;
m._y = (m._height+20)*i;

function setTabFocus(tab) {
var tab:Number = tab;
var tab_mc:String = “” + tab + “_mc”;
trace (tab_mc);
if (selectedItem == null) {
} else {

Pretty please, help me!