Ok folks, the use of CFC's in Flash and ColdFusion is driving me bonkers. The following is a scaled down version of a more complicated problem that brought this to my attention. This is my very simple CFC. It stores a variable, and has one function to return it and another to set it; I'll call it simple: <cfcomponent hint="very simple cfc"> <cfscript>storeThisVariable = 2;</cfscript> <cffunction name="getVar" access="remote" returntype="numeric" > <cfreturn storeThisVariable> </cffunction> <cffunction name="setVar" access="remote" returntype="numeric" > <cfargument name="value" type="numeric"> <cfset storeThisVariable = arguments.value> <cfreturn storeThisVariable> </cffunction> </cfcomponent>
Now, in ColdFusion, I can run the following code and it returns the expected results: <cfscript> simple = createObject("component","component/simple"); writeoutput("getvar: " & simple.getVar() & "<br>"); writeoutput("setvar: " & simple.setVar(3) & "<br>"); writeoutput("getvar: " & simple.getVar() & "<br>"); </cfscript> I get the following output, as I expect it would: getvar: 2 setvar: 3 getvar: 3 In Flash, I run the following action script: #include "NetServices.as" #include "DataGlue.as" isGatewayOpen = true; NetServices.setDefaultGatewayUrl("http://myserver:8000/flashservices/gateway/"); var gatewayConnnection = NetServices.createGatewayConnection(); var simple = gatewayConnnection.getService("CFAmp4.component.simple", this); simple.getvar(); simple.setVar(3); simple.getVar(); function getVar_result(result){ trace("getvar: " + result); } function setVar_result(result){ trace("setvar: " + result); } Unlike ColdFusion, this returns the following: getvar: 2 setvar: 3 getvar: 2 To me this indicates the Flash takes the time to reload the CFC everytime. Basically doing powerful than doing the following: http://localhost/simple.cfc?method=getvar http://localhost/simple.cfc?method=setvar&value=3 http://localhost/simple.cfc?method=getvar This cannot possibly be the expected behavior. I, of course, could code around this, but why? Thanks Mike Wokasch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm