Flash Remoting MX is Macromedia’s technology that provides a connection between Macromedia Flash and leading application servers. This allows developers to create rich Internet applications by using the Flash UI to connect to business logic on the backend. Flash Remoting is natively supported in ColdFusion MX and JRUN 4, and it can be purchased as an add-on for .NET and Java servers ($999).
With support for .NET, developers can leverage ASP.NET pages, DLLs, ADO.NET objects, and Web services. This is a major advantage for developers deploying content for .NET servers. They will now be able to use their existing business logic with the rich interface that Macromedia Flash MX provides.
Flash Remoting can be deployed on both J2EE and Java application servers since it is a pure Java implementation. Java resources such as objects and Beans are supported, as well as J2EE resources such as Java classes and EJB. Flash can ultimately be used as an effective replacement for Java applets and holds such advantages as:
- Cross-browser compatibility
- Flash player penetration
- Minimal plug-in download
- Quick load times
- The ability to display on multiple devices, such as desktops, PDAs, mobile phones and game consoles
Figure A illustrates the communication process between Flash, Flash Remoting, and the application server.
As you can see, all communication is done via HTTP calls between Flash and the application server. The Flash Remoting service sits on top of the application server and handles incoming requests as well as passing data back to Flash. This data can come in the form of strings, integers, arrays, objects, recordsets, and much more. For all of this to take place, the Flash Remoting components need to be installed. (They’re already available if you’ve installed ColdFusion MX.) These components consist of the necessary ActionScript include files that serve as an API for making remote service calls using Flash Remoting. Along with these components comes a nifty tool called the NetConnection debugger. The debugger allows you to trace and watch events on both the client and server. This happens in real time and is a great enhancement to the debugging process compared to older, pre-MX methods.
A good example of a place to use Flash Remoting is an online reporting system. Reporting systems generally have pages and pages of data that have to be paged/clicked through. Initially, an application like this wouldn’t be too cumbersome to work with, but as the months go by and more reports are added, the display of data might become difficult to manage. Flash Remoting can solve this problem by allowing Flash to serve as the presentation layer while service calls are made on the application server. Data would be sent to and from the Flash UI and the page would never have to be refreshed. All communication would be invisible and handled behind the scenes.
Figure B illustrates the communication process of the online reporting application.
Although this is a hypothetical application, it does demonstrate how the communication process would work. The service calls can be accessed from Flash via Flash Remoting and will respond accordingly. If the login method is called, the logic will take care of authenticating the user and sending a flag back to Flash allowing or denying access to the user. The getReports method will return to Flash a recordset of all reports for a certain month. The Flash ActionScript code will parse the data and display the reports. A user can add a new report and send this record to the addReport service method. The record will then be inserted into the DB, and a response will be sent back to Flash denoting the success or failure of the insert. Once again, all of this happens behind the scenes and is invisible to the user. That’s the beauty of Flash Remoting.
Flash can be a viable solution when used effectively, and the ability to display data-driven content and interface with business logic on the server side makes it more appealing than ever. Many hardcore developers and programmers have been against Flash from the beginning, since it has mainly been used to create useless Web site intros and animations. Flash has now become more of a developer’s tool, especially now that Flash Remoting is available. If you still aren’t convinced, I challenge you to download a 30-day trial of Flash Remoting MX to run with your existing application server. You can also download the Flash Remoting components using the same URL (not necessary for ColdFusion MX users).
Stay tuned. In the coming weeks, we’ll be taking a more in-depth look into Flash Remoting MX. We’ll cover code samples and sample applications that use Flash Remoting and can be applied to real-world applications.