如何在 AS3 中创建共享按钮 [英] How to create a share button in AS3

查看:22
本文介绍了如何在 AS3 中创建共享按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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!

推荐答案

Look: 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');
}

为了使用图片添加以下元标签:

In order to use a picture add the following Metatags:

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

更多信息:https://developers.facebook.com/docs/opengraph/

这篇关于如何在 AS3 中创建共享按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆