I\'m using BlazeDS to connect Flex with Java. I\'m having trouble passing ArrayLists of custom objects from Flex to java.
I have two objects, one is called Category,
One of the most common complaints with AS3 is the lack of typed arrays. ArrayLists will only contain objects, you will have to cast the results yourself.
Here is an example of a Java and AS3 class that I would pass around.
In Java:
The top level class:
package mystuff;
public class StuffToSend
{
public List sections;
...
}
Sections class:
package mystuff;
public class Section
{
public List categories;
...
}
Category class:
package mystuff;
public class Category
{
...
}
In AS3:
package mystuff
{
[RemoteClass(alias="mystuff.StuffToSend")] // So AS3 knows which Java class to map
public class StuffToSend
{
public var sections:ArrayCollection;
...
}
}
package mystuff
{
[RemoteClass(alias="mystuff.Section")] // So AS3 knows which Java class to map
public class Section
{
public var categories:ArrayCollection;
...
}
}
package mystuff
{
[RemoteClass(alias="mystuff.Category")] // So AS3 knows which Java class to map
public class Category
{
...
}
}
You can learn more about remoteObjects here: Data Access