ZeroClipboard:swf加载,但不工作 [英] ZeroClipboard: swf loaded, but not working

查看:312
本文介绍了ZeroClipboard:swf加载,但不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



该网站托管在本地主机上运行的HTTPS网络服务器上。网站和SWF都通过同一台服务器通过HTTPS提供。



SWF文件正确加载并定位在按钮上(ID:testButton)。当右键点击按钮时,会显示Flash上​​下文菜单(关于Adobe Flash Player 11.7 ...)。



然而,没有一个事件,甚至没有加载,被解雇。



我现在正在为这个问题处理两天

附加信息:


  • ZeroClipboard版本:v1。 1.7,也试过v1.2.0-beta.3,编辑:v1.3.1也一样官方测试网站正在运行



这是我的代码:

pre $ var $ clip $ new ZeroClipboard(document.getElementById(testButton),{
moviePath:media / zeroclipboard.swf
});
clip.on(dataRequested,function(client,args){
client.setText(Copy me!);
});
clip.on(load,function(client){
alert(movie is loaded);
});
clip.on(complete,function(client,args){
alert(Copied text to clipboard:+ args.text);
});
clip.on(mouseover,function(client){
alert(mouse over);
});
clip.on(mouseout,function(client){
alert(mouse out);
});
clip.on(mousedown,function(client){
alert(mouse down);
});
clip.on(mouseup,function(client){
alert(mouse up);
});


解决方案

>
$ b 在浏览器的CommonJS环境中,ZeroClipboard不能正常工作,即使它说了。



<对于这个问题的解决方法是将模块范围变量(例如ZeroClipboard)分配给全局窗口对象:

  ZeroClipboard = require zeroclipboard); 
window.ZeroClipboard = ZeroClipboard;

我为此创建了一个错误报告:
https://github.com/zeroclipboard/zeroclipboard/issues/332


ZeroClipboard doesn't work and it doesn't throw any errors (javascript console).

The website is hosted on a HTTPS webserver running on localhost. Both the website and the SWF are served over HTTPS by the same server.

The SWF is loaded and positioned correctly over the button (with ID: testButton). When right-clicking on the button, the flash context menu (About Adobe Flash Player 11.7...) is shown.

However, none of the events, not even "load", gets fired.

I am working on this problem for two days months now and i can't find a solution.

Additional info:

  • ZeroClipboard version: v1.1.7, also tried v1.2.0-beta.3, edit: This also happens with v1.3.1
  • Browser: Chromium 28 on Mac OSX
  • Official test website is working

Here is my code:

var clip = new ZeroClipboard(document.getElementById("testButton"), {
    moviePath: "media/zeroclipboard.swf"
});
clip.on("dataRequested", function(client, args) {
    client.setText("Copy me!");
});
clip.on("load", function(client) {
    alert("movie is loaded");
});
clip.on("complete", function(client, args) {
    alert("Copied text to clipboard: " + args.text);
});
clip.on("mouseover", function(client) {
    alert("mouse over");
});
clip.on("mouseout", function(client) {
    alert("mouse out");
});
clip.on("mousedown", function(client) {
    alert("mouse down");
});
clip.on("mouseup", function(client) {
    alert("mouse up");
});

解决方案

After months I finally found a solution:

ZeroClipboard doesn't work out-of-the-box in CommonJS environments in the browser, even it says it does.

The fix for that is assigning the module scope variable (e.g. ZeroClipboard) to the global window object:

ZeroClipboard = require("zeroclipboard");
window.ZeroClipboard = ZeroClipboard;

I created a bug report on this: https://github.com/zeroclipboard/zeroclipboard/issues/332

这篇关于ZeroClipboard:swf加载,但不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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