# AMF::Perl - Flash Remoting in Perl and Python

## (Formerly known as Flash::FLAP)

## Open source Perl and Python implementation of Macromedia's AMF protocol
Download it! Current version is AMF-Perl-0.14.tar.gz. July 11, 2004. An alpha implementation of AMF in Python. Version 0.02. 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 AMF::Perl, 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 AMF::Perl or in contributing to it. | ## Examples CPU Usage Data grid that gets its data from the server as an array of objects. Service discovery example. It sends data from client to server and back. Now with exception handling! Accessing a Mysql database PETMARKET!!! ## Applications AMF::Perl is used for Geneboy, a genetics educational tool written in Flash. Collaborative music lyrics editor by Dave Waller Animated greetings by Jonathan Buhacoff. ## Administrivia Authors: Simon Ilyushchenko Adrian Arva The initial code is based on the AMF-PHP project. There also exists a shareware (but not open-source) Java and .NET implementation of server-side Flash Remoting. Created on Feb 24, 2003. Update history (last updated July 06, 2004) Mailing list on SourceForge is set up. Please go here to subscribe.