我想知道是否有人知道创建AS3 Facebook分享按钮的好方法?我需要能够自定义标题,描述和图片。谢谢!
答案 0 :(得分:13)
看:http://www.facebook.com/facebook-widgets/share.php
http://www.facebook.com/sharer.php?u=<url>&t=<title>
在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');
}
为了使用图片,请添加以下元标记:
<meta name="title" content="my title" />
<meta name="description" content="my description" />
<link rel="image_src" href="images/thumbnail_image.jpg" />
答案 1 :(得分:4)
你去:
redirect_uri 是必需的(并且必须重定向到Facebook应用程序设置页面中定义的应用程序站点)
var req:URLRequest = new URLRequest();
req.url = "http://www.facebook.com/dialog/feed";
var vars:URLVariables = new URLVariables();
vars.app_id = "000000000000"; // your application's id
vars.link = "http://YourSite.com";
vars.picture = "https://www.google.com/intl/en_com/images/srpr/logo3w.png";
vars.name = "name name";
vars.caption = "caption caption caption";
vars.description = "description description description";
vars.message = "message message message message message";
vars.redirect_uri = "http://YourSite.com";
req.data = vars;
req.method = URLRequestMethod.GET;
navigateToURL(req, "_blank");
答案 2 :(得分:1)
这取决于您希望分享的内容。
您可以在按钮中使用以下网址:
http://www.facebook.com/share.php?u=http://www.mypage.com/
将弹出一个页面,提示用户登录并分享他们想要分享的内容。
关于您希望用户分享的内容,您能更精确地
吗?