0 Replies Latest reply on Sep 6, 2006 9:17 AM by Newsgroup_User

    Returning records in increments to Flash

    Level 7
      I am trying to figure out this example in the CF docs. The thing I do not
      understand is where does this go. I have tried to put it in the getData.cfm
      by itself but it just displays the code. It there supposed to be some CF
      tags around it like a function tag or something. I have look everywhere for
      a live example of this and I cannot find any.

      include "NetServices.as"
      NetServices.setDefaultGatewayUrl(" http://localhost:8500/flashservices/gateway");
      gatewayConnection = NetServices.createGatewayConnection();
      CFMService = gatewayConnection.getService("helloExamples", this);
      CFMService.getData();

      I would appreciate any help you can give!!!

      Returning records in increments to Flash
      ColdFusion lets you return record set results to Flash in increments. For
      example, if a query returns 20 records, you can set the Flash.Pagesize
      variable to return five records at a time to Flash. Incremental record sets
      lets you minimize the time that Flash application waits for the application
      server data to load.

      To create a ColdFusion page that returns a incremental record set to Flash:
      1.. Create a ColdFusion page, and save it as getData.cfm in the
      helloExamples directory.
      2.. Modify getData.cfm so that the code appears as follows:
      <cfparam name="pagesize" default="10">
      <cfif IsDefined("Flash.Params")>
      <cfset pagesize = Flash.Params[1]>
      </cfif>
      <cfquery name="myQuery" datasource="ExampleApps">
      SELECT *
      FROM tblParks
      </cfquery>
      <cfset Flash.Pagesize = pagesize>
      <cfset Flash.Result = myQuery>
      In this example, if a single parameter is passed from the Flash application,
      the pagesize variable is set to the value of the Flash.Params[1] variable,
      otherwise the default is set to 10. Next, a cfquery statement queries the
      database. After that, the pagesize variable is assigned into the
      Flash.Pagesize variable. Finally, the query results are assigned into the
      Flash.Result variable, which is returned to Flash.

      3.. Save your work.
      When you assign a value to the Flash.Pagesize variable, you are specifying
      that if the record set has more than a certain number of records, the record
      set becomes pageable and returns the number of records specified in the
      Flash.Pagesize. For example:

      include "NetServices.as"
      NetServices.setDefaultGatewayUrl(" http://localhost:8500/flashservices/gateway");
      gatewayConnection = NetServices.createGatewayConnection();
      CFMService = gatewayConnection.getService("helloExamples", this);
      CFMService.getData();
      After the initial delivery of records, the RecordSet ActionScript class
      becomes responsible for fetching records. You can configure the client-side
      RecordSet object to fetch records in various ways using the setDeliveryMode
      ActionScript function.