Time for action – creating an HTTP Requestor

The idea is, we move all of the code regarding the URLLoader from CustomGraphContainerController to a separate class, called HTTPRequestor. We will then replace the CustomGraphContainerController constructor with this:

public function CustomGraphContainerController(a_graphControlContainer:GraphControlContainer)
{
  super(a_graphControlContainer);
  
  _requestor = new HTTPRequestor();
  _requestor.request(new GraphRequest("PacktPub"));
}

Why bother? Well, apart from being neater, there are two main advantages:

  1. It's much simpler to request several Graph Objects or Graph Lists; no need to deal with multiple instances of URLLoader.
  2. In the next chapter, we'll see how to use the official Adobe AS3 Facebook SDK to retrieve ...

Get Facebook Graph API Development with Flash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.