From cd8f168452c3fb56c23acf4b8e9d3c529df2c8f6 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 18 Apr 2006 01:58:44 +0000 Subject: [PATCH] Create controllers in the new way (actionscript wants to be all growed up just like uncle Java!). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4028 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/crowd/client/LocationDirector.as | 17 ++++++----------- src/as/com/threerings/crowd/data/PlaceConfig.as | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/as/com/threerings/crowd/client/LocationDirector.as b/src/as/com/threerings/crowd/client/LocationDirector.as index 09e08defe..42c8cceb7 100644 --- a/src/as/com/threerings/crowd/client/LocationDirector.as +++ b/src/as/com/threerings/crowd/client/LocationDirector.as @@ -313,18 +313,13 @@ public class LocationDirector extends BasicDirector _placeId = placeId; // check whether we should use a custom class loader - var cclass :Class = config.getControllerClass(); - try { - // start up a new place controller to manage the new place - _controller = (new cclass() as PlaceController); - _controller.init(_cctx, config); - - } catch (e :Error) { - Log.warning("Error creating or initializing place controller " + - "[cclass=" + cclass + - ", config=" + config + "]."); - Log.logStackTrace(e); + _controller = config.createController(); + if (_controller == null) { + Log.warning("Place config returned null controller " + + "[config=" + config + "]."); + return; } + _controller.init(_cctx, config); // subscribe to our new place object to complete the move _cctx.getDObjectManager().subscribeToObject(_placeId, this); diff --git a/src/as/com/threerings/crowd/data/PlaceConfig.as b/src/as/com/threerings/crowd/data/PlaceConfig.as index f0a1306fb..0a3b4cd86 100644 --- a/src/as/com/threerings/crowd/data/PlaceConfig.as +++ b/src/as/com/threerings/crowd/data/PlaceConfig.as @@ -48,7 +48,7 @@ public /*abstract*/ class PlaceConfig * this place. The controller class must derive from {@link * PlaceController}. */ - public function getControllerClass () :Class + public function createController () :PlaceController { return null; }