質問

I would like to call js function via ExternalInterface from as3 code LOCALLY, not on remote server. All browsers work great but not Chrome. Note that in flash-debug player version (C:\Windows\system32\Macromed\Flash\NPSWF32_11_9_900_170.dll, version 11,9,900,170) I have installed in Chrome it works. But in default flash player version (C:\Program Files\Google\Chrome\Application\33.0.1750.117\PepperFlash\pepflashplayer.dll, version 12.0.0.70) it doesn't work.

PS: I've also tried to open my old project (with ExternalInterface) I've developed 2 years ago -> same issue.

IDE I have used -> FlashBuilder4.6 and also tried in FlashDevelop. I am using AC_OETags.js in order to include swf into web-page.

ExternalInterface.call("someFunc","testMsg") calls when swf initializes.

Chrome version is 33.0.1750.117 m

Thanks in advance.

役に立ちましたか?

解決

This is a bug in Chrome using the pepper plugin: https://code.google.com/p/chromium/issues/detail?id=137734

What's happening is that the trusted locations (set here: https://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html) aren't taken into account, so any Flash <-> JS interaction is broken.

It doesn't look like this bug is getting fixed (judging by the comments on the issue today, there's a good chance it'll get marked as a "Won't fix"), so for now there's 3 ways around it:

  • Use another browser - not ideal
  • Use the NPAPI plugin - the pepper plugin is the default, but it's mostly a set-once-and-forget sort of task
  • Run a local webserver - either something like apache (http://www.easyphp.org/) or node (http://nodejs.org/). This is Google's preferred method of dealing with this, as it more closely mimics network behaviour (including security stuff)

他のヒント

This code helps you to check if PepperPlayer is installed:

checkPepperPlayer=function(){
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if (is_chrome) {
        var pluginsList = navigator.plugins;
        for (var plugin in pluginsList) {
            if (plugin && pluginsList[plugin] && pluginsList[plugin].filename) {
                var filename = pluginsList[plugin].filename;
                if (filename == "pepflashplayer.dll" || filename == "PepperFlashPlayer.plugin" || filename == "libpepflashplayer.so") {
                    return true;
                }
            }
        }
    }
    return false;
};
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top