好的,我通过 WebOrb 将一个复杂对象从我的 .NET 库传递到我的 Flex 应用程序。为了自动翻译,我使用 [RemoteClass] 元数据标签如下:
[RemoteClass(alias="test.PlanVO")]
public class Plan
{
[SyncId]
public var id:int;
public var Name:String;
}
这绝对没问题,直到我尝试扩展 Plan 类以包含一组复杂项目:
。网:
public class PlanVO
{
public int id { get; set; }
public string Name { get; set; }
public List<PlanElementVO> children { get; set; }
}
public class PlanElementVO
{
public string elementName { get; set; }
}
动作脚本:
[RemoteClass(alias="test.PlanVO")]
public class Plan
{
[SyncId]
public var id:int;
public var Name:String;
public var children:ArrayCollection;
}
[RemoteClass(alias="test.PlanElementVO")]
public class PlanElement
{
public var elementName:String;
}
在这种情况下,即使 .NET 库返回子级,ActionScript Plan 类的 children 属性也为空。
我尝试将 children 字段更改为这样的属性:
private var _children:ArrayCollection;
public function get children():ArrayCollection
{
return _children;
}
public function set children(o:*):void
{
if(o is ArrayCollection)
_children = o;
else if(o is Array)
_children = new ArrayCollection(o);
else
_children = null;
}
但是 set 函数永远不会被调用。
我该怎么做才能让孩子们以这种方式进入我的 Flex 应用程序?
谢谢!