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

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

问题描述

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



以下是模块加载代码:

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


保护函数onModuleReady(moduleEvent:ModuleEvent):void
{
var moduleInfo:IModuleInfo = moduleEvent.module;
var sample:IDiagrammerModule = moduleInfo.factory.create()as IDiagrammerModule;
Application.application.addChild(sample.testRender());

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

  VerifyError:错误#1014:无法找到类mx.modules :: ModuleBase。 
在flash.display :: MovieClip / nextFrame()
在mx.core :: FlexModuleFactory / deferredNextFrame()[E:\dev\4.0.0\frameworks\projects\framework \src\mx\core\FlexModuleFactory.as:631]
在mx.core :: FlexModuleFactory / update()[E:\dev\4.0.0\frameworks\projects\\ \\ framework \src\mx\core\FlexModuleFactory.as:401]
在mx.core :: FlexModuleFactory / moduleCompleteHandler()[E:\dev\4.0.0\frameworks\ projects \framework\src\mx\core\FlexModuleFactory.as:718]

我怀疑这可能是Flex 3.5和4.0中ModuleBase的类定义不匹配的结果。我的应用程序和/或模块项目有配置改变,可以解决这个错误?

以下是我的配置信息:
IDE:Flash builder 4插件



应用程序项目


  • 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中编译的模块是可能的,但是您必须考虑兼容性问题。


    $ b

    ed 马歇尔计划,你可以阅读更多关于它的信息这里这里基本上,主机应用程序建立不同的沙箱模块,他们之间的沟通是有限的(虽然仍然非常可能)。

    希望有帮助。


    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.

    Here is the module loading code:

    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]
    

    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?

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

    App project

    • SDK: Flex 3.5
    • framework linkage: Merged into code
    • Additional compiler arguments: -locale=en_US,ja_JP -source-path=./locale/{locale}

    Module project

    • SDK: Flex 4.0
    • framework linkage: Use SDK default (runtime shared library)
    • Copy non-embedded files to output file: true
    • Generate accessible SWF File: true
    • Additional compiler arguments: -locale en_US

    解决方案

    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).

    Hope that helps.

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

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