Quantcast
Viewing all articles
Browse latest Browse all 10

ArrayCollections, WebORB deserialization, .NET generics

From the “don’t-beat-your-head-against-the-same-wall” department: Here’s the original situation:

1. .NET class (MyContainerType) with a public List<MyChildType> Data { get; set; }

2. Flex has both IMyContainerType and IMyChildType and their corresponding value object classes.

3. Both deserialize properly when service method calls return either class directly, but NOT the MyChildType objects in the Data property of MyContainerType; they return as simple AS3 Objects.

The problem is that unless you refer to the class “MyChildType” somewhere in your project, the Flash runtime has no idea that the “MyChildType” exists. Typically, you’d refer to this class in a view or something, so this problem is very esoteric and you most likely won’t encounter it, but if you do, keep this in mind.

The safest thing you can do is mention the class you intend for your ArrayCollection to contain in your value object (in lieu of Flex Generics) as follows:

Image may be NSFW.
Clik here to view.
AS3 ArrayCollection "Generic"

Ensure that the compiler includes the Class that the ArrayCollection will contain.


Viewing all articles
Browse latest Browse all 10

Trending Articles