将使用 Flex 4 SDK 编译的 flex 模块加载到使用 Flex 3.5 编译的应用程序中 [英] Loading flex modules compiled with Flex 4 SDK into an application compiled with Flex 3.5

查看:30
本文介绍了将使用 Flex 4 SDK 编译的 flex 模块加载到使用 Flex 3.5 编译的应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为需要 Flex 4 功能的应用程序开发一项功能.由于应用程序从 Flex 3.5 到 4.0 的一些迁移问题,我决定将此功能实现为使用 Flex 4.0 编译的模块.理论上,应用程序将保持在 Flex 3.5 中编译并在需要时加载模块.

I am working on a feature for an application that requires Flex 4 functionality. Due to some migration issues of the application from Flex 3.5 to 4.0, I have decided to implement this feature as a module that is compiled with Flex 4.0. The theory is that the application would remain compiled in Flex 3.5 and load the module when it needs it.

这是模块加载代码:

public function loadDiagModule():void {
    var moduleLoader:ModuleLoader = new ModuleLoader();
    moduleLoader.url = "module/DiagrammerModule.swf";
    moduleLoader.loadModule();
    moduleLoader.addEventListener(ModuleEvent.READY, onModuleReady);
}

protected function onModuleReady( moduleEvent:ModuleEvent ):void
{
    var moduleInfo:IModuleInfo = moduleEvent.module;
    var sample:IDiagrammerModule = moduleInfo.factory.create() as IDiagrammerModule;
    Application.application.addChild(sample.testRender());
}

不幸的是,我在应用程序中加载模块时遇到运行时错误:

Unfortunately, I am encountering a runtime error when I load the module in the application:

VerifyError: Error #1014: Class mx.modules::ModuleBase could not be found.
 at flash.display::MovieClip/nextFrame()
 at mx.core::FlexModuleFactory/deferredNextFrame()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:631]
 at mx.core::FlexModuleFactory/update()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:401]
 at mx.core::FlexModuleFactory/moduleCompleteHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:718]

我怀疑这可能是 Flex 3.5 和 4.0 中 ModuleBase 类定义不匹配的结果.我的应用程序和/或模块项目是否有某种配置更改可以纠正此错误?

I suspect that this may be a result of a mismatch in ModuleBase's class definition in Flex 3.5 and 4.0. Is there some kind of configuration change with my application and/or module project that would remedy this error?

以下是有关我的配置的一些信息:IDE:Flash Builder 4 插件

Here's some info on my configuration: IDE: Flash builder 4 plugin

应用项目

  • SDK:Flex 3.5
  • 框架链接:合并到代码中
  • 其他编译器参数:-locale=en_US,ja_JP -source-path=./locale/{locale}

模块项目

  • SDK:Flex 4.0
  • 框架联动:使用SDK默认(运行时共享库​​)
  • 将非嵌入文件复制到输出文件:true
  • 生成可访问的 SWF 文件:true
  • 其他编译器参数:-locale en_US

推荐答案

从 Flex 3.2 开始,可以加载在不同版本的 SDK 中编译的模块,但是您必须考虑兼容性问题.

Loading modules compiled in a different version of the SDK is possible since Flex 3.2, however there are compatibility considerations you must consider.

它被称为马歇尔计划,您可以阅读有关它的更多信息这里这里本质上宿主应用程序建立了不同的沙箱对于模块,它们之间的通信是有限的(尽管仍然很有可能).

It's called The Marshall Plan, and you can read more information about it here and hereEssentially the host application establishes different sandboxes for the modules, and communication between them is limited (although still very possible).

希望有所帮助.

这篇关于将使用 Flex 4 SDK 编译的 flex 模块加载到使用 Flex 3.5 编译的应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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