模块和面板问题 [英] Modules and Panels issue

查看:23
本文介绍了模块和面板问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题.

在我的应用程序中,我有几个模块,每个模块都有组件 CollapsableTitleWindow(扩展面板).打开窗口后,它被添加到主应用程序 (CollapsableTitleWindowContainer) 中的容器中.在这些窗口中,您可以打开另一个窗口(依此类推).

现在有什么问题.当我更改(重新加载)任何模块并且我想用已经加载的窗口打开一个新窗口(子窗口)时,我收到此错误:

TypeError:错误 #1009:无法访问空对象引用的属性或方法.在 mx.containers::Panel/layoutChrome()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\Panel.as:1405]在 com::CollapsableTitleWindow/layoutChrome()[D:\Flex 3 Workspace\WesobCrm\src\com\CollapsableTitleWindow.as:216]在 mx.core::Container/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2867] (...)

表示主应用有对象面板

请帮忙.

附言我在
(来源:
(来源:ak.bx.pl)

你可以看到它丢失了样式声明.

解决方案

我找到了一个解决方案,但它的做法很糟糕:

我在我的主应用程序中添加

public function getProductWindow():ProductWindow {返回新的产品窗口();}

和模块中的变化:

来自

var productWindow:ProductWindow = new ProductWindow();

var productWindow:ProductWindow = Application.application.getProductWindow();

如果有人有更好的解决方案?

I have the following problem.

In my application I have several modules and each of them have components CollapsableTitleWindow (extends Panel). After opening the window it is added to the container which is in the main application (CollapsableTitleWindowContainer). In these windows you can open another window (and so on).

Now, what is the problem. When I change (reload) any module and I want to open a new window (sub window) with the already loaded window I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at mx.containers::Panel/layoutChrome()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\Panel.as:1405]
 at com::CollapsableTitleWindow/layoutChrome()[D:\Flex 3 Workspace\WesobCrm\src\com\CollapsableTitleWindow.as:216]
 at mx.core::Container/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2867] (...)

Indicates that the main applications have object Panel

Please help.

P.S. I found a similar problem on http://www.nabble.com/Flex-Module-issue-with-Panel-td20168053.html

ADDED: I extendes the Panel class and do something like that:

override protected function layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void
    {
        use namespace mx_internal;
        if(!(mx_internal::titleBarBackground is TitleBackground)) {
            mx_internal::titleBarBackground = new TitleBackground();
        }
        super.layoutChrome(unscaledWidth, unscaledHeight);          
    }

But now i had something like that: Before
(source: ak.bx.pl)
After
(source: ak.bx.pl)

You can see that it loos style declaration.

解决方案

I found a solution but it is bad pratice:

I add in my main application

public function getProductWindow():ProductWindow {
    return new ProductWindow();
}

And change in the module:

From

var productWindow:ProductWindow = new ProductWindow();

To

var productWindow:ProductWindow = Application.application.getProductWindow();

If anyone have a better solution ?

这篇关于模块和面板问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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