如何检测“共享”使用动作脚本?
我们都知道可以为 Facebook 制作一个共享按钮,允许用户共享任何项目。但是当我们被引导到该页面时,用户有两个选择。按“取消”按钮,这当然会关闭窗口,或者按“共享”按钮,然后将项目添加到人员墙上。
我想做的是确定是否已按下该共享按钮。因为当他们按下它时,我希望我的 swf 追踪出一条消息,说“感谢分享我的项目”
,虽然我可以将它们重定向到该页面,但我无法知道他们是否共享它。我的想法是使用 Enter_frame 事件并尝试查看是否有任何数据通过 php 发送。因为这就是按钮按下时会执行的操作。但我没有运气让它发挥作用。
这是到目前为止的代码。这是一个教程,因为重点是我的问题:
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'); }
we all know its possible to make a share button for face book which allows users to share whatever item. but when we are directed to that page the user has two options. press the "cancel" button which of course closes the window, or to press the "share" button which then adds the item to the persons wall.
what i'm trying to do is determine if that share button has been pressed. see because when they press it i want my swf to trace out a message saying "thanks for sharing my item"
and while i can redirect them to the page i have no way of knowing if they shared it or not. my idea was to use an enter_frame event and try and see if any data was being sent via php. because thats what the button would be doing when pressed. but i haven't had any luck making that work.
here is the code so far. its a tutorial as the focus is at my problem:
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'); }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用静态类进行共享。
看看这个:
I use static class for share.
Look at this: