From 51a40c5f4fccb78917fd00a30d3b6d7295d15fae Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 11 Aug 2006 17:40:28 +0000 Subject: [PATCH] Use mx.utils.DisplayUtil. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4320 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/crowd/client/PlaceViewUtil.as | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/as/com/threerings/crowd/client/PlaceViewUtil.as b/src/as/com/threerings/crowd/client/PlaceViewUtil.as index 39f5e3f32..8b36177e3 100644 --- a/src/as/com/threerings/crowd/client/PlaceViewUtil.as +++ b/src/as/com/threerings/crowd/client/PlaceViewUtil.as @@ -21,7 +21,9 @@ package com.threerings.crowd.client { -import flash.display.DisplayObjectContainer; +import flash.display.DisplayObject; + +import mx.utils.DisplayUtil; import com.threerings.crowd.data.PlaceObject; @@ -66,25 +68,23 @@ public class PlaceViewUtil private static function dispatch ( root :Object, plobj :PlaceObject, funct :String) :void { - // dispatch the call on this component if it implements PlaceView - if (root is PlaceView) { - try { - (root as PlaceView)[funct](plobj); - } catch (e :Error) { - var log :Log = Log.getLog(PlaceViewUtil); - log.warning("Component choked on " + funct + "() " + - "[component=" + root + ", plobj=" + plobj + "]."); - log.logStackTrace(e); - } + if (!(root is DisplayObject)) { + return; } - // now traverse all of this component's children - if (root is DisplayObjectContainer) { - var cont :DisplayObjectContainer = (root as DisplayObjectContainer); - for (var ii :int = 0; ii < cont.numChildren; ii++) { - dispatch(cont.getChildAt(ii), plobj, funct); - } - } + DisplayUtil.walkDisplayObjects(root as DisplayObject, + function (disp :DisplayObject) :void { + if (disp is PlaceView) { + try { + (root as PlaceView)[funct](plobj); + } catch (e :Error) { + var log :Log = Log.getLog(PlaceViewUtil); + log.warning("Component choked on " + funct + "() " + + "[component=" + root + ", plobj=" + plobj + "]."); + log.logStackTrace(e); + } + } + }); } } }