From 31e6bbee017d866a93a0d34f7f6ac9f6f51de567 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 8 Mar 2007 21:01:33 +0000 Subject: [PATCH] Automatically unwrap args in a MessageEvent, like we do in other events. The way this all works is: when you send a primitive to the server, you must wrap it up yourself, because there's no way for flash to distinguish between the integer 3 and the floating point value 3.0. But when it comes from the server, it's all wrapped up in a very specific type and we can easily unwrap it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4623 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/presents/dobj/MessageEvent.as | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/as/com/threerings/presents/dobj/MessageEvent.as b/src/as/com/threerings/presents/dobj/MessageEvent.as index bc25158ad..a1b91329b 100644 --- a/src/as/com/threerings/presents/dobj/MessageEvent.as +++ b/src/as/com/threerings/presents/dobj/MessageEvent.as @@ -26,6 +26,7 @@ import com.threerings.io.ObjectOutputStream; import com.threerings.io.TypedArray; import com.threerings.util.StringBuilder; +import com.threerings.util.Wrapped; /** * A message event is used to dispatch a message to all subscribers of a @@ -111,6 +112,14 @@ public class MessageEvent extends NamedEvent { super.readObject(ins); _args = (ins.readField(Array) as Array); + + if (_args != null) { + for (var ii :int = _args.length - 1; ii >= 0; ii--) { + if (_args[ii] is Wrapped) { + _args[ii] = (_args[ii] as Wrapped).unwrap(); + } + } + } } protected var _args :Array;