Use mx.utils.DisplayUtil.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4320 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-08-11 17:40:28 +00:00
parent 54f3fdb3e6
commit 51a40c5f4f
@@ -21,7 +21,9 @@
package com.threerings.crowd.client { package com.threerings.crowd.client {
import flash.display.DisplayObjectContainer; import flash.display.DisplayObject;
import mx.utils.DisplayUtil;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
@@ -66,25 +68,23 @@ public class PlaceViewUtil
private static function dispatch ( private static function dispatch (
root :Object, plobj :PlaceObject, funct :String) :void root :Object, plobj :PlaceObject, funct :String) :void
{ {
// dispatch the call on this component if it implements PlaceView if (!(root is DisplayObject)) {
if (root is PlaceView) { return;
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);
}
} }
// now traverse all of this component's children DisplayUtil.walkDisplayObjects(root as DisplayObject,
if (root is DisplayObjectContainer) { function (disp :DisplayObject) :void {
var cont :DisplayObjectContainer = (root as DisplayObjectContainer); if (disp is PlaceView) {
for (var ii :int = 0; ii < cont.numChildren; ii++) { try {
dispatch(cont.getChildAt(ii), plobj, funct); (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);
}
}
});
} }
} }
} }