views:

988

answers:

4

I was wondering if anyone knew a good way of creating an AS3 Facebook share button? I need to be able to customize the title, description and picture. Thanks!

A: 

It depends on what you wish to share.

You can use the following url in a button:

http://www.facebook.com/share.php?u=http://www.mypage.com/

which will pop up a page prompting the user to log in and share whatever they want to share.

Could you be more precise as to what you want to allow your users to share?

Christopher Richa
I just want the ability to share the location of the application, I know I can do it the way you explained above, but I wont be able to customize the title, description, etc...because AS3 can't pass off meta tags?
alvincrespo
+2  A: 

Look: http://www.facebook.com/facebook-widgets/share.php

http://www.facebook.com/sharer.php?u=<url>&t=<title>

In Flash:

import flash.net.navigateToURL;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;

share_btn.addEventListener(MouseEvent.CLICK, shareClickHandler);

function shareClickHandler(evt:MouseEvent):void
{
    var varsShare:URLVariables = new URLVariables();
    varsShare.u = 'http://domain.com/pageN.html';
    varsShare.t = 'Title Page';

    var urlFacebookShare:URLRequest = new URLRequest('http://www.facebook.com/sharer.php');
    urlFacebookShare.data = varsShare;
    urlFacebookShare.method = URLRequestMethod.GET;

    navigateToURL(urlFacebookShare, '_blank');
}

For use a picture you need to share the page has some Metatags.

<meta name="title" content="my title" />
<meta name="description" content="my description" />
<link rel="image_src" href="images/thumbnail_image.jpg" />

For more info: wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags

Otaku RzO
Hmm very interesting, I didnt think about it that way. Thanks for the tip, Ill check this out and let you know how it worked :)
alvincrespo
A: 

THank you so much Otaku RzO! it worked as I wanted

Sri
A: 

Nice thank you. Good luck getting that like button to function in Flash...

Michael Benin