Skip to content

Embedding flash object in Facebook Apps (FBML)

Yesterday I was trying to include a flash object in a facebook app using FBML fb:swf tag. The flash object needed to change the url of the page it was running on on a particular event. But since facebook prevents direct script access from flash, this could not be done.

Here is a simple workaround:

1. Create a simple html page containing only the flash object that you want to include.

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   </head>
   <body>
   	<object type="application/x-shockwave-flash" data="foo.swf" width="300" height="300">
   		<param name="movie" value="foo.swf">
         	<param name="quality" value="high">
         	<param name="scale" value="noscale">
         	<param name="salign" value="LT">
         	<param name="menu" value="false">
    	</object>
    </body>
</html>

2. Embed this html on the facebook page using the fb:iframe tag.

<fb:iframe src="http://anandnalya.com/foo.html" width="300" height="300" frameborder="0" scrolling="no"></fb:iframe>

Now you can make all the Actionscript calls you want to. Only caveat to this approach is that you will no longer be able to make Facebook API calls directly from flash.

{ 9 } Comments

  1. tvance | July 10, 2009 at 7:44 am | Permalink

    Thank you thank you thank you!!! I could not figure out how to get Amazon widgets into my php page and you solved my problem!
    thanks!!!!!

  2. Andry Fixa | April 14, 2010 at 2:44 pm | Permalink

    thanks, you give me an idea with different way. cause not works for me

  3. Shira | May 19, 2010 at 3:55 am | Permalink

    Hey, I realize this post is dated a year ago but I was wondering if you see this comment if you can please answer some of my questions regarding this post. I hope to hear from you, thanks!

    - S

  4. anand | May 19, 2010 at 9:28 am | Permalink

    @Shira

    Let me know your question, I”ll try to answer them :)

  5. Shira | May 26, 2010 at 11:48 am | Permalink

    where would I create a simple html page with the flash object I want to include?

  6. lee-ann | June 25, 2010 at 12:20 pm | Permalink

    Hi I need help I want to put this on a Static FBML page on my facebook PAGE

    How do i do it ???

  7. anand | June 25, 2010 at 3:22 pm | Permalink

    @lee-ann
    You can use the Static FBML app for including it on your facebook page.

  8. Michael Benin | August 8, 2010 at 10:15 am | Permalink

    thanks for sharing. I’m trying to figure out how to add a like button in my .swf, at the time it’s more complex than I was expecting.

  9. Nil | August 16, 2010 at 10:15 pm | Permalink

    Hi,
    Is it possible for you to point to an example “flash-object only” page to check if that works for me? Before I will start creating a page like this. Also: fb:frame needs to be inserted into a new tab created with static fbml?

Post a Comment

Your email is never published nor shared. Required fields are marked *