【问题标题】:How to create a share button in AS3如何在 AS3 中创建分享按钮
【发布时间】:2012-05-25 13:50:48
【问题描述】:

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

【问题讨论】:

    标签: flash actionscript-3 facebook


    【解决方案1】:

    看: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" />
    

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

    【讨论】:

    • 嗯很有趣,我没有这么想。感谢您的提示,我会检查一下并告诉您它是如何工作的:)
    • 您如何使用这种方法分享高分?
    【解决方案2】:

    给你:

    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");
    

    【讨论】:

    【解决方案3】:

    这取决于你想分享什么。

    您可以在按钮中使用以下网址:

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

    这将弹出一个页面,提示用户登录并分享他们想要分享的任何内容。

    您能否更准确让您的用户分享哪些内容?

    【讨论】:

    • 我只是想要共享应用程序位置的能力,我知道我可以按照您上面解释的方式进行操作,但是我无法自定义标题、描述等...因为AS3 不能传递元标签?
    猜你喜欢
    • 2021-11-23
    • 2016-04-28
    • 2016-04-07
    • 1970-01-01
    • 2014-10-04
    • 1970-01-01
    • 1970-01-01
    • 2013-11-13
    • 2013-06-02
    相关资源
    最近更新 更多