Flash applications that use Flash Remoting MX resemble other client-server development platforms, including traditional HTML-based web applications. For example, Flash applications usually appear in the context of a browser window, much like HTML pages. In addition, Flash applications can contain controls for displaying text and graphics, gathering user input, and communicating with a remote server, much like HTML.
Like a web browser request for an HTML page, the Flash application makes a service function call to a remote service. The service function call is a client-initiated, asynchronous event. The Flash application makes a request to the remote service, the service processes the request, and returns the results. The Flash Player does not wait for the result, it handles the result when it is returned.
Because Flash Remoting MX connects two distinct and separate runtime environments, you build Flash applications with Flash Remoting MX in two programming languages, ActionScript and the programming language of your application server. Therefore, building Flash applications with Flash Remoting MX demands knowledge of at least two different development environments:
Because of the separation between the client and server environments, you might develop Flash applications using Flash Remoting MX as a team project. In traditional HTML-based web applications, responsibilities usually fall into two general roles, designer and developer. The designer creates the HTML user interface, and the developer creates the application server logic.
In Flash development using Flash Remoting MX, you might find it useful to organize development roles as server-side developers, client-side developer, and client-side designer. Under this division of labor, the client-side designer creates the Flash user interface, including layout, animation, and effects. The client-side developer creates the ActionScript to connect to the remote service and handle the results. Finally, the server-side developer builds the business logic on the application server to serve as the remote service.
For more information on process planning, see the PetMarket Blueprint application on the Macromedia website at http://www.macromedia.com/desdev/mx/blueprint/.
Flash Remoting MX is designed to integrate into established design patterns and frameworks. For Flash applications, Flash Remoting MX streamlines the implementation of properly structured design patterns. Besides increasing development efficiency and reducing mistakes caused by poor designs, patterns can help increase the performance and stability of your applications by forcing you to examine the client-server interactions.
Widely adopted by the software development community for user interface-oriented applications, the model-view-controller (MVC) architecture organizes the code of your application by use. The MVC architecture consists of the following elements:
The following figure depicts the MVC architecture in the context of Flash Remoting MX:
In the figure, Flash Remoting MX enables the separation of the controller from the model by providing a communication channel between Flash applications and application servers or web services. For more information about applying MVC patterns to Flash applications that use Flash Remoting MX, see the PetStore Blueprint application on the Macromedia website at http://www.macromedia.com/desdev/mx/blueprint.
Other design patterns exist that try to reduce service function calls, such as the value object pattern. Flash Remoting MX can return results from a remote service as an ActionScript object. An ActionScript object lets you encapsulate service data, which lets you return one object to the Flash application. Instead of numerous individual calls, one object is returned. For more information, see the Value Object entry in the Design Pattern Catalog at http://java.sun.com/blueprints/patterns/j2ee_patterns/value_object/index.html.
To simplify the remote service API available to Flash applications, you can use the facade design pattern to provide a buffer layer between a Flash application and the remote service. The facade pattern prescribes an application server-based broker to receive Flash application service calls and relay the function to the appropriate server resource. This gives you the flexibility of changing your remote service architecture without changing the Flash application.
The following figure depicts the facade design pattern in the context of Flash Remoting MX:
A ColdFusion component, JavaBean, or .NET assembly could serve as the facade by receiving all service function requests from Flash and dispatching the requests to the appropriate application server resource or web service call.
For more information about using the value object and facade design patterns with Flash Remoting MX, see "Software Design Patterns for Flash Remoting" on the Macromedia web site at http://www.macromedia.com/desdev/articles/facades.html.