Follow new style, look for a function named COMMAND first.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4348 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -42,8 +42,23 @@ public class Controller
|
|||||||
public function handleAction (cmd :String, arg :Object) :Boolean
|
public function handleAction (cmd :String, arg :Object) :Boolean
|
||||||
{
|
{
|
||||||
// fall back to a method named the cmd
|
// fall back to a method named the cmd
|
||||||
|
var fn :Function = null;
|
||||||
try {
|
try {
|
||||||
var fn :Function = (this["handle" + cmd] as Function);
|
fn = (this[cmd] as Function);
|
||||||
|
} catch (e :Error) {
|
||||||
|
// suppress
|
||||||
|
//Log.testing("Caught error finding '" + cmd + "()' [" + this + "]");
|
||||||
|
}
|
||||||
|
if (fn == null) {
|
||||||
|
// try the old style with "handle" prepended
|
||||||
|
try {
|
||||||
|
fn = (this["handle" + cmd] as Function);
|
||||||
|
} catch (e :Error) {
|
||||||
|
// suppress
|
||||||
|
//Log.testing("Caught error finding 'handle" + cmd + "()' [" +
|
||||||
|
// this + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (fn != null) {
|
if (fn != null) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
@@ -68,9 +83,6 @@ public class Controller
|
|||||||
// we "handled" the event, even if it threw an error
|
// we "handled" the event, even if it threw an error
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (e :Error) {
|
|
||||||
// suppress, and fall through
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // not handled
|
return false; // not handled
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user