I am having trouble accessing any Java objects that return something other
than the Java types flex will implicitly convert. I am using the
RemoteObject tag. The first time I try to access the result from the pojo
function call I get "Error: org/apache/commons/collections/FastHashMap" in
the JRun console. Each successive call will throw "Error: null". I am
using JRun4.
The code is below. I have stripped all of the functionality to try and get
rid of the error and to try to get Flex to recognize my remote object
returned.
For now all I want to do is successfully call the function that returns my
person and display one of the fields from the object.
Has anybody else experienced this type of problem?
Josh
/****
Java Class I am trying to use in Flex
****/
public class Person implements Serializable {
private String name;
private String birthdate;
public Person (){
}
public Person (String name, String birthdate) {
this.name = name;
this.birthdate = birthdate;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setBirthdate(String birthdate) {
this.birthdate = birthdate;
}
public String getBirthdate() {
return birthdate;
}
}
/*****
Java Function Call that returns an Object to Flex and resides in People
Object
*****/
public Person getPerson(){
return new Person("Josh", "8/8/2005");
}
/***
MXML File
***/
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:RemoteObject id="peopleObject" source="People">
<mx:method name="getPerson"
result="handleResults(event.result)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
function handleResults(eventResult){
var p1:Person = new
Person(eventResult.getProperty('name'),
eventResult.getProperty('birthdate'));
}
]]>
</mx:Script>
<mx:Panel width="800" height="600">
<mx:HBox>
<mx:Button label="Get Person"
click="{peopleObject.getPerson()}" />
</mx:HBox>
</mx:Panel>
</mx:Application>
/***
AS class
***/
// ActionScript Document
class Person implements DataProvider{
var name:String;
var birthdate:String;
function Horse(myName:String, myBirthdate:String){
this.name = myName;
this.birthdate = myBirthdate;
}
function getName(){
return(name);
}
function getBirthdate(){
return(birthdate);
}
}
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hpk2rmu/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123482548/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/