Dynamic Paths again

Hi everyone, I am having trouble finding info on how to have a dynamic path, I know I have asked this question before but I think it is different this time, since I am using it in a function…

This is my code, why doesnt it work?


onClipEvent (load){
	function dropDown(section){
		dropdownmenuTarget = eval("_root.submenu_"+section);
		variableTarget = eval("_root."+section+"menuOver");
		buttonTarget = eval("_root."+section+"_button");
		
		if (buttonTarget.hitTest(_root._xmouse, _root._ymouse, true)) {
			buttonTarget.gotoAndStop(2);
			variableTarget = true;
			trace("on");
			
		} else if (dropdownmenuTarget.hitTest(_root._xmouse, _root._ymouse, true)) {
			buttonTarget.gotoAndStop(2);
			variableTarget = true;
			trace("Sub Menu On");
		} else {
			buttonTarget.gotoAndStop(1);
			variableTarget = false;
			trace("off");
		}
	}
}
onClipEvent (enterFrame) {
	dropDown(services);
}

Thank you all for your help!

Ted

is this part right:

[AS]
dropdownmenuTarget = eval(“root.submenu”+section);
variableTarget = eval("_root."+section+“menuOver”);
buttonTarget = eval("_root."+section+"_button");
[/AS]

it seems like you’re missing some dot operators. let’s say section = “myS”, then you’d get:

[AS]
dropdownmenuTarget = eval("_root.submenu_myS");
variableTarget = eval("_root.mySmenuOver");
buttonTarget = eval("_root.myS_button");
[/AS]

see what i’m saying?

Of course thats exactly what I want, but for some reason it doesnt work. Also when I try to trace the variable “section” it returns undefined even though I am declaring “function dropDown(section)” and calling “dropDown(services)” Am I doing something else wrong? Anyone know?

Thanks

Ted