在 module1 中加载与 module2 中的类同名的类

发布于 2024-08-17 20:51:23 字数 441 浏览 2 评论 0原文

我有一个 Flex 应用程序,可以根据需要加载模块。当第一个模块加载时,它会创建一个类 MyBackground(),它将背景绘制为红色。当我选择加载第二个模块(并卸载第一个模块)时,我再次加载类 MyBackground (从第二个模块)。但是,当我进入 MyBackground 的构造函数时,它会直接进入 UIComponentDescriptor 的构造函数:

public function UIComponentDescriptor(descriptorProperties:Object)
{
    super(descriptorProperties);
}

这是否与我加载的每个模块使用相同的应用程序域有关? Flex 是否将类类型加载到父应用程序中并缓存它们,因此当我第二次请求一个类时,它只是进行查找,而不实际查看该类是否相同?

任何有关这方面的信息表示赞赏。

I have a Flex application that can load modules as necessary. When the first module is loaded, it creates a class MyBackground(), which paints the background red. When I choose to load a second module (and unload the first) I again load a class MyBackground (from the second module). However, when I step into the constructor for MyBackground, it goes straight into the constructor for the UIComponentDescriptor:

public function UIComponentDescriptor(descriptorProperties:Object)
{
    super(descriptorProperties);
}

Is this something to do with using the same application domain for each module that I load? Does Flex load in the class types into the parent application and cache them, so when I request a class the second time it just does a lookup, without actually seeing if the class is the same?

Any info on this appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℡Ms空城旧梦 2024-08-24 20:51:23

我已经设法通过使用子应用程序域解决了这个问题(这并不是 100% 有意义,因为它说子域不能覆盖父域,但这似乎正是发生的情况)。

m_moduleInfo.load(new ApplicationDomain(ApplicationDomain.currentDomain));

I've managed to fix the issue by using a child application domain (which doesn't make 100% sense as it says child domains can't override parent domains, yet that appears to be exactly what is happening).

m_moduleInfo.load(new ApplicationDomain(ApplicationDomain.currentDomain));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文