After I upload a photo on a desktop facebook application i need to store it’s post id in a database. From the facebook ActionScript SDK documentation:
api() method
public static function api(method:String, callback:Function, params:* = null, requestMethod:String = GET):void
Makes a new request on the Facebook Graph API.
Parameters […]
callback:Function — Method that will be called when this request is complete The handler must have the signature of callback(result:Object, fail:Object); On success, result will be the object data returned from Facebook. On fail, result will be null and fail will contain information about the error.
So I implemented my callback function as follows:
protected function handleUploadComplete(response:Object, fail:Object):void{
status = (response) ? 'Success' : 'Error';
var file:File = File.desktopDirectory.resolvePath("Log.txt");
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTFBytes(response.toString());
stream.close();
}
The problem is that response or response.toString() both return “[object Object]”, and I was hoping for something more like “id: somenumber”.
What am I doing wrong?
If everything has worked the
responsewill contain a property calledidthat is your post ID. Otherwise it will be null and thefailobject will be populated.