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.3. Communicate with a Service Tha...

15.3. Communicate with a Service That Returns JSON-Formatted Data

Problem

You need to be able to send and parse JSON data to communicate with a service.

Solution

Configure a HTTPService object and use the JSON.decode() method from the as3corelib open source library.

Discussion

First, you’ll want to create and configure a HTTP service. From the Flash Builder Data menu, select “Connect to a HTTPService.” You can then use the wizard to create your service, as shown in Figures 15-1, 15-2, and 15-3.

Creating a HTTP service
Figure 15-1. Creating a HTTP service

Note the parameters that will be passed to the service (Figure 15-2). Because the service is using the GET method, when the googleSearch() method is called both parameters are expected.


  

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