User Guide
Table Of Contents
- Contents
- About Flash Remoting
- Getting Started
- Using Flash Remoting ActionScript
- Using the RemotingConnector component (Flash Professional only)
- Using Flash Remoting Data in ActionScript
- About Flash Remoting and data types
- Understanding Action Message Format
- Converting from ActionScript to application server data types
- Converting from application server data types to ActionScript
- ColdFusion to ActionScript data conversion issues
- About working with objects
- About working with RecordSet objects
- About working with XML
- The NetConnection Debugger
- Using Flash Remoting with ColdFusion MX
- Using Flash Remoting for Java
- About Flash Remoting for Java
- Calling Java classes or JavaBeans from ActionScript
- Calling Enterprise JavaBeans (EJBs) from Flash
- Calling servlets and JSPs from Flash
- Calling JMX MBeans from Flash (JRun only)
- Calling server-side ActionScript from Flash (JRun only)
- Handling function results in ActionScript
- Using Flash Remoting with JRun security
- Passing XML objects between Flash and Java
- Viewing Flash Remoting log entries
- Using Flash Remoting for Microsoft .NET
- Flash Remoting for Microsoft .NET
- Calling ASP.NET pages from Flash
- Making an ASP.NET page available to Flash Remoting
- Getting a reference to an ASPX-based service in ActionScript
- Invoking ASPX pages in ActionScript
- Using the Flash Remoting custom server control in ASPX pages
- Using the Flash Remoting namespace in code-behind files
- Using ASP.NET state management with Flash Remoting
- Using ASP.NET exception handling
- Using ADO.NET objects with Flash Remoting
- Displaying a RecordSet object in Flash with ActionScript
- Calling web services from Flash
- Calling ASP.NET assemblies from Flash
- Viewing Flash Remoting log entries
- Using NetServices and Connection Classes
- Index

152 Chapter 8: Using Flash Remoting for Microsoft .NET
To return a session variable, you use the Flash.Result property, as shown in the following
example:
<%@ Page language="c#" debug="true" %>
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway"
Assembly="flashgateway" %>
<Macromedia:Flash ID="Flash" Runat="Server" />
<%
Flash.Result = session.myPreference;
%>
In the code, the value of the myPreference variable is assigned to the Flash.Result property,
which is returned to Flash. To set a session variable using a variable passed from Flash Remoting,
you use the
Flash.Params property, as shown in the following example:
<%@ Page language="c#" debug="true" %>
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway"
Assembly="flashgateway" %>
<Macromedia:Flash ID="Flash" Runat="Server" />
<%
if (Flash.Params.Count > 0)
{
session.myPreference = Flash.Params[0].ToString();
}
%>
In the code, the parameter passed from Flash is assigned into the myPreference session variable.
Using ASP.NET exception handling
To return custom ASP.NET exceptions to Flash, you use the
throw statement. You can throw
exceptions in the context of a
try/catch statement, an if/else statement, and so on. For
example, the following C# code fragment throws an exception:
if (Flash.Params.Count == 0)
{
throw new Exception("No arguments received.");
}
In the code, if the Flash.Params.Count variable is set to 0, an exception is thrown. The
exception message returns to Flash as part of the
FaultEvent object. To display the exception in
Flash, you use the
FaultEvent.fault.faultstring property, as shown in the following
ActionScript code fragment:
function serviceFunctionName_Fault (fe:mx.rpc.FaultEvent):Void {
textField = fe.fault.faultstring;
}
In the code, the fe.fault.faultstring property is assigned to the textField variable, which
represents a text field in the Flash application. If you want to display the stack trace information
returned from .NET, use the
FaultEvent.fault.detail property. For more information about
the FaultEvent object, see the FaultEvent class in Flash Remoting ActionScript Dictionary Help.