all groups > macromedia flash flash remoting > november 2003 >
You're in the

macromedia flash flash remoting

group:

Strange FLMX 2004 Remoting problem


Strange FLMX 2004 Remoting problem Script Error
11/21/2003 11:55:36 PM
macromedia flash flash remoting: hi everybody,

I have a very strange problem with remoting on Flash MX 2004. The =
wierdens is that compiled for Flash 6 player with Action Script 1.0 =
this component works pefect and returns data without any problem BUT... =
If movie is saved as Flash 2004 movie and exactly the same code is =
compiled as Flash 7 Action Scrpt 2.0 the output is "undefined". Please =
explain me what am I doing wrong? Flash 2004 is updated with latest =
Remoting components but it does not help at all. The actual code I took =
from MM Help file for Flash 2004 Remoting. I never had a problem with =
remoting on Flash MX...

Here is the sample code:
---------------------------------------------------------------
Flash MX code :

#include "NetServices.as"
NetServices.setDefaultGatewayUrl(http://localhost/flashservices/gateway);=

gatewayConnection =3D NetServices.createGatewayConnection();
CFCService =3D gatewayConnection.getService("helloWorld", this);

function helloWorld_Result(result){
trace(result.helloMessage)
}

CFCService.helloWorld();
stop();
---------------------------------------------------------------
---------------------------------------------------------------
Coldfusion MX CFC code:

<cfcomponent>
<cffunction name=3D"helloWorld" access=3D"remote" =
returnType=3D"Struct">
<cfset tempStruct =3D StructNew()>
<cfset tempStruct.timeVar =3D DateFormat(Now ())>
<cfset tempStruct.helloMessage =3D "Hello World">
<cfreturn tempStruct>
</cffunction>
</cfcomponent>
---------------------------------------------------------------

Thank you in advance.

Re: Strange FLMX 2004 Remoting problem Script Error
11/22/2003 11:29:20 AM
:) :) :) Solved the problem. It is really stupid. Still don't know the =
cause though

OLD NON-WORKING Flash AS
function helloWorld_Result(result){
trace(result.helloMessage)
}

NEW WORKING Flash AS

function helloWorld_Result(result){
trace(result.HELLOMESSAGE)
}

For some reason when data is coming from CFC into Flash 2004 actual CF =
variable names are ALL CAPS. Why? Don't ask me. Ask MM. To be ready for =
this kind of error use Netconnection debugger and check if variables =
coming from CFC are all caps or not. Then change variables in Flash.

Happy programming :)

AddThis Social Bookmark Button