FLAP - Flash Remoting in Perl


Open source implementation of Macromedia's AMF protocol


Download it! Current version is Flash-FLAP-0.09.tar.gz.

Usage instructions and code samples.

What is this?

Short version

Flash Remoting is a way for Flash movies running in a web browser to request structured data from the web server. The following data types are supported - strings, numbers, dates, arrays, dictionaries/hashes, objects, recordsets. Flash clients talk with the server using the AMF protocol, which is proprietary to Macromedia. However, it's not that hard to decode.

Using FLAP, it is possible to send arbitrary data between client and server using very few lines of code. There is no need to pack complicated data structures into CGI form parameteres or XML strings. The coding time can be spent on better things - data preparation and graphical presentation, not data delivery.

Long version

HTML forms are ugly. HTML itself is not well suited for presenting data. Everybody knows that but still uses them. However, the Rich Internet Client is back and it gets adopted more and more. In part this has to do with Macromedia's eforts.

Macromedia Flash has matured enough to
a) allow developers to build rich, visually attractive user interfaces and
b) receive data from the server in a convenient way.

But if you believe in the idea of more and more programmers taking a shot at developing clients in Flash, you must also see the need for a good data gateway between web clients (the Flash movie) and web servers. Macromedia offers just that in Macromedia Flash Remoting, available for ColdFusion, JRun, .NET, J2EE.

The Macromedia development tools are neither free nor open-source. The server costs go into thousands. (There are fully-fuctional trial versions available, though.)
However, by using Perl to implement the server-side part of the gateway, that part of the solution becomes free.

Flash Remoting protocol (AMF) is similar to SOAP, but the protocol complexities are hidden from the developer. On the client side you call a local function, and your call is passed to the corresponding function on the server. Another function, a callback, is invoked by the framework when the data is received. On the server side you provide a handler with a certain name that registers certain functions, available to be used by the client. Everything on the server side is within the syntax of the server language. The client side uses ActionScript. This is what the code looks like.
To build/export .swf files with Flash Remoting, you need to install Flash Remoting MX Components for free at:
http://www.macromedia.com/software/flashremoting/downloads/components/
This will install the scripts "NetServices.as" and "NetDebug.as" that are used in the ActionScript.

We think that it is very important for the Open Source community to make this technology available in Perl and (why not?) in Python as well. We set out to decode the protocol, but soon discovered that PHP folks beat us by a month, so we simply rewrote their code in Perl.

We would like to hear the community feedback - the amount of time we will put into this project will be proportional to the need for it.

Please respond if you are interested either in using FLAP or in contributing to it.


Examples

Applications

FLAP is used for Geneboy, a genetics educational tool written in Flash.

Administrivia

Authors:

Simon Ilyushchenko
Adrian Arva

The initial code is based on the AMF-PHP project.

Created on Feb 24, 2003.

Update history (last updated August 3, 2003)

Mailing list on SourceForge is set up. Please go here to subscribe.