OK, I am passing a complex object from my .NET library to my Flex application via WebOrb. In order to automatically translate, I am using the [RemoteClass] meta data tag as follows:
[RemoteClass(alias="test.PlanVO")]
public class Plan
{
[SyncId]
public var id:int;
public var Name:String;
}
This works absolutely fine, until I try to extend the Plan class to contain an array of complex items:
.NET:
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; }
}
ActionScript:
[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;
}
In this case, even when children are returned by the .NET library, the children property of the ActionScript Plan class is null.
I have tried changing the children field to a property like this:
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;
}
but the set function never gets called.
What can I do to get the children into my Flex app in this way?
Thanks!