in Actionscript 3

What the hell is AMF?

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().

Other Technologies
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 :)


Write a Comment



  1. Nice article :)

    Might be easy to say that AMF is a translator between native ActionScript data types and bytes. AMF determines how an ActionScript variable is represented in bytes.

    LocalConnection and SharedObject both use AMF to convert their data to bytes.

    Greetz Erik

  2. I have been thinking of using AMF with Asp.Net but always go back to webservices approach. Is there any resource which compares AMF with Windows Communication Foundation?

  3. Possibly worth mentioning James Ward’s BlazeBench which demonstrates and compares performance of AMF against other methods.


  4. WebOrb is also very good for remoting php. Take a look at it if haven’t yet.
    Have a nice day and thx a lot for all your tutorials

  5. big tutorial, i know this allready, and looking forward

    as you wrote, i am a big fan of xml especially now with AS 3

    but still, many tools, many trades

    big up!

  6. Yes, Lee! This has been a big question mark in my mind for a while. I’m looking forward to your tutorials to help clear it up. Thank you!

  7. Hi Lee, I´ve always heard about it, but never found a good and simple (as always you make) tutorial to go deep inside it. So thanks in advance :)

  8. How about serialisation vs. AMFPHP? I’m using a simple AS3 serialisation class und do it the other around on the php side. It’s quick and simple. Until now I have not found any advantages of AMFPHP which cannot be used with simple serialisation or am I wrong?

  9. No wonder, I become a good designer with out going to the extra class. The informations given in the blogs is much enough to know designing.
    You man have done a wonderful job…
    cheer up>>>

  10. Hi Lee
    Following the advice you gave me at the Adobe onAir tour I started working with the AMF format and have to say I’m pretty happy with the results. The speed boost is incredible and now I can really use all the data I have.
    The demo is almost finished and let’s hope that soon a brand new Adobe AIR app will be released in the wild.

    Thanks again

    ps. I’ll send you an email with the demo as soon as I have a RC

  11. I wish you would do your tutorials around Blaze DS, since I have yet to see one that uses flash and not flex.

    I have been in love with AMFPHP for over the three years, But the project has been at a stand still for over the last year in a half with the last version still in beta for over a year.

    I would take the time to learn java so I could use blaze but I’m not sure if it works well with flash since I can’t seem to get to work right and all the current examples use flex only. We need some good “Blaze DS + Flash CS3” tutorials. Even then I can’t wait to see what you have made since I know I will learn something new.

    Thanks lee your the man!

    PS: one thing to note that is GREAT about AMFPHP is that you can return a Recordset directly from an SQL query and send it directly to a dataprovider of a Datagrid or what ever else you want

  12. I’d also like to throw in a vote for Fluorine (.NET-only). Compared to Adobe’s version of Flash Remoting, it’s less buggy, easier to use, and much better supported. And free.

    Btw, I followed the link to LiveCycle and after reading the product description, I still have no idea what it is.

  13. Sorry about the misapprehension in my other post. I didn’t notice that you allready answered. I guess I have to test it myself, because I’m sending all my requestdata like one information and so I don’t have this big overhead shown in the comparison.

  14. Hi,

    Has anyone successfully used AMF.NET? More importanty with AS3? the documentation on the AMF.NET page is no help ( as it uses a class called ‘Service’ which doesn’t appear to be in the AS2 or AS3 documentation.

    It seems that although they’re called a similar thing (AMFPHP & AMF.NET) the way you communicate to their interface within Flash is competely different. Does anyone know of a better alternative for .NET?

    It looks like we may stick with webservices….


  15. Hi all,

    In case anyone is interested, I’ve started to work on a portable C implementation of the AMF0/3 formats, based on my partial AMF0 implementation for the FLVmeta tool (
    I’ve created a project on sourceforge, please visit and don’t hesitate to leave comments in the public forums of the project page.
    I haven’t committed code yet, but I think I’ll have a beta available for testing by the end of august.

  16. What am I missing here??? AMF is just object serialization/deserialization. What call it “Action Message Format”. Is that simply to give some marketing jack-hole the opportunity to monetize something that should be inherent in the platform?