User Guide

Table Of Contents
Calling ASP.NET pages from Flash 149
Using the Flash Remoting custom server control in ASPX pages
To access data passed from Flash applications or return results to Flash applications in ASPX
pages, you use the Flash Remoting custom server control in your ASPX page. The Flash
Remoting server control is provided by the flashgateway DLL, which is located in the local
assembly cache (bin directory) of your application. You must first register this control, as you
would any custom server control, in your ASPX page. Here is an example:
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway"
Assembly="flashgateway" %>
The Register directive establishes the tag prefix (Macromedia), namespace (FlashGateway), and
the assembly that provides the functionality (
flashgateway). After you register the custom server
control in your ASPX page, you can use it to pass data to Flash applications, as the following
example shows:
<Macromedia:Flash ID="Flash" runat="server">
Hello from .NET!
</Macromedia:Flash>
When the Flash application invokes the custom server control, the string Hello from .NET! is
returned.
In addition to passing simple strings, you can write code in a .NET-supported language that
accesses parameters passed from Flash and returns processed results to Flash. The Flash Remoting
custom server control contains two properties for accessing passed parameters and returning
results:
Flash.Params and Flash.Result.
The
Flash.Params property is a list consisting of parameters passed from a Flash application.
The parameters arrive in the order that they were passed from the service function call in the
ActionScript code of a Flash application. The
Flash.Result property returns its value to Flash.
You can access Flash parameters like any other value in .NET, as the following C# example shows:
<%@ Page Language="C#" debug="true" %>
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway"
Assembly="flashgateway" %>
<Macromedia:Flash ID="Flash" Runat="Server" />
<%
String message = "Hi ";
if (Flash.Params.Count > 0)
{
message += Flash.Params[0].ToString();
}
Flash.Result = message;
%>
Between the rendering blocks (<%...%>), the if statement condition, Flash.Params.Count >
0
, evaluates the Flash.Params list for the number of parameters present. If a parameter is
present, the parameter value, as a string, is appended to the
message variable. Finally, the
message variable is assigned into the Flash.Result property, which is returned to Flash.