Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

15. Working with Services and Server-Sid... > 15.8. Track Results from Multiple Si...

15.8. Track Results from Multiple Simultaneous Service Calls

Contributed by Andrew Alderson

Problem

You need to determine what returned data belongs to which of your multiple simultaneous service calls.

Solution

Use ASyncToken to add a variable to each call to identify it.

Discussion

Because mx.rpc.ASyncToken is a dynamic class, you can add properties and methods to it at runtime. The Flex documentation states that it is “a place to set additional or token-level data for asynchronous rpc operations.”

As an example, consider an application with a DateChooser control in it. Every time the user scrolls to a new month, you need to retrieve a XML file from the server for that month. Because there is no way to guarantee in what order these files will come back, you need a way to identify them. By using ASyncToken, you can add an identifying property to the result event that is returned by the service call. For example:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint