Delphi/WebServers
Including Flash Movies

I use Flash movies to provide interactive graphs (and other interactive content) in web pages.

This provides the advantages that

Note: I use the terms Flash movie, Flash form, and Flash application interchangeably. Adobe prefers the term movie - However, in my mind, a movie runs from the beginning to the end with minimal human interaction. By design, applications and forms are designed specifically for human interaction. As a result, I tend to use the term movie to refer to the file and the other terms when discussing what the program does.

Automatic Update | HTML code | Pretend Directories | Passing Parameters | Drawbacks


Automatic Update

One of the advantages of writing applications in Flash is that each time the user accesses it, the current .. updated .. copy is executed ... well, that was the theory anyway.

In practice, the web server caches the Delphi executables ... making debug a real pain. It is possible that the same is happening with Flash movie files. I have not seen this yet, but it is possible.

In my graphing applications

  1. A Delphi application is called from the web server
  2. The returned web page has code to include a Flash application
  3. The Flash application is read from the web server
  4. The Flash application reads an ini-file from the web server
  5. The Flash application calls another Delphi application on the web server to get the data to plot
As you can see, there are a lot of places for a server cache to cause problems. This scenario has 2 Delphi programs, a Flash movie, and a configuration file on the server.

Using IIS as the web server, I have had problems with caching. One way to get around this is to manually add some random text to the query string.


HTML code

To add a Flash movie to a web page, some html code needs to be added to the page and a JavaScript file - AC_RunActiveContent.js - needs to be placed on the server. The Flash IDE will generate the code for you (so I won't repeat it here) via While this code works fine in normal html files, the Delphi Pretend Directories (next section) will require you to modify it.


Pretend Directories

When cgi applications are written in Delphi, it is possible to pass an action parameter by using a slash.

Unfortunately, this confuses the browsers who now think that the exe-name is actually a directory name. As a result, all relative URI's used by the Flash application will have the fake directory automatically prepended. For example,

becomes when what I really wanted was In addition, this problem causes the html generated by the Flash IDE to fail. For instance, the following code is not able to locate AC_RunActiveContent.js (required to use Flash movies). There is also a problem with the html code that references the Flash movie itself. Text similar to the following needs to be changed to This is a super pain - I suggest NOT using action's in any code that uses Flash movies. (Unfortunately, I was adding graphs to an existing application.)


Passing Parameters

I have a separate page on Passing Parameters from the web page to the Flash movie.


Drawbacks

In every way (except being able to make a web page interactive), Delphi is greatly superior to Adobe Flash. For example I could go on ... I have written some pages on developing Flash applications using ActionScript 3.0 - the Flash development language.

At any rate, I have used Flash to develop web based applications that could not have been done with Delphi alone.


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Databases / Delphi / WebServers / Including_Flash_Movies.html