Facebook Graph API - Image Uploading (as3/flash)

Posted by lollertits on Stack Overflow See other posts from Stack Overflow or by lollertits
Published on 2010-05-26T14:40:18Z Indexed on 2010/05/26 14:41 UTC
Read the original article Hit count: 486

Filed under:
|
|
|

I have been trying to get a bit more familiar with the Graph API for facebook. Its very convenient although the documentation is poor at some places.

Im having trouble uploading an image to an album. Anyone know how to do it ?

This is the code im currently working on :)

private function uploadNewPic(albumId:String):void

{ var bmd1:BitmapData = new BitmapData(200, 200, false, 0x666666); var bm1:Bitmap = new Bitmap(bmd1); var jpgEncoder:JPGEncoder = new JPGEncoder(); var ba:ByteArray = jpgEncoder.encode(bmd1); var data:URLVariables = new URLVariables(); data.message = "Message"; data.image = ba; data.photos = ba; data.url = ba;

var method:String = URLRequestMethod.POST;
var loader:URLLoader = facebook.call(albumId + "/photos", data, method);
loader.addEventListener(FacebookOAuthGraphEvent.ERROR, onPicError);
loader.addEventListener(FacebookOAuthGraphEvent.DATA, onPicUploaded);

}

Im pretty much down to trial and error :) Any ideas ?

© Stack Overflow or respective owner

Related posts about flash

Related posts about facebook