Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / November 2005



Tip: Looking for answers? Try searching our database.

Issues with returning data using remoting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
onedge3d - 17 Oct 2005 18:03 GMT
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
meager - 17 Oct 2005 20:09 GMT
Try this..
frmNotes.text = r.result.items[0].Notes

This assumes you are returning only one record.

Hope it helps.
meager - 17 Oct 2005 20:18 GMT
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>
onedge3d - 18 Oct 2005 15:07 GMT
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
kahanamaka - 21 Oct 2005 19:26 GMT
Why are you doing r.result?  since all you are returning is a string, the entire "result" is what you want.  try doing just trace(result) and see what it does.
hybrid_ProgArtes - 11 Nov 2005 05:28 GMT
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 :)
hybrid_ProgArtes - 11 Nov 2005 05:29 GMT
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 :)
hybrid_ProgArtes - 11 Nov 2005 05:29 GMT
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 :) ;)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.