BlazeDS FlashDevelop RPC ArrayList
(Russell_C_Taylor) Jun 23, 2008 4:34 AMHi,<br /><br />I've managed to get RPC working with BlazeDS and FlashDevelop using pure actionscript 3 & rpc.swc. Great, I can return strings & booleans from the my java objects.<br /><br />I've tried some tutes and the BlazeDS developers guide to try and create custom serialization. But I am stuck with - ArgumentError: Error #2004: One of the parameters is invalid. When I try to return an ArrayList?<br /><br />The developers guide says it's possible to associate the java ArrayList with mx.collections.ArrayCollection. I've tried several methods but so far just get the above error. <br /><br />Here's the ArrayList<IdeaRO> that I'm trying to serialize;<br /><br />package tbi.DAO;<br /><br />//import java.util.Vector;<br />import java.io.Externalizable;<br />import java.io.IOException;<br />import java.io.ObjectInput;<br />import java.io.ObjectOutput;<br /><br />/**<br /> * <br /> * @author Russell Taylor<br /> * @created 13.06.2008<br /> * <br /> * This result object contains relates to each Idea Touch Point<br /> * and can also be used the Ideas in the related scroll component<br /> *<br /> */<br />public class IdeaRO implements Externalizable {<br /> <br /> private int _id;<br /> private String _title;<br /> private String _imageUrl;<br /> private int _level;<br /> private int _plusScore;<br /> private int _minusScore;<br /> <br /> /**<br /> * BlazeDS needs this to instantiate<br /> */<br /> public IdeaRO(){<br /> <br /> }<br /> <br /> public int getId(){<br /> return _id;<br /> }<br /> <br /> public void setId(int value){<br /> this._id = value;<br /> }<br /> <br /> public String getTitle(){<br /> return _title;<br /> }<br /> <br /> public void setTitle(String value){<br /> this._title = value;<br /> }<br /> <br /> public String getImageURL(){<br /> return _imageUrl;<br /> }<br /> <br /> public void setImageURL(String value){<br /> this._imageUrl = value;<br /> }<br /> <br /> public int getLevel(){<br /> return _level;<br /> }<br /> <br /> public void setLevel(int value){<br /> this._level = value;<br /> }<br /> <br /> public int getPlusScore(){<br /> return _plusScore;<br /> }<br /> <br /> public void setPlusScore(int value){<br /> this._plusScore = value;<br /> }<br /> <br /> public int getMinusScore(){<br /> return _minusScore;<br /> }<br /> <br /> public void setMinusScore(int value){<br /> this._minusScore = value;<br /> }<br /> <br /> /**<br /> * Serializes the server state of an instance of ThirdPartyProxy<br /> * by sending a String for the name, a Map of properties<br /> * String for the description, and a floating point<br /> * integer (single precision) for the price. Notice that the inventory <br /> * identifier is not sent to external clients.<br /> */<br /> public void writeExternal(ObjectOutput out) throws IOException {<br /> // Write out the client properties from the server representation<br /> out.writeFloat(_id);<br /> out.writeObject(_title);<br /> out.writeObject(_imageUrl);<br /> out.writeFloat(_level);<br /> out.writeFloat(_minusScore);<br /> out.writeFloat(_plusScore);<br /> }<br /> <br /> /**<br /> * Deserializes the client state of an instance of ThirdPartyProxy<br /> * by reading in String for the name, a Map of properties<br /> * for the description, and <br /> * a floating point integer (single precision) for the price. <br /> */<br /> public void readExternal(ObjectInput in) throws IOException,<br /> ClassNotFoundException {<br /> // Read in the server properties from the client representation.<br /> _id = (int)in.readFloat();<br /> _title = (String)in.readObject();<br /> _imageUrl = (String)in.readObject();<br /> _level = (int)in.readFloat();<br /> _minusScore = (int)in.readFloat();<br /> _plusScore = (int)in.readFloat();<br /> <br /> }<br /><br />}<br /><br />Any help would be appreciated.<br /><br />Thanks,<br /><br />Russell