Macromedia Flash Remoting MX exposes ASP.NET technologies as remote services to Flash applications, which are accessible as ActionScript functions. A variety of Microsoft .NET technologies can serve as remote services, including ASP.NET pages, web services, and assembly methods. A Flash developer writes ActionScript that uses a library of functions called NetServices to connect to a remote .NET server, get a reference to the remote service, and invoke the remote service's functions.
To transport messages, Flash Remoting MX uses a binary message format called Action Message Format (AMF) delivered over HTTP and modeled on the Simple Object Access Protocol (SOAP) used in web services implementations. AMF is smaller and faster than standard SOAP, and is purely asynchronous and event-driven. It lets you send a variety of data types, including RecordSets, primitives like integers, strings, XML documents, and dates across the Internet using HTTP.
The Flash Remoting gateway acts as a front controller on the ASP.NET runtime that handles the conversion of data types from ActionScript to the .NET Common Language Runtime (CLR) and so on. When the gateway receives a service request, the request passes through a set of filters that handle serialization, logging, and security before arriving at a service adapter designed to handle the service and invocation type.
Flash Remoting MX contains four service adapters for .NET technologies:
Flash Remoting MX for .NET requires the .NET Framework SDK to be installed. To check if you have the .NET Framework installed, open to the Windows Control Panel and double-click the Add/Remove Programs icon. In the Add/Remove Programs dialog box, look for Microsoft .NET Framework SDK. If you do not see it, go to the Microsoft website to download the SDK at http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml.
When embedded in ASPX pages with other server controls that render HTML, a Flash application that uses Flash Remoting MX becomes part of the client tier of a .NET application. Flash Remoting MX can be used as a custom server control in ASP.NET pages in .NET Web Form applications, or as a namespace in .NET DLL files, code-behind class files, and web services. A .NET assembly (flashgateway.dll), located within the local assembly cache of your ASP.NET application, provides the Flash Remoting functionality.
To assist you in planning your Flash applications, a design pattern represents a solution to a frequently experienced problem and provides a way to standardize coding practices across a complex project. Many design patterns are used in the context of a model-view-controller architecture, in which you separate data access functionality from the user interface and control logic that uses that functionality.
Like an ASPX page, a Flash application represents the view portion. The Flash MX Player, running in a web browser or in stand-alone mode, is the client in which the view is rendered. The Flash Remoting gateway is a front controller that translates interactions with the Flash-based view into actions that server-side .NET technologies perform.
Two design patterns, the Value Object and Session Facade patterns, can be particularly useful with Flash Remoting MX. Both patterns can reduce the number of remote method calls required in a Flash application.
You can use a value object to send a coarse-grained view of data to the server and get back fine-grained data. For example, you can call a single method on a value object that aggregates several method calls on several different web services. The method result is returned to the Flash application as an ActionScript result object from which you can access data locally. This pattern can help reduce network traffic and response time.
The facade structural design pattern can be particularly useful with Flash Remoting MX by reducing the number of remote method calls required in a Flash application. You can use a service facade to provide a single point of contact to a set of ASPX pages or DLL methods. You can call methods on a DLL facade that is capable of calling various methods on several other DLLs, ASPX pages, or web services, depending on the user's current context in the application. This pattern reduces network traffic and makes it easier to support different types of clients, change the enterprise data model, or change the server implementation.
For more information on the .NET architecture and design patterns, go to http://msdn.microsoft.com/architecture/.
To enable an ASP.NET application with Flash Remoting MX, you place the Flash Remoting assembly in the application's local assembly cache (bin directory) and register the assembly in the application's web.config file. In the simplest form, your ASP.NET application directory structure might look like the following figure:
As the figure shows, the local assembly cache in the myASPApp directory contains the Flash Remoting assembly, flashgateway.dll. Also, to connect a Flash application with a remote service, you must reference a physical resource in your application's directory in the web root. Flash Remoting MX automatically installs a blank ASPX page named gateway.aspx, but you can use any ASPX file in the application directory.
The web.config file contains the registration for the flashgateway.dll. The HttpModule reference handles all web requests to ASP.NET resources. Here is an example:
<httpModules>
<add name="GatewayController" type="FlashGateway.Controller.GatewayController,flashgateway" /> </httpModules>
If the request contains AMF, Flash Remoting MX proceeds with the request.
Note: The Flash Remoting MX for .NET installer creates a directory in your webroot named flashremoting. Inside the flashremoting directory, you will find a local assembly cache (bin directory) and a Samples directory, which contains example Flash applications.
Before you can start development with Flash Remoting MX, you must set up your ASP.NET application. The Flash Remoting MX for .NET installer creates a preconfigured application for you named flashremoting. You can find the flashremoting folder in your IIS webroot, such as C:/Inetpub/wwwroot/flashremoting.
When creating the directory structure for your own ASP.NET application that uses Flash Remoting MX, you must assign specific security permissions to the local assembly cache. Using Windows 2000 Professional as the operating system, the following procedure creates an ASP.NET application directory for Flash Remoting MX:
httpModule tag that registers the Flash Remoting assembly, as the following example shows:<httpModules> <add name="GatewayController" type="FlashGateway.Controller.GatewayController,flashgateway" /> </httpModules>
Your Flash Remoting-enabled ASP.NET application directory is now ready to use.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flashremoting/mx/Using_Flash_Remoting_MX/usingFRNET2.htm
Comments
soaf said on Dec 14, 2002 at 10:10 PM : sgilson102 said on Jan 6, 2003 at 3:35 PM : Parwez.Akhtar@pdo.co.om said on Mar 28, 2004 at 2:05 AM : No screen name said on May 10, 2004 at 8:50 AM : No screen name said on Jul 11, 2004 at 2:21 PM : No screen name said on Nov 3, 2004 at 8:57 AM : No screen name said on Jan 21, 2005 at 8:57 AM : jaxonweb said on Aug 18, 2005 at 10:53 AM : No screen name said on Aug 22, 2005 at 9:12 PM :