O'Reilly logo

Java® and Flex® Integration Bible by Charles A. Christiansen, Matthew Keefe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Sending Data from Flex

IN THIS CHAPTER

  • Understanding the sending process

  • Writing the sample test

In this chapter, you learn how to send data from Flex. The concepts you learn aren't specific to Java because no matter what back-end language you decide to work with, you still need to send and load some form of data.

The actual process of sending data consists of packages and classes that ship with Flex, paired with a custom response handler that the developer would create and which you will now learn to create.

Understanding the Sending Process

The process of sending data in Flex requires an object to send the data and another to handle the response that's captured once the requested server returns a result. This is because Flex uses an asynchronous sending process, which means that the response calls are assigned to an response handler because it's not known when the response will be available. In a synchronous (blocking) process, the application waits until the response is available.

The object for the asynchronous call is also used to hold any variables that need to be passed to the server.

When creating a service to send data, first you need to determine the purpose and functionality of the service. For example, if you want to load a user's information from a server-based database, you would make a request with a user ID and expect a slug (fragment) of XML or a formatted string that contains the response.

ActionScript approach

The above scenario may look something like this when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required