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

140 Chapter 7: Using Flash Remoting for Java
The following example shows entries for the FlashRole role and corresponding EJB method
permissions in an ejb-jar.xml file:
<assembly-descriptor>
<security-role>
<role-name>FlashRole</role-name>
</security-role>
<method-permission>
<role-name>FlashRole</role-name>
<method>
<ejb-name>SampleLoanBean</ejb-name>
<method-name>calculate</method-name>
</method>
</method-permission>
</assembly-descriptor>
Passing XML objects between Flash and Java
Both ActionScript and Java have object types for storing XML documents, and you can use Flash
Remoting to send XML documents back and forth between ActionScript and Java.
In Flash, you can use an ActionScript XML object to represent and manipulate an XML
document tree. In Java, you can use an org.w3c.dom.Document object to represent and
manipulate an XML document tree. Flash Remoting converts ActionScript XML objects to
org.w3c.dom.Document objects and org.w3c.dom.Document objects to ActionScript XML
objects. For more information about ActionScript XML objects, see the Flash documentation set.
For more information about the Java org.w3c.dom.Document interface, see the Java 2 Platform
Standard Edition API documentation available at http://java.sun.com.
The following sections describe how you pass XML between ActionScript and Java.
Note: If you make a reference to an XML Document Type Definition (DTD) or schema in your XML
document, you must use a Uniform Resource Identifier (URI) that the server can reach. Do not use a
relative path.
Sending an ActionScript XML object to Java
The following ActionScript function creates an XML object and sends it as a parameter to a
service function, which in this case is a JavaBean method that expects an org.w3c.dom.Document
object; the first element of the XML document contains text entered in a Flash text field called
input:
function testDocument()
{
var xmlDocument:XML = new XML();
var firstElement:XMLNode = xmlDocument.createElement("test");
firstElement.attributes.message = input.text;
var secondElement:XMLNode = xmlDocument.createElement("insidetest");
firstElement.appendChild(secondElement);
xmlDocument.appendChild(firstElement);