all groups > macromedia flash flash remoting > october 2005 >
You're in the

macromedia flash flash remoting

group:

Issues with returning data using remoting



Issues with returning data using remoting onedge3d
10/17/2005 12:00:00 AM
macromedia flash flash remoting: The remoting thing is new to me and I have no idea what I am doing wrong. When
I trace the r.results, flash tells me I have a string. If I try to set it to
the textarea.text property I get the error message:

Type mismatch in assignment statement: found Object where String is required.

Here is my code in Flash

public function Notes_Result(r:ResultEvent):Void {
frmNotes.text = r.result;
//trace(typeof(r.result))
}

Here is my code in ColdFusion

<cffunction name="GetEmployeeNotes" access="remote" returnType="string"
output="false">
<cfargument name="ID" type="numeric" required="true">
<!--- GetEmployeeNotes body --->
<cfquery datasource="datasourse" name="Notes">
SELECT Notes FROM dbo.tblEmployees WHERE Employee_ID = #ID#
</cfquery>
<cfset retResult = Notes.Notes>
<cfreturn retResult>
</cffunction>

Please help me, this is driving me crazy.

Thanks
Jason
Re: Issues with returning data using remoting meager
10/17/2005 7:09:21 PM
Try this..
frmNotes.text = r.result.items[0].Notes

This assumes you are returning only one record.

Re: Issues with returning data using remoting meager
10/17/2005 7:18:40 PM
Wait a minute..I didn't see that you were returning type="string". Sorry for
the bad information.

Are you able to trace the returned results? Try dumping the output="false" on
your cffunction.

See if this works.

Action Script:
Notes_Result = function(r:mx.rpc.ResultEvent)
{
rsNotes = r.result;
frmNotes.text = rsNotes.items[0].Notes //again..assuming one record
}

Coldfusion:
<cffunction name="GetEmployeeNotes" access="remote" returnType="query">
<cfargument name="ID" type="numeric" required="true">
<!--- GetEmployeeNotes body --->
<cfquery datasource="datasourse" name="Notes">
SELECT Notes FROM dbo.tblEmployees WHERE Employee_ID = #ID#
</cfquery>
<cfreturn Notes>
</cffunction>
Re: Issues with returning data using remoting onedge3d
10/18/2005 12:00:00 AM
Not sure but would returning a string be more efficient than returning a single
column record?
I did though make 2 work arounds for my problem.

1.
public function Notes_Result(r:ResultEvent):Void {
frmNotes.text = r.result.toString();
//trace(typeof(r.result))
}

or

2.
public function Notes_Result(r:ResultEvent):Void {
frmNotes.text = "" + r.result;
//trace(typeof(r.result))
}

I chose number 2 for now. It seems that there is a bug here. If ColdFusion
return a string and Flash sees it as an object that contradicts what the Flash
Remoting help files show me.

Thanks for you input, maybe Macromedia will fix this glitch?

Jason
Re: Issues with returning data using remoting kahanamaka
10/21/2005 6:26:22 PM
Re: Issues with returning data using remoting hybrid_ProgArtes
11/11/2005 5:28:27 AM
Problem Regarding Typecasting .Java class to .AS class

Hello, I am a J2EE Programmer and am also doing actionscripting in Flash MX,
specifically Remoting.

I already have tried Flash to "talk" to Java but I have some problems
regarding typecasting from a .java object to a .as custom class. Here are the
details:

I have my custom Person.as class in Flash and Person.java class in Java.
Another class in Flash called example2.as uses my Person.as as a variable.
example2.as has a getPerson() method which remotely calls Messenger.java's
getPerson() method. Messenger.java's getPerson() method returns an instance of
my Person.java class which has 2 properties in it,namely firstName and lastName
(both Strings). As i can see it in my NetDebugger panel in Flash, Java is
throwing to Flash the right object which is a Person.java class with right
properties in it, firstName and lastName.
The problem is that i cannot get the properties of Person.java when i typecast
it to Person.as class in Flash.
The following thing i've done before trying to typecast Person.java to
Person.as:

1) registered my Person.as class using Object.registerClass() in Flash

. . .this is done to make Flash understand that a Person.java class is to be
deserialized to Person.as class, that is what I think so. Please correct me if
i'm wrong. What i need to do is to correcly typecast Person.java class to
Person.as class so that i can extract the Person's properties, namely firstName
and lastName.

Anybody who knows this more is free to address his/her insight.

thanks a lot..

you may also email me at image.gif@gmail.com...thanks :)
Re: Issues with returning data using remoting hybrid_ProgArtes
11/11/2005 5:29:22 AM
Problem Regarding Typecasting .Java class to .AS class

Hello, I am a J2EE Programmer and am also doing actionscripting in Flash MX,
specifically Remoting.

I already have tried Flash to "talk" to Java but I have some problems
regarding typecasting from a .java object to a .as custom class. Here are the
details:

I have my custom Person.as class in Flash and Person.java class in Java.
Another class in Flash called example2.as uses my Person.as as a variable.
example2.as has a getPerson() method which remotely calls Messenger.java's
getPerson() method. Messenger.java's getPerson() method returns an instance of
my Person.java class which has 2 properties in it,namely firstName and lastName
(both Strings). As i can see it in my NetDebugger panel in Flash, Java is
throwing to Flash the right object which is a Person.java class with right
properties in it, firstName and lastName.
The problem is that i cannot get the properties of Person.java when i typecast
it to Person.as class in Flash.
The following thing i've done before trying to typecast Person.java to
Person.as:

1) registered my Person.as class using Object.registerClass() in Flash

. . .this is done to make Flash understand that a Person.java class is to be
deserialized to Person.as class, that is what I think so. Please correct me if
i'm wrong. What i need to do is to correcly typecast Person.java class to
Person.as class so that i can extract the Person's properties, namely firstName
and lastName.

Anybody who knows this more is free to address his/her insight.

thanks a lot..

you may also email me at image.gif@gmail.com...thanks :)
Re: Issues with returning data using remoting hybrid_ProgArtes
11/11/2005 5:29:53 AM
Problem Regarding Typecasting .Java class to .AS class

Hello, I am a J2EE Programmer and am also doing actionscripting in Flash MX,
specifically Remoting.

I already have tried Flash to "talk" to Java but I have some problems
regarding typecasting from a .java object to a .as custom class. Here are the
details:

I have my custom Person.as class in Flash and Person.java class in Java.
Another class in Flash called example2.as uses my Person.as as a variable.
example2.as has a getPerson() method which remotely calls Messenger.java's
getPerson() method. Messenger.java's getPerson() method returns an instance of
my Person.java class which has 2 properties in it,namely firstName and lastName
(both Strings). As i can see it in my NetDebugger panel in Flash, Java is
throwing to Flash the right object which is a Person.java class with right
properties in it, firstName and lastName.
The problem is that i cannot get the properties of Person.java when i typecast
it to Person.as class in Flash.
The following thing i've done before trying to typecast Person.java to
Person.as:

1) registered my Person.as class using Object.registerClass() in Flash

. . .this is done to make Flash understand that a Person.java class is to be
deserialized to Person.as class, that is what I think so. Please correct me if
i'm wrong. What i need to do is to correcly typecast Person.java class to
Person.as class so that i can extract the Person's properties, namely firstName
and lastName.

Anybody who knows this more is free to address his/her insight.

thanks a lot..

you may also email me at image.gif@gmail.com...thanks :) ;)
AddThis Social Bookmark Button