Home > Adobe Flash, Adobe Flex, Xuland > Adding a Facebook “like” button to a Flash/Flex Application

Adding a Facebook “like” button to a Flash/Flex Application

Mission: Add a Facebook “like” button to my experimental Flex social networking site Xuland.

I initially thought, “Boy this must be a piece of cake. Surely thousands of other developers have already figured this out!”. Boy was I wrong.

The best example I could find on this specific topic was http://labs.byhook.com/2010/08/03/facebook-like-button-in-flash/. Spend a good half hour digesting the contents of that blog posting and you’ll be ready to scratch the idea altogether.

I wanted a simple implementation that I could knock out in less than an hour. I figured why not just use an iframe!

Here’s the steps:

First, go to http://developers.facebook.com/docs/reference/plugins/like

Fill out the form to get your special iframe code

Next, open up your Flex application’s HTML wrapper (e.g. index.template.html) in FlexBuilder

Copy and paste the iframe code (from above) into the HTML template. I put mine right under the <div id=”flashContent”> section.

1
2
3
4
5
6
7
8
9
<div id="flashContent" style="z-index:-1">
  ...
</div>
 
<iframe 
     src="<< insert your custom facebook like URL here >>" 
     scrolling="no" frameborder="0" 
     style="border:none; overflow:hidden; width:100px; height:21px; z-index:99; position: absolute; top: 0px; left: 100;" 
     allowTransparency="true"></iframe>

Notice the iframe style declaration. Make sure z-index=99, then you can use CSS to position your like button exactly where you want it.

Also notice the flashContent div style declaration. Set its z-index = -1.

In the SWFObject section, add a param for “wmode”. Set it to “transparent”.

1
2
3
4
5
6
7
var params = {};
params.wmode = "transparent";
swfobject.embedSWF(
  "${swf}.swf", "flashContent", 
  "${width}", "${height}", 
  swfVersionStr, xiSwfUrlStr, 
  flashvars, params, attributes);

In the body tag, set the z-index=0

1
<body style="position:relative;left:0px;top:0px;z-index:0;">

That’s it!

The result should look something like this:

Good luck with your implementation!

To read more about Xuland, visit my other blog post regarding this application.

Erich

Categories: Adobe Flash, Adobe Flex, Xuland Tags:
  1. June 14th, 2011 at 21:03 | #1

    although iframe is the easiest solusion
    yes it is if all HTMLs of the project are completely in your control
    you cannot implement an iframe on ad-provider such as fourm, yahoo nor msn

  2. April 30th, 2013 at 23:17 | #2

    Have you ever considered about adding a little
    bit more than just your articles? I mean, what you say is important and all.
    Nevertheless just imagine if you added some great graphics or video clips to give your posts more, “pop”!

    Your content is excellent but with pics and videos, this site
    could certainly be one of the most beneficial in its field.
    Great blog!

  3. March 15th, 2014 at 12:38 | #3

    Awesome things here. I’m very satisfied too peer your
    article. Thank you so much and I amm having a look forward to touch you.
    Will you kindly drop me a e-mail?

  4. March 23rd, 2014 at 09:05 | #4

    Don’t wait to competition beat you be faster and get Facebook fans now.

    They also offer custom packages to help you get upto
    twenty million Facebook fans. Glee Live tickets for two at Valley View
    Casino Center on Sunday, May 29 ($78, a $132 value).

  5. March 23rd, 2014 at 21:13 | #5

    Hey! Quick question that’s entirely off topic. Do you know how to make your
    site mobile friendly? My website looks weird when viewing from my iphone 4.

    I’m trying to find a theme or plugin that might be able to resolve this problem.
    If you have any suggestions, please share. Thanks!

  6. April 25th, 2014 at 05:05 | #6

    Hello my family member! I want to say that this post is amazing, nice
    written and come with approximately all significant infos.
    I’d like to peer more posts like this .

  7. May 3rd, 2014 at 12:20 | #7

    magnificent issues altogether, you just won a emblem new reader.
    What would you recommend about your put up that you made a few days in the past?
    Any sure?

  8. May 21st, 2014 at 17:39 | #8

    This website was… how do you say it? Relevant!! Finally I have found something
    that helped me. Thanks!

  9. June 22nd, 2020 at 04:56 | #9

    Major thankies for the blog article.Really looking forward to read more. Want more.

  10. June 26th, 2020 at 02:49 | #10

    Jet Set in Style with Esembles Collection

  11. July 8th, 2020 at 10:24 | #11

    Wow, great post.Really thank you! Fantastic.

  12. July 19th, 2020 at 11:00 | #12

    some cheap softwares some cheap softwares does not offer good online technical support so i would caution about using them`

  13. August 6th, 2020 at 09:24 | #13

    It is thhe best time to make somee plns forr the llng run and it as time

  14. August 17th, 2020 at 09:42 | #14

    Ive reckoned many web logs and I can for sure tell that this one is my favourite.

  15. August 24th, 2020 at 06:37 | #15

    If you dont mind, where do you host your blog? I am searching for a very good web host and your webpage seams to be extremely fast and up all the time

  16. August 24th, 2020 at 07:48 | #16

    Very exciting information! Perfect just what I was trying to find!

  17. September 14th, 2020 at 06:02 | #17

    Pretty! This has been a really wonderful article. Thank you for providing this information.

  18. September 20th, 2020 at 17:26 | #18

    Thanks-a-mundo for the blog post.Really thank you! Really Great.

  19. October 20th, 2020 at 06:59 | #19

    Magnificent beat ! I wish to apprentice even as you amend your web site, how can i
    subscribe for a blog site? The account aided me a appropriate
    deal. I had been tiny bit familiar of this your broadcast offered
    vivid clear concept

  20. January 2nd, 2021 at 19:25 | #20

    -economic

    structures. Israel is often considered to be the most

    advanced country in Middle East in industrial,

    technological and economic development. The leading exports

    of Israel are software, machinery, chemicals, textiles and

    agriculture. Israel is a platform for various blockchain

    startups. As technology adoption in Israel is fast, a lot

    of the population is actively using cryptocurrencies to

    trade, invest https:/

  21. February 25th, 2021 at 07:21 | #21
  22. February 27th, 2021 at 04:02 | #23

    fe-acc18ru.ru

  23. March 28th, 2021 at 06:19 | #24
  24. usa
    June 10th, 2021 at 02:20 | #26

    The greatness f the power of nature

  25. July 21st, 2021 at 17:28 | #29
  26. July 23rd, 2021 at 13:19 | #30
  27. July 24th, 2021 at 07:18 | #31
  28. August 3rd, 2021 at 07:18 | #32
  29. August 9th, 2021 at 17:30 | #33
  30. August 26th, 2021 at 11:11 | #34
  31. August 28th, 2021 at 13:54 | #35
  32. September 25th, 2024 at 12:31 | #36

    What’s up to all, hoow iis thhe whbole thing,
    I tink every one iss getting more from thuis site, and your viewws aree nijce foor
    neew viewers.

  1. November 16th, 2014 at 13:37 | #1