我有一个用于 Flash ActiveX 控件的自定义容器 (C#),并且正在来回传递数据。以前我会使用ExternalInterface.call 并传递一个数组作为参数。我更愿意使用 Vector 类,因为它可用,但似乎当我这样做时,永远不会进行调用。
然而,如果它嵌入在 IE 中,它就会被制作出来。看来在 IE 中,Flash 会发送 JavaScript 来执行,而不是序列化为 XML。我的猜测是 Vector XML 序列化未内置,因此 Flash 只是忽略该调用。
有人有什么想法吗?除了重新使用数组之外,我现在已经这样做了。
I have a custom container (C#) for the Flash ActiveX control and am passing data back and forth. Previously I would use ExternalInterface.call and pass an Array as a parameter. I would prefer to use the Vector class now that it is available, but it appears that when I do that the call is never made.
It is however made if it is embedded in IE. It appears that when in IE, Flash will send out JavaScript to execute rather than serializing to XML. My guess is that the Vector XML serialization isn't baked in, so Flash just ignores the call.
Anyone have any ideas? Other than just going back to using Array, I've already done that for now.
发布评论
评论(2)
文档指出:
目前尚不完全清楚这意味着什么,因为自定义类也是对象 - 我猜只有普通对象才算数?但无论如何,Vector 看起来属于“其他内置类”类别,因此您需要使用 Array,或者在传递数据之前重新转换为 Array。
The docs note that:
It's not completely clear what that means, since custom classes are also Objects - I guess only vanilla objects count? But at any rate it looks like Vector falls into that "other built-in classes" category, so you'll need to either use Array, or re-cast to Array before you pass the data.
您可以使用带有
[ArrayElementType("type")]
的数组。或者为Vector
编写序列化函数you can use arrays with
[ArrayElementType("type")]
instead. or write a serialization function forVector