1 Reply Latest reply on Jul 4, 2011 9:25 AM by shahinyan

    Flex 4.5 Mobile ColdFusion integration newbie question

    shahinyan Level 1

      Dear friends,

      i am struggling to connect my simple Flex project to CF cfc. Here is the Flex part:

       

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark" title="Photo Upload" creationComplete="photoUploadService.getUsers.send();">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:RemoteObject id="photoUploadService" destination="ColdFusion" source="cfc.upload" endpoint="http://www.smalltheater.am/flex2gateway">
                  <s:method name="getUsers" result="getUsersResultHandler(event)"  />
              </s:RemoteObject>
                     
          </fx:Declarations>
          <fx:Script>
              <![CDATA[
                  import flash.sensors.Geolocation;
                  import mx.collections.ArrayCollection;
                  import mx.rpc.events.ResultEvent;
         
                  [Bindable]
                  private var usersCollection:ArrayCollection;
                 
                  private function getUsersResultHandler(event:ResultEvent):void{
                     
                      usersCollection=event.result as ArrayCollection;
                      trace(usersCollection);
                 
                  }
                 
              ]]>
          </fx:Script>
         
          <s:VGroup x="21" y="23" width="200" height="200">
              <s:DataGrid id="testData" dataProvider="{usersCollection}"/>
          </s:VGroup>
      </s:View>

       

      ColdFusion component: upload.cfc

      <cffunction name="getUsers" access="remote" returntype="query">
      <cfquery datasource="#application.dsn#" name="qUsers">
      SELECT * FROM farUsers
      </cfquery>
      <cfreturn qUsers/>
          </cffunction>

       

      when i am trying to debug my arrayCollection i am getting null.

       

      What i am doing wrong? Please help.

       

      P.S. crossdomain.xml set to allow all connections on www.smalltheater.am