在 IE 8 上打开 Flash 图表

发布于 2024-09-24 06:56:07 字数 1055 浏览 0 评论 0原文

我正在使用 Open Flash Chart 2 在我的网站中展示图形和图表。 我正在尝试从同一页面加载图表的 JSON 数据。有几种方法可以做到这一点。

  • 使用图表的 get-data 属性并传递返回 json 的 javascript 方法
  • 使用 Flash 图表知道的 open_flash_chart_data 方法读取数据

所有似乎在 FireFox、Chrome 等上都工作正常。唯一有问题的浏览器是 IE (我使用的是 IE 8)

稍微研究一下开源,我发现该库正在使用 ExetrnalInterface 来执行 javascript 方法,尽管ExternalInterface 似乎可用,但对于 IE 中的任何执行方法,它都会返回 null。

似乎 Flash 开发人员社区已经知道这个问题,所以我尝试了一些方法(尽管有一些解决方案我无法在库中使用 - 例如嵌入元素的唯一 id。库生成它

)结论,我可能缺少一个简单的解决方案来解决我的问题。

我的代码:

这是从 javascript 对打开的 flash 图表的 jquery 调用:

$('#myDiv').flash
(
    {
        src: ofc_swf,
        width: "400",
        height: "250",
        allowscriptaccess: "always",
        wmode: "transparent",                 
        flashvars: {"get-data": "getFlashJson"}                       
    },
    {
        version: 8
    }
);

这是将返回图表的 JSON 源的 javascript 方法:

function getFlashJson()
{
    var val = $("#myJson").val();
    return val;
}

如果有任何帮助,我将不胜感激。

谢谢

I'm using Open Flash Chart 2 to present graphs and charts in my website.
I'm trying to load the JSON data for a chart from the same page. There are several ways to do that.

  • Use get-data property of the chart and pass a javascript method that returns the json
  • Use the open_flash_chart_data method which the flash chart knows to read data from

All seem to work fine on FireFox, Chrome etc. The only browser that has a problem is IE (I'm using IE 8)

Looking a little into the open source I found that the library is using ExetrnalInterface to execute the javascript method, and altough the ExternalInterface seems to be available, it returns null for any execution of a method in IE.

It seems like this issue is already known for the Flash developers community, so I did tried few things (though there are some solutions that I could not use in the library - for example unique id for the embed element. The library generates it)

In conclusion, I'm probably missing a simple solution for my problem.

My code:

This is the jquery call to the open flash chart from javascript:

$('#myDiv').flash
(
    {
        src: ofc_swf,
        width: "400",
        height: "250",
        allowscriptaccess: "always",
        wmode: "transparent",                 
        flashvars: {"get-data": "getFlashJson"}                       
    },
    {
        version: 8
    }
);

And this is the javascript method that will return the JSON source of the chart:

function getFlashJson()
{
    var val = $("#myJson").val();
    return val;
}

I'll appreciate any help on this.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请恋爱 2024-10-01 06:56:07

尝试更新 swfobject.js:对我来说,2.2 版本已经解决了我的问题。

Try to update swfobject.js: for me, version 2.2 had resolved my problems.

半边脸i 2024-10-01 06:56:07

我遇到了这个问题并找到了解决方案。

删除 php 文件中电影 ID 前面带有 ie_ 的 Flash 代码部分,并将 SWFOBJECT javascript 代码更改为:

function findSWF(movieName) {
  if (navigator.appName.indexOf("Microsoft")!= -1) {
    return window[movieName];
  } else {
    return document[movieName];
  }
}

I had this problem and found a solution.

Remove the parts of the flash code in the php file which preface the movie ID with ie_ and also change the SWFOBJECT javascript code to this:

function findSWF(movieName) {
  if (navigator.appName.indexOf("Microsoft")!= -1) {
    return window[movieName];
  } else {
    return document[movieName];
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文