Ah, I figured out how to fix up my one issue with controllers:
The default behavior of an event is determined by the entity that calls into the event dispatcher, so the solution was to unify the dispatch of these events. Created a utility method in CommandEvent to do that, and did some singlton-like hackery on the constructor to prevent folks from thinking they can just dispatch these themselves and have it work correctly. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4317 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -37,7 +37,7 @@ public class CommandButton extends Button
|
||||
// stop the click event
|
||||
event.stopImmediatePropagation();
|
||||
// dispatch the command event
|
||||
dispatchEvent(new CommandEvent(_cmd, _arg));
|
||||
CommandEvent.dispatch(this, _cmd, _arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,9 @@ public class CommandMenu extends Menu
|
||||
{
|
||||
event.stopImmediatePropagation();
|
||||
var element :Array = (event.item as Array);
|
||||
mx_internal::parentDisplayObject.dispatchEvent(
|
||||
new CommandEvent(String(element[2]), element[3]));
|
||||
|
||||
CommandEvent.dispatch(mx_internal::parentDisplayObject,
|
||||
String(element[2]), element[3]);
|
||||
}
|
||||
|
||||
// our function for retrieving a label for a menu entry
|
||||
|
||||
Reference in New Issue
Block a user