# Dynamic Paths again

**URL:** <https://forum.kirupa.com/t/dynamic-paths-again/63540>\
**Category:** flash\
**Created:** [September 7, 2004, 7:32pm UTC](https://forum.kirupa.com/t/dynamic-paths-again/63540 "2004-09-07T19:32:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedc](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tedc](https://forum.kirupa.com/u/tedc)\
**Post date:** [September 7, 2004, 7:32pm UTC](https://forum.kirupa.com/t/dynamic-paths-again/63540/1 "2004-09-07T19:32:33Z")

</div>

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?

```auto

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 7, 2004, 8:31pm UTC](https://forum.kirupa.com/t/dynamic-paths-again/63540/2 "2004-09-07T20:31:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 8, 2004, 1:48pm UTC](https://forum.kirupa.com/t/dynamic-paths-again/63540/3 "2004-09-08T13:48:01Z")

</div>

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
