简体   繁体   English

如何在我的Flash文件中添加一个sharethis按钮?

[英]how to add a sharethis button to my flash file?

I have been searching for this solution for some time have not found any good solid solutions. 我一直在寻找该解决方案已有一段时间,没有找到任何好的解决方案。 Everything I have seen is either 2 years old and does not work. 我所看到的一切都是2岁,并且无法正常工作。

What I would like to do is use a MC in my flash file to act like a button and when clicked open the sharethis pop up to share this particular video's url. 我想做的是在Flash文件中使用MC来充当按钮,然后单击以打开sharethis弹出窗口以共享此特定视频的url。 The site API docs really don't touch on Flash working with sharethis. 站点API文档确实不涉及使用sharethis的Flash。 Any help would do. 任何帮助都可以。

Thanks, 谢谢,

Matt 马特

Share This works in HTML,frames and uses javascript. 分享这可以在HTML,框架和使用javascript中使用。 You would need an external interface to use it. 您将需要一个外部接口才能使用它。 I am not sure we are on the same page when you say live in the swf. 当您说住在瑞士法郎中时,我不确定我们是否在同一页面上。 You may have to bind it to some object or the sorts to achieve it. 您可能必须将其绑定到某个对象或进行某种排序才能实现它。

Did you check Barklund.org for their working on ShareThis and ExternalInterface ? 您是否检查过Barklund.org在ShareThis和ExternalInterface上的工作?

They have broken down the procedure as follows 他们将程序分解如下

First, simply go to sharethis.com publisher section and customize your widget. 首先,只需转到sharethis.com发布者部分并自定义窗口小部件。 Instead of placing the widget code snippet where you want the button, put it in the head section of your website. 与其将小部件代码段放置在您想要的按钮的位置,不如将其放置在网站的顶部。

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=636e055b-a4a2-4f9c-872c-b7aa9a701bb0&amp;type=website&amp;send_services=email&amp;post_services=facebook%2Clinkedin%2Cmyspace%2Cdigg%2Cdelicious%2Ctwitter%2Creddit%2Ctechnorati%2Cwordpress%2Cblogger%2Cgoogle_bmarks%2Cwindows_live"></script>

Then create a little javascript function like: 然后创建一个小的javascript函数,例如:

  function share(url, title) {
    var s = SHARETHIS.addEntry({
      url: url,
      title: title
    }, {button:false,popup:true});
    s.popup()
    return false;
  }

Finally, simple call this function from Flash using ExternalInterface : 最后,使用ExternalInterface从Flash调用此函数:

var url:String = "http://www.barklund.org/blog/2009/05/06/using-sharethis-with-flash/";
var title:String = "Barklund.org - Using ShareThis with Flash";
import flash.external.ExternalInterface;
ExternalInterface.call("share", url, title);

There are also some comments from the author saying there were problems due to the change in the API but the example worked well for me. 作者还发表了一些评论,说由于API的更改而导致出现问题,但是该示例对我来说效果很好。 If it does not you can check out there Using AddThis with Flash implementation 如果不是,则可以在其中签出使用AddThis与Flash实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM