mike chambers | about

Example : loading data from a data base into Flash MX with Flash Remoting and ServerSide ActionScript

First, view the following tutorial / example:

Example : loading data from a data base into Flash MX with Flash Remoting and CF MX

we will use the same Flash MX code in that example, and just change the server side code.

Instead of creating a ColdFusion component called DbTest.cfc, create a file called DbTest.asr. Make sure that you rename the DbTest.cfc to something else if you did the first tutorial.

Add the following to the DbTest.asr file:

function getData() {
    /**create an object to hold our parameters**/
    var queryData = new Object();

    /**set the DSN name pointing to the database**/
    queryData.datasource = "CompanyInfo";

    /**setup our SQL Query**/
    queryData.sql = "select * from Employee";

    /**Execute the query, and store the results in a variable**/
    var rs = CF.query(queryData);

    /**return the RecordSet to flash**/
    return rs;
}

You don’t need to change anything in the Flash code. Create the Flash movie according to the directions in the tutorial and test your movie.

twitter github flickr behance