代码之家  ›  专栏  ›  技术社区  ›  P4ndaman

将使用flex 4 sdk编译的flex模块加载到使用flex 3.5编译的应用程序中

  •  2
  • P4ndaman  · 技术社区  · 14 年前

    我正在为需要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);
    }
    
    protected function onModuleReady( moduleEvent:ModuleEvent ):void
    {
        var moduleInfo:IModuleInfo = moduleEvent.module;
        var sample:IDiagrammerModule = moduleInfo.factory.create() as IDiagrammerModule;
        Application.application.addChild(sample.testRender());
    }
    

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

    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的类定义不匹配造成的。我的应用程序和/或模块项目是否有某种配置更改可以弥补此错误?

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

    应用程序项目

    • 软件开发工具包:flex 3.5
    • 框架链接:合并到代码中
    • 其他编译器参数:-locale=en_us,ja_jp-source path=/locale/locale

    模块化项目

    • 软件开发工具包:flex 4.0
    • 框架链接:使用SDK默认值(运行时共享库)
    • 将非嵌入文件复制到输出文件:真
    • 生成可访问的SWF文件:真
    • 其他编译器参数:-区域设置
    1 回复  |  直到 14 年前
        1
  •  3
  •   Marty Pitt    14 年前

    The Marshall Plan here here