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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user