Adobe COLDFUSION 9 Manual page 695

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Note: On the server side, ActionScript files use the extension .asr.
For example, the following server-side ActionScript code builds on the client-side code shown previously:
// Filename: stockquotes.asr
// Here is the getQuotes method invoked in the client-side ActionScript.
// It accepts a single stock quote symbol argument.
function getQuotes(symbol)
{
// Query some provider for the specified stock quote and return the
// results. In this case, the getQuotesFromProvider method is
// defined elsewhere in this ActionScript code.
data = getQuotesFromProvider(symbol);
// Return the data to the client.
// Note: this example does not include any of the error checking
// logic you would normally use prior to returning the data.
return data;
}
The
function conducts the stock quote request and returns the results of the request to the client as a
getQuotes
RecordSet object.
Software requirements
To use server-side ActionScript files, you must have the following software installed:
• Adobe Flash
• ColdFusion
• Flash Remoting Components
For more information about these products, go to www.adobe.com.
Location of server-side ActionScript files
You can place ActionScript files (
subdirectories of the web root or a virtual directory, use package dot notation (use dots instead of slashes in a fully
qualified directory name). For example, in the following assignment code, the stockquotes.asr file is located in the
mydir/stock/ directory:
stockService = gatewayConnnection.getService("mydir.stock.stockquotes", this);
You can also point to virtual mappings, such as
mapping and
is subdirectories of that mapping.
asr.stock
Benefits
Server-side ActionScript lets your ActionScript engineers use their knowledge of ActionScript to write code for the
back end of their SWF files, which can mean more meaningful levels of interactivity for your users. Your SWF files can
share a library of server-side ActionScript functions, which means you can define functions that are tailored to your
own business.
You could, for example, create a server-side ActionScript file that defines a whole library of SQL query methods. With
these query methods defined on the server side, your Flash designers only have to run the specific query function they
want to return data to their SWF movies. They do not have to write any SQL, and they do not have to create a query
every time they retrieve data from a ColdFusion data source. It is a way of creating reusable queries that your entire
Flash design team can use.
) on the server anywhere below the root directory of the web server. To specify
*.asr
cfsuite.asr.stock.stockquotes
Last updated 8/5/2010
where
is a virtual
cfsuite
690

Advertisement

Table of Contents
loading

Table of Contents