3 Replies Latest reply on Apr 19, 2008 12:13 AM by miaomm

    cfc to flex - not sure bug

    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 with where condition. if u see artist example. bring all data..

      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: cfc to flex - not sure bug
          Michael Borbor Level 4
          I kinda don't understand your question but if you want to use flex to call a remote object and send a parameter to coldfusion you just simply write something like this remoteService.getQuery(param);
          Where param can be a variable, an array , and so on. And in coldfusion set an cfargument and that's it.
          • 2. Re: cfc to flex - not sure bug
            miaomm
            I will suggest since you are using coldfusion, why don't you use cfc to responses to the request. You then can handle the return result at whatever way you like.
            • 3. Re: cfc to flex - not sure bug
              miaomm Level 1
              in flex something like
              <mx:RemoteObject id="Rservice" showBusyCursor="true"
              destination="ColdFusion" source="cfc.MyServe">
              <mx:method name="getsgentDatax" result="dataHandler(event)">
              <mx:arguments>
              <p1> {firstname} </p1>
              </mx:arguments>
              </mx:method>
              </mx:RemoteObject>

              in cfc then you can use the query you use
              select artistid, firstname, lastname, email
              from artists where firstname like '#Arguments.firstname%#'
              and return as query