首页 > 解决方案 > 将 Adob​​e Flex Web 应用程序迁移到 Adob​​e AIR 包应用程序 - ExternalInterface.call 失败

问题描述

由于对 Adob​​e Flex 的支持将于 2020 年结束,我们将按照以下步骤将 Adob​​e Flex Web 应用程序迁移到 Adob​​e AIR 独立应用程序中 创建证书 ./adt -certificate -cn SelfSigned 1024-RSA sampleCert.p12 samplePassword 创建 AIR 应用程序

./adt -package -keystore ./sampleCert.p12 -storetype pkcs12 -target bundle AIRApp.app App-descriptor.xml App.swf

在很多地方,我们都会调用 ExternalInterface,如下所示

ExternalInterface.call("window.location.search.toString"); 并抛出异常 

    at Error$/throwError()
    at flash.external::ExternalInterface$/call()```
 

Is there a way to enable ExternalInterface in Adobe AIR?

标签: airadobeflex4flex3flex4.5

解决方案


ExternalInterface 用于在 Flex 应用程序的封闭 HTML 页面中调用 Javascript 函数。ExternalInterface 在 AIR 中不存在,因为它没有封闭的 HTML 页面/Javascript。

您必须检查 Flex 应用程序中的每个 ExternalInterface 调用,并在 AIR 中编写等效的调用。Adobe AIR API 可能有用


推荐阅读