Macromedia Flash Remoting MX

Flash Remoting MX can interface with most Web Services or interact with Application Servers that are supported by Macromedia. The technology uses a format called Action Message Format (AMF). This format is unique in that it transfers binary data between the Application Server's Flash Gateway and either the Flash player or the Flash Communication Server. Traditionally, Flash developers were pinned to the floor with XML. I'm not saying that XML is bad; in fact, it's quite the opposite. XML is a great, user-friendly form to transmit data. Being so user-friendly, it carries some overhead. Parsing XML in Flash is complicated and relatively slow. Macromedia, with the release of Flash Player 6, dramatically improved the XML parsing engine in Flash; however, it really doesn't compare to the speed both in development and at runtime of Flash Remoting MX.

Connecting with Application Servers is now a very natural event for both the Flash player and the Flash Communication Server. Application Servers are intermediary technology that can expose server resources to public interfaces such as HTML, Flash, or external servers. Traditionally, the Application Server was used to expose database information or as a framework to manage content via a web browser or some Internet user interface. Flash developers learned very quickly (in Flash 4.0) that you could use an Application Server to deliver content to the Flash player using the loadVariables() method. In Flash 5.0, Macromedia extended this functionality with the XML object. Both of these operations involved heavy code and development to assemble, transport, and convert into ActionScript objects. Flash Remoting MX was introduced in Flash MX as a way to remove the preparation stage that was required to transfer database data or add advanced server resources to the Flash movies. Server resources could include databases, email servers, LDAP servers, and even file systems.

Using Flash Remoting MX allows the developer to leverage these servers and development teams familiar with the technology to expose Flash to standard application programming interfaces (APIs) to be consumed by the Flash player or the Flash Communication Server or even other Application Servers and resources. By calling a simple public (or remote) method, Flash can receive ActionScript objects such as a special RecordSet object, which is a sophisticated array of objects acting like a standard query object.

There are two types of commercially available Application Servers on the market today. It is the battle between Microsoft .NET and Java (Java 2 Enterprise Edition) Frameworks. Flash Remoting MX is available natively on Macromedia J2EE Server products, JRUN 4, and Macromedia ColdFusion MX. It is also available as an add-on for any J2EE server such as SunONE, IBM WebSphere, or BEA WebLogic. Microsoft.NET is also supported if you use ASP.NET, C#.NET, or VisualBasic.NET. If you are not using the Macromedia Server products, Flash Remoting MX components are available for purchase on the Macromedia web site at


We don't have enough space in this book to go through each Application Server, so we'll use Macromedia ColdFusion MX because it is easy to understand and has native support for Flash Remoting MX. Keep in mind as you read that everything we are doing in ColdFusion can be done in any language that supports Flash Remoting MX (.NET or J2EE).

Working with the NetServices Object

The NetServices object is an ActionScript object with methods and properties used to connect with Application Servers and Web Services. The object communicates with Remoting-enabled Application Servers using Macromedia's home-grown AMF language over HTTP. Instantiating the object will give your application access to public (.NET) or Remote (ColdFusion) methods that you can create on your Application Server. It also gives you easy access to any methods embedded within a Web Service. NetServices takes care of all data transportation and transformation, and returns standard ActionScript objects that are ready to use with no additional handling required.

The NetServices object is available on both the Flash Communication Server and within Flash MX. You can choose to directly access an Application Server with the Flash player or through Flash Communication Server. For a complete list of methods available with NetServices, refer to Appendix B,"Macromedia Flash ActionScript Objects Quick Reference."

    Part I: 10 Quick Steps for Getting Started