Whats the correct syntax?

I have a function that I want to use for all my menus:



function button(menuvar){
      trace(menuvar);	
	_root.menuvar.gotoAndPlay("open");
}


So if I call the function from a rollover I can send the menu name as a parameter to the function.


on (rollOver) {
	_root.button("aboutmenu");
}

However, its not working. When I trace the variable menuvar it shows as aboutmenu. My movieclip IS called aboutmenu. If I change the target from

_root.menuvar.gotoAndPlay(“open”);

to

_root.aboutmenu.gotoAndPlay(“open”);

it does work. So I’m guessing I’ve got the syntax wrong or I need to define the variables differently or something.

Any help would be much appreciated.