Facebook Graph API Development with Flash
上QQ阅读APP看书,第一时间看更新

Time for action - traversing the Graph

Set the Visualizer to start by requesting the PacktPub Page. Now, compile and run your SWF, and use the Connections box and the Pop Out buttons to explore the Graph, and see how far you can get. Don't forget you can drag Renderers around, and zoom out to fit even more in the Flash Player window! And remember, black lines signify connections, while gray lines signify that the object belongs to a List.

The following screenshot shows what it could look like after only a few clicks:

Time for action - traversing the Graph

You can already see the resemblance to the sprawling diagrams of the Graph seen previously in the chapter.

What just happened?

You've written the code to power an RIA that allows you to explore the entire public Graph, starting from any point. In other words, you've made a Facebook crawler, in Flash.

Have a go hero – exploring other areas

You don't have to start exploring from the PacktPub Page. Try changing that initial GraphRequest instance to request the Facebook Page, Facebook, or Mark Zuckerberg's public profile, markzuckerberg, or the Page of any other brand, company, or famous person.

Also, realize that you're not limited to a single GraphRequest; you can create as many as you like. Try starting with a few at once, and see if you come across any overlaps!

Keep an eye on your output window for traces telling you that a Graph Object or List could not be retrieved. Is it always for the same reason?

Pop Quiz

  1. What does the ?metadata=1 parameter do when used in a Graph API URL?

    a. It makes the metadata visible

    b. It makes the metadata invisible

  2. How many levels through the Graph can you traverse, starting with any Page?

    a. One

    b. Two

    c. Ten

    d. Unlimited

  3. True or false: If the JSON returned from a Graph URL contains an object called data, we can always assume it's a Graph List.

    a. True

    b. False

  4. True or false: If the JSON returned from a Graph URL doesn't contain an object called data, we can always assume it's a Graph Object.

    a. True

    b. False