Accessibility
Ramchandra Kulkarni

Ramchandra Kulkarni

Adobe

Created:
30 July 2007
User Level:
Beginner
Products:
Coldfusion

Flash Media Server event gateway sample application

The Adobe Flash Media Server event gateway sample application shows an Adobe ColdFusion application that uses the Flash Media Server event gateway to manipulate Flash Media Server shared objects. The application lets you manipulate a shared object using the ColdFusion application or the Adobe Flash client. The changes that you make are reflected in a graph, and the database is updated.

In the sample application (see Figure 1), the left pane displays a form to modify sales data and lists sales data. This is the ColdFusion application. The lower-right pane displays the Flash client that contains a form to modify sales data. The upper-right pane displays the Flash client that displays a graph of the sales data. The shared object name is SalesDataSO.

Flash Media Server gateway sample application

Figure 1. Flash Media Server event gateway sample application

When you initially browse to the application, the graph does not appear because you have not yet connected the Flash client to Flash Media Server.

The files in fms_gateway_demo.zip, demonstrate a simple ColdFusion application that uses the Flash Media Server event gateway.

Requirements

To use this sample application, you will need to install the following software and files:

ColdFusion 8

Flash Media Server 2

Sample files:

The following files, which are included in fms_gateway_demo.zip, comprise the example application:

  • sales_data.mdb: The Microsoft Access database that contains sales data.
  • sales_data.cfm: The ColdFusion page that displays and lets users modify sales data in the sales_data database.
  • sales_data_form.html: The page that contains an Adobe Flash form to modify sales data.
  • sales.cfc: The CFC that contains the methods to modify sales data.
  • fms_gateway.cfc: The CFC that contains methods that are called when the Flash Media Server event gateway receives a notification from Flash Media Server that a shared object was modified.
  • fms_gateway.cfg: The configuration file for the Flash Media Server event gateway.
  • sales_data_graph.html: The page that displays a Flash client that shows a graph of the sales data.
  • sales_graph.swf: Flash client that contains the form to modify sales data.
  • index.html: The page that contains sales_data.cfm, sales_data_graph.html, and sales_data_form.html in frames.

Installing the sample

To install the sample application:

  1. Extract the contents of the fms_gateway_demo.zip file to the web root (for example, C:\CFusionMX7\wwwroot).
  2. In ColdFusion Administrator, create a data source named SalesData. This data source uses the Microsoft Access Unicode driver and the sales_data.mdb file.
  3. In Flash Media Server, create an application named SalesDataApp. You do so by creating a folder named SalesDataApp in the applications directory of Flash Media Server.
  4. Start Flash Media Server. Read the instructions in LiveDocs for starting Flash Media Server.
  5. In ColdFusion Administrator, create an instance of the gateway with the following specifications:

    • Gateway ID: FMS Sales App
    • Gateway Type: FMS Gateway
    • CFC Path: Path to fms_gateway.cfc
    • Configuration File: Path to fms_gateway.cfg
  6. Start the FMS Sales App event gateway.

Running the sample

To run the sample application:

  1. Open the file http://localhost:8500/FMSGatewayDemo in your browser. (If you are not using the built-in JRun server, do not include the port number in the URL.)
  2. Enter the URL of Flash Media Server in the upper-right and lower-right (Flash client) panes. The default URL is rtmp://localhost:1935/SalesDataApp. If you are using a different server name or IP address, enter that address instead.
  3. In the upper-right and lower-right panes, click Connect to connect the Flash clients to Flash Media Server.
  4. In the left pane, modify the sales data for any month in 2005, and then click Submit.

    Note: The graph in the upper-right pane changes to reflect the new data. Modifications you make through the ColdFusion application appear in the Flash client.

  5. In the lower-right pane, enter a sales amount for any month of 2005, and then click Submit.

    Note: The graph in the upper-right pane changes to reflect the new data. Modifications you make in one Flash client appear in the other Flash client.

  6. In the left pane, click Refresh.

    Note: The changes you make to the data through the Flash client are reflected in the ColdFusion application.

About the author

Ramchandra Kulkarni is a senior computer scientist on the ColdFusion development team, and has been working at Adobe since 2004. In his earlier jobs he worked as a software architect and developed solutions in a number of domains like finance, retail, medical, etc. He has been programming since 1994 using C, C++, MFC, Java/JEE, and other technologies.