3 Replies Latest reply on Apr 9, 2008 8:18 AM by Gaurav J

    pass flex val into cfc

    Nick201 Level 1
      I have coldfusion form and i would like to pass form value in cfc using flex.

      only problem i didn't see any example with cfc where condition.

      I mean
      select artistid, firstname, lastname, email
      from artists where firstname like '#Arguments.firstname%#'



      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
      id="test" width="70%" height="70%"
      codebase=" http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
      <param name="movie" value="test1.swf" />
      <param name="quality" value="high" />
      <param name="bgcolor" value="##869ca7" />
      <param name="allowScriptAccess" value="sameDomain" />
      <embed src="test1.swf quality="high" bgcolor="##869ca7"
      width="600" height="400" name="test" align="middle"
      play="true"
      loop="false"
      quality="high"
      allowScriptAccess="sameDomain"
      type="application/x-shockwave-flash"
      pluginspage=" http://www.adobe.com/go/getflashplayer"
      >

      </embed>
      </object>
      </noscript>

      ------------------------------------------------------------------------------------------ -------------------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      layout="absolute"
      creationComplete="initApp()">

      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

      public function initApp():void
      {
      remoteService.getQuery();
      }
      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="remoteService"
      destination="ColdFusion"
      showBusyCursor="true"
      source="components.simple">
      </mx:RemoteObject>


      <mx:Panel label="Simple Grid" width="100%" height="100%">
      <mx:DataGrid id="mygrid"
      dataProvider="{remoteService.getQuery.lastResult}"
      width="100%" height="100%">
      <mx:columns>
      <mx:DataGridColumn dataField="artistid" />
      <mx:DataGridColumn dataField="firstname" />
      <mx:DataGridColumn dataField="lastname" />
      <mx:DataGridColumn dataField="email" />
      </mx:columns>
      </mx:DataGrid>
      </mx:Panel>

      </mx:Application>
        • 1. Re: pass flex val into cfc
          Gaurav J Adobe Employee
          try

          firstname like <cfqueryparam value="#arguments.firstname#" cfsqltype="CF_SQL_VARCHAR">
          • 2. Re: pass flex val into cfc
            Nick201 Level 1
            But how do pass cfc value to flex. when i passed different value

            first time i pass name = Nick and secone time i pass name ='brian' so i would like to pass this value to cfc.

            I am using coldfusion and just called remote object inside my coldfusion using provided code.
            • 3. Re: pass flex val into cfc
              Gaurav J Adobe Employee
              You can define method inside your cfc components which accept parameter.

              <mx:RemoteObject id="remoteService" destination="ColdFusion"
              showBusyCursor="true" source="components.simple">
              <mx:method name="getSimpleData" result="onResult(event)" fault="onFault(event)" />
              </mx:RemoteObject>


              and call those methods with the arguments.

              public function initApp():void {
              remoteService.getSimpleData(name);
              }