In the past, Flash communicated with the server by calling server-side scripts using the “fscommand()” and “getURL()” functions, which in turn called the “callFrame()” and “callLabel()” functions in Flash. This tedious and somewhat confusing method was improved when ActionScript 2 was introduced to Flash with functions such as LoadVars() and the XML Socket Object. While improving the process of communication with server-side scripts, larger applications could easily clutter up the source code and make it an annoyance for developers when it came time to update the system. With the introduction of AMFPHP, this process has been greatly simplified.
AMFPHP is the Flash Remoting Gateway for PHP. AMF (the Action Message Format) was originally developed by Macromedia (now Adobe) for use with their ColdFusion server (now Flash Media Server). The ColdFusion server allows for easy data exchange between the Flash application and the server. It was only a matter of time before the binary AMF packet was exposed, allowing developers to reverse-engineer AMF. With AMF now easily accessible to the public, developer Wade Arnold ported Flash Remoting to PHP and officially released it to the open-source community.
AMFPHP allows client applications built in Flash, Flex and AIR to communicate directly with PHP class objects on the server. AMFPHP takes care of type casting between ActionScript and PHP because it allows for native data-types and complex object-mapping between the client and the server. AMFPHP allows for fast client-server communication because data sent between the client and the server is serialized into binary format.
Some other great features of AMFPHP include:
- Quick installation and implementation
- PHP4 / PHP5 compatible
- Lightweight and fast
- Calls are simply plain PHP classes that can be used with anything else
- Includes productivity tools such as a service/class browser
- Includes a NetConnection debugger
If you’d like to try AMFPHP, follow one of the tutorial links listed below. Remember to secure your AMFPHP installation before moving your website live (follow the links below to on how to go about that). If you’re using Flash CS3 or CS4, the remoting classes are included in Flash. For the versions listed below, you will have to download the remoting components package from the Adobe website and install it (this link is also provided).
Useful Resources:
AMFPHP Homepage
Wade Arnold’s Blog
Tutorials
http://www.flash-db.com/Tutorials/hello/flashamfphp.php
http://theflashblog.com/?p=415
http://soenkerohde.com/tutorials/amfphp/
http://flashenabledblog.com/2008/07/31/tutorials-as3-and-amfphp-roundup/
http://www.jessewarden.com/archives/amfphp/tutorials/
Flash Remoting Components (for ActionScript 2)
http://www.adobe.com/products/flashremoting/downloads/components/
Securing AMFPHP




No related posts.