CFC 和 Flex 之间的嵌套类强制转换失败

发布于 2024-07-16 12:49:35 字数 435 浏览 4 评论 0原文

我有两个 AS3 类,A 和 B。A 类包含一个 ArrayCollection,它将保存 B 类的多个实例。

在 ColdFusion 中,我有匹配的 CFC,具有相同顺序的同名变量,以及每个变量的 cfproperty 标记。

AS3 类都使用 RemoteClass 元数据将它们与其 CFC 对应项关联起来。

问题是,虽然 A.cfc 从 CF 返回并适当地填充 A.as 实例,但我无法填充任何嵌套的 B.as 实例。 相反,我收到此错误:

TypeError: Error #1034: Type Coercion failed: cannot convert []@2f4465f1 to mx.collections.ArrayCollection.

为什么 A 实例除了其嵌套 B 实例的集合之外还能正常工作?

I have two AS3 classes, A and B. Class A contains an ArrayCollection that will hold multiple instances of class B.

In ColdFusion, I have matching CFCs, with same-named variables in the same order, as well as cfproperty tags for each variable.

The AS3 classes both use the RemoteClass metadata to associate them with their CFC counterparts.

The problem is that, while A.cfc comes back from CF and populates the A.as instances appropriately, I can't get any of the nested B.as instances to populate. Instead, I get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert []@2f4465f1 to mx.collections.ArrayCollection.

Why would the A instance work fine except for the collection of its nested B instances?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

双马尾 2024-07-23 12:49:35

问题是该对象作为数组从 ColdFusion 返回,而 Flex 不想为我将其转换为 ArrayCollection。 Flex 会将 ColdFusion 查询转换为 ArrayCollection,但 ColdFusion 数组显然只能是 Flex 中的数组(自动)。

我将 Flex 中的 ArrayCollection 更改为 Array,一切正常。

The problem was that the object was coming back from ColdFusion as an array and Flex didn't want to convert that into an ArrayCollection for me. Flex will turn a ColdFusion query into an ArrayCollection, but a ColdFusion array apparently can only be an Array (automatically) in Flex.

I changed the ArrayCollection in Flex to an Array and everything works fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文