# Function doesnt work

**URL:** <https://forum.kirupa.com/t/function-doesnt-work/63714>\
**Category:** Uncategorized\
**Created:** [September 9, 2004, 12:13pm UTC](https://forum.kirupa.com/t/function-doesnt-work/63714 "2004-09-09T12:13:30Z")\
**Posts on this page:** 5\
**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 9, 2004, 12:13pm UTC](https://forum.kirupa.com/t/function-doesnt-work/63714/1 "2004-09-09T12:13:30Z")

</div>

Hello everyone, I have posted already in the Flash MX 2004 forum, but I think there is best since this is something pretty basic. This is my first time creating a user defined function that actually will save me time for something, but it doesnt work! I think it should be pretty simple and I dont get any errors but it just doesnt do anything:

```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);
}

```

If Im not mistaken, when I run the function with the parameter “services” it should read like this including the eval: \_root.services\_button.gotoAndStop(2); but really it doesnt do anything. :hurt: None of the commands work, as if the target was wrong but… well Im really confused… Any help would be GREATLY appreciated.

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 9, 2004, 3:12pm UTC](https://forum.kirupa.com/t/function-doesnt-work/63714/2 "2004-09-09T15:12:45Z")

</div>

mmmm no one knows? Shouldnt this be relatively simple for you hardcore actionscripters? :{

---

<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 9, 2004, 3:29pm UTC](https://forum.kirupa.com/t/function-doesnt-work/63714/3 "2004-09-09T15:29:07Z")

</div>

attach ya fla dude

---

<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 9, 2004, 4:23pm UTC](https://forum.kirupa.com/t/function-doesnt-work/63714/4 "2004-09-09T16:23:00Z")

</div>

It wouldnt really change anything, the only thing I have is a menu system, and with 3 mc’s one dj :cowboy: (and one variable)the first mc is the controller that is outside the stage and has the ascript on it, the second is a sub menu that opens and closes according to the boolean value of the variable and the third mc is used for a button. That function should work no?  
ok now that I think about it Im uploading the fla. :pa:

I really need help with this cause I like need to finish this project and I dont want to repeat the same functions for every button.

heres the fla: [work.tedconn.com/home.fla](http://work.tedconn.com/home.fla)

---

<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 10, 2004, 9:05am UTC](https://forum.kirupa.com/t/function-doesnt-work/63714/5 "2004-09-10T09:05:15Z")

</div>

Dont have mx2004 to open it…  
But taking a quick look at the code, i think you should remove the "'s in the target lines (“_root.submenu_”+section) etc.

right?
