User Guide

Table Of Contents
122 Chapter 7: Using Flash Remoting for Java
The following table lists standard ways to add classes to the system classpath:
Getting a reference to a Java class or JavaBean in ActionScript
Before calling methods of a Java class or JavaBean from ActionScript, you must get a reference to
the Java object.
To get a reference to a Java object:
1.
Import the following files:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
2.
Establish the Flash Remoting gateway and get a reference to the Java class or JavaBean as shown
in the following example:
var flashtestService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"flashgateway.samples.FlashJavaBean",
null,
null);
The first parameter of the Service constructor is the gateway URL. The third parameter is the
fully qualified class name of the Java class or JavaBean.
Note: There are several other ways to specify the gateway URL. For more information, see
“Establishing the Flash Remoting gateway connection” on page 37.
Application server Classpath information
Sun™ ONE Web
Server
In the Web Server Administration Server console, add classes to the
Classpath field in the Configure JVM Attributes page of the Java panel.
IBM® WebSphere® In the WebSphere Application Server Console, add classes to the
Classpath field of the JVM Settings page for your server. In the
server-cfg.xml tree in the left pane of the console, JVM Settings is under
WebSphere Administrative Domain > Nodes > nodename > Application
Servers > servername > Process Definition.
Note: To call a class or JavaBean in WebSphere, you also must grant
clients permission to access the package that contains the class or
JavaBean. To do this, you add a line to the default permissions granted to all
domains in the websphere_root/AppServer/java/jre/lib/security/java.policy
file. For example, the following line lets users access the Flash Remoting
sample classes in the flashgateway.samples package:
permission java.lang.RuntimePermission
"accessClassInPackage.flashgateway.samples";
JRun Copy classes to the jrun_root/jrun_server/SERVER-INF/classes directory in
subdirectories that match the package structure of the classes. Copy JAR
files to the jrun_root/jrun_server/SERVER-INF/lib directory.