如何在AS3中创建共享按钮

alv*_*spo 8 flash facebook actionscript-3

我想知道是否有人知道创建AS3 Facebook分享按钮的好方法?我需要能够自定义标题,描述和图片.谢谢!

小智 13

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

http://www.facebook.com/sharer.php?u=<url>&t=<title>
Run Code Online (Sandbox Code Playgroud)

在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');
}
Run Code Online (Sandbox Code Playgroud)

为了使用图片,请添加以下元标记:

<meta name="title" content="my title" />
<meta name="description" content="my description" />
<link rel="image_src" href="images/thumbnail_image.jpg" />
Run Code Online (Sandbox Code Playgroud)

有关详细信息:https://developers.facebook.com/docs/opengraph/