From 124835193e7c55cbe38e4a72b28389ed2ecaa273 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 29 Aug 2006 20:55:16 +0000 Subject: [PATCH] If the button is a toggle button and no arg has been specified, pass the value of 'selected' (true or false) as the argument. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4349 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/mx/controls/CommandButton.as | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/as/com/threerings/mx/controls/CommandButton.as b/src/as/com/threerings/mx/controls/CommandButton.as index 6f1dc1edf..199cd80ab 100644 --- a/src/as/com/threerings/mx/controls/CommandButton.as +++ b/src/as/com/threerings/mx/controls/CommandButton.as @@ -36,8 +36,14 @@ public class CommandButton extends Button if (enabled) { // stop the click event event.stopImmediatePropagation(); + // dispatch the command event - CommandEvent.dispatch(this, _cmd, _arg); + // if the arg is null and we're a toggle button, dispatch our state + var arg :Object = _arg; + if (arg == null && toggle) { + arg = selected; + } + CommandEvent.dispatch(this, _cmd, arg); } }