How to get your Flash Applications on Facebook!

fcebk icon

This posting will teach you how to get your Flash applications on Facebook.

1. The first thing you want to do is log in to facebook. Then you want to click the developers link on the bottom of the page. After that, click the ‘Apps on Facebook.com’ link on the left.

2. Go down to the ‘Getting Started’ headline and click, ‘register your Facebook application’.

3. Fill out the Application Name and click the ‘Agree’ radio button.

4. Fill out the Security Check.

5. At this point, you should be at the Application Settings page. Fill out the description of your application.

6. If you have a logo and a icon, click the links ‘Change your icon’/’Change your logo’.

7. Next, click the ‘Web Site’ link on the left of the page. Copy your Application ID and Application Secret to a text document for later use. Make sure to click the save changes button.

8. After you have copied the Application ID and Application Secret, fill out the site URL. This URL is the URL of were you have your website page stored on your hosting.

For example, when you are in Flash, and published out the application to a SWF and HTML. You take those files and put it on your server. The URL to those files is the URL you will put into the Site URL blank.
ex: www.mydomain.com/apps/

I used index.php as my page, so I don’t need to reference the page.

9. After that, fill out the Site Domain.  Then click the save changes button.
ex: mydomain.com

10. Then, click the Facebook Integration button the left. Go to the Canvas section. For the Canvas Page, fill out the blank. As you can see, you are making the URL for your application.

Ex: myGame

11. The next step is to fill out the Canvas URL. This is the same as the URL you filled out in the last section.
ex: www.mydomain.com/apps/

12. Select the ‘IFrame’ radio button.

13. Click the ‘Auto-resize’ radio button.

14. Under the Discovery section, make sure ‘Enabled’ radio button is selected. Then click the save changes button.

15. Then you should be at the My Applications page. Go to the bottom and click the ‘example code’ link. At the top, you’ll see

$ curl -L http://github.com/facebook/php-sdk/tarball/master | tar xvz
$ mv facebook-php-sdk-* facebook-php-sdk
$ cp facebook-php-sdk/examples/example.php index.php

Download: http://github.com/facebook/php-sdk/tarball/master
Extract the folder to your desktop. Rename the folder to: facebook-php-sdk.
Upload that folder to your server. Make sure to put it in the same folder that you uploaded the SWF and HTML files that you published from Flash.
The directory of the files that you just downloaded is similar to: www.mydomain.com/apps/facebook-php-sdk/.

16. Now you want to go into that html file that you published from Flash. Copy and paste this code right under the <body> tag. The text after the // can be changed to anything you want. Go the the 'appId' part in the code and put your application's appID that you copied to a text document. Do the same for the 'secret'. 

<?php
// Awesome My Application
//
// Name: Application
// 

require_once 'facebook-php-sdk/src/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
 'appId'  => 'YOUR CODE',
 'secret' => 'YOUR CODE',
 'cookie' => true,
));

?>

If your Flash application is on a php page, do this next step, otherwise, skip this step. Go to the html page that you published from Flash and copy the code that starts with ‘<object classid’ all the way to to, ‘</object>’.

Above the ‘?>’ line of code, put this line of code.

echo ‘<CENTER>

Paste that code that you copied from the HTML page that Flash copied and paste it right after the <CENTER> tag. Right after the </object> tag, type:

</CENTER>’;

It would look similar to:

echo ‘<CENTER><object classid=”

</object></CENTER>’;

Save the page and upload it to your server and replace the previous file.

17. To view your application. You should still be at the My Applications page. Click the, ‘Application Profile Page’ link on the right. Then, click the ‘Go to Application’ button on the top left. You should see your Flash application.

flash_application on facebook
My Flash Application on Facebook

Click the picture to test it for yourself!

I am not affiliated with Facebook.