I am currently working on a series of tutorials on using AMFPHP and I thought it would be a good idea to write a post explaining what AMF actually is. AMF is an acronym that stands for Action Message Format. Here is the official definition that I got directly from the AMF specification document:
“Action Message Format (AMF) is a compact binary format that is used to serialize ActionScript object graphs. Once serialized an AMF encoded object graph may be used to persist and retrieve the public state of an application across sessions or allow two endpoints to communicate through the exchange of strongly typed data.”
While that description is helpful, it is still a little confusing in my opinion. The easiest way to think of AMF is that it is the fastest way to send and receive data between your Flash movie and a web server. The reason that it is so fast is that the data is compressed and is in binary format. Most Flashers are very familiar with the methods of exchanging data with a server using XML. This is still a good approach for a lot of situations, but when large amounts of data are involved, AMF is far superior.
AMF is actually used internally by the Flash Player is many situations. One example is that Flash uses AMF to represent the binary data stored using the ByteArray class. But the main thing that Flash developers need to be concerned with is how to use AMF to send and receive data with their web server. As with most things in Flash, there are many different methods of accomplishing this. Which method you use is primarily determined by which server-side platform you are using. Let’s quickly take a look at some of the most popular options:
One the most robust solutions for working with AMF is ColdFusion. This is not surprising as ColdFusion is an Adobe product and has built-in support for AMF throughout the technology. The main roadblock to using ColdFusion is that you need to have a web hosting provider that supports it. If you are about to choose a web host and you plan on doing a lot of Flash work, ColdFusion is definitely something that you should be looking in to.
Adobe recently open-sourced the AMF specification along with BlazeDS, which is a free Java server-side technology for using AMF. Again, since this is an official Adobe technology, you can be sure that the AMF implementation is rock solid. Using BlazeDS requires a Java server, so if you have a typical LAMP setup, you will not be able to play with it.
LiveCycle Data Services
This is the most robust, scalable way of using AMF for Flash and Flex applications. This is the option to choose if you are building large enterprise applications. LiveCycle is very pricey however, and also needs to run on a Java server. These reasons put it out of reach for most non-enterprise applications.
AMFPHP is a free open-source PHP implementation of AMF. The major benefit of AMFPHP is that it can run on the vast majority of web servers as the only requirement is that PHP is supported. There are actually other PHP implementations of AMF, but AMFPHP is by far the most popular. This will be the subject of my next couple of tutorials at gotoAndLearn().
There are many other technologies out there that have implemented AMF. AMF.NET is an open source .NET AMF solution for Flash. Rubyamf is a Ruby implementation of AMF. Similar projects have sprouted up for Python and other languages.
AMF is far too large a topic for a single blog post. But the main thing to know is that it is a fast, binary protocol for exchanging data between your Flash movies and a server. Look for my tutorials on AMFPHP in the next week for some real-world examples. For those AMF geeks out there, please correct or add to my post in the comments