Forum Sitebox Uploading pictures to FB in ActionScript

Discussion and help relating to the PlayerIO webpage and Facebook app hosting solution, Sitebox.

Uploading pictures to FB in ActionScript

Postby johnnyk427 » May 5th, 2012, 2:38 am

Having trouble with this. I want to upload a bitmap I have in my flash app to Facebook. Anyone had any luck with this?

I can do a URL, but dont know how to send a bitmap. Cant find any good information on the web.

var myBitmapDataObject:BitmapData = new BitmapData(150, 150, false, 0xFF0000);
var myImage:Bitmap = new Bitmap(myBitmapDataObject);
addChild(myImage)

//Doesnt work
FB.api("/me/photos", function():void {}, {message:"Test!",source:myImage, fileName:'FILE'}, URLRequestMethod.POST);


//This does work
FB.api("/me/photos", function():void {}, {message:"Test!",url:"http://laughingsquid.com/wp-content/uploads/nyan.jpg", fileName:'FILE.bmp'}, URLRequestMethod.POST);
johnnyk427
Paid Member
 
Posts: 9
Joined: March 31st, 2012, 2:05 am

Re: Uploading pictures to FB in ActionScript

Postby johnnyk427 » May 7th, 2012, 7:39 am

Ok, I spent all weekend looking into this and still having lots of problems, but I understand the issues a little better. Could really use some help from a PlayerIO dev. Here's what I figured out:

- There are two APIs for accessing Facebook from Actionscript. There's the PlayerIO one, and the official Adobe one. It looks like uploading pictures is just not yet supported in the PlayerIO one, which gives me 2 choices:
1) Implement picture uploading into the PlayerIO Facebook API myself
2) Switch over to the official Adobe Facebook API, where picture uploading already works.

Pretty torn as to which way to go at this point. If I go with 1, I'll need to do a lot of work understanding how picture HTTP post requests are made, how they're formatted, how to encode image files in the right format, etc. It will be a massive and difficult task.

If I go with 2, I'm in unknown territory, because the PlayerIO Facebook API has all these extra things it does that I dont understand. For example, I pass in the PlayerIO game id when I init it (why? what does that do?), and it has options for partner integration which I plan to use later. So I will lose all that if I switch to the Adobe API, and I have no idea what the later consequences will be. Plus, none of the Adobe Facebook API samples run currently, and I'll have to spend a lot of time just figuring why that is (in typical Adobe fashion).

Of course, there is the elusive option 3), where I find out its already added by the wonderful PlayerIO dev team but not released yet and all my problems will be solved momentarily... :)

For reference, I'm trying to upload to Facebook a picture the player has drawn in the app.
johnnyk427
Paid Member
 
Posts: 9
Joined: March 31st, 2012, 2:05 am


Return to Sitebox



cron