Search Flex Components Free

Custom Search

December 9, 2007

Flash Remoting with AS3

Remoting and amfphp

If you don't know what Remoting is, probably you can read the introduction of AS2 tutorial . The short history is: a way of invoke RPC (Remote Procedure Calls) on server and share data in a binary format. Is the best structured and faster way to work when developing RIAs. Indeed, AS3 trough Flash and Flex opens new ways of sending data to and back, and this will be the focus of this tutorial.
Amfphp have been upgraded and now support AMF3 (Flex specs for amf) and it's easier to be installed, while it comes with a new service browser developed in Flex. If you compile your PHP library with a special C extension, parsing routine can become extremely fast and also your average, check this article. Client side is probably a little cumbersome due to strong typing in AS3, but was simplified with the use of NetConnection as the base class.

Requirements

- A server running PHP (easy to install bundled packets on apachefriends site) PHP 5+ needed for type checking on server side for VO examples
- amfphp 1.9 beta 2
- Flash 9 (Flash example) and Flex 2 Builder (Flex example)
- Charles for debugging

Relevant topics

This tutorial is divided into three little parts, and if you have some knowledge, you can skip the first simple example and go to VO example with Flash or Flex. Since many examples on using Flex with amfphp can be finded around there (even using advance techniques like mapping multiple data to class instances trough ArrayColection), not much on using Flash with the same features it's easy to find. Will be Flex the tool for heavy developers while Flash more oriented to design? I'm not totally agree, and as Flash fan will continue to use it as much as possible.
So our topics

1. Amfphp installation
2. Debugging with Charles
2. Basic example of loading/saving
3. Passing VOs to Remoting using Flash
4. Passing VOs to Remoting using Flex

Related Flex Tutorials