1 Reply Latest reply on Jun 8, 2009 8:05 AM by mack_

    Function references and stateful cfcs?


      Using 8.0.1


      ok, i have a happy component (example4.cfc):



      <cfcomponent output="false">
        variables.txt = "un-init";
      <cffunction name="Init" access="public" returntype="example4" output="false">

        variables.txt = "init";
        <cfreturn this />
      <cffunction name="remoteEcho" access="remote" returntype="string" ExtDirect="true" output="false">
        <cfargument name="str" type="string" required="true" />

        <cfreturn str &  "[" & variables.txt & "]"/>


      and I am trying to call a function reference like so:


      cfc = CreateObject('Component', 'Example4').Init();
      method = cfc['RemoteEcho']; //<- try to create function reference
      <cfdump var="#cfc#">
      <cfdump var="#method#">
      <cfdump var="#cfc.remoteEcho('bobo')#"><!--- this works, naturally --->
      <cfdump var="#method('bobo')#"><!--- failure here --->


      The problem that I am running into is that it cannot find the variables.txt private member.


      Element TXT is undefined in VARIABLES.


      The direct call works fine, however the reference acts as if it's, i don't know, a regular UDF outside of a cfc?


      Any help here, or will this just not work?