29
CHAPTER 2
Using Flash Remoting ActionScript
This chapter explains how to write ActionScript 2.0 code that uses Macromedia Flash Remoting
for Flash MX 2004 to access application services. It explains how to configure connection
information, call service functions, and handle the results that the service returns. After reading
this chapter, you should be able to create a simple application that uses Flash Remoting to obtain
data from an application server.
This chapter describes two ways to access a remote service. The first and easiest way is to use the
RemotingConnector component. The second way is to use the methods of the Flash Remoting
API. The chapter leaves the discussion of the RemotingConnector component to the end because
whether you use it or the API, you need to understand the structure of a Flash Remoting
application and how to handle the results that the service returns.
The chapter also contains two extended examples, CustomerInfoExampleAPI and
CustomerInfoExampleCon, that are different versions of the same application. The
CustomerInfoExampleAPI example uses the Flash Remoting API to connect to and access a
service. The CustomerInfoExampleCon example uses the RemotingConnector component to
connect to and access the same service. For descriptions of these examples, see
“Using the Flash
Remoting ActionScript API in the CustomerInfoExampleAPI application” on page 47
and
“Using the RemotingConnector in the CustomerInfoExampleCon application” on page 57
.
This chapter contains the following sections:
•
“Flash Remoting application structure” on page 30
•
“Flash Remoting ActionScript classes” on page 32
•
“Configuring Flash Remoting” on page 36
•
“Calling service functions” on page 41
•
“Handling service results and errors” on page 43
•
“Using the Flash Remoting ActionScript API in the CustomerInfoExampleAPI application”
on page 47
•
Chapter 3, “Using the RemotingConnector component (Flash Professional only),” on page 53
•
“Using the RemotingConnector in the CustomerInfoExampleCon application” on page 57