# ContextMenuItem picky about function declaration

**URL:** <https://forum.kirupa.com/t/contextmenuitem-picky-about-function-declaration/228990>\
**Category:** flash\
**Created:** [June 13, 2007, 5:46am UTC](https://forum.kirupa.com/t/contextmenuitem-picky-about-function-declaration/228990 "2007-06-13T05:46:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joebert](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joebert/32/563_2.png) [@joebert](https://forum.kirupa.com/u/joebert)\
**Post date:** [June 13, 2007, 5:46am UTC](https://forum.kirupa.com/t/contextmenuitem-picky-about-function-declaration/228990/1 "2007-06-13T05:46:35Z")

</div>

I can literally toggle weather the item is shown or not by changing the way the onSelect handlers function is declared.

This works,

```auto
wme.customItems.push(new ContextMenuItem("Widget Settings", helpme));
function helpme(obj,item){
	trace('wtf');
}

```

But this doesn’t,

```auto
wme.customItems.push(new ContextMenuItem("Widget Settings", helpme));
helpme = function(obj,item){
	trace('wtf');
}

```

I don’t understand why this happens.  
I can obviously work around it, but would like to know what’s going on if anyone knows. 😃
