These are exciting times. Macromedia is attempting to change the way application developers create web-based applications.
Flash Remoting constitutes a complete rethinking of how web applications are constructed. Using Flash Remoting, you can create complex client/server applications that more closely resemble desktop applications than traditional web pages. For those of you familiar with traditional Windows-style programming IDEs, Flash Remoting is roughly the web equivalent of a Visual Basic client/server application. This chapter presents a broad overview of Flash Remoting.
Flash Remoting technology is at the center of Macromedia's Studio MX product suite, linking the server platforms with the client-side tools. Flash Remoting is built into Macromedia's two application servers?ColdFusion MX and JRun 4. In addition, programmers using other technologies, such as ASP.NET or J2EE application servers, can purchase the Flash Remoting MX package so that Flash Remoting can be utilized on those servers. Although Macromedia doesn't officially support other languages, open source implementations are available for PHP (the AMFPHP project at http://www.amfphp.org) and Perl (the FLAP project at http://www.simonf.com/flap). There is also an open source Flash Remoting for Java implementation (OpenAMF at http://www.openamf.org).
The Flash authoring environment includes UI components, which form the basis of Macromedia's strategy of using a Flash movie as the client in a client/server atmosphere. This approach allows the application server to provide the programming power for the application. Using Flash Remoting, a Flash movie can act as the interface for diverse applications, including connections to databases, SMTP mailers, server components, web services, and much more. Flash Remoting ties together the Macromedia authoring tools and application server technologies to form a new approach to web application development and deployment.
Flash Remoting is a server-side technology that integrates with existing application servers to provide a gateway between the Flash Player and remote services deployed on the server. A service can be a simple ColdFusion page or ColdFusion Component (CFC), a PHP or Perl script, a Java class, or an ASP.NET page or DLL. Flash Remoting allows developers to access remote services and web services from within Flash through a simple ActionScript API that is similar to JavaScript. Flash Remoting also allows developers to integrate Flash with existing client/server applications with little modification, to provide a rich, robust user interface that can be deployed across browsers, platforms, and devices.
The Flash Remoting gateway on the server sits between the Flash Player on the client and the server-side tier of an application. It handles data serialization and procedure calls between the Flash Player and the server. Serialization is the translation of data to a format that can be easily transmitted over the Web. This translation is transparent to both client-side Flash developers and server-side developers. We'll discuss a client/server architecture using the Flash Player and the Flash Remoting gateway later in this chapter.
Using Flash Remoting, a Flash movie can connect to virtually any remote service deployed on the server. The remote services can be deployed using various languages and technologies, including:
Java classes
JavaBeans™
Enterprise JavaBeans (EJB)
Java Management Extensions (JMX MBeans)
ColdFusion templates
ColdFusion Components
Server-Side ActionScript (SSAS)
ASP.NET pages
ASP.NET DLLs
SOAP-based web services
PHP pages
In other words, a remote service might be a ColdFusion page, a PHP page, or an ASP.NET DLL, among other things. Flash Remoting allows Flash to make remote procedure calls on existing server-side services; server-side developers do not have to implement any Flash-specific APIs or adjust their design patterns. Calling a service from a Flash movie is as easy as calling it by name. For example, if you have a server-side method named getRecords( ) that you would typically call from another server-side page to feed an HTML page, Flash Remoting lets you call the getRecords( ) method directly from the Flash movie. Gone are the page reloads associated with HTML pages. The communication with the server is seamless and invisible to the user. This means that the typical web experience is much more user friendly and performs more like a traditional desktop application.