开发者

Pop gives error when trying to Center in application

开发者 https://www.devze.com 2023-04-06 20:01 出处:网络
Hello I am having this error when trying to center my popUp. If I remove the centerPopUp code line, the popUp appears but of course is not centered.
Hello I am having this error when trying to center my popUp. If I remove the centerPopUp code line, the popUp appears but of course is not centered.

The Error is as such:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.managers::PopUpManagerImpl/centerPopUp()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:494]

My Code:

    var helpWindow:TitleWindow=
       开发者_如何转开发             PopUpManager.createPopUp(this, screen_Name, true) as TitleWindow;
                    PopUpManager.centerPopUp(helpWindow);


Can someone address this issue?


You should be passing the FlexGlobals.topLevelApplication as an argument to createpopup if you want to center your panel/titleWindow later on.

So, here it will be

var helpWindow:TitleWindow=
                    PopUpManager.createPopUp(this,FlexGlobals.topLevelApplication , true) as TitleWindow;
                    PopUpManager.centerPopUp(helpWindow);

Im sure this will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消