Daemonite: Building an Installer for FR Site Deployment Archive

Daemonite: Building an Installer for FR Site Deployment Archive


Saturday, February 08, 2003
Building an Installer for FR Site Deployment

I've written a bit of CFML for CFMX Flash Remoting site deployment that dynamically creates an XML configuration file which the Flash app can use to set up createGatewayConnection() & getService() variables, inspired by comments that Charlie Arehart of CFMXPLUS fame had made to the Macromedia Trainers mailing list which I belong to.

Deploying a Flash Remoting application requires a couple of variables to be set within the Flash movie so that we can make a connection to the server.

With createGatewayConnection() we establish which server the Flash app will communicate with, getService() tells the application which programming interface on the server it'll use in it's calls.

One thing that I quickly realised while developing Flash Remoting applications is that, due to it's security implementation, if the gateway url is wrong the FR application just won't work.

If you haven't done the checklist when you're deploying one thing that you could miss is setting the gateway address from the development server to the production server - this has to be done before you publish the .swf or the client might think that you've given them a dud.

So what I've done is create an installation process that automates this process for deployment.

If you've had a look under the hood of the Pet Market you'll have a fair idea of where the inspiration has come from. Three files make up the interface to make this work in addition to your Flash application.

The first is a ColdFusion page that I've called "installer.cfm", it contains the code that you see below:

It's pretty well commented throughout but what it does is determine if it sits below the conventional web root of the server, I've chosen to build this example for my own system which uses the built in CFMX development web server, you will need to modify for your directory structure.

This will create the second file, an XML packet that contains configuration information needed for the Flash Remoting application, a sample of that file's contents is below:

The third and last thing that I use is an ActionScript (.as) file that parses the XML into variables for use in the Flash app. It's saved as "appInit.as" within the same directory as everything else. Code below:

To use this within your Flash Remoting app you need to have a layer for your ActionScript with keyframes in both first and second frames within the app.

In the first frame I have the following code, note the use of the stop() command:

In the second frame I have the following code to initialise the gateway with the variables passed in from the XML packet:

I hope that this has been interesting, informative or at least worth the long read for you, especially if you are a ColdFusion developer coming to grips with Flash Remoting. It seems as though one major issue for first time users is the correct definition for the getService() variable.

NB: CFFile must be enabled on your server for the CFML to work.

You can download a sample collection of the necessary files here.

Andrew

Posted by at 08:52 PM | Permalink
Trackback: http://blog.daemon.com.au/cgi-bin/dmblog/mt-tb.cgi/84

Comments