Allow a function to be specified here, too.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@174 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -34,7 +34,7 @@ public class MenuUtil
|
|||||||
* Create a menu item that will submit a controller command when selected.
|
* Create a menu item that will submit a controller command when selected.
|
||||||
*/
|
*/
|
||||||
public static function createControllerMenuItem (
|
public static function createControllerMenuItem (
|
||||||
caption :String, cmd :String, arg :Object = null,
|
caption :String, cmdOrFn :Object, arg :Object = null,
|
||||||
separatorBefore :Boolean = false, enabled :Boolean = true,
|
separatorBefore :Boolean = false, enabled :Boolean = true,
|
||||||
visible :Boolean = true) :ContextMenuItem
|
visible :Boolean = true) :ContextMenuItem
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ public class MenuUtil
|
|||||||
new ContextMenuItem(caption, separatorBefore, enabled, visible);
|
new ContextMenuItem(caption, separatorBefore, enabled, visible);
|
||||||
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
|
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
|
||||||
function (event :ContextMenuEvent) :void {
|
function (event :ContextMenuEvent) :void {
|
||||||
CommandEvent.dispatch(event.mouseTarget, cmd, arg);
|
CommandEvent.dispatch(event.mouseTarget, cmdOrFn, arg);
|
||||||
});
|
});
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user