You use the CF.query function to populate SWF movie elements with data retrieved from a ColdFusion data source. To use the CF.query function you do the following:
Pull data into your SWF movie from a ColdFusion data source
- Create a server-side ActionScript file that performs queries against a ColdFusion data source.
- Write ActionScript code in your SWF movie that references your ActionScript file (.asr) on the ColdFusion server.
You create server-side ActionScript to execute the query and return the data in a record set to the client your SWF movie. You can use methods in the RecordSet ActionScript object on the client to manipulate data in the record set and present data in your SWF movie.
Note: Client-side ActionScript files use the .as extension. Server-side ActionScript files use the .asr (ActionScript remote) extension.
Publishing dynamic data
You use the server-side ActionScript feature in ColdFusion to publish dynamic data. To do this, you write server-side ActionScript files that perform queries against ColdFusion data sources. Before using ActionScript, you must understand how to do the following:
- Create database queries in the server-side ActionScript file using the CF.query ActionScript function. See Using the CF.query function.
- Reference the server-side ActionScript file in your SWF movie. See Connecting to the Flash Remoting service.
Using the CF.query function, you can do the following tasks:
- Create user login interfaces that validate users against a ColdFusion data source.
- Populate form elements and data grids with data from a ColdFusion data source.
- Create banners that pull data (such as URLs or image file paths) out of a database.
The CF.query function can retrieve data from any supported ColdFusion data source (see About ColdFusion data sources below).
About ColdFusion data sources
For ColdFusion developers, the term data source can mean many different types of structured data accessible locally or across a network. You can query websites, Lightweight Directory Access Protocol (LDAP) servers, POP mail servers, and documents in a variety of formats. For server-side ActionScript, a data source ordinarily means the entry point to a ColdFusion database.
Your ColdFusion administrator can help you identify and configure data sources. To create ActionScript files that successfully perform queries on ColdFusion data sources, you must know how ColdFusion identifies the data source, as well as any other parameters that affect your ability to connect to that database, such as whether a user name and password are required to connect.
You use server-side ActionScript in ColdFusion to return record set data to a Flash client from a ColdFusion data source. You specify the ColdFusion data source name and the SQL statement you execute on the data source as arguments in the CF.query function in server-side ActionScript.
Typically, your server-side ActionScript handles the interaction with the ColdFusion data source, and returns a record set to the Flash client through the Flash Remoting service.
For more detailed information about ColdFusion data sources, see Configuring and Administering ColdFusion.