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 = NetServices.createGatewayConnection();
CFCService = gatewayConnection.getService("helloWorld", this);
function helloWorld_Result(result){
trace(result.helloMessage)
}
CFCService.helloWorld();
stop();
---------------------------------------------------------------
---------------------------------------------------------------
Coldfusion MX CFC code:
<cfcomponent>
<cffunction name="helloWorld" access="remote" returnType="Struct">
<cfset tempStruct = StructNew()>
<cfset tempStruct.timeVar = DateFormat(Now ())>
<cfset tempStruct.helloMessage = "Hello World">
<cfreturn tempStruct>
</cffunction>
</cfcomponent>
---------------------------------------------------------------
Thank you in advance.
Script Error
Script Error - 22 Nov 2003 16:29 GMT
:) :) :) 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 :)
Script error