1 Reply Latest reply on Jul 25, 2008 6:20 AM by spacehog

    Am I missing something

    spacehog Level 1
      Okay I wrote this little piece of code to show a friend how Flex can return variables from a CFC (I already showed him my app returning query data). For whatever reason this always returns the value 'null'. Now it is just frustrating me and I can't relax until I find an answer.

      The CFC:
      <cfcomponent >
      <cffunction name="qMonthlyUsage" returntype="string" access="remote">
      <cfset getData = "Bye">
      <cfreturn getData>
      </cffunction>
      </cfcomponent>

      The mxml is :

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp(event)">
      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.core.Application;
      import mx.rpc.events.FaultEvent;
      import mx.controls.Alert;

      private function initApp(e:Event):void {
      chartmth_RO.qMonthlyUsage();
      }

      [Bindable]
      public var flatDP:String;
      public function get_Result(event:ResultEvent):void
      {
      flatDP = event.result as String;
      }
      ]]>
      </mx:Script>

      <mx:RemoteObject id="chartmth_RO" destination="ColdFusion" source="multipleArgumentsTest.cfcs.multiple">
      <mx:method name="qMonthlyUsage" result="get_Result(event)"/>
      </mx:RemoteObject>
      <mx:Label id="lbl4text" text="Value: {flatDP}"/>
      <mx:Button label="get String" click="chartmth_RO.qMonthlyUsage()"/>



      </mx:Application>