Skip to main content
August 12, 2011
Question

ahh! stuck again :(

  • August 12, 2011
  • 1 reply
  • 310 views

so thanks to the kind help of "kennethkawamoto" He helped me with setting up the facebook API with AS3, i thought i could then put the data into text fields, which i tried to do but failed. So what im asking from someone who knows how to do this is to show me....

This is the facebook API -

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import com.adobe.serialization.json.JSON;
 
var loader:URLLoader = new URLLoader(new URLRequest("https://graph.facebook.com/XXX/feed?access_token=XXX"));
loader.addEventListener(Event.COMPLETE, loadComplete);
 
function loadComplete(e:Event):void {
    processData(e.target.data);
}
 
function processData(data:String):void {
    var facebookFeed:Array = JSON.decode(data).data as Array;
    for(var i:uint, feedCount:uint = facebookFeed.length; i < feedCount; i++){
        trace(facebookFeed.message);
    }
}






Iys working as it is traced into the output window!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 12, 2011

i thought we just did that.  how many duplicate threads are you running?


August 12, 2011

what do you mean duplicate!? you showed me this before:

function onGraphDataLoadComplete(event:Event):void

{

     var graphData:String = (event.target as URLLoader).data;

var tf:TextField=new TextField();

addChild(tf);

tf.text=graphData;

}

but that does not work when i done it on the code above, i know onGraphDataLoadComplete does not exist in the code above, but i did try adn change it into a function from above but could not figure it out, which is why i requested help from the forum.....

August 12, 2011

basically what you demonstrated in a previous post was correct, it done what was asked of you.

But i want to be able to display this into a text field:

function processData(data:String):void {
    var facebookFeed:Array = JSON.decode(data).data as Array;
    for(var i:uint, feedCount:uint = facebookFeed.length; i < feedCount; i++){
        trace(facebookFeed.message);