Putting Your Flash Application on Facebook (iFrame)
After I read the book “Facebook Graph API Development with Flash“, I wanted to make a little application to test out what I had learned.
If you want to see what I came up with, you can try it here: http://apps.facebook.com/jello-friends/ (you’ll need a Facebook account)
Please notice that the actual iFrame width you have to your disposal, is 758 pixels, as facebook somehow eats up a pixel in each side. (Stackowerflow question)
I wanted to have this functionality: If the user is not logged in, or haven’t allowed the application to access the basic information about the user yet, redirect to the appropriate site (login / authorization), else display my SWF.
I had a great deal of trouble making this work, but finally found a way to do this.
I used version 1.5 of the official Adobe ActionScript 3 SDK for Facebook.
In addition to that I used a modified version of a index PHP file from the examples of the SDK.
I’ve made all the things you need to edit variables in this PHP file, so it should be VERY easy to use! (I also told robots that they shouldn’t crawl this, but feel free to remove that – line 3)
In your AS3 project, you simply just call:
Facebook.init ( "YOUR_APPLICATION_ID", initComplete ) ; |
Where the initComplete function must look something like this (at least accept the two obejct parameters):
function initComplete(success:Object, fail:Object):void { if (success is FacebookSession) { // we're good to go! } else { // something went very wrong! } } |
I did not actually use the SDK to make the calls inside my application, but I would not believe you would have to do any more than this to make it work!
- Review: Facebook Graph API Book
- Putting Your Flash Application on Facebook (iFrame)
Posted on February 24th, 2011 Filed under ActionScript 3, Tutorial |
3 Responses to “Putting Your Flash Application on Facebook (iFrame)”
-
April 18th, 2011 at 05:12 -
April 18th, 2011 at 05:20NVM!!
I just changed the original .html extension and put it to .asp and worked!
Lulz.
-
April 18th, 2011 at 18:48Glad you worked it out :)
Man, im at the same situation you were.
I just read the same book, and when i try to put my app to facebook iframe it keeps passing me “Incorrect Function”.
Do you have any source code when you app just login? I just need that and the rest is by my own.
Thanks in advance.